aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cmake.conf6
-rw-r--r--.gitignore8
-rw-r--r--.prev_CMakeLists.txt28
-rw-r--r--.qmake.conf5
-rw-r--r--CMakeLists.txt22
-rw-r--r--LICENSES/BSD-3-Clause.txt9
-rw-r--r--LICENSES/GFDL-1.3-no-invariants-only.txt451
-rw-r--r--LICENSES/GPL-3.0-only.txt (renamed from LICENSE.GPL3)0
-rw-r--r--LICENSES/LicenseRef-Qt-Commercial.txt8
-rw-r--r--LICENSES/Qt-GPL-exception-1.0.txt22
-rw-r--r--cmake/CerenceCommon.cmake26
-rw-r--r--cmake/FindCerenceHwrAlphabetic.cmake84
-rw-r--r--cmake/FindCerenceHwrCjk.cmake77
-rw-r--r--cmake/FindCerenceXt9.cmake84
-rw-r--r--cmake/FindHunspell.cmake3
-rw-r--r--cmake/FindMyScript.cmake198
-rw-r--r--cmake/QtVirtualKeyboardSetup.cmake83
-rw-r--r--coin/axivion/ci_config_linux.json46
-rw-r--r--coin/module_config.yaml1
-rw-r--r--config.tests/hunspell/CMakeLists.txt12
-rw-r--r--config.tests/hunspell/hunspell.pro1
-rw-r--r--config.tests/hunspell/main.cpp37
-rw-r--r--configure.cmake3
-rw-r--r--configure.json5
-rw-r--r--dependencies.yaml9
-rw-r--r--dist/changes-5.15.127
-rw-r--r--examples/CMakeLists.txt5
-rw-r--r--examples/virtualkeyboard/CMakeLists.txt5
-rw-r--r--examples/virtualkeyboard/basic/Basic.qml43
-rw-r--r--examples/virtualkeyboard/basic/CMakeLists.txt48
-rw-r--r--examples/virtualkeyboard/basic/basic-b2qt.qml61
-rw-r--r--examples/virtualkeyboard/basic/content/AutoScroller.qml34
-rw-r--r--examples/virtualkeyboard/basic/content/HandwritingModeButton.qml32
-rw-r--r--examples/virtualkeyboard/basic/content/TextArea.qml36
-rw-r--r--examples/virtualkeyboard/basic/content/TextField.qml36
-rw-r--r--examples/virtualkeyboard/basic/main.cpp30
-rw-r--r--licenseRule.json89
-rw-r--r--qt_cmdline.cmake1
-rw-r--r--qtvirtualkeyboard.pro5
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/components/AlternativeKeys.qml107
-rw-r--r--src/components/BackspaceKey.qml28
-rw-r--r--src/components/BaseKey.qml234
-rw-r--r--src/components/CMakeLists.txt61
-rw-r--r--src/components/ChangeLanguageKey.qml53
-rw-r--r--src/components/CharacterPreviewBubble.qml55
-rw-r--r--src/components/EnterKey.qml34
-rw-r--r--src/components/FillerKey.qml23
-rw-r--r--src/components/FlickKey.qml96
-rw-r--r--src/components/FunctionPopupList.qml110
-rw-r--r--src/components/HandwritingModeKey.qml33
-rw-r--r--src/components/HideKeyboardKey.qml28
-rw-r--r--src/components/InputModeKey.qml103
-rw-r--r--src/components/Key.qml25
-rw-r--r--src/components/Keyboard.qml1828
-rw-r--r--src/components/KeyboardColumn.qml38
-rw-r--r--src/components/KeyboardLayout.qml163
-rw-r--r--src/components/KeyboardLayoutLoader.qml115
-rw-r--r--src/components/KeyboardRow.qml37
-rw-r--r--src/components/ModeKey.qml42
-rw-r--r--src/components/MultiSoundEffect.qml47
-rw-r--r--src/components/MultitapInputMethod.qml106
-rw-r--r--src/components/NumberKey.qml25
-rw-r--r--src/components/PopupList.qml33
-rw-r--r--src/components/SelectionControl.qml74
-rw-r--r--src/components/ShadowInputControl.qml129
-rw-r--r--src/components/ShiftKey.qml29
-rw-r--r--src/components/SpaceKey.qml29
-rw-r--r--src/components/SymbolModeKey.qml28
-rw-r--r--src/components/TraceInputArea.qml198
-rw-r--r--src/components/TraceInputKey.qml92
-rw-r--r--src/components/WordCandidatePopupList.qml59
-rw-r--r--src/import/CMakeLists.txt46
-rw-r--r--src/import/dependencies.json22
-rw-r--r--src/import/import.pro34
-rw-r--r--src/import/plugins.qmltypes2444
-rw-r--r--src/import/qmldir10
-rw-r--r--src/import/qtquickvirtualkeyboardplugin.cpp154
-rw-r--r--src/import/qtquickvirtualkeyboardplugin.h50
-rw-r--r--src/layouts/CMakeLists.txt361
-rw-r--r--src/layouts/ar_AR/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/ar_AR/dialpad.fallback)0
-rw-r--r--src/layouts/ar_AR/digits.qml100
-rw-r--r--src/layouts/ar_AR/handwriting.qml74
-rw-r--r--src/layouts/ar_AR/main.qml205
-rw-r--r--src/layouts/ar_AR/numbers.qml173
-rw-r--r--src/layouts/ar_AR/symbols.qml365
-rw-r--r--src/layouts/bg_BG/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/bg_BG/dialpad.fallback)0
-rw-r--r--src/layouts/bg_BG/digits.fallback (renamed from src/virtualkeyboard/content/layouts/bg_BG/digits.fallback)0
-rw-r--r--src/layouts/bg_BG/handwriting.qml57
-rw-r--r--src/layouts/bg_BG/main.qml373
-rw-r--r--src/layouts/bg_BG/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/bg_BG/numbers.fallback)0
-rw-r--r--src/layouts/bg_BG/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/bg_BG/symbols.fallback)0
-rw-r--r--src/layouts/cs_CZ/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/cs_CZ/dialpad.fallback)0
-rw-r--r--src/layouts/cs_CZ/digits.fallback (renamed from src/virtualkeyboard/content/layouts/cs_CZ/digits.fallback)0
-rw-r--r--src/layouts/cs_CZ/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/da_DK/handwriting.fallback)0
-rw-r--r--src/layouts/cs_CZ/main.qml201
-rw-r--r--src/layouts/cs_CZ/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/cs_CZ/numbers.fallback)0
-rw-r--r--src/layouts/cs_CZ/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/cs_CZ/symbols.fallback)0
-rw-r--r--src/layouts/da_DK/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/da_DK/dialpad.fallback)0
-rw-r--r--src/layouts/da_DK/digits.fallback (renamed from src/virtualkeyboard/content/layouts/da_DK/digits.fallback)0
-rw-r--r--src/layouts/da_DK/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/de_DE/handwriting.fallback)0
-rw-r--r--src/layouts/da_DK/main.qml202
-rw-r--r--src/layouts/da_DK/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/da_DK/numbers.fallback)0
-rw-r--r--src/layouts/da_DK/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/da_DK/symbols.fallback)0
-rw-r--r--src/layouts/de_DE/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/de_DE/dialpad.fallback)0
-rw-r--r--src/layouts/de_DE/digits.fallback (renamed from src/virtualkeyboard/content/layouts/de_DE/digits.fallback)0
-rw-r--r--src/layouts/de_DE/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/en_GB/handwriting.fallback)0
-rw-r--r--src/layouts/de_DE/main.qml197
-rw-r--r--src/layouts/de_DE/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/de_DE/numbers.fallback)0
-rw-r--r--src/layouts/de_DE/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/de_DE/symbols.fallback)0
-rw-r--r--src/layouts/el_GR/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/el_GR/dialpad.fallback)0
-rw-r--r--src/layouts/el_GR/digits.fallback (renamed from src/virtualkeyboard/content/layouts/el_GR/digits.fallback)0
-rw-r--r--src/layouts/el_GR/handwriting.qml57
-rw-r--r--src/layouts/el_GR/main.qml383
-rw-r--r--src/layouts/el_GR/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/el_GR/numbers.fallback)0
-rw-r--r--src/layouts/el_GR/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/el_GR/symbols.fallback)0
-rw-r--r--src/layouts/en_GB/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/en_GB/dialpad.fallback)0
-rw-r--r--src/layouts/en_GB/digits.fallback (renamed from src/virtualkeyboard/content/layouts/en_GB/digits.fallback)0
-rw-r--r--src/layouts/en_GB/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/en_US/handwriting.fallback)0
-rw-r--r--src/layouts/en_GB/main.fallback (renamed from src/virtualkeyboard/content/layouts/en_GB/main.fallback)0
-rw-r--r--src/layouts/en_GB/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/en_GB/numbers.fallback)0
-rw-r--r--src/layouts/en_GB/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/en_GB/symbols.fallback)0
-rw-r--r--src/layouts/en_US/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/en_US/dialpad.fallback)0
-rw-r--r--src/layouts/en_US/digits.fallback (renamed from src/virtualkeyboard/content/layouts/en_US/digits.fallback)0
-rw-r--r--src/layouts/en_US/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/et_EE/handwriting.fallback)0
-rw-r--r--src/layouts/en_US/main.fallback (renamed from src/virtualkeyboard/content/layouts/en_US/main.fallback)0
-rw-r--r--src/layouts/en_US/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/en_US/numbers.fallback)0
-rw-r--r--src/layouts/en_US/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/en_US/symbols.fallback)0
-rw-r--r--src/layouts/es_ES/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/es_ES/dialpad.fallback)0
-rw-r--r--src/layouts/es_ES/digits.fallback (renamed from src/virtualkeyboard/content/layouts/es_ES/digits.fallback)0
-rw-r--r--src/layouts/es_ES/handwriting.qml54
-rw-r--r--src/layouts/es_ES/main.qml186
-rw-r--r--src/layouts/es_ES/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/es_ES/numbers.fallback)0
-rw-r--r--src/layouts/es_ES/symbols.qml360
-rw-r--r--src/layouts/es_MX/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/es_MX/dialpad.fallback)0
-rw-r--r--src/layouts/es_MX/digits.fallback (renamed from src/virtualkeyboard/content/layouts/es_MX/digits.fallback)0
-rw-r--r--src/layouts/es_MX/handwriting.qml54
-rw-r--r--src/layouts/es_MX/main.qml186
-rw-r--r--src/layouts/es_MX/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/es_MX/numbers.fallback)0
-rw-r--r--src/layouts/es_MX/symbols.qml360
-rw-r--r--src/layouts/et_EE/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/et_EE/dialpad.fallback)0
-rw-r--r--src/layouts/et_EE/digits.fallback (renamed from src/virtualkeyboard/content/layouts/et_EE/digits.fallback)0
-rw-r--r--src/layouts/et_EE/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/fi_FI/handwriting.fallback)0
-rw-r--r--src/layouts/et_EE/main.qml199
-rw-r--r--src/layouts/et_EE/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/et_EE/numbers.fallback)0
-rw-r--r--src/layouts/et_EE/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/et_EE/symbols.fallback)0
-rw-r--r--src/layouts/fa_FA/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/fa_FA/dialpad.fallback)0
-rw-r--r--src/layouts/fa_FA/digits.qml89
-rw-r--r--src/layouts/fa_FA/handwriting.qml74
-rw-r--r--src/layouts/fa_FA/main.qml172
-rw-r--r--src/layouts/fa_FA/numbers.qml163
-rw-r--r--src/layouts/fa_FA/symbols.qml363
-rw-r--r--src/layouts/fallback/dialpad.qml90
-rw-r--r--src/layouts/fallback/digits.qml91
-rw-r--r--src/layouts/fallback/handwriting.qml54
-rw-r--r--src/layouts/fallback/main.qml203
-rw-r--r--src/layouts/fallback/numbers.qml163
-rw-r--r--src/layouts/fallback/symbols.qml358
-rw-r--r--src/layouts/fi_FI/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/fi_FI/dialpad.fallback)0
-rw-r--r--src/layouts/fi_FI/digits.fallback (renamed from src/virtualkeyboard/content/layouts/fi_FI/digits.fallback)0
-rw-r--r--src/layouts/fi_FI/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/fr_CA/handwriting.fallback)0
-rw-r--r--src/layouts/fi_FI/main.qml196
-rw-r--r--src/layouts/fi_FI/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/fi_FI/numbers.fallback)0
-rw-r--r--src/layouts/fi_FI/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/fi_FI/symbols.fallback)0
-rw-r--r--src/layouts/fr_CA/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/fr_CA/dialpad.fallback)0
-rw-r--r--src/layouts/fr_CA/digits.fallback (renamed from src/virtualkeyboard/content/layouts/fr_CA/digits.fallback)0
-rw-r--r--src/layouts/fr_CA/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/fr_FR/handwriting.fallback)0
-rw-r--r--src/layouts/fr_CA/main.qml195
-rw-r--r--src/layouts/fr_CA/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/fr_CA/numbers.fallback)0
-rw-r--r--src/layouts/fr_CA/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/fr_CA/symbols.fallback)0
-rw-r--r--src/layouts/fr_FR/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/fr_FR/dialpad.fallback)0
-rw-r--r--src/layouts/fr_FR/digits.fallback (renamed from src/virtualkeyboard/content/layouts/fr_FR/digits.fallback)0
-rw-r--r--src/layouts/fr_FR/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/id_ID/handwriting.fallback)0
-rw-r--r--src/layouts/fr_FR/main.qml183
-rw-r--r--src/layouts/fr_FR/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/fr_FR/numbers.fallback)0
-rw-r--r--src/layouts/fr_FR/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/fr_FR/symbols.fallback)0
-rw-r--r--src/layouts/he_IL/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/he_IL/dialpad.fallback)0
-rw-r--r--src/layouts/he_IL/digits.fallback (renamed from src/virtualkeyboard/content/layouts/he_IL/digits.fallback)0
-rw-r--r--src/layouts/he_IL/handwriting.qml57
-rw-r--r--src/layouts/he_IL/main.qml392
-rw-r--r--src/layouts/he_IL/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/he_IL/numbers.fallback)0
-rw-r--r--src/layouts/he_IL/symbols.qml358
-rw-r--r--src/layouts/hi_IN/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/hi_IN/dialpad.fallback)0
-rw-r--r--src/layouts/hi_IN/digits.fallback (renamed from src/virtualkeyboard/content/layouts/hi_IN/digits.fallback)0
-rw-r--r--src/layouts/hi_IN/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/it_IT/handwriting.fallback)0
-rw-r--r--src/layouts/hi_IN/main.qml191
-rw-r--r--src/layouts/hi_IN/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/hi_IN/numbers.fallback)0
-rw-r--r--src/layouts/hi_IN/symbols.qml368
-rw-r--r--src/layouts/hr_HR/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/hr_HR/dialpad.fallback)0
-rw-r--r--src/layouts/hr_HR/digits.fallback (renamed from src/virtualkeyboard/content/layouts/hr_HR/digits.fallback)0
-rw-r--r--src/layouts/hr_HR/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/ms_MY/handwriting.fallback)0
-rw-r--r--src/layouts/hr_HR/main.qml190
-rw-r--r--src/layouts/hr_HR/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/hr_HR/numbers.fallback)0
-rw-r--r--src/layouts/hr_HR/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/hr_HR/symbols.fallback)0
-rw-r--r--src/layouts/hu_HU/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/hu_HU/dialpad.fallback)0
-rw-r--r--src/layouts/hu_HU/digits.fallback (renamed from src/virtualkeyboard/content/layouts/hu_HU/digits.fallback)0
-rw-r--r--src/layouts/hu_HU/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/nb_NO/handwriting.fallback)0
-rw-r--r--src/layouts/hu_HU/main.qml195
-rw-r--r--src/layouts/hu_HU/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/hu_HU/numbers.fallback)0
-rw-r--r--src/layouts/hu_HU/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/hu_HU/symbols.fallback)0
-rw-r--r--src/layouts/id_ID/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/id_ID/dialpad.fallback)0
-rw-r--r--src/layouts/id_ID/digits.fallback (renamed from src/virtualkeyboard/content/layouts/id_ID/digits.fallback)0
-rw-r--r--src/layouts/id_ID/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/nl_NL/handwriting.fallback)0
-rw-r--r--src/layouts/id_ID/main.fallback (renamed from src/virtualkeyboard/content/layouts/id_ID/main.fallback)0
-rw-r--r--src/layouts/id_ID/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/id_ID/numbers.fallback)0
-rw-r--r--src/layouts/id_ID/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/id_ID/symbols.fallback)0
-rw-r--r--src/layouts/it_IT/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/it_IT/dialpad.fallback)0
-rw-r--r--src/layouts/it_IT/digits.fallback (renamed from src/virtualkeyboard/content/layouts/it_IT/digits.fallback)0
-rw-r--r--src/layouts/it_IT/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/pl_PL/handwriting.fallback)0
-rw-r--r--src/layouts/it_IT/main.qml193
-rw-r--r--src/layouts/it_IT/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/it_IT/numbers.fallback)0
-rw-r--r--src/layouts/it_IT/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/it_IT/symbols.fallback)0
-rw-r--r--src/layouts/ja_JP/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/ja_JP/dialpad.fallback)0
-rw-r--r--src/layouts/ja_JP/digits.fallback (renamed from src/virtualkeyboard/content/layouts/ja_JP/digits.fallback)0
-rw-r--r--src/layouts/ja_JP/handwriting.qml57
-rw-r--r--src/layouts/ja_JP/main.qml453
-rw-r--r--src/layouts/ja_JP/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/ja_JP/numbers.fallback)0
-rw-r--r--src/layouts/ja_JP/symbols.qml486
-rw-r--r--src/layouts/ko_KR/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/ko_KR/dialpad.fallback)0
-rw-r--r--src/layouts/ko_KR/digits.fallback (renamed from src/virtualkeyboard/content/layouts/ko_KR/digits.fallback)0
-rw-r--r--src/layouts/ko_KR/handwriting.qml73
-rw-r--r--src/layouts/ko_KR/main.qml334
-rw-r--r--src/layouts/ko_KR/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/ko_KR/numbers.fallback)0
-rw-r--r--src/layouts/ko_KR/symbols.qml362
-rw-r--r--src/layouts/ms_MY/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/ms_MY/dialpad.fallback)0
-rw-r--r--src/layouts/ms_MY/digits.fallback (renamed from src/virtualkeyboard/content/layouts/ms_MY/digits.fallback)0
-rw-r--r--src/layouts/ms_MY/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/pt_BR/handwriting.fallback)0
-rw-r--r--src/layouts/ms_MY/main.fallback (renamed from src/virtualkeyboard/content/layouts/ms_MY/main.fallback)0
-rw-r--r--src/layouts/ms_MY/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/ms_MY/numbers.fallback)0
-rw-r--r--src/layouts/ms_MY/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/ms_MY/symbols.fallback)0
-rw-r--r--src/layouts/nb_NO/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/nb_NO/dialpad.fallback)0
-rw-r--r--src/layouts/nb_NO/digits.fallback (renamed from src/virtualkeyboard/content/layouts/nb_NO/digits.fallback)0
-rw-r--r--src/layouts/nb_NO/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/pt_PT/handwriting.fallback)0
-rw-r--r--src/layouts/nb_NO/main.qml202
-rw-r--r--src/layouts/nb_NO/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/nb_NO/numbers.fallback)0
-rw-r--r--src/layouts/nb_NO/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/nb_NO/symbols.fallback)0
-rw-r--r--src/layouts/nl_NL/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/nl_NL/dialpad.fallback)0
-rw-r--r--src/layouts/nl_NL/digits.fallback (renamed from src/virtualkeyboard/content/layouts/nl_NL/digits.fallback)0
-rw-r--r--src/layouts/nl_NL/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/ru_RU/handwriting.fallback)0
-rw-r--r--src/layouts/nl_NL/main.fallback (renamed from src/virtualkeyboard/content/layouts/nl_NL/main.fallback)0
-rw-r--r--src/layouts/nl_NL/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/nl_NL/numbers.fallback)0
-rw-r--r--src/layouts/nl_NL/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/nl_NL/symbols.fallback)0
-rw-r--r--src/layouts/pl_PL/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/pl_PL/dialpad.fallback)0
-rw-r--r--src/layouts/pl_PL/digits.fallback (renamed from src/virtualkeyboard/content/layouts/pl_PL/digits.fallback)0
-rw-r--r--src/layouts/pl_PL/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/sk_SK/handwriting.fallback)0
-rw-r--r--src/layouts/pl_PL/main.qml197
-rw-r--r--src/layouts/pl_PL/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/pl_PL/numbers.fallback)0
-rw-r--r--src/layouts/pl_PL/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/pl_PL/symbols.fallback)0
-rw-r--r--src/layouts/pt_BR/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/pt_BR/dialpad.fallback)0
-rw-r--r--src/layouts/pt_BR/digits.fallback (renamed from src/virtualkeyboard/content/layouts/pt_BR/digits.fallback)0
-rw-r--r--src/layouts/pt_BR/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/sl_SI/handwriting.fallback)0
-rw-r--r--src/layouts/pt_BR/main.qml182
-rw-r--r--src/layouts/pt_BR/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/pt_BR/numbers.fallback)0
-rw-r--r--src/layouts/pt_BR/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/pt_BR/symbols.fallback)0
-rw-r--r--src/layouts/pt_PT/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/pt_PT/dialpad.fallback)0
-rw-r--r--src/layouts/pt_PT/digits.fallback (renamed from src/virtualkeyboard/content/layouts/pt_PT/digits.fallback)0
-rw-r--r--src/layouts/pt_PT/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/sq_AL/handwriting.fallback)0
-rw-r--r--src/layouts/pt_PT/main.qml182
-rw-r--r--src/layouts/pt_PT/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/pt_PT/numbers.fallback)0
-rw-r--r--src/layouts/pt_PT/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/pt_PT/symbols.fallback)0
-rw-r--r--src/layouts/ro_RO/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/ro_RO/dialpad.fallback)0
-rw-r--r--src/layouts/ro_RO/digits.fallback (renamed from src/virtualkeyboard/content/layouts/ro_RO/digits.fallback)0
-rw-r--r--src/layouts/ro_RO/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/sv_SE/handwriting.fallback)0
-rw-r--r--src/layouts/ro_RO/main.qml192
-rw-r--r--src/layouts/ro_RO/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/ro_RO/numbers.fallback)0
-rw-r--r--src/layouts/ro_RO/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/ro_RO/symbols.fallback)0
-rw-r--r--src/layouts/ru_RU/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/ru_RU/dialpad.fallback)0
-rw-r--r--src/layouts/ru_RU/digits.fallback (renamed from src/virtualkeyboard/content/layouts/ru_RU/digits.fallback)0
-rw-r--r--src/layouts/ru_RU/handwriting.qml57
-rw-r--r--src/layouts/ru_RU/main.qml190
-rw-r--r--src/layouts/ru_RU/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/ru_RU/numbers.fallback)0
-rw-r--r--src/layouts/ru_RU/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/ru_RU/symbols.fallback)0
-rw-r--r--src/layouts/sk_SK/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/sk_SK/dialpad.fallback)0
-rw-r--r--src/layouts/sk_SK/digits.fallback (renamed from src/virtualkeyboard/content/layouts/sk_SK/digits.fallback)0
-rw-r--r--src/layouts/sk_SK/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/th_TH/handwriting.fallback)0
-rw-r--r--src/layouts/sk_SK/main.qml202
-rw-r--r--src/layouts/sk_SK/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/sk_SK/numbers.fallback)0
-rw-r--r--src/layouts/sk_SK/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/sk_SK/symbols.fallback)0
-rw-r--r--src/layouts/sl_SI/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/sl_SI/dialpad.fallback)0
-rw-r--r--src/layouts/sl_SI/digits.fallback (renamed from src/virtualkeyboard/content/layouts/sl_SI/digits.fallback)0
-rw-r--r--src/layouts/sl_SI/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/tr_TR/handwriting.fallback)0
-rw-r--r--src/layouts/sl_SI/main.qml197
-rw-r--r--src/layouts/sl_SI/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/sl_SI/numbers.fallback)0
-rw-r--r--src/layouts/sl_SI/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/sl_SI/symbols.fallback)0
-rw-r--r--src/layouts/sq_AL/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/sq_AL/dialpad.fallback)0
-rw-r--r--src/layouts/sq_AL/digits.fallback (renamed from src/virtualkeyboard/content/layouts/sq_AL/digits.fallback)0
-rw-r--r--src/layouts/sq_AL/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/uk_UA/handwriting.fallback)0
-rw-r--r--src/layouts/sq_AL/main.qml209
-rw-r--r--src/layouts/sq_AL/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/sq_AL/numbers.fallback)0
-rw-r--r--src/layouts/sq_AL/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/sq_AL/symbols.fallback)0
-rw-r--r--src/layouts/sr_SP/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/sr_SP/dialpad.fallback)0
-rw-r--r--src/layouts/sr_SP/digits.fallback (renamed from src/virtualkeyboard/content/layouts/sr_SP/digits.fallback)0
-rw-r--r--src/layouts/sr_SP/handwriting.qml57
-rw-r--r--src/layouts/sr_SP/main.qml371
-rw-r--r--src/layouts/sr_SP/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/sr_SP/numbers.fallback)0
-rw-r--r--src/layouts/sr_SP/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/sr_SP/symbols.fallback)0
-rw-r--r--src/layouts/sv_SE/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/sv_SE/dialpad.fallback)0
-rw-r--r--src/layouts/sv_SE/digits.fallback (renamed from src/virtualkeyboard/content/layouts/sv_SE/digits.fallback)0
-rw-r--r--src/layouts/sv_SE/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/vi_VN/handwriting.fallback)0
-rw-r--r--src/layouts/sv_SE/main.qml196
-rw-r--r--src/layouts/sv_SE/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/sv_SE/numbers.fallback)0
-rw-r--r--src/layouts/sv_SE/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/sv_SE/symbols.fallback)0
-rw-r--r--src/layouts/th_TH/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/th_TH/dialpad.fallback)0
-rw-r--r--src/layouts/th_TH/digits.fallback (renamed from src/virtualkeyboard/content/layouts/th_TH/digits.fallback)0
-rw-r--r--src/layouts/th_TH/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/th_TH/numbers.fallback)0
-rw-r--r--src/layouts/th_TH/handwriting.qml57
-rw-r--r--src/layouts/th_TH/main.qml475
-rw-r--r--src/layouts/th_TH/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/tr_TR/numbers.fallback)0
-rw-r--r--src/layouts/th_TH/symbols.qml358
-rw-r--r--src/layouts/tr_TR/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/tr_TR/dialpad.fallback)0
-rw-r--r--src/layouts/tr_TR/digits.fallback (renamed from src/virtualkeyboard/content/layouts/tr_TR/digits.fallback)0
-rw-r--r--src/layouts/tr_TR/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/tr_TR/symbols.fallback)0
-rw-r--r--src/layouts/tr_TR/main.qml214
-rw-r--r--src/layouts/tr_TR/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/uk_UA/numbers.fallback)0
-rw-r--r--src/layouts/tr_TR/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/uk_UA/symbols.fallback)0
-rw-r--r--src/layouts/uk_UA/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/uk_UA/dialpad.fallback)0
-rw-r--r--src/layouts/uk_UA/digits.fallback (renamed from src/virtualkeyboard/content/layouts/uk_UA/digits.fallback)0
-rw-r--r--src/layouts/uk_UA/handwriting.qml57
-rw-r--r--src/layouts/uk_UA/main.qml181
-rw-r--r--src/layouts/uk_UA/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/vi_VN/numbers.fallback)0
-rw-r--r--src/layouts/uk_UA/symbols.fallback (renamed from src/virtualkeyboard/content/layouts/vi_VN/dialpad.fallback)0
-rw-r--r--src/layouts/vi_VN/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/zh_CN/dialpad.fallback)0
-rw-r--r--src/layouts/vi_VN/digits.fallback (renamed from src/virtualkeyboard/content/layouts/vi_VN/digits.fallback)0
-rw-r--r--src/layouts/vi_VN/handwriting.fallback (renamed from src/virtualkeyboard/content/layouts/zh_CN/digits.fallback)0
-rw-r--r--src/layouts/vi_VN/main.qml199
-rw-r--r--src/layouts/vi_VN/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/zh_CN/numbers.fallback)0
-rw-r--r--src/layouts/vi_VN/symbols.qml358
-rw-r--r--src/layouts/zh_CN/dialpad.fallback (renamed from src/virtualkeyboard/content/layouts/zh_TW/dialpad.fallback)0
-rw-r--r--src/layouts/zh_CN/digits.fallback (renamed from src/virtualkeyboard/content/layouts/zh_TW/digits.fallback)0
-rw-r--r--src/layouts/zh_CN/handwriting.qml73
-rw-r--r--src/layouts/zh_CN/main.qml194
-rw-r--r--src/layouts/zh_CN/numbers.fallback (renamed from src/virtualkeyboard/content/layouts/zh_TW/numbers.fallback)0
-rw-r--r--src/layouts/zh_CN/symbols.qml476
-rw-r--r--src/layouts/zh_TW/dialpad.fallback0
-rw-r--r--src/layouts/zh_TW/digits.fallback0
-rw-r--r--src/layouts/zh_TW/handwriting.qml73
-rw-r--r--src/layouts/zh_TW/main.qml459
-rw-r--r--src/layouts/zh_TW/numbers.fallback0
-rw-r--r--src/layouts/zh_TW/symbols.qml476
-rw-r--r--src/plugin/CMakeLists.txt24
-rw-r--r--src/plugin/extensionloader.cpp114
-rw-r--r--src/plugin/extensionloader.h59
-rw-r--r--src/plugin/plugin.cpp98
-rw-r--r--src/plugin/plugin.h32
-rw-r--r--src/plugin/plugin.pro36
-rw-r--r--src/plugins/CMakeLists.txt39
-rw-r--r--src/plugins/cerence/.gitignore1
-rw-r--r--src/plugins/cerence/CMakeLists.txt24
-rw-r--r--src/plugins/cerence/cerencecommon/CMakeLists.txt93
-rw-r--r--src/plugins/cerence/cerencecommon/dummy.txt0
-rw-r--r--src/plugins/cerence/cerencecommon/xt9dbfile.cpp72
-rw-r--r--src/plugins/cerence/cerencecommon/xt9dbfile.h32
-rw-r--r--src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp167
-rw-r--r--src/plugins/cerence/cerencecommon/xt9ldbmanager.h41
-rw-r--r--src/plugins/cerence/hwr/CMakeLists.txt6
-rw-r--r--src/plugins/cerence/hwr/plugin/CMakeLists.txt419
-rw-r--r--src/plugins/cerence/hwr/plugin/cerence_hwr_p.h36
-rw-r--r--src/plugins/cerence/hwr/plugin/content/layouts/zh_HK/handwriting.qml73
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writeabstractdictionary_p.h50
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writedictionary.cpp281
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writedictionary_p.h122
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp2824
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writeinputmethod_p.h86
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writewordcandidate.cpp23
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writewordcandidate_p.h45
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writeworker.cpp472
-rw-r--r--src/plugins/cerence/hwr/plugin/t9writeworker_p.h230
-rw-r--r--src/plugins/cerence/unpack.py386
-rw-r--r--src/plugins/cerence/xt9/CMakeLists.txt2
-rw-r--r--src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/ja_JP/main.qml673
-rw-r--r--src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_CN/main.qml165
-rw-r--r--src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_TW/main.qml161
-rw-r--r--src/plugins/cerence/xt9/plugin/CMakeLists.txt172
-rw-r--r--src/plugins/cerence/xt9/plugin/content/layouts/ja_JP/main.qml927
-rw-r--r--src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/dialpad.fallback0
-rw-r--r--src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/digits.fallback0
-rw-r--r--src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/main.qml168
-rw-r--r--src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/numbers.fallback0
-rw-r--r--src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/symbols.qml476
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp303
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9awinputmethod_p.h48
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp147
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate_p.h56
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp165
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9cpinputmethod_p.h58
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate.cpp134
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate_p.h44
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9inputmethod.cpp30
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9inputmethod_p.h28
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9inputmethodprivate.cpp603
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9inputmethodprivate_p.h119
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9jinputmethod.cpp104
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9jinputmethod_p.h39
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate.cpp116
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate_p.h44
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp44
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9kinputmethod_p.h32
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate.cpp28
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate_p.h37
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9thaiinputmethod.cpp32
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9thaiinputmethod_p.h30
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate.cpp15
-rw-r--r--src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate_p.h23
-rw-r--r--src/plugins/cerence/xt9/xt9common/CMakeLists.txt144
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9awime.cpp112
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9awime.h39
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9callbacks.h21
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9cpime.cpp284
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9cpime.h47
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9ime.cpp304
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9ime.h108
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9jime.cpp42
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9jime.h21
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdb.cpp25
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdb.h23
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdbarea.cpp21
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdbarea.h25
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdbelement.cpp15
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdbelement.h23
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdbkey.cpp100
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdbkey.h87
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdblayout.cpp40
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kdblayout.h31
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.cpp141
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.h58
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kime.cpp48
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9kime.h27
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9languagemap.cpp224
-rw-r--r--src/plugins/cerence/xt9/xt9common/xt9languagemap.h40
-rw-r--r--src/plugins/example/CMakeLists.txt15
-rw-r--r--src/plugins/example/hwr/CMakeLists.txt284
-rw-r--r--src/plugins/example/hwr/examplehwrinputmethod.cpp632
-rw-r--r--src/plugins/example/hwr/examplehwrinputmethod_p.h65
-rw-r--r--src/plugins/hangul/.prev_CMakeLists.txt53
-rw-r--r--src/plugins/hangul/CMakeLists.txt45
-rw-r--r--src/plugins/hangul/hangul.cpp46
-rw-r--r--src/plugins/hangul/hangul.json6
-rw-r--r--src/plugins/hangul/hangul.pro45
-rw-r--r--src/plugins/hangul/hangul_p.h30
-rw-r--r--src/plugins/hangul/hangulinputmethod.cpp34
-rw-r--r--src/plugins/hangul/hangulinputmethod_p.h33
-rw-r--r--src/plugins/hangul/hangulplugin.cpp44
-rw-r--r--src/plugins/hangul/hangulplugin.h49
-rw-r--r--src/plugins/hunspell/3rdparty/hunspell/CMakeLists.txt41
-rw-r--r--src/plugins/hunspell/3rdparty/hunspell/config.h.cmake.in2
-rw-r--r--src/plugins/hunspell/3rdparty/hunspell/hunspell.pro52
-rw-r--r--src/plugins/hunspell/CMakeLists.txt6
-rw-r--r--src/plugins/hunspell/hunspell.pro14
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/.prev_CMakeLists.txt38
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/CMakeLists.txt45
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp412
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.pro28
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp337
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.h92
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p_p.h97
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellworker.cpp772
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/hunspellworker_p.h298
-rw-r--r--src/plugins/hunspell/hunspellinputmethod/qhunspellinputmethod_global.h49
-rw-r--r--src/plugins/hunspell/module/CMakeLists.txt53
-rw-r--r--src/plugins/hunspell/module/hunspellinputmethod.cpp350
-rw-r--r--src/plugins/hunspell/module/hunspellinputmethod_p.cpp347
-rw-r--r--src/plugins/hunspell/module/hunspellinputmethod_p.h62
-rw-r--r--src/plugins/hunspell/module/hunspellinputmethod_p_p.h77
-rw-r--r--src/plugins/hunspell/module/hunspellwordlist.cpp308
-rw-r--r--src/plugins/hunspell/module/hunspellwordlist_p.h86
-rw-r--r--src/plugins/hunspell/module/hunspellworker.cpp450
-rw-r--r--src/plugins/hunspell/module/hunspellworker_p.h213
-rw-r--r--src/plugins/hunspell/module/qhunspellinputmethod_global.h10
-rw-r--r--src/plugins/hunspell/plugin/CMakeLists.txt41
-rw-r--r--src/plugins/hunspell/plugin/hunspell.json6
-rw-r--r--src/plugins/hunspell/plugin/hunspellplugin.cpp45
-rw-r--r--src/plugins/hunspell/plugin/hunspellplugin.h49
-rw-r--r--src/plugins/hunspell/plugin/plugin.pro40
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/CMakeLists.txt3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/MIT_LICENSE.txt18
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/license.txt13
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/lipi-toolkit.pro4
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg382
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdtbin11505083 -> 0 bytes
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg1
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg2
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini76
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.cfg362
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.mdt61
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/profile.cfg1
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini14
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/lipiengine.cfg2
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/qt_attribution.json15
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/CMakeLists.txt6
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/.prev_CMakeLists.txt65
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/CMakeLists.txt65
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp556
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp362
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKException.cpp154
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp441
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp730
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp418
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp1134
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/common.pro16
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h239
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKChannel.h215
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h73
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h248
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKException.h129
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKInc.h68
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h91
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLogger.h184
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h118
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKMacros.h894
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h111
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h58
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h73
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h632
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h213
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h329
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h225
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h238
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h26
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h221
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h178
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h142
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h188
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h241
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h304
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h214
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h294
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTypes.h126
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h203
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h128
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h143
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/headers.pri32
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri21
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/.prev_CMakeLists.txt42
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/CMakeLists.txt42
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp1371
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h350
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp439
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def7
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h126
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro19
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/version.h59
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipilib.pri5
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiplugin.pri9
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/CMakeLists.txt4
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/reco.pro7
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/CMakeLists.txt8
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/.prev_CMakeLists.txt47
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp138
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def4
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h95
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp1186
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h194
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp211
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h161
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp178
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h139
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp6257
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h1203
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/CMakeLists.txt47
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg422
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro27
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/CMakeLists.txt33
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp538
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp223
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp486
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp250
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp288
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h142
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro13
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/CMakeLists.txt7
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/CMakeLists.txt29
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h224
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp64
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h102
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp222
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h94
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro9
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro13
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/.prev_CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp673
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h267
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp587
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h112
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp105
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h94
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro22
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/.prev_CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp103
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h92
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp340
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h253
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp722
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h97
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro22
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/.prev_CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp106
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h110
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp517
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h199
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp394
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h70
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro22
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/.prev_CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp115
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h98
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp675
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h200
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp1035
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h139
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro22
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/.prev_CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/CMakeLists.txt44
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp112
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def4
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h62
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp4682
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h1111
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg407
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro21
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/.prev_CMakeLists.txt45
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/CMakeLists.txt45
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp142
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def4
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h100
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp370
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h110
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp5432
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h1178
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg362
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro23
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/.prev_CMakeLists.txt43
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/CMakeLists.txt43
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp3353
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp109
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h82
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro20
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro14
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/CMakeLists.txt4
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/.prev_CMakeLists.txt43
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp1336
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h231
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/CMakeLists.txt43
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg13
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp129
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def3
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h90
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro20
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/CMakeLists.txt30
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp1065
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp477
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp291
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro10
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro7
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/src.pro11
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/CMakeLists.txt4
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/.prev_CMakeLists.txt55
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/CMakeLists.txt55
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp579
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h164
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp270
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h134
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h566
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp209
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h60
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h1592
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp1306
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h431
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp676
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h135
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp235
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h111
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp410
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h132
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp378
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h108
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp349
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h135
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp75
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp401
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h133
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp327
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h110
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp245
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h104
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp469
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h114
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp582
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h110
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/lib.pro39
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/.prev_CMakeLists.txt41
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/CMakeLists.txt42
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp399
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.cpp240
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.def10
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.h92
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.pro19
-rw-r--r--src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/util.pro7
-rw-r--r--src/plugins/lipi-toolkit/CMakeLists.txt4
-rw-r--r--src/plugins/lipi-toolkit/lipi-toolkit.pro7
-rw-r--r--src/plugins/lipi-toolkit/plugin/.prev_CMakeLists.txt92
-rw-r--r--src/plugins/lipi-toolkit/plugin/CMakeLists.txt133
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipi.json6
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiinputmethod.cpp641
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiinputmethod_p.h98
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiplugin.cpp43
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiplugin.h49
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipisharedrecognizer.cpp408
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipisharedrecognizer_p.h105
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiworker.cpp250
-rw-r--r--src/plugins/lipi-toolkit/plugin/lipiworker_p.h161
-rw-r--r--src/plugins/lipi-toolkit/plugin/plugin.pro68
-rw-r--r--src/plugins/myscript/3rdparty/myscript/myscript.pri59
-rw-r--r--src/plugins/myscript/CMakeLists.txt2
-rw-r--r--src/plugins/myscript/myscript.pro4
-rw-r--r--src/plugins/myscript/plugin/.prev_CMakeLists.txt196
-rw-r--r--src/plugins/myscript/plugin/CMakeLists.txt390
-rw-r--r--src/plugins/myscript/plugin/myscript.json6
-rw-r--r--src/plugins/myscript/plugin/myscriptinputmethod.cpp67
-rw-r--r--src/plugins/myscript/plugin/myscriptinputmethod_p.h37
-rw-r--r--src/plugins/myscript/plugin/myscriptinputmethod_p_p.h34
-rw-r--r--src/plugins/myscript/plugin/myscriptplugin.cpp43
-rw-r--r--src/plugins/myscript/plugin/myscriptplugin.h49
-rw-r--r--src/plugins/myscript/plugin/plugin.pro111
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt3
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/openwnn.pro63
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp4
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp30
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp12
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp12
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp8
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp2
-rw-r--r--src/plugins/openwnn/CMakeLists.txt50
-rw-r--r--src/plugins/openwnn/openwnn.pro9
-rw-r--r--src/plugins/openwnn/openwnninputmethod.cpp806
-rw-r--r--src/plugins/openwnn/openwnninputmethod_p.h58
-rw-r--r--src/plugins/openwnn/plugin/.prev_CMakeLists.txt53
-rw-r--r--src/plugins/openwnn/plugin/CMakeLists.txt54
-rw-r--r--src/plugins/openwnn/plugin/openwnn.json6
-rw-r--r--src/plugins/openwnn/plugin/openwnninputmethod.cpp829
-rw-r--r--src/plugins/openwnn/plugin/openwnninputmethod_p.h82
-rw-r--r--src/plugins/openwnn/plugin/openwnnplugin.cpp44
-rw-r--r--src/plugins/openwnn/plugin/openwnnplugin.h49
-rw-r--r--src/plugins/openwnn/plugin/plugin.pro45
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/.prev_CMakeLists.txt63
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/CMakeLists.txt10
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/pinyin.pro64
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp8
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp3
-rw-r--r--src/plugins/pinyin/3rdparty/pinyin/update-patches.sh30
-rw-r--r--src/plugins/pinyin/CMakeLists.txt74
-rw-r--r--src/plugins/pinyin/pinyin.pro7
-rw-r--r--src/plugins/pinyin/pinyindecoderservice.cpp210
-rw-r--r--src/plugins/pinyin/pinyindecoderservice_p.h60
-rw-r--r--src/plugins/pinyin/pinyininputmethod.cpp477
-rw-r--r--src/plugins/pinyin/pinyininputmethod_p.h58
-rw-r--r--src/plugins/pinyin/plugin/.prev_CMakeLists.txt78
-rw-r--r--src/plugins/pinyin/plugin/CMakeLists.txt79
-rw-r--r--src/plugins/pinyin/plugin/pinyin.json6
-rw-r--r--src/plugins/pinyin/plugin/pinyindecoderservice.cpp236
-rw-r--r--src/plugins/pinyin/plugin/pinyindecoderservice_p.h86
-rw-r--r--src/plugins/pinyin/plugin/pinyininputmethod.cpp501
-rw-r--r--src/plugins/pinyin/plugin/pinyininputmethod_p.h82
-rw-r--r--src/plugins/pinyin/plugin/pinyinplugin.cpp44
-rw-r--r--src/plugins/pinyin/plugin/pinyinplugin.h49
-rw-r--r--src/plugins/pinyin/plugin/plugin.pro59
-rw-r--r--src/plugins/plugins.pro19
-rw-r--r--src/plugins/t9write/3rdparty/t9write/CMakeLists.txt70
-rw-r--r--src/plugins/t9write/3rdparty/t9write/t9write-build.pri83
-rw-r--r--src/plugins/t9write/3rdparty/t9write/t9write.pro27
-rw-r--r--src/plugins/t9write/3rdparty/t9write/unpack.py278
-rw-r--r--src/plugins/t9write/CMakeLists.txt4
-rw-r--r--src/plugins/t9write/plugin/CMakeLists.txt264
-rw-r--r--src/plugins/t9write/plugin/plugin.pro118
-rw-r--r--src/plugins/t9write/plugin/t9write.json6
-rw-r--r--src/plugins/t9write/plugin/t9write_p.h63
-rw-r--r--src/plugins/t9write/plugin/t9writedictionary.cpp121
-rw-r--r--src/plugins/t9write/plugin/t9writedictionary_p.h80
-rw-r--r--src/plugins/t9write/plugin/t9writeinputmethod.cpp2177
-rw-r--r--src/plugins/t9write/plugin/t9writeinputmethod_p.h117
-rw-r--r--src/plugins/t9write/plugin/t9writeplugin.cpp44
-rw-r--r--src/plugins/t9write/plugin/t9writeplugin.h49
-rw-r--r--src/plugins/t9write/plugin/t9writeworker.cpp406
-rw-r--r--src/plugins/t9write/plugin/t9writeworker_p.h221
-rw-r--r--src/plugins/t9write/t9write.pro7
-rw-r--r--src/plugins/tcime/3rdparty/tcime/CMakeLists.txt3
-rw-r--r--src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp8
-rw-r--r--src/plugins/tcime/3rdparty/tcime/qt_attribution.json10
-rw-r--r--src/plugins/tcime/3rdparty/tcime/tcime.pro37
-rw-r--r--src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp6
-rw-r--r--src/plugins/tcime/CMakeLists.txt74
-rw-r--r--src/plugins/tcime/plugin/.prev_CMakeLists.txt89
-rw-r--r--src/plugins/tcime/plugin/CMakeLists.txt90
-rw-r--r--src/plugins/tcime/plugin/plugin.pro63
-rw-r--r--src/plugins/tcime/plugin/tcime.json6
-rw-r--r--src/plugins/tcime/plugin/tcimeplugin.cpp43
-rw-r--r--src/plugins/tcime/plugin/tcimeplugin.h49
-rw-r--r--src/plugins/tcime/plugin/tcinputmethod.cpp556
-rw-r--r--src/plugins/tcime/plugin/tcinputmethod_p.h90
-rw-r--r--src/plugins/tcime/tcime.pro7
-rw-r--r--src/plugins/tcime/tcinputmethod.cpp530
-rw-r--r--src/plugins/tcime/tcinputmethod_p.h66
-rw-r--r--src/plugins/thai/CMakeLists.txt53
-rw-r--r--src/plugins/thai/plugin/.prev_CMakeLists.txt58
-rw-r--r--src/plugins/thai/plugin/CMakeLists.txt58
-rw-r--r--src/plugins/thai/plugin/plugin.pro50
-rw-r--r--src/plugins/thai/plugin/thai.json6
-rw-r--r--src/plugins/thai/plugin/thaiinputmethod.cpp94
-rw-r--r--src/plugins/thai/plugin/thaiinputmethod_p.h65
-rw-r--r--src/plugins/thai/plugin/thaiplugin.cpp43
-rw-r--r--src/plugins/thai/plugin/thaiplugin.h49
-rw-r--r--src/plugins/thai/thai.pro4
-rw-r--r--src/plugins/thai/thaiinputmethod.cpp68
-rw-r--r--src/plugins/thai/thaiinputmethod_p.h42
-rw-r--r--src/settings/CMakeLists.txt50
-rw-r--r--src/settings/dependencies.json2
-rw-r--r--src/settings/plugins.qmltypes50
-rw-r--r--src/settings/qmldir5
-rw-r--r--src/settings/qquickvirtualkeyboardsettings.cpp669
-rw-r--r--src/settings/qquickvirtualkeyboardsettings_p.h160
-rw-r--r--src/settings/qtquickvirtualkeyboardsettingsplugin.cpp57
-rw-r--r--src/settings/qtquickvirtualkeyboardsettingsplugin.h50
-rw-r--r--src/settings/settings.pro23
-rw-r--r--src/shared.pri5
-rw-r--r--src/src.pro16
-rw-r--r--src/styles/CMakeLists.txt73
-rw-r--r--src/styles/KeyIcon.qml33
-rw-r--r--src/styles/KeyPanel.qml36
-rw-r--r--src/styles/KeyboardStyle.qml62
-rw-r--r--src/styles/SelectionListItem.qml33
-rw-r--r--src/styles/TraceCanvas.qml103
-rw-r--r--src/styles/TraceInputKeyPanel.qml33
-rw-r--r--src/styles/TraceUtils.js30
-rw-r--r--src/styles/builtin/CMakeLists.txt95
-rw-r--r--src/styles/builtin/default/images/backspace-fff.svg23
-rw-r--r--src/styles/builtin/default/images/check-fff.svg8
-rw-r--r--src/styles/builtin/default/images/enter-fff.svg13
-rw-r--r--src/styles/builtin/default/images/globe-fff.svg26
-rw-r--r--src/styles/builtin/default/images/handwriting-fff.svg62
-rw-r--r--src/styles/builtin/default/images/hidekeyboard-fff.svg55
-rw-r--r--src/styles/builtin/default/images/search-fff.svg14
-rw-r--r--src/styles/builtin/default/images/selectionhandle-bottom.svg (renamed from src/virtualkeyboard/content/styles/default/images/selectionhandle-bottom.svg)0
-rw-r--r--src/styles/builtin/default/images/settings-fff.svg61
-rw-r--r--src/styles/builtin/default/images/shift-80c342.svg (renamed from src/virtualkeyboard/content/styles/default/images/shift-80c342.svg)0
-rw-r--r--src/styles/builtin/default/images/shift-c5d6b6.svg (renamed from src/virtualkeyboard/content/styles/default/images/shift-c5d6b6.svg)0
-rw-r--r--src/styles/builtin/default/images/shift-fff.svg12
-rw-r--r--src/styles/builtin/default/images/textmode-fff.svg80
-rw-r--r--src/styles/builtin/default/style.qml1215
-rw-r--r--src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.cpp22
-rw-r--r--src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.h23
-rw-r--r--src/styles/builtin/retro/images/backspace-c5a96f.svg (renamed from src/virtualkeyboard/content/styles/retro/images/backspace-c5a96f.svg)0
-rw-r--r--src/styles/builtin/retro/images/check-c5a96f.svg (renamed from src/virtualkeyboard/content/styles/retro/images/check-c5a96f.svg)0
-rw-r--r--src/styles/builtin/retro/images/enter-c5a96f.svg (renamed from src/virtualkeyboard/content/styles/retro/images/enter-c5a96f.svg)0
-rw-r--r--src/styles/builtin/retro/images/globe-110b05.svg (renamed from src/virtualkeyboard/content/styles/retro/images/globe-110b05.svg)0
-rw-r--r--src/styles/builtin/retro/images/globe-c5a96f.svg26
-rw-r--r--src/styles/builtin/retro/images/globe-fff.svg26
-rw-r--r--src/styles/builtin/retro/images/handwriting-110b05.svg62
-rw-r--r--src/styles/builtin/retro/images/handwriting-c5a96f.svg62
-rw-r--r--src/styles/builtin/retro/images/handwriting-fff.svg62
-rw-r--r--src/styles/builtin/retro/images/hidekeyboard-110b05.svg55
-rw-r--r--src/styles/builtin/retro/images/hidekeyboard-c5a96f.svg (renamed from src/virtualkeyboard/content/styles/retro/images/hidekeyboard-c5a96f.svg)0
-rw-r--r--src/styles/builtin/retro/images/hidekeyboard-fff.svg55
-rw-r--r--src/styles/builtin/retro/images/key154px_black.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_black.png)bin9977 -> 9977 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_black.svg19
-rw-r--r--src/styles/builtin/retro/images/key154px_black_long.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_black_long.png)bin11828 -> 11828 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_capslock.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_capslock.png)bin21410 -> 21410 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_capslock_long.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_capslock_long.png)bin24503 -> 24503 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_colorA.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_colorA.png)bin16911 -> 16911 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_colorA.svg (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_colorA.svg)0
-rw-r--r--src/styles/builtin/retro/images/key154px_colorA_long.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_colorA_long.png)bin21161 -> 21161 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_colorB.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_colorB.png)bin17447 -> 17447 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_shiftcase.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_shiftcase.png)bin9675 -> 9675 bytes
-rw-r--r--src/styles/builtin/retro/images/key154px_shiftcase_long.png (renamed from src/virtualkeyboard/content/styles/retro/images/key154px_shiftcase_long.png)bin10444 -> 10444 bytes
-rw-r--r--src/styles/builtin/retro/images/key156px_black_long.png (renamed from src/virtualkeyboard/content/styles/retro/images/key156px_black_long.png)bin10931 -> 10931 bytes
-rw-r--r--src/styles/builtin/retro/images/key156px_black_medium_long.png (renamed from src/virtualkeyboard/content/styles/retro/images/key156px_black_medium_long.png)bin11989 -> 11989 bytes
-rw-r--r--src/styles/builtin/retro/images/key156px_colorA.png (renamed from src/virtualkeyboard/content/styles/retro/images/key156px_colorA.png)bin17049 -> 17049 bytes
-rw-r--r--src/styles/builtin/retro/images/key156px_colorB.png (renamed from src/virtualkeyboard/content/styles/retro/images/key156px_colorB.png)bin17462 -> 17462 bytes
-rw-r--r--src/styles/builtin/retro/images/key160px_black.png (renamed from src/virtualkeyboard/content/styles/retro/images/key160px_black.png)bin10165 -> 10165 bytes
-rw-r--r--src/styles/builtin/retro/images/key160px_colorA.png (renamed from src/virtualkeyboard/content/styles/retro/images/key160px_colorA.png)bin17575 -> 17575 bytes
-rw-r--r--src/styles/builtin/retro/images/key160px_colorB.png (renamed from src/virtualkeyboard/content/styles/retro/images/key160px_colorB.png)bin18291 -> 18291 bytes
-rw-r--r--src/styles/builtin/retro/images/key_preview.png (renamed from src/virtualkeyboard/content/styles/retro/images/key_preview.png)bin14779 -> 14779 bytes
-rw-r--r--src/styles/builtin/retro/images/search-c5a96f.svg (renamed from src/virtualkeyboard/content/styles/retro/images/search-c5a96f.svg)0
-rw-r--r--src/styles/builtin/retro/images/selectionhandle-bottom.svg (renamed from src/virtualkeyboard/content/styles/retro/images/selectionhandle-bottom.svg)0
-rw-r--r--src/styles/builtin/retro/images/shift-c5a96f.svg (renamed from src/virtualkeyboard/content/styles/retro/images/shift-c5a96f.svg)0
-rw-r--r--src/styles/builtin/retro/images/shift-cd8865.svg (renamed from src/virtualkeyboard/content/styles/retro/images/shift-cd8865.svg)0
-rw-r--r--src/styles/builtin/retro/images/shift-dc4f28.svg (renamed from src/virtualkeyboard/content/styles/retro/images/shift-dc4f28.svg)0
-rw-r--r--src/styles/builtin/retro/images/textmode-110b05.svg80
-rw-r--r--src/styles/builtin/retro/images/textmode-c5a96f.svg80
-rw-r--r--src/styles/builtin/retro/images/textmode-fff.svg80
-rw-r--r--src/styles/builtin/retro/images/triangle_black.png (renamed from src/virtualkeyboard/content/styles/retro/images/triangle_black.png)bin2249 -> 2249 bytes
-rw-r--r--src/styles/builtin/retro/images/triangle_highlight.png (renamed from src/virtualkeyboard/content/styles/retro/images/triangle_highlight.png)bin2120 -> 2120 bytes
-rw-r--r--src/styles/builtin/retro/style.qml1248
-rw-r--r--src/styles/plugins.qmltypes570
-rw-r--r--src/styles/qmldir5
-rw-r--r--src/styles/qtquickvirtualkeyboardstylesplugin.cpp74
-rw-r--r--src/styles/qtquickvirtualkeyboardstylesplugin.h32
-rw-r--r--src/styles/styles.pro34
-rw-r--r--src/styles/styles.qrc11
-rw-r--r--src/styles/svgimageprovider.cpp32
-rw-r--r--src/styles/svgimageprovider.h30
-rw-r--r--src/virtualkeyboard/.prev_CMakeLists.txt357
-rw-r--r--src/virtualkeyboard/.prev_configure.cmake373
-rw-r--r--src/virtualkeyboard/CMakeLists.txt679
-rw-r--r--src/virtualkeyboard/EnterKey.qml8
-rw-r--r--src/virtualkeyboard/HandwritingInputPanel.qml122
-rw-r--r--src/virtualkeyboard/InputPanel.qml141
-rw-r--r--src/virtualkeyboard/abstractinputpanel.cpp30
-rw-r--r--src/virtualkeyboard/abstractinputpanel_p.h33
-rw-r--r--src/virtualkeyboard/appinputpanel.cpp30
-rw-r--r--src/virtualkeyboard/appinputpanel_p.h32
-rw-r--r--src/virtualkeyboard/appinputpanel_p_p.h32
-rw-r--r--src/virtualkeyboard/configure.cmake164
-rw-r--r--src/virtualkeyboard/configure.json497
-rw-r--r--src/virtualkeyboard/configure.pri181
-rw-r--r--src/virtualkeyboard/content/HandwritingInputPanel.qml138
-rw-r--r--src/virtualkeyboard/content/InputPanel.qml150
-rw-r--r--src/virtualkeyboard/content/components/AlternativeKeys.qml129
-rw-r--r--src/virtualkeyboard/content/components/BackspaceKey.qml49
-rw-r--r--src/virtualkeyboard/content/components/BaseKey.qml250
-rw-r--r--src/virtualkeyboard/content/components/ChangeLanguageKey.qml79
-rw-r--r--src/virtualkeyboard/content/components/CharacterPreviewBubble.qml56
-rw-r--r--src/virtualkeyboard/content/components/EnterKey.qml57
-rw-r--r--src/virtualkeyboard/content/components/FillerKey.qml45
-rw-r--r--src/virtualkeyboard/content/components/HandwritingModeKey.qml54
-rw-r--r--src/virtualkeyboard/content/components/HideKeyboardKey.qml48
-rw-r--r--src/virtualkeyboard/content/components/InputModeKey.qml123
-rw-r--r--src/virtualkeyboard/content/components/Key.qml47
-rw-r--r--src/virtualkeyboard/content/components/Keyboard.qml1643
-rw-r--r--src/virtualkeyboard/content/components/KeyboardColumn.qml63
-rw-r--r--src/virtualkeyboard/content/components/KeyboardLayout.qml148
-rw-r--r--src/virtualkeyboard/content/components/KeyboardLayoutLoader.qml127
-rw-r--r--src/virtualkeyboard/content/components/KeyboardRow.qml62
-rw-r--r--src/virtualkeyboard/content/components/ModeKey.qml63
-rw-r--r--src/virtualkeyboard/content/components/MultiSoundEffect.qml73
-rw-r--r--src/virtualkeyboard/content/components/MultitapInputMethod.qml132
-rw-r--r--src/virtualkeyboard/content/components/NumberKey.qml47
-rw-r--r--src/virtualkeyboard/content/components/PopupList.qml67
-rw-r--r--src/virtualkeyboard/content/components/SelectionControl.qml100
-rw-r--r--src/virtualkeyboard/content/components/ShadowInputControl.qml141
-rw-r--r--src/virtualkeyboard/content/components/ShiftKey.qml52
-rw-r--r--src/virtualkeyboard/content/components/SpaceKey.qml50
-rw-r--r--src/virtualkeyboard/content/components/SymbolModeKey.qml49
-rw-r--r--src/virtualkeyboard/content/components/TraceInputArea.qml186
-rw-r--r--src/virtualkeyboard/content/components/TraceInputKey.qml116
-rw-r--r--src/virtualkeyboard/content/components/WordCandidatePopupList.qml85
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/digits.qml121
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml116
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/main.qml340
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/numbers.qml194
-rw-r--r--src/virtualkeyboard/content/layouts/ar_AR/symbols.qml388
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml99
-rw-r--r--src/virtualkeyboard/content/layouts/bg_BG/main.qml370
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/cs_CZ/main.qml207
-rw-r--r--src/virtualkeyboard/content/layouts/da_DK/main.qml215
-rw-r--r--src/virtualkeyboard/content/layouts/de_DE/main.qml210
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/handwriting.qml99
-rw-r--r--src/virtualkeyboard/content/layouts/el_GR/main.qml364
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/main.qml211
-rw-r--r--src/virtualkeyboard/content/layouts/es_ES/symbols.qml378
-rw-r--r--src/virtualkeyboard/content/layouts/es_MX/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/es_MX/main.qml211
-rw-r--r--src/virtualkeyboard/content/layouts/es_MX/symbols.qml378
-rw-r--r--src/virtualkeyboard/content/layouts/et_EE/main.qml215
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/digits.qml111
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml116
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/main.qml344
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/numbers.qml184
-rw-r--r--src/virtualkeyboard/content/layouts/fa_FA/symbols.qml378
-rw-r--r--src/virtualkeyboard/content/layouts/fallback/dialpad.qml113
-rw-r--r--src/virtualkeyboard/content/layouts/fallback/digits.qml112
-rw-r--r--src/virtualkeyboard/content/layouts/fallback/handwriting.qml96
-rw-r--r--src/virtualkeyboard/content/layouts/fallback/main.qml208
-rw-r--r--src/virtualkeyboard/content/layouts/fallback/numbers.qml184
-rw-r--r--src/virtualkeyboard/content/layouts/fallback/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/fi_FI/main.qml209
-rw-r--r--src/virtualkeyboard/content/layouts/fr_CA/main.qml200
-rw-r--r--src/virtualkeyboard/content/layouts/fr_FR/main.qml204
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/handwriting.qml99
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/main.qml381
-rw-r--r--src/virtualkeyboard/content/layouts/he_IL/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml103
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/main.qml340
-rw-r--r--src/virtualkeyboard/content/layouts/hi_IN/symbols.qml386
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml102
-rw-r--r--src/virtualkeyboard/content/layouts/hr_HR/main.qml218
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml97
-rw-r--r--src/virtualkeyboard/content/layouts/hu_HU/main.qml201
-rw-r--r--src/virtualkeyboard/content/layouts/it_IT/main.qml198
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml99
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/main.qml432
-rw-r--r--src/virtualkeyboard/content/layouts/ja_JP/symbols.qml294
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml118
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/main.qml313
-rw-r--r--src/virtualkeyboard/content/layouts/ko_KR/symbols.qml380
-rw-r--r--src/virtualkeyboard/content/layouts/nb_NO/main.qml215
-rw-r--r--src/virtualkeyboard/content/layouts/pl_PL/main.qml202
-rw-r--r--src/virtualkeyboard/content/layouts/pt_BR/main.qml207
-rw-r--r--src/virtualkeyboard/content/layouts/pt_PT/main.qml207
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml102
-rw-r--r--src/virtualkeyboard/content/layouts/ro_RO/main.qml229
-rw-r--r--src/virtualkeyboard/content/layouts/ru_RU/main.qml394
-rw-r--r--src/virtualkeyboard/content/layouts/sk_SK/main.qml208
-rw-r--r--src/virtualkeyboard/content/layouts/sl_SI/main.qml203
-rw-r--r--src/virtualkeyboard/content/layouts/sq_AL/main.qml205
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml99
-rw-r--r--src/virtualkeyboard/content/layouts/sr_SP/main.qml363
-rw-r--r--src/virtualkeyboard/content/layouts/sv_SE/main.qml209
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/handwriting.qml99
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/main.qml489
-rw-r--r--src/virtualkeyboard/content/layouts/th_TH/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/tr_TR/main.qml221
-rw-r--r--src/virtualkeyboard/content/layouts/uk_UA/main.qml373
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/main.qml205
-rw-r--r--src/virtualkeyboard/content/layouts/vi_VN/symbols.qml376
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml116
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/main.qml204
-rw-r--r--src/virtualkeyboard/content/layouts/zh_CN/symbols.qml294
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml116
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/main.qml458
-rw-r--r--src/virtualkeyboard/content/layouts/zh_TW/symbols.qml294
-rw-r--r--src/virtualkeyboard/content/styles/default/images/backspace-868482.svg23
-rw-r--r--src/virtualkeyboard/content/styles/default/images/check-868482.svg8
-rw-r--r--src/virtualkeyboard/content/styles/default/images/enter-868482.svg13
-rw-r--r--src/virtualkeyboard/content/styles/default/images/globe-868482.svg26
-rw-r--r--src/virtualkeyboard/content/styles/default/images/handwriting-868482.svg18
-rw-r--r--src/virtualkeyboard/content/styles/default/images/hidekeyboard-868482.svg55
-rw-r--r--src/virtualkeyboard/content/styles/default/images/search-868482.svg14
-rw-r--r--src/virtualkeyboard/content/styles/default/images/shift-868482.svg12
-rw-r--r--src/virtualkeyboard/content/styles/default/images/textmode-868482.svg33
-rw-r--r--src/virtualkeyboard/content/styles/default/style.qml1036
-rw-r--r--src/virtualkeyboard/content/styles/default/virtualkeyboard_default_style.qrc17
-rw-r--r--src/virtualkeyboard/content/styles/retro/images/handwriting-110b05.svg18
-rw-r--r--src/virtualkeyboard/content/styles/retro/images/textmode-110b05.svg33
-rw-r--r--src/virtualkeyboard/content/styles/retro/style.qml1079
-rw-r--r--src/virtualkeyboard/content/styles/retro/virtualkeyboard_retro_style.qrc37
-rw-r--r--src/virtualkeyboard/content/virtualkeyboard_content.qrc35
-rw-r--r--src/virtualkeyboard/desktopinputpanel.cpp81
-rw-r--r--src/virtualkeyboard/desktopinputpanel_p.h32
-rw-r--r--src/virtualkeyboard/desktopinputselectioncontrol.cpp48
-rw-r--r--src/virtualkeyboard/desktopinputselectioncontrol_p.h33
-rw-r--r--src/virtualkeyboard/doc/doc.pri8
-rw-r--r--src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf28
-rw-r--r--src/virtualkeyboard/doc/snippets/CustomInputMethod.qml38
-rw-r--r--src/virtualkeyboard/doc/snippets/cmake.txt4
-rw-r--r--src/virtualkeyboard/doc/snippets/qtvirtualkeyboard-custom-language-popup.qml28
-rw-r--r--src/virtualkeyboard/doc/src/build.qdoc463
-rw-r--r--src/virtualkeyboard/doc/src/deployment-guide.qdoc168
-rw-r--r--src/virtualkeyboard/doc/src/handwriting.qdoc96
-rw-r--r--src/virtualkeyboard/doc/src/includes/build.qdocinc7
-rw-r--r--src/virtualkeyboard/doc/src/layouts.qdoc28
-rw-r--r--src/virtualkeyboard/doc/src/qtvirtualkeyboard-components.qdoc17
-rw-r--r--src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc36
-rw-r--r--src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc167
-rw-r--r--src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc38
-rw-r--r--src/virtualkeyboard/doc/src/qtvirtualkeyboard-namespace.qdoc53
-rw-r--r--src/virtualkeyboard/doc/src/technical-guide.qdoc333
-rw-r--r--src/virtualkeyboard/doc/src/user-guide.qdoc31
-rw-r--r--src/virtualkeyboard/doc/src/xt9.qdoc58
-rw-r--r--src/virtualkeyboard/enterkeyaction.cpp31
-rw-r--r--src/virtualkeyboard/enterkeyaction_p.h40
-rw-r--r--src/virtualkeyboard/enterkeyactionattachedtype.cpp30
-rw-r--r--src/virtualkeyboard/enterkeyactionattachedtype_p.h35
-rw-r--r--src/virtualkeyboard/fallbackinputmethod.cpp30
-rw-r--r--src/virtualkeyboard/fallbackinputmethod_p.h33
-rw-r--r--src/virtualkeyboard/gesturerecognizer.cpp30
-rw-r--r--src/virtualkeyboard/gesturerecognizer_p.h33
-rw-r--r--src/virtualkeyboard/handwritinggesturerecognizer.cpp36
-rw-r--r--src/virtualkeyboard/handwritinggesturerecognizer_p.h32
-rw-r--r--src/virtualkeyboard/inputmethod.cpp37
-rw-r--r--src/virtualkeyboard/inputmethod_p.h38
-rw-r--r--src/virtualkeyboard/inputselectionhandle.cpp30
-rw-r--r--src/virtualkeyboard/inputselectionhandle_p.h33
-rw-r--r--src/virtualkeyboard/inputview.cpp30
-rw-r--r--src/virtualkeyboard/inputview_p.h33
-rw-r--r--src/virtualkeyboard/plaininputmethod.cpp30
-rw-r--r--src/virtualkeyboard/plaininputmethod_p.h35
-rw-r--r--src/virtualkeyboard/platforminputcontext.cpp74
-rw-r--r--src/virtualkeyboard/platforminputcontext_p.h37
-rw-r--r--src/virtualkeyboard/qt_cmdline.cmake24
-rw-r--r--src/virtualkeyboard/qvirtualkeyboard_global.h45
-rw-r--r--src/virtualkeyboard/qvirtualkeyboard_global_p.h40
-rw-r--r--src/virtualkeyboard/qvirtualkeyboard_namespace.h13
-rw-r--r--src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h69
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.cpp76
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h40
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.cpp19
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.h35
-rw-r--r--src/virtualkeyboard/qvirtualkeyboarddictionary.cpp70
-rw-r--r--src/virtualkeyboard/qvirtualkeyboarddictionary.h39
-rw-r--r--src/virtualkeyboard/qvirtualkeyboarddictionarymanager.cpp214
-rw-r--r--src/virtualkeyboard/qvirtualkeyboarddictionarymanager.h54
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp68
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardextensionplugin.h54
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardfeatures_namespace_p.h46
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp68
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext.h58
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp220
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h69
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputengine.cpp64
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputengine.h45
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardnamespace_p.h70
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardobserver.cpp65
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardobserver.h39
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp56
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h40
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardtrace.cpp77
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardtrace.h48
-rw-r--r--src/virtualkeyboard/settings.cpp204
-rw-r--r--src/virtualkeyboard/settings_p.h71
-rw-r--r--src/virtualkeyboard/shadowinputcontext.cpp49
-rw-r--r--src/virtualkeyboard/shadowinputcontext_p.h37
-rw-r--r--src/virtualkeyboard/shifthandler.cpp42
-rw-r--r--src/virtualkeyboard/shifthandler_p.h38
-rw-r--r--src/virtualkeyboard/unipentrace.cpp32
-rw-r--r--src/virtualkeyboard/unipentrace_p.h33
-rw-r--r--src/virtualkeyboard/virtualkeyboard.cpp52
-rw-r--r--src/virtualkeyboard/virtualkeyboard.pro433
-rw-r--r--src/virtualkeyboard/virtualkeyboard_p.h44
-rw-r--r--src/virtualkeyboard/virtualkeyboardattachedtype.cpp33
-rw-r--r--src/virtualkeyboard/virtualkeyboardattachedtype_p.h48
-rw-r--r--src/virtualkeyboard/virtualkeyboarddebug_p.h31
-rw-r--r--src/virtualkeyboard/virtualkeyboardsettings.cpp471
-rw-r--r--src/virtualkeyboard/virtualkeyboardsettings_p.h135
-rw-r--r--sync.profile6
-rw-r--r--tests/CMakeLists.txt3
-rw-r--r--tests/auto/.prev_CMakeLists.txt7
-rw-r--r--tests/auto/CMakeLists.txt10
-rw-r--r--tests/auto/auto.pro8
-rw-r--r--tests/auto/cmake/CMakeLists.txt12
-rw-r--r--tests/auto/cmake/cmake.pro6
-rw-r--r--tests/auto/dictionarymanager/CMakeLists.txt29
-rw-r--r--tests/auto/dictionarymanager/tst_dictionarymanager.cpp69
-rw-r--r--tests/auto/inputpanel/BLACKLIST1
-rw-r--r--tests/auto/inputpanel/CMakeLists.txt11
-rw-r--r--tests/auto/inputpanel/data/inputpanel/handwriting.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml36
-rw-r--r--tests/auto/inputpanel/data/inputpanel/inputpanel.qml246
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js30
-rw-r--r--tests/auto/inputpanel/data/inputpanel/utils.js46
-rw-r--r--tests/auto/inputpanel/data/tst_inputpanel.qml396
-rw-r--r--tests/auto/inputpanel/hwr_test_data/README.txt4
-rwxr-xr-xtests/auto/inputpanel/hwr_test_data/build_unipen_data.py62
-rw-r--r--tests/auto/inputpanel/inputpanel.pro19
-rw-r--r--tests/auto/inputpanel/tst_inputpanel.cpp61
-rw-r--r--tests/auto/inputpanelcontrols/CMakeLists.txt17
-rw-r--r--tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml15
-rw-r--r--tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml98
-rw-r--r--tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp31
-rw-r--r--tests/auto/layoutfilesystem/BLACKLIST3
-rw-r--r--tests/auto/layoutfilesystem/CMakeLists.txt13
-rw-r--r--tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml35
-rw-r--r--tests/auto/layoutfilesystem/layoutfilesystem.pro20
-rw-r--r--tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp30
-rw-r--r--tests/auto/layoutresources/CMakeLists.txt17
-rw-r--r--tests/auto/layoutresources/data/layouts/en_GB/main.qml35
-rw-r--r--tests/auto/layoutresources/data/resourceslayout.qrc5
-rw-r--r--tests/auto/layoutresources/layoutresources.pro20
-rw-r--r--tests/auto/layoutresources/tst_layoutresources.cpp30
-rw-r--r--tests/auto/shadowinput/CMakeLists.txt17
-rw-r--r--tests/auto/shadowinput/data/inputpanel/inputpanel.qml24
-rw-r--r--tests/auto/shadowinput/data/tst_shadowinput.qml92
-rw-r--r--tests/auto/shadowinput/tst_shadowinput.cpp23
-rw-r--r--tests/auto/shared/layouttest.pri5
-rw-r--r--tests/auto/shared/layouttesthelper.cpp33
-rw-r--r--tests/auto/shared/layouttesthelper.h30
-rw-r--r--tests/auto/styles/BLACKLIST3
-rw-r--r--tests/auto/styles/CMakeLists.txt31
-rw-r--r--tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml36
-rw-r--r--tests/auto/styles/data/tst_styles.qml41
-rw-r--r--tests/auto/styles/styles.pro23
-rw-r--r--tests/auto/styles/tst_styles.cpp30
-rw-r--r--tests/auto/virtualkeyboardattached/CMakeLists.txt17
-rw-r--r--tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml16
-rw-r--r--tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml99
-rw-r--r--tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp12
-rw-r--r--tests/manual/CMakeLists.txt13
-rw-r--r--tests/manual/manual.pro5
-rw-r--r--tests/manual/quickcontrols2/CMakeLists.txt9
-rw-r--r--tests/manual/quickcontrols2/main.cpp30
-rw-r--r--tests/manual/quickcontrols2/main.qml38
-rw-r--r--tests/manual/quickcontrols2/main.qrc5
-rw-r--r--tests/manual/quickcontrols2/quickcontrols2.pro6
-rw-r--r--tests/manual/startupperformance/CMakeLists.txt24
-rw-r--r--tests/manual/startupperformance/main.cpp23
-rw-r--r--tests/manual/startupperformance/main.qml28
-rw-r--r--tests/manual/x11vkbtest/CMakeLists.txt17
-rw-r--r--tests/manual/x11vkbtest/colors.h30
-rw-r--r--tests/manual/x11vkbtest/filehelper.cpp33
-rw-r--r--tests/manual/x11vkbtest/filehelper.h30
-rw-r--r--tests/manual/x11vkbtest/main.cpp31
-rw-r--r--tests/manual/x11vkbtest/memorymonitor.cpp30
-rw-r--r--tests/manual/x11vkbtest/memorymonitor.h38
-rw-r--r--tests/manual/x11vkbtest/mousesimulator.cpp30
-rw-r--r--tests/manual/x11vkbtest/mousesimulator.h30
-rw-r--r--tests/manual/x11vkbtest/processhandler.cpp30
-rw-r--r--tests/manual/x11vkbtest/processhandler.h30
-rw-r--r--tests/manual/x11vkbtest/startclose.cpp30
-rw-r--r--tests/manual/x11vkbtest/startclose.h30
-rw-r--r--tests/manual/x11vkbtest/testbase.cpp30
-rw-r--r--tests/manual/x11vkbtest/testbase.h30
-rw-r--r--tests/manual/x11vkbtest/testenglishletters.cpp30
-rw-r--r--tests/manual/x11vkbtest/testenglishletters.h30
-rw-r--r--tests/manual/x11vkbtest/testlanguagechange.cpp30
-rw-r--r--tests/manual/x11vkbtest/testlanguagechange.h30
-rw-r--r--tests/manual/x11vkbtest/testreporter.cpp33
-rw-r--r--tests/manual/x11vkbtest/testreporter.h30
-rw-r--r--tests/manual/x11vkbtest/testthread.cpp30
-rw-r--r--tests/manual/x11vkbtest/testthread.h30
-rw-r--r--tests/manual/x11vkbtest/windowhelper.cpp34
-rw-r--r--tests/manual/x11vkbtest/windowhelper.h30
-rw-r--r--tests/manual/x11vkbtest/x11vkbtest.pro41
-rw-r--r--tests/manual/x11vkbwrapper/CMakeLists.txt36
-rw-r--r--tests/manual/x11vkbwrapper/Keyboard.qml38
-rw-r--r--tests/manual/x11vkbwrapper/chromeextension/background.js30
-rw-r--r--tests/manual/x11vkbwrapper/chromeextension/content.js30
-rw-r--r--tests/manual/x11vkbwrapper/common_defs.h30
-rw-r--r--tests/manual/x11vkbwrapper/handleatspievents.cpp33
-rw-r--r--tests/manual/x11vkbwrapper/handleatspievents.h30
-rw-r--r--tests/manual/x11vkbwrapper/handledbusforchrome.cpp30
-rw-r--r--tests/manual/x11vkbwrapper/handledbusforchrome.h30
-rw-r--r--tests/manual/x11vkbwrapper/handlekeyevents.cpp30
-rw-r--r--tests/manual/x11vkbwrapper/handlekeyevents.h30
-rw-r--r--tests/manual/x11vkbwrapper/handlelanguagechange.cpp30
-rw-r--r--tests/manual/x11vkbwrapper/handlelanguagechange.h30
-rw-r--r--tests/manual/x11vkbwrapper/keysymmapsforfakeinput.h30
-rw-r--r--tests/manual/x11vkbwrapper/main.cpp31
-rw-r--r--tests/manual/x11vkbwrapper/main.qml34
-rw-r--r--tests/manual/x11vkbwrapper/qml.qrc7
-rw-r--r--tests/manual/x11vkbwrapper/vkbhidetimer.cpp30
-rw-r--r--tests/manual/x11vkbwrapper/vkbhidetimer.h30
-rw-r--r--tests/manual/x11vkbwrapper/vkbnativehost/CMakeLists.txt7
-rw-r--r--tests/manual/x11vkbwrapper/vkbnativehost/common_defs.h30
-rwxr-xr-xtests/manual/x11vkbwrapper/vkbnativehost/install_host.sh30
-rw-r--r--tests/manual/x11vkbwrapper/vkbnativehost/main.cpp30
-rw-r--r--tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.cpp30
-rw-r--r--tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.h30
-rw-r--r--tests/manual/x11vkbwrapper/vkbnativehost/vkbnativehost.pro26
-rw-r--r--tests/manual/x11vkbwrapper/x11vkbwrapper.pro52
-rw-r--r--tests/manual/x11vkbwrapper/xcbkeyboard.h30
-rw-r--r--tests/tests.pro3
1261 files changed, 49055 insertions, 120034 deletions
diff --git a/.cmake.conf b/.cmake.conf
index 93054804..dc1d7a92 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -1 +1,5 @@
-set(QT_REPO_MODULE_VERSION "6.0.0")
+set(QT_REPO_MODULE_VERSION "6.8.0")
+set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
+set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
+list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1")
+list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_CONTEXTLESS_CONNECT=1")
diff --git a/.gitignore b/.gitignore
index bee08fee..fc44dba9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,12 +2,11 @@
# --------------------------------------------------------------
examples/virtualkeyboard/basic/basic
-!src/plugins/hunspell/3rdparty/hunspell/hunspell.pro
src/plugins/hunspell/3rdparty/hunspell/*
src/plugins/hunspell/3rdparty/hunspell/doc/html
-src/plugins/t9write/3rdparty/t9write/api
-src/plugins/t9write/3rdparty/t9write/data
-src/plugins/t9write/3rdparty/t9write/lib
+!src/plugins/hunspell/3rdparty/hunspell/hunspell.pro
+!src/plugins/hunspell/3rdparty/hunspell/CMakeLists.txt
+!src/plugins/hunspell/3rdparty/hunspell/config.h.cmake.in
*_wrapper.sh
*_wrapper.bat
@@ -17,6 +16,7 @@ src/plugins/t9write/3rdparty/t9write/lib
*.ilk
*.pdb
*.pro.user
+CMakeLists.txt.user
*.a
*.so
*.moc
diff --git a/.prev_CMakeLists.txt b/.prev_CMakeLists.txt
deleted file mode 100644
index 628db9f6..00000000
--- a/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Generated from qtvirtualkeyboard.pro.
-
-cmake_minimum_required(VERSION 3.15.0)
-
-include(.cmake.conf)
-project(QtVirtualKeyboard
- VERSION "${QT_REPO_MODULE_VERSION}"
- DESCRIPTION "Qt VirtualKeyboard Libraries"
- HOMEPAGE_URL "https://qt.io/"
- LANGUAGES CXX C
-)
-
-find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core SET_ME_TO_SOMETHING_USEFUL)
-find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS SET_ME_TO_SOMETHING_USEFUL)
-
-if(NOT TARGET Qt::Quick)
- message(NOTICE "Skipping the build as the condition \"TARGET Qt::Quick\" is not met.")
- return()
-endif()
-if(NOT TARGET Qt::Svg)
- message(NOTICE "Skipping the build as the condition \"TARGET Qt::Svg\" is not met.")
- return()
-endif()
-if(WINRT)
- message(NOTICE "Skipping the build as the condition \"NOT WINRT\" is not met.")
- return()
-endif()
-qt_build_repo()
diff --git a/.qmake.conf b/.qmake.conf
deleted file mode 100644
index 3066cd88..00000000
--- a/.qmake.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-load(qt_build_config)
-
-DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS
-
-MODULE_VERSION = 6.0.0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32fe356f..b52481c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from qtvirtualkeyboard.pro.
-cmake_minimum_required(VERSION 3.15.0)
+cmake_minimum_required(VERSION 3.16)
include(.cmake.conf)
project(QtVirtualKeyboard
@@ -10,8 +13,21 @@ project(QtVirtualKeyboard
LANGUAGES CXX C
)
-find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Qml QmlTools Quick Svg) # special case
-find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS QuickTest QuickControls2) # special case
+# Make sure we use the fixed BASE argument of qt_add_resource.
+set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE)
+
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) # special case
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG
+ OPTIONAL_COMPONENTS
+ Qml
+ QmlTools
+ Quick
+ Svg
+ QuickTest
+ QuickControls2
+ Multimedia
+)
+qt_internal_project_setup()
if(NOT TARGET Qt::Quick)
message(NOTICE "Skipping the build as the condition \"TARGET Qt::Quick\" is not met.")
diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt
new file mode 100644
index 00000000..b91bbd89
--- /dev/null
+++ b/LICENSES/BSD-3-Clause.txt
@@ -0,0 +1,9 @@
+Copyright (c) <year> <owner>.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/LICENSES/GFDL-1.3-no-invariants-only.txt b/LICENSES/GFDL-1.3-no-invariants-only.txt
new file mode 100644
index 00000000..857214dd
--- /dev/null
+++ b/LICENSES/GFDL-1.3-no-invariants-only.txt
@@ -0,0 +1,451 @@
+
+ GNU Free Documentation License
+ Version 1.3, 3 November 2008
+
+
+ Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
+ <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document "free" in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The "Document", below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as "you". You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A "Modified Version" of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not "Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML, PostScript or PDF designed for human modification. Examples of
+transparent image formats include PNG, XCF and JPG. Opaque formats
+include proprietary formats that can be read and edited only by
+proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML, PostScript or PDF produced by some word
+processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, "Title Page" means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+The "publisher" means any person or entity that distributes copies of
+the Document to the public.
+
+A section "Entitled XYZ" means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as "Acknowledgements",
+"Dedications", "Endorsements", or "History".) To "Preserve the Title"
+of such a section when you modify the Document means that it remains a
+section "Entitled XYZ" according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no
+other conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to
+give them a chance to provide you with an updated version of the
+Document.
+
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+ from that of the Document, and from those of previous versions
+ (which should, if there were any, be listed in the History section
+ of the Document). You may use the same title as a previous version
+ if the original publisher of that version gives permission.
+B. List on the Title Page, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the Modified
+ Version, together with at least five of the principal authors of the
+ Document (all of its principal authors, if it has fewer than five),
+ unless they release you from this requirement.
+C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+D. Preserve all the copyright notices of the Document.
+E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+F. Include, immediately after the copyright notices, a license notice
+ giving the public permission to use the Modified Version under the
+ terms of this License, in the form shown in the Addendum below.
+G. Preserve in that license notice the full lists of Invariant Sections
+ and required Cover Texts given in the Document's license notice.
+H. Include an unaltered copy of this License.
+I. Preserve the section Entitled "History", Preserve its Title, and add
+ to it an item stating at least the title, year, new authors, and
+ publisher of the Modified Version as given on the Title Page. If
+ there is no section Entitled "History" in the Document, create one
+ stating the title, year, authors, and publisher of the Document as
+ given on its Title Page, then add an item describing the Modified
+ Version as stated in the previous sentence.
+J. Preserve the network location, if any, given in the Document for
+ public access to a Transparent copy of the Document, and likewise
+ the network locations given in the Document for previous versions
+ it was based on. These may be placed in the "History" section.
+ You may omit a network location for a work that was published at
+ least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.
+K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section all
+ the substance and tone of each of the contributor acknowledgements
+ and/or dedications given therein.
+L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section titles.
+M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+N. Do not retitle any existing section to be Entitled "Endorsements"
+ or to conflict in title with any Invariant Section.
+O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History"
+in the various original documents, forming one section Entitled
+"History"; likewise combine any sections Entitled "Acknowledgements",
+and any sections Entitled "Dedications". You must delete all sections
+Entitled "Endorsements".
+
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other
+documents released under this License, and replace the individual
+copies of this License in the various documents with a single copy
+that is included in the collection, provided that you follow the rules
+of this License for verbatim copying of each of the documents in all
+other respects.
+
+You may extract a single document from such a collection, and
+distribute it individually under this License, provided you insert a
+copy of this License into the extracted document, and follow this
+License in all other respects regarding verbatim copying of that
+document.
+
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an "aggregate" if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements",
+"Dedications", or "History", the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+
+However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions of the
+GNU Free Documentation License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in
+detail to address new problems or concerns. See
+https://www.gnu.org/licenses/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation. If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy's public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+
+11. RELICENSING
+
+"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works. A
+public wiki that anybody can edit is an example of such a server. A
+"Massive Multiauthor Collaboration" (or "MMC") contained in the site
+means any set of copyrightable works thus published on the MMC site.
+
+"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+
+"Incorporate" means to publish or republish a Document, in whole or in
+part, as part of another Document.
+
+An MMC is "eligible for relicensing" if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole or
+in part into the MMC, (1) had no cover texts or invariant sections, and
+(2) were thus incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+ Copyright (c) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.3
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+ A copy of the license is included in the section entitled "GNU
+ Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with the
+ Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
diff --git a/LICENSE.GPL3 b/LICENSES/GPL-3.0-only.txt
index 94a9ed02..94a9ed02 100644
--- a/LICENSE.GPL3
+++ b/LICENSES/GPL-3.0-only.txt
diff --git a/LICENSES/LicenseRef-Qt-Commercial.txt b/LICENSES/LicenseRef-Qt-Commercial.txt
new file mode 100644
index 00000000..825b1f35
--- /dev/null
+++ b/LICENSES/LicenseRef-Qt-Commercial.txt
@@ -0,0 +1,8 @@
+Licensees holding valid commercial Qt licenses may use this software in
+accordance with the the terms contained in a written agreement between
+you and The Qt Company. Alternatively, the terms and conditions that were
+accepted by the licensee when buying and/or downloading the
+software do apply.
+
+For the latest licensing terms and conditions, see https://www.qt.io/terms-conditions.
+For further information use the contact form at https://www.qt.io/contact-us.
diff --git a/LICENSES/Qt-GPL-exception-1.0.txt b/LICENSES/Qt-GPL-exception-1.0.txt
new file mode 100644
index 00000000..d0322bf0
--- /dev/null
+++ b/LICENSES/Qt-GPL-exception-1.0.txt
@@ -0,0 +1,22 @@
+The Qt Company GPL Exception 1.0
+
+Exception 1:
+
+As a special exception you may create a larger work which contains the
+output of this application and distribute that work under terms of your
+choice, so long as the work is not otherwise derived from or based on
+this application and so long as the work does not in itself generate
+output that contains the output from this application in its original
+or modified form.
+
+Exception 2:
+
+As a special exception, you have permission to combine this application
+with Plugins licensed under the terms of your choice, to produce an
+executable, and to copy and distribute the resulting executable under
+the terms of your choice. However, the executable must be accompanied
+by a prominent notice offering all users of the executable the entire
+source code to this application, excluding the source code of the
+independent modules, but including any changes you have made to this
+application, under the terms of this license.
+
diff --git a/cmake/CerenceCommon.cmake b/cmake/CerenceCommon.cmake
new file mode 100644
index 00000000..875f988f
--- /dev/null
+++ b/cmake/CerenceCommon.cmake
@@ -0,0 +1,26 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(NOT CERENCE_SDK_ROOT)
+ if(INPUT_vkb_cerence_sdk)
+ set(CERENCE_SDK_ROOT ${INPUT_vkb_cerence_sdk})
+ elseif(DEFINED ENV{CERENCE_SDK_ROOT})
+ set(CERENCE_SDK_ROOT $ENV{CERENCE_SDK_ROOT})
+ else(EXISTS "${QtVirtualKeyboard_SOURCE_DIR}/src/plugins/cerence/sdk")
+ set(CERENCE_SDK_ROOT "${QtVirtualKeyboard_SOURCE_DIR}/src/plugins/cerence/sdk")
+ endif()
+endif()
+
+if(WIN32)
+ set(CERENCE_SDK_OS_DIR "win32")
+else()
+ set(CERENCE_SDK_OS_DIR "linux")
+endif()
+
+set(CERENCE_SDK_ARCH_DIR ${CMAKE_SYSTEM_PROCESSOR})
+
+if(BUILD_SHARED_LIBS AND NOT FEATURE_vkb_cerence_static)
+ set(CERENCE_SDK_LINK_DIR "shared")
+else()
+ set(CERENCE_SDK_LINK_DIR "static")
+endif()
diff --git a/cmake/FindCerenceHwrAlphabetic.cmake b/cmake/FindCerenceHwrAlphabetic.cmake
new file mode 100644
index 00000000..3c5e53a2
--- /dev/null
+++ b/cmake/FindCerenceHwrAlphabetic.cmake
@@ -0,0 +1,84 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#[=======================================================================[.rst:
+FindCerenceHwrAlphabetic
+------------------------
+
+Searches for Cerence Handwriting Alphabetic SDK.
+
+::
+
+ CERENCE_SDK_ROOT this parameter is required and it indicates the location
+ of the Cerence SDK. The SDK must be unpacked using unpack.py found in
+ `src/plugins/cerence/unpack.py`.
+
+::
+
+ CERENCE_HWR_ALPHABETIC_FOUND is set to TRUE if SDK is found.
+#]=======================================================================]
+
+include(CerenceCommon REQUIRED)
+
+set(CERENCE_HWR_ALPHABETIC_REQUIRED_VARS CERENCE_HWR_ALPHABETIC_INCLUDE_DIRS)
+
+#
+# Find handwriting engine
+#
+
+find_path(CERENCE_HWR_ALPHABETIC_INCLUDE_DIRS
+ NAMES "decuma_hwr.h"
+ PATHS "${CERENCE_SDK_ROOT}/t9write/api"
+)
+
+if(NOT CERENCE_HWR_ALPHABETIC_INCLUDE_DIRS STREQUAL "CERENCE_HWR_ALPHABETIC_INCLUDE_DIRS-NOTFOUND")
+ set(CERENCE_HWR_ALPHABETIC_FOUND ON CACHE BOOL "" FORCE)
+ list(APPEND CERENCE_HWR_ALPHABETIC_REQUIRED_VARS
+ CERENCE_HWR_DATAPATH
+ CERENCE_HWR_ALPHABETIC_LIBRARIES
+ )
+
+ find_path(CERENCE_HWR_DATAPATH
+ NAMES "hwrDB_le.bin"
+ PATHS "${CERENCE_SDK_ROOT}/t9write/data"
+ )
+
+ find_library(CERENCE_HWR_ALPHABETIC_LIBRARIES
+ NAMES "t9write-ucr"
+ PATHS "${CERENCE_SDK_ROOT}/t9write/lib/${CERENCE_SDK_OS_DIR}/${CERENCE_SDK_ARCH_DIR}/${CERENCE_SDK_LINK_DIR}/alphabetic/"
+ )
+
+ if(NOT CERENCE_HWR_ALPHABETIC_LIBRARIES STREQUAL "CERENCE_HWR_ALPHABETIC_LIBRARIES-NOTFOUND")
+ set(CERENCE_HWR_ALPHABETIC_FOUND ON CACHE BOOL "" FORCE)
+ endif()
+
+ if(${CERENCE_SDK_LINK_DIR} STREQUAL "shared")
+ if(WIN32)
+ find_file(CERENCE_HWR_ALPHABETIC_BINARIES
+ NAMES "t9write-ucr.dll"
+ PATHS "${CERENCE_SDK_ROOT}/t9write/lib/${CERENCE_SDK_OS_DIR}/${CERENCE_SDK_ARCH_DIR}/${CERENCE_SDK_LINK_DIR}/alphabetic/"
+ NO_DEFAULT_PATH
+ )
+ else()
+ set(CERENCE_HWR_ALPHABETIC_BINARIES ${CERENCE_HWR_CJK_LIBRARIES} CACHE STRING "" FORCE)
+ endif()
+ list(APPEND CERENCE_HWR_ALPHABETIC_REQUIRED_VARS CERENCE_HWR_ALPHABETIC_BINARIES)
+ endif()
+endif()
+
+if(CERENCE_HWR_ALPHABETIC_FOUND AND NOT TARGET Cerence::HWR::Alphabetic)
+ add_library(Cerence::HWR::Alphabetic UNKNOWN IMPORTED)
+ set_target_properties(Cerence::HWR::Alphabetic PROPERTIES
+ IMPORTED_LOCATION "${CERENCE_HWR_ALPHABETIC_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CERENCE_HWR_ALPHABETIC_INCLUDE_DIRS}")
+endif()
+
+#
+# Common
+#
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(CerenceHwrAlphabetic
+ REQUIRED_VARS ${CERENCE_HWR_ALPHABETIC_REQUIRED_VARS}
+)
diff --git a/cmake/FindCerenceHwrCjk.cmake b/cmake/FindCerenceHwrCjk.cmake
new file mode 100644
index 00000000..6b590295
--- /dev/null
+++ b/cmake/FindCerenceHwrCjk.cmake
@@ -0,0 +1,77 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#[=======================================================================[.rst:
+FindCerenceHwrCjk
+-----------------
+
+Searches for Cerence Handwriting CJK SDK.
+
+::
+
+ CERENCE_SDK_ROOT this parameter is required and it indicates the location
+ of the Cerence SDK. The SDK must be unpacked using unpack.py found in
+ `src/plugins/cerence/unpack.py`.
+
+::
+
+ CERENCE_HWR_CJK_FOUND is set to TRUE if SDK is found.
+#]=======================================================================]
+
+include(CerenceCommon REQUIRED)
+
+set(CERENCE_HWR_CJK_REQUIRED_VARS CERENCE_HWR_CJK_INCLUDE_DIRS)
+
+#
+# Find handwriting engine for Chinese Japanese and Korean
+#
+
+find_path(CERENCE_HWR_CJK_INCLUDE_DIRS
+ NAMES "decuma_hwr_cjk.h"
+ PATHS "${CERENCE_SDK_ROOT}/t9write/api"
+)
+
+if(NOT CERENCE_HWR_CJK_INCLUDE_DIRS STREQUAL "CERENCE_HWR_CJK_INCLUDE_DIRS-NOTFOUND")
+ set(CERENCE_HWR_CJK_FOUND ON CACHE BOOL "" FORCE)
+
+ find_library(CERENCE_HWR_CJK_LIBRARIES
+ NAMES "t9write-cjk"
+ PATHS "${CERENCE_SDK_ROOT}/t9write/lib/${CERENCE_SDK_OS_DIR}/${CERENCE_SDK_ARCH_DIR}/${CERENCE_SDK_LINK_DIR}/cjk/"
+ NO_DEFAULT_PATH
+ )
+
+ if(NOT CERENCE_HWR_CJK_LIBRARIES STREQUAL "CERENCE_HWR_CJK_LIBRARIES-NOTFOUND")
+ set(CERENCE_HWR_CJK_FOUND ON CACHE BOOL "" FORCE)
+ list(APPEND CERENCE_HWR_CJK_REQUIRED_VARS CERENCE_HWR_CJK_LIBRARIES)
+ endif()
+
+ if(${CERENCE_SDK_LINK_DIR} STREQUAL "shared")
+ if(WIN32)
+ find_file(CERENCE_HWR_CJK_BINARIES
+ NAMES "t9write-cjk.dll"
+ PATHS "${CERENCE_SDK_ROOT}/t9write/lib/${CERENCE_SDK_OS_DIR}/${CERENCE_SDK_ARCH_DIR}/${CERENCE_SDK_LINK_DIR}/cjk/"
+ NO_DEFAULT_PATH
+ )
+ else()
+ set(CERENCE_HWR_CJK_BINARIES ${CERENCE_HWR_CJK_LIBRARIES} CACHE STRING "" FORCE)
+ endif()
+ list(APPEND CERENCE_HWR_CJK_REQUIRED_VARS CERENCE_HWR_CJK_BINARIES)
+ endif()
+endif()
+
+if(CERENCE_HWR_CJK_FOUND AND NOT TARGET Cerence::HWR::CJK)
+ add_library(Cerence::HWR::CJK UNKNOWN IMPORTED)
+ set_target_properties(Cerence::HWR::CJK PROPERTIES
+ IMPORTED_LOCATION "${CERENCE_HWR_CJK_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CERENCE_HWR_INCLUDE_DIRS}")
+endif()
+
+#
+# Common
+#
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(CerenceHwrCjk
+ REQUIRED_VARS ${CERENCE_HWR_CJK_REQUIRED_VARS}
+)
diff --git a/cmake/FindCerenceXt9.cmake b/cmake/FindCerenceXt9.cmake
new file mode 100644
index 00000000..d91932ce
--- /dev/null
+++ b/cmake/FindCerenceXt9.cmake
@@ -0,0 +1,84 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#[=======================================================================[.rst:
+FindCerenceXt9
+--------------
+
+Searches for Cerence XT9 SDK.
+
+::
+
+ CERENCE_SDK_ROOT this parameter is required and it indicates the location
+ of the Cerence SDK. The SDK must be unpacked using unpack.py found in
+ `src/plugins/cerence/unpack.py`.
+
+::
+
+ CERENCE_XT9_FOUND is set to TRUE if SDK is found.
+#]=======================================================================]
+
+include(CerenceCommon REQUIRED)
+
+set(CERENCE_XT9_REQUIRED_VARS CERENCE_XT9_INCLUDE_DIRS)
+
+#
+# Find XT9 engine
+#
+
+find_path(CERENCE_XT9_INCLUDE_DIRS
+ NAMES "et9api.h"
+ PATHS "${CERENCE_SDK_ROOT}/xt9/api"
+)
+
+if(NOT CERENCE_XT9_INCLUDE_DIRS STREQUAL "CERENCE_XT9_INCLUDE_DIRS-NOTFOUND")
+ set(CERENCE_XT9_FOUND ON CACHE BOOL "" FORCE)
+ list(APPEND CERENCE_XT9_REQUIRED_VARS
+ CERENCE_XT9_DATAPATH
+ CERENCE_XT9_LIBRARIES
+ )
+
+ find_path(CERENCE_XT9_DATAPATH
+ NAMES
+ "ENubUN_xt9.ldb"
+ "FRusUN_xt9_ALM3.ldb"
+ "DEusUN_xt9_ALM3.ldb"
+ PATHS "${CERENCE_SDK_ROOT}/xt9/data"
+ )
+
+ find_library(CERENCE_XT9_LIBRARIES
+ NAMES "xt9-acktn"
+ PATHS "${CERENCE_SDK_ROOT}/xt9/lib/${CERENCE_SDK_OS_DIR}/${CERENCE_SDK_ARCH_DIR}/${CERENCE_SDK_LINK_DIR}/"
+ NO_DEFAULT_PATH
+ )
+
+ if(${CERENCE_SDK_LINK_DIR} STREQUAL "shared")
+ if(WIN32)
+ find_file(CERENCE_XT9_BINARIES
+ NAMES "xt9-acktn.dll"
+ PATHS "${CERENCE_SDK_ROOT}/xt9/lib/${CERENCE_SDK_OS_DIR}/${CERENCE_SDK_ARCH_DIR}/${CERENCE_SDK_LINK_DIR}/"
+ NO_DEFAULT_PATH
+ )
+ else()
+ set(CERENCE_XT9_BINARIES ${CERENCE_XT9_LIBRARIES} CACHE STRING "" FORCE)
+ endif()
+ list(APPEND CERENCE_XT9_REQUIRED_VARS CERENCE_XT9_BINARIES)
+ endif()
+endif()
+
+if(CERENCE_XT9_FOUND AND NOT TARGET Cerence::XT9)
+ add_library(Cerence::XT9 UNKNOWN IMPORTED)
+ set_target_properties(Cerence::XT9 PROPERTIES
+ IMPORTED_LOCATION "${CERENCE_XT9_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CERENCE_XT9_INCLUDE_DIRS}")
+endif()
+
+#
+# Common
+#
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(CerenceXt9
+ REQUIRED_VARS ${CERENCE_XT9_REQUIRED_VARS}
+)
diff --git a/cmake/FindHunspell.cmake b/cmake/FindHunspell.cmake
index 8b588317..3cf22147 100644
--- a/cmake/FindHunspell.cmake
+++ b/cmake/FindHunspell.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
if(TARGET Hunspell::Hunspell)
diff --git a/cmake/FindMyScript.cmake b/cmake/FindMyScript.cmake
new file mode 100644
index 00000000..81f6d21d
--- /dev/null
+++ b/cmake/FindMyScript.cmake
@@ -0,0 +1,198 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#[=======================================================================[.rst:
+FindMyScript
+------------
+
+Searches for MyScript SDK.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``MyScript::VOIM``
+ The MyScript VOIM library
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+``MyScript_FOUND``
+ TRUE if MyScript SDK is found.
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+``MyScript_ROOT_DIR``
+ It is a required variable and it indicates the location of the MyScript SDK.
+ Please contact MyScript Support team to get detailed installation guide.
+
+``MyScript_BINARIES``
+ It is a list of MyScript Library Binaries which need to be installed.
+ It includes required variables: MyScript_VOIM_BINARY, MyScript_Ink_BINARY,
+ MyScript_Prediction_BINARY, MyScript_Text_BINARY and MyScript_Engine_BINARY.
+
+#]=======================================================================]
+
+set(MYSCRIPT_REQUIRED_VARS
+ MyScript_ROOT_DIR
+ MyScript_VOIM_INCLUDE_DIR
+ MyScript_VOIM_BINARY
+ MyScript_Ink_BINARY
+ MyScript_Prediction_BINARY
+ MyScript_Text_BINARY
+ MyScript_Engine_BINARY
+)
+
+if(NOT MyScript_ROOT_DIR)
+ if(INPUT_vkb_myscript_sdk)
+ set(MyScript_ROOT_DIR ${INPUT_vkb_myscript_sdk} CACHE STRING "" FORCE)
+ elseif(DEFINED ENV{MYSCRIPT_SDK_ROOT})
+ set(MyScript_ROOT_DIR $ENV{MYSCRIPT_SDK_ROOT} CACHE STRING "" FORCE)
+ elseif(EXISTS "${QtVirtualKeyboard_SOURCE_DIR}/src/plugins/myscript/sdk")
+ set(MyScript_ROOT_DIR "${QtVirtualKeyboard_SOURCE_DIR}/src/plugins/myscript/sdk" CACHE STRING "" FORCE)
+ endif()
+endif()
+
+if(MyScript_ROOT_DIR AND NOT MyScript_ARCH)
+ if(INPUT_vkb_myscript_arch)
+ if(WIN32)
+ set(MyScript_ARCH "win-${INPUT_vkb_myscript_arch}")
+ else()
+ set(MyScript_ARCH "lin-${INPUT_vkb_myscript_arch}")
+ endif()
+ else()
+ if(WIN32)
+ if(CMAKE_SIZEOF_VOID_P MATCHES "8")
+ set(MyScript_ARCH "win-x64")
+ else()
+ set(MyScript_ARCH "win-x86")
+ endif()
+ else()
+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
+ set(MyScript_ARCH "lin-arm64")
+ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
+ set(MyScript_ARCH "lin-armv7hf")
+ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ set(MyScript_ARCH "lin-x64")
+ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "i386" OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
+ set(MyScript_ARCH "lin-x86")
+ endif()
+ endif()
+ endif()
+endif()
+
+find_path(MyScript_VOIM_INCLUDE_DIR
+ NAMES "voim.h"
+ PATHS "${MyScript_ROOT_DIR}/voim/api/c/include"
+ NO_DEFAULT_PATH
+)
+
+if(NOT MyScript_VOIM_INCLUDE_DIR STREQUAL "MyScript_VOIM_INCLUDE_DIR-NOTFOUND")
+ if(WIN32)
+ find_file(MyScript_VOIM_BINARY
+ NAMES "voim.dll"
+ PATHS "${MyScript_ROOT_DIR}/voim/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_file(MyScript_Ink_BINARY
+ NAMES "MyScriptInk.dll"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_file(MyScript_Prediction_BINARY
+ NAMES "MyScriptPrediction.dll"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_file(MyScript_Text_BINARY
+ NAMES "MyScriptText.dll"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_file(MyScript_Engine_BINARY
+ NAMES "MyScriptEngine.dll"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+ else()
+ find_library(MyScript_VOIM_BINARY
+ NAMES "voim"
+ PATHS "${MyScript_ROOT_DIR}/voim/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_library(MyScript_Ink_BINARY
+ NAMES "MyScriptInk"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_library(MyScript_Prediction_BINARY
+ NAMES "MyScriptPrediction"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_library(MyScript_Text_BINARY
+ NAMES "MyScriptText"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+
+ find_library(MyScript_Engine_BINARY
+ NAMES "MyScriptEngine"
+ PATHS "${MyScript_ROOT_DIR}/engine/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+ endif()
+
+ set(MyScript_BINARIES
+ ${MyScript_VOIM_BINARY}
+ ${MyScript_Ink_BINARY}
+ ${MyScript_Prediction_BINARY}
+ ${MyScript_Text_BINARY}
+ ${MyScript_Engine_BINARY}
+ CACHE STRING "" FORCE
+ )
+endif()
+
+if(NOT MyScript_VOIM_BINARY STREQUAL "MyScript_VOIM_BINARY-NOTFOUND" AND NOT TARGET MyScript::VOIM)
+ add_library(MyScript::VOIM SHARED IMPORTED)
+
+ if(WIN32)
+ find_library(MyScript_VOIM_LIBRARY
+ NAMES "voim"
+ PATHS "${MyScript_ROOT_DIR}/voim/bin/${MyScript_ARCH}"
+ NO_DEFAULT_PATH
+ )
+ list(APPEND MYSCRIPT_REQUIRED_VARS MyScript_VOIM_LIBRARY)
+
+ set_target_properties(MyScript::VOIM PROPERTIES
+ IMPORTED_LOCATION "${MyScript_VOIM_BINARY}"
+ IMPORTED_IMPLIB "${MyScript_VOIM_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${MyScript_VOIM_INCLUDE_DIR}"
+ )
+ else()
+ set_target_properties(MyScript::VOIM PROPERTIES
+ IMPORTED_LOCATION "${MyScript_VOIM_BINARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${MyScript_VOIM_INCLUDE_DIR}"
+ )
+ endif()
+endif()
+
+#
+# Common
+#
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(MyScript
+ REQUIRED_VARS ${MYSCRIPT_REQUIRED_VARS}
+)
+
diff --git a/cmake/QtVirtualKeyboardSetup.cmake b/cmake/QtVirtualKeyboardSetup.cmake
index ea4c2d3a..e7aa254b 100644
--- a/cmake/QtVirtualKeyboardSetup.cmake
+++ b/cmake/QtVirtualKeyboardSetup.cmake
@@ -1,3 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+get_filename_component(VKB_LAYOUTS_BASE "${CMAKE_CURRENT_LIST_DIR}/../src/layouts" REALPATH CACHE)
+set(VKB_LAYOUTS_PREFIX "/qt-project.org/imports/QtQuick/VirtualKeyboard/Layouts" CACHE STRING "" FORCE)
+
set(valid_languages
ar_AR
bg_BG
@@ -41,6 +47,7 @@ set(valid_languages
vi_VN
zh_CN
zh_TW
+ zh_HK
)
function(process_vkb_enable)
@@ -62,67 +69,10 @@ function(process_vkb_enable)
endfunction()
function(check_3rdparty_hunspell)
- if (EXISTS src/plugins/hunspell/3rdparty/hunspell/hunspell.h AND
- EXISTS src/plugins/hunspell/3rdparty/hunspell/data)
- set(VKB_HAVE_3RDPARTY_HUNSPELL TRUE CACHE STRING "" FORCE)
- else()
- set(VKB_HAVE_3RDPARTY_HUNSPELL FALSE CACHE STRING "" FORCE)
- endif()
-endfunction()
-
-set(__t9write_base_dir "src/plugins/t9write/3rdparty/t9write")
-function(t9write_find_library output_found name)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
- set(lib_dir "${__t9write_base_dir}/lib/arm/shared")
- elseif(UNIX AND NOT APPLE)
- set(lib_dir "${__t9write_base_dir}/lib/linux-x86/shared")
- elseif(WIN32)
- set(lib_dir "${__t9write_base_dir}/lib/win32/shared")
- else()
- set(${output_found} FALSE PARENT_SCOPE)
- return()
- endif()
-
- if (WIN32)
- file(GLOB result "${lib_dir}/${mame}/*.obj")
- if (NOT result)
- file(GLOB result "${lib_dir}/${mame}/*.lib")
- endif()
- if (NOT result)
- set(${output_found} FALSE PARENT_SCOPE)
- return()
- endif()
- else()
- file(GLOB result "${lib_dir}/${mame}/*.o")
- if (NOT result)
- file(GLOB result "${lib_dir}/${mame}/*.a")
- endif()
- if (NOT result)
- file(GLOB result "${lib_dir}/${mame}/*.so")
- endif()
- if (NOT result)
- set(${output_found} FALSE PARENT_SCOPE)
- return()
- endif()
- endif()
- set(${output_found} TRUE PARENT_SCOPE)
-endfunction()
-
-function(check_t9write_alpha)
- t9write_find_library(found_alpha "alphabetic")
- if (EXISTS "${__t9write_base_dir}/api/decuma_hwr.h" AND found_alpha)
- set(VKB_HAVE_T9WRITE_ALPHA TRUE CACHE STRING "" FORCE)
- else()
- set(VKB_HAVE_T9WRITE_ALPHA FALSE CACHE STRING "" FORCE)
- endif()
-endfunction()
-
-function(check_t9write_cjk)
- t9write_find_library(found_alpha "cjk")
- if (EXISTS "${__t9write_base_dir}/api/decuma_hwr_cjk.h" AND found_alpha)
- set(VKB_HAVE_T9WRITE_CJK TRUE CACHE STRING "" FORCE)
+ if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/../src/plugins/hunspell/3rdparty/hunspell/hunspell/src/hunspell/hunspell.h")
+ set(VKB_HAVE_3RDPARTY_HUNSPELL TRUE CACHE BOOL "Detection of local Hunspell source code" FORCE)
else()
- set(VKB_HAVE_T9WRITE_CJK FALSE CACHE STRING "" FORCE)
+ set(VKB_HAVE_3RDPARTY_HUNSPELL FALSE CACHE BOOL "Detection of local Hunspell source code" FORCE)
endif()
endfunction()
@@ -130,19 +80,16 @@ function(process_vkb_style)
set(INPUT_vkb_style "${vkb-style}" CACHE STRING "" FORCE)
endfunction()
-function(process_vkb_handwriting)
- set(INPUT_vkb_handwriting "${vkb-handwriting}" CACHE STRING "" FORCE)
-endfunction()
-
function(process_vkb_hunspell)
set(INPUT_vkb_hunspell "${vkb-hunspell}" CACHE STRING "" FORCE)
endfunction()
+function(process_vkb_cerence_sdk)
+ set(INPUT_vkb_cerence_sdk "${vkb-cerence-sdk}" CACHE STRING "" FORCE)
+endfunction()
+
process_vkb_hunspell()
process_vkb_style()
process_vkb_enable()
-process_vkb_handwriting()
+process_vkb_cerence_sdk()
check_3rdparty_hunspell()
-check_t9write_alpha()
-check_t9write_cjk()
-
diff --git a/coin/axivion/ci_config_linux.json b/coin/axivion/ci_config_linux.json
new file mode 100644
index 00000000..4249f9b4
--- /dev/null
+++ b/coin/axivion/ci_config_linux.json
@@ -0,0 +1,46 @@
+{
+ "Project": {
+ "BuildSystemIntegration": {
+ "child_order": [
+ "GCCSetup",
+ "CMake",
+ "LinkLibraries"
+ ]
+ },
+ "CMake": {
+ "_active": true,
+ "_copy_from": "CMakeIntegration",
+ "build_environment": {},
+ "build_options": "-j4",
+ "generate_options": "--fresh",
+ "generator": "Ninja"
+ },
+ "GCCSetup": {
+ "_active": true,
+ "_copy_from": "Command",
+ "build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/"
+ },
+ "LinkLibraries": {
+ "_active": true,
+ "_copy_from": "AxivionLinker",
+ "input_files": [
+ "build/lib/lib*.so*.ir",
+ "build/qml/*/*/lib*.so*.ir",
+ "build/qml/*/*/*/lib*.so*.ir",
+ "build/qml/*/*/*/*/lib*.so*.ir"
+ ],
+ "ir": "build/$(env:TESTED_MODULE_COIN).ir",
+ "plugin_files": [
+ "build/plugins/*/lib*.so*.ir"
+ ]
+ }
+ },
+ "_Format": "1.0",
+ "_Version": "7.6.2",
+ "_VersionNum": [
+ 7,
+ 6,
+ 2,
+ 12725
+ ]
+}
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
index 16d158c6..aaf33238 100644
--- a/coin/module_config.yaml
+++ b/coin/module_config.yaml
@@ -10,3 +10,4 @@ instructions:
Test:
- !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml"
+ - !include "{{qt/qtbase}}/coin_module_test_docs.yaml"
diff --git a/config.tests/hunspell/CMakeLists.txt b/config.tests/hunspell/CMakeLists.txt
index b54cff6c..4aa35fa7 100644
--- a/config.tests/hunspell/CMakeLists.txt
+++ b/config.tests/hunspell/CMakeLists.txt
@@ -1,8 +1,18 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from hunspell.pro.
-cmake_minimum_required(VERSION 3.14.0)
+cmake_minimum_required(VERSION 3.16)
project(config_test_hunspell LANGUAGES C CXX)
+if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH)
+ set(CMAKE_SYSTEM_PREFIX_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_PREFIX_PATH}")
+endif()
+if(DEFINED QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH)
+ set(CMAKE_SYSTEM_FRAMEWORK_PATH "${QT_CONFIG_COMPILE_TEST_CMAKE_SYSTEM_FRAMEWORK_PATH}")
+endif()
+
foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
find_package(${p})
endforeach()
diff --git a/config.tests/hunspell/hunspell.pro b/config.tests/hunspell/hunspell.pro
deleted file mode 100644
index 28dcadcb..00000000
--- a/config.tests/hunspell/hunspell.pro
+++ /dev/null
@@ -1 +0,0 @@
-SOURCES += main.cpp
diff --git a/config.tests/hunspell/main.cpp b/config.tests/hunspell/main.cpp
index d37e6983..81ba797b 100644
--- a/config.tests/hunspell/main.cpp
+++ b/config.tests/hunspell/main.cpp
@@ -1,38 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtualkeyboard module
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: BSD-3-Clause
#include <hunspell/hunspell.h>
diff --git a/configure.cmake b/configure.cmake
index 53e3f110..68f54ce7 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#### Inputs
diff --git a/configure.json b/configure.json
deleted file mode 100644
index 06bf1afe..00000000
--- a/configure.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "subconfigs": [
- "src/virtualkeyboard"
- ]
-}
diff --git a/dependencies.yaml b/dependencies.yaml
index 8e647af6..6f1752f7 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,10 +1,13 @@
dependencies:
../qtbase:
- ref: 860220bd335dde71ff4be16de2304abeeb17c7f9
+ ref: 4641945e45206508b44678011bb83da7722bad62
required: true
../qtdeclarative:
- ref: 08dbc9940bcb4d139313f03f2aec5a1cbccdbfd3
+ ref: 828b823938395d4d43f9b7a1b7f53f10a4a6b99b
required: true
+ ../qtmultimedia:
+ ref: f1f3ce4bc98e989e4d1e99a69e0a9c30dd5a1e67
+ required: false
../qtsvg:
- ref: bba01a8f21153fe5a8d2196e4705ae2fedc08a7e
+ ref: c6fe4261bdaa4f47f779e3ef0e4de89ca80d2be7
required: true
diff --git a/dist/changes-5.15.1 b/dist/changes-5.15.1
new file mode 100644
index 00000000..ed49438e
--- /dev/null
+++ b/dist/changes-5.15.1
@@ -0,0 +1,27 @@
+Qt 5.15.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.15.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5.15/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+ - [QTBUG-83217] Fixed InputPanel position in b2qt example in portrait mode.
+ - [QTBUG-74664] Fixed cursor position in Japanese input.
+ - [QTBUG-83187] Fixed static build when using disable-layouts and
+ no-builtin-style.
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 2bef5939..a4dd5c9b 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,6 +1,7 @@
-# Generated from examples.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-qt_examples_build_begin()
+qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(virtualkeyboard)
diff --git a/examples/virtualkeyboard/CMakeLists.txt b/examples/virtualkeyboard/CMakeLists.txt
index 0d6a0977..8e52b3e0 100644
--- a/examples/virtualkeyboard/CMakeLists.txt
+++ b/examples/virtualkeyboard/CMakeLists.txt
@@ -1,5 +1,6 @@
-# Generated from virtualkeyboard.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
if(TARGET Qt::QuickControls2)
- add_subdirectory(basic)
+ qt_internal_add_example(basic)
endif()
diff --git a/examples/virtualkeyboard/basic/Basic.qml b/examples/virtualkeyboard/basic/Basic.qml
index 3df811ac..445b6738 100644
--- a/examples/virtualkeyboard/basic/Basic.qml
+++ b/examples/virtualkeyboard/basic/Basic.qml
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.14
-import QtQuick.Controls 2.3
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick
+import QtQuick.Controls
+import QtQuick.VirtualKeyboard
import "content"
Rectangle {
@@ -37,7 +11,7 @@ Rectangle {
height: 720
color: "#F6F6F6"
- // Only set with CONFIG+=disable-desktop.
+ // If enabled, prevents interaction with the text fields
property bool handwritingInputPanelActive: false
Flickable {
@@ -143,4 +117,9 @@ Rectangle {
anchors.fill: parent
visible: handwritingInputPanelActive
}
+
+ Shortcut {
+ sequence: "Ctrl+Q"
+ onActivated: Qt.quit()
+ }
}
diff --git a/examples/virtualkeyboard/basic/CMakeLists.txt b/examples/virtualkeyboard/basic/CMakeLists.txt
index 9958b24b..dc52fbd1 100644
--- a/examples/virtualkeyboard/basic/CMakeLists.txt
+++ b/examples/virtualkeyboard/basic/CMakeLists.txt
@@ -1,28 +1,31 @@
-# Generated from basic.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(basic LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/virtualkeyboard/basic")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick OPTIONAL_COMPONENTS Multimedia)
+if(QT_FEATURE_static)
+ find_package(Qt6 REQUIRED COMPONENTS Svg)
+endif()
-add_qt_gui_executable(basic
+qt_add_executable(basic
main.cpp
)
+
+set_target_properties(basic PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
target_link_libraries(basic PUBLIC
Qt::Core
Qt::Gui
@@ -30,6 +33,10 @@ target_link_libraries(basic PUBLIC
Qt::Quick
)
+if(TARGET Qt::Multimedia)
+ # See QTBUG-122607
+ target_link_libraries(basic PRIVATE Qt::Multimedia)
+endif()
# Resources:
set(demo_resource_files
@@ -51,21 +58,30 @@ qt6_add_resources(basic "demo"
${demo_resource_files}
)
-if(NOT QT_BUILD_SHARED_LIBS)
- target_link_libraries(basic PUBLIC
+if(QT_FEATURE_static)
+ target_link_libraries(basic PRIVATE
Qt::Svg
)
+ qt_import_plugins(basic
+ INCLUDE Qt::QVirtualKeyboardPlugin
+ )
+endif()
+
+if(ANDROID AND TARGET Qt::Multimedia)
+ qt_import_plugins(basic
+ INCLUDE Qt::QAndroidMediaPlugin
+ )
endif()
if(NOT QT_FEATURE_vkb_desktop)
target_compile_definitions(basic PUBLIC
- MAIN_QML="basic-b2qt.qml" # special case
+ MAIN_QML="basic-b2qt.qml"
)
endif()
if(QT_FEATURE_vkb_desktop)
target_compile_definitions(basic PUBLIC
- MAIN_QML="Basic.qml" # special case
+ MAIN_QML="Basic.qml"
)
endif()
diff --git a/examples/virtualkeyboard/basic/basic-b2qt.qml b/examples/virtualkeyboard/basic/basic-b2qt.qml
index 107e7a0c..d23c7464 100644
--- a/examples/virtualkeyboard/basic/basic-b2qt.qml
+++ b/examples/virtualkeyboard/basic/basic-b2qt.qml
@@ -1,38 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
-import QtQml 2.14
-import QtQuick.Window 2.2
-import QtQuick.VirtualKeyboard 2.2
-import QtQuick.VirtualKeyboard.Settings 2.2
+import QtQml
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
import "content"
Item {
@@ -41,15 +15,15 @@ Item {
Item {
id: appContainer
- width: Screen.orientation === Qt.LandscapeOrientation ? parent.width : parent.height
- height: Screen.orientation === Qt.LandscapeOrientation ? parent.height : parent.width
+ width: inLandscapeOrientation ? parent.width : parent.height
+ height: inLandscapeOrientation ? parent.height : parent.width
anchors.centerIn: parent
Basic {
id: virtualKeyboard
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
- anchors.bottom: parent.bottom
+ anchors.bottom: inputPanel.top
handwritingInputPanelActive: handwritingInputPanel.available && handwritingInputPanel.active
}
@@ -109,12 +83,10 @@ Item {
id: inputPanel
z: 89
y: yPositionWhenHidden
- x: Screen.orientation === Qt.LandscapeOrientation ? 0 : (parent.width-parent.height) / 2
- width: Screen.orientation === Qt.LandscapeOrientation ? parent.width : parent.height
-
- keyboard.shadowInputControl.height: (Screen.orientation === Qt.LandscapeOrientation ? parent.height : parent.width) - keyboard.height
+ x: 0
+ width: parent.width
- property real yPositionWhenHidden: Screen.orientation === Qt.LandscapeOrientation ? parent.height : parent.width + (parent.height-parent.width) / 2
+ property real yPositionWhenHidden: parent.height
states: State {
name: "visible"
@@ -162,9 +134,8 @@ Item {
}
- property bool inLandscapeOrientation: Screen.orientation === Qt.LandscapeOrientation
-
- Screen.orientationUpdateMask: Qt.LandscapeOrientation | Qt.PortraitOrientation
+ property bool inLandscapeOrientation: Screen.primaryOrientation === Qt.LandscapeOrientation ||
+ Screen.primaryOrientation === Qt.InvertedLandscapeOrientation
Binding {
target: appContainer.Window.window !== null ? appContainer.Window.window.contentItem : null
diff --git a/examples/virtualkeyboard/basic/content/AutoScroller.qml b/examples/virtualkeyboard/basic/content/AutoScroller.qml
index 9df74b7a..5f21dfd9 100644
--- a/examples/virtualkeyboard/basic/content/AutoScroller.qml
+++ b/examples/virtualkeyboard/basic/content/AutoScroller.qml
@@ -1,34 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
Item {
diff --git a/examples/virtualkeyboard/basic/content/HandwritingModeButton.qml b/examples/virtualkeyboard/basic/content/HandwritingModeButton.qml
index 6b2f9dbc..e4878847 100644
--- a/examples/virtualkeyboard/basic/content/HandwritingModeButton.qml
+++ b/examples/virtualkeyboard/basic/content/HandwritingModeButton.qml
@@ -1,33 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
+import QtQuick
Item {
id: handwritingModeButton
diff --git a/examples/virtualkeyboard/basic/content/TextArea.qml b/examples/virtualkeyboard/basic/content/TextArea.qml
index 899882ab..6ff3e1c3 100644
--- a/examples/virtualkeyboard/basic/content/TextArea.qml
+++ b/examples/virtualkeyboard/basic/content/TextArea.qml
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.10
-import QtQuick.Controls 2.3 as Controls
-import QtQuick.VirtualKeyboard 2.3
+import QtQuick
+import QtQuick.Controls as Controls
+import QtQuick.VirtualKeyboard
Controls.TextArea {
id: control
diff --git a/examples/virtualkeyboard/basic/content/TextField.qml b/examples/virtualkeyboard/basic/content/TextField.qml
index 6ce4f61c..7c398a82 100644
--- a/examples/virtualkeyboard/basic/content/TextField.qml
+++ b/examples/virtualkeyboard/basic/content/TextField.qml
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.10
-import QtQuick.Controls 2.3 as Controls
-import QtQuick.VirtualKeyboard 2.3
+import QtQuick
+import QtQuick.Controls as Controls
+import QtQuick.VirtualKeyboard
Controls.TextField {
id: control
diff --git a/examples/virtualkeyboard/basic/main.cpp b/examples/virtualkeyboard/basic/main.cpp
index 883808b8..e3d58bb6 100644
--- a/examples/virtualkeyboard/basic/main.cpp
+++ b/examples/virtualkeyboard/basic/main.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QQuickView>
#include <QGuiApplication>
diff --git a/licenseRule.json b/licenseRule.json
new file mode 100644
index 00000000..623171cd
--- /dev/null
+++ b/licenseRule.json
@@ -0,0 +1,89 @@
+[
+ {
+ "comment" : ["file_pattern_ending: strings matched against the end of a file name.",
+ "location keys: regular expression matched against the beginning of",
+ "the file path (relative to the git submodule root).",
+ "spdx: list of SPDX-License-Expression's allowed in the matching files.",
+ "-------------------------------------------------------",
+ "Files with the following endings are Build System licensed,",
+ "unless they are examples",
+ "Files with other endings can also be build system files"
+ ],
+ "file_pattern_ending" : ["CMakeLists.txt", ".cmake", ".pro", ".pri", ".prf",
+ "configure", "configure.bat", "cmake.in", "plist.in", "CMakeLists.txt.in"],
+ "location" : {
+ "" : {
+ "comment" : "Default",
+ "file type" : "build system",
+ "spdx" : ["BSD-3-Clause"]
+ },
+ "(.*)(examples/|snippets/)" : {
+ "comment" : "Example takes precedence",
+ "file type" : "examples and snippets",
+ "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+ }
+ }
+ },
+ {
+ "comments" : ["Files with the following endings are Tool licensed,",
+ "unless they are examples.",
+ "Files with other endings can also be tool files."],
+ "file_pattern_ending" : [".sh", ".py", ".pl", ".bat", ".ps1"],
+ "location" :{
+ "" : {
+ "comment" : "Default",
+ "file type" : "tools and utils",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0"]
+ },
+ "(.*)(examples/|snippets/)" : {
+ "comment" : "Example takes precedence",
+ "file type" : "examples and snippets",
+ "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+ }
+ }
+ },
+ {
+ "comment" : "Files with the following endings are Documentation licensed.",
+ "file_pattern_ending" : [".qdoc", ".qdocinc" , ".qdocconf", ".txt", "README", "qt_attribution.json"],
+ "location" :{
+ "" : {
+ "comment" : "",
+ "file type" : "documentation",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"]
+ }
+ }
+ },
+ {
+ "comment" : ["All other files",
+ "The licensing is defined only by the file location in the Qt module repository.",
+ "NO <file_pattern_ending> key for this case!",
+ "This needs to be the last entry of the file."],
+ "location" : {
+ "" : {
+ "comment" : "Default",
+ "file type" : "module and plugin",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+ },
+ "src/" : {
+ "comment" : "Default",
+ "file type" : "module and plugin",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+ },
+ "tests/" : {
+ "comment" : "Default",
+ "file type" : "test",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+ },
+ "(.*)(examples/|snippets/)" : {
+ "comment" : "Default",
+ "file type" : "examples and snippets",
+ "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+ },
+ "config\\.tests/" : {
+ "comment" : "Default",
+ "file type" : "build system",
+ "spdx" : ["BSD-3-Clause"]
+ }
+ }
+ }
+]
diff --git a/qt_cmdline.cmake b/qt_cmdline.cmake
new file mode 100644
index 00000000..300fd534
--- /dev/null
+++ b/qt_cmdline.cmake
@@ -0,0 +1 @@
+qt_commandline_subconfig(src/virtualkeyboard)
diff --git a/qtvirtualkeyboard.pro b/qtvirtualkeyboard.pro
deleted file mode 100644
index d3abe826..00000000
--- a/qtvirtualkeyboard.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-OTHER_FILES += README.md
-requires(qtHaveModule(quick))
-requires(qtHaveModule(svg))
-requires(!winrt)
-load(qt_parts)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2e4862cc..747defa4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,8 +1,12 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from src.pro.
add_subdirectory(virtualkeyboard)
-add_subdirectory(import)
add_subdirectory(settings)
+add_subdirectory(components)
+add_subdirectory(layouts)
add_subdirectory(styles)
add_subdirectory(plugin)
add_subdirectory(plugins)
diff --git a/src/components/AlternativeKeys.qml b/src/components/AlternativeKeys.qml
new file mode 100644
index 00000000..d3e5eae8
--- /dev/null
+++ b/src/components/AlternativeKeys.qml
@@ -0,0 +1,107 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+Item {
+ property bool active: listView.currentIndex != -1
+ property int highlightIndex: -1
+ property alias listView: listView
+ property int keyCode
+ property point origin
+ signal clicked
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
+
+ z: 1
+ visible: active
+ anchors.fill: parent
+
+ ListModel {
+ id: listModel
+ }
+
+ ListView {
+ id: listView
+ spacing: 0
+ model: listModel
+ delegate: keyboard.style.alternateKeysListDelegate
+ highlight: keyboard.style.alternateKeysListHighlight ? keyboard.style.alternateKeysListHighlight : defaultHighlight
+ highlightMoveDuration: 0
+ highlightResizeDuration: 0
+ keyNavigationWraps: true
+ orientation: ListView.Horizontal
+ height: keyboard.style ? keyboard.style.alternateKeysListItemHeight : 0
+ x: origin.x
+ y: keyboard.style ? origin.y - height - keyboard.style.alternateKeysListBottomMargin : 0
+ Component {
+ id: defaultHighlight
+ Item {}
+ }
+ }
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: keyboard.style.alternateKeysListBackground
+ anchors.fill: listView
+ z: -1
+ states: State {
+ name: "highlighted"
+ when: highlightIndex !== -1 && highlightIndex === listView.currentIndex &&
+ backgroundLoader.item !== null && backgroundLoader.item.hasOwnProperty("currentItemHighlight")
+ PropertyChanges {
+ target: backgroundLoader.item
+ currentItemHighlight: true
+ }
+ }
+ }
+
+ onClicked: {
+ if (active && listView.currentIndex >= 0 && listView.currentIndex < listView.model.count) {
+ var activeKey = listView.model.get(listView.currentIndex)
+ InputContext.inputEngine.virtualKeyClick(keyCode, activeKey.data,
+ InputContext.uppercase ? Qt.ShiftModifier : 0)
+ }
+ }
+
+ function open(key, originX, originY) {
+ keyCode = key.key
+ var alternativeKeys = key.effectiveAlternativeKeys
+ var displayAlternativeKeys = key.displayAlternativeKeys
+ if (alternativeKeys.length > 0 && displayAlternativeKeys.length === alternativeKeys.length) {
+ for (var i = 0; i < alternativeKeys.length; i++) {
+ listModel.append({
+ "text": InputContext.uppercase ? displayAlternativeKeys[i].toUpperCase() : displayAlternativeKeys[i],
+ "data": InputContext.uppercase ? alternativeKeys[i].toUpperCase() : alternativeKeys[i]
+ })
+ }
+ listView.width = keyboard.style.alternateKeysListItemWidth * listModel.count
+ listView.forceLayout()
+ highlightIndex = key.effectiveAlternativeKeysHighlightIndex
+ if (highlightIndex === -1) {
+ console.log("AlternativeKeys: active key \"" + key.text + "\" not found in alternativeKeys \"" + alternativeKeys + ".\"")
+ highlightIndex = 0
+ }
+ listView.currentIndex = highlightIndex
+ var currentItemOffset = (listView.currentIndex + 0.5) * keyboard.style.alternateKeysListItemWidth
+ origin = Qt.point(Math.min(Math.max(keyboard.style.alternateKeysListLeftMargin, originX - currentItemOffset), width - listView.width - keyboard.style.alternateKeysListRightMargin), originY)
+ if (backgroundLoader.item && backgroundLoader.item.hasOwnProperty("currentItemOffset")) {
+ backgroundLoader.item.currentItemOffset = currentItemOffset
+ }
+ }
+ return active
+ }
+
+ function move(mouseX) {
+ var newIndex = listView.indexAt(Math.max(1, Math.min(listView.width - 1, mapToItem(listView, mouseX, 0).x)), 1)
+ if (newIndex !== listView.currentIndex) {
+ listView.currentIndex = newIndex
+ }
+ }
+
+ function close() {
+ listView.currentIndex = -1
+ listModel.clear()
+ }
+}
diff --git a/src/components/BackspaceKey.qml b/src/components/BackspaceKey.qml
new file mode 100644
index 00000000..cb018be0
--- /dev/null
+++ b/src/components/BackspaceKey.qml
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype BackspaceKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits BaseKey
+
+ \brief Backspace key for keyboard layouts.
+
+ Sends a backspace key for input method processing.
+ This key is repeatable.
+*/
+
+BaseKey {
+ key: Qt.Key_Backspace
+ keyType: QtVirtualKeyboard.KeyType.BackspaceKey
+ repeat: true
+ functionKey: true
+ highlighted: true
+ keyPanelDelegate: keyboard.style ? keyboard.style.backspaceKeyPanel : undefined
+}
diff --git a/src/components/BaseKey.qml b/src/components/BaseKey.qml
new file mode 100644
index 00000000..1fb2dff4
--- /dev/null
+++ b/src/components/BaseKey.qml
@@ -0,0 +1,234 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype BaseKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \inherits Item
+
+ \brief Common parent for all key types.
+
+ BaseKey is a common type for all keys in keyboard layout.
+
+ This type should not be used directly in the layouts. The specialized
+ key types, such as Key or EnterKey should be used instead.
+*/
+
+Item {
+ id: keyItem
+
+ /*! \since QtQuick.VirtualKeyboard 6.1
+
+ \l Key type for the specialized key. Possible values are defined by the
+ {QtVirtualKeyboard::KeyType}{key type enumeration}.
+
+ For example, \l SpaceKey sets this value to \e QtVirtualKeyboard.KeyType.SpaceKey.
+ */
+ property int keyType: QtVirtualKeyboard.KeyType.BaseKey
+
+ /*! Sets the key weight value which determines the relative size of the key.
+
+ Use this property to change the key size in the layout.
+
+ The default value is inherited from the parent element
+ of the key in the layout hierarchy.
+ */
+ property real weight: parent.keyWeight
+
+ /*! Sets the key text for input method processing.
+
+ In most cases, this is the Unicode representation of the key code.
+
+ The default value is an empty string.
+ */
+ property string text: ""
+
+ /*! Sets the display text.
+
+ This string is rendered in the keyboard layout.
+
+ The default value is the key text.
+ */
+ property string displayText: text
+
+ /*! \since QtQuick.VirtualKeyboard 2.0
+
+ Sets the small text rendered in the corner of the key.
+
+ The default value based on the default item in the effective alternative keys.
+ */
+ property string smallText: effectiveAlternativeKeys && effectiveAlternativeKeysHighlightIndex !== -1 ? effectiveAlternativeKeys[effectiveAlternativeKeysHighlightIndex] : ""
+
+ /*! \since QtQuick.VirtualKeyboard 2.0
+
+ Sets the visibility of small text.
+
+ The default value is inherited from the parent.
+ */
+ property bool smallTextVisible: parent.smallTextVisible
+
+ /*! Sets the list of alternative keys.
+
+ This property can be set to a string, or a list of strings. If the value is
+ a string, the alternative keys are presented as individual characters of
+ that string. If the value is a list of strings, the list is used instead.
+
+ The alternative keys are presented to the user by pressing and holding a key
+ with this property set.
+
+ \note If the alternative keys contains the key \c text, it will be filtered from
+ the \c effectiveAlternativeKeys and its position will be used as an indicator
+ for the highlighted item instead.
+
+ The default is empty list.
+ */
+ property var alternativeKeys: []
+
+ /*! \since QtQuick.VirtualKeyboard 2.0
+
+ This property contains the effective alternative keys presented to user.
+
+ The list is contains the items in the \c alternativeKeys excluding the \c text
+ item.
+ */
+ readonly property var effectiveAlternativeKeys: {
+ var textIndex = alternativeKeys.indexOf(text)
+ if (textIndex == -1)
+ return alternativeKeys
+ return alternativeKeys.slice(0, textIndex).concat(alternativeKeys.slice(textIndex + 1))
+ }
+
+ /*! \since QtQuick.VirtualKeyboard 2.0
+
+ This property contains the index of highlighted item in the \c effectiveAlternativeKeys.
+
+ The index is calculated from the index of the key \c text in the \c alternativeKeys.
+
+ For example, if the alternative keys contains "çcċčć" and the key \c text is "c",
+ this index will become 1 and the effective alternative keys presented to user will
+ be "ç[ċ]čć".
+ */
+ readonly property int effectiveAlternativeKeysHighlightIndex: {
+ var index = alternativeKeys.indexOf(text)
+ return index > 0 && (index + 1) == alternativeKeys.length ? index - 1 : index
+ }
+
+ /*! \since QtQuick.VirtualKeyboard 6.2
+
+ This property allows overriding the list of key strings presented to the user in the
+ alternative keys view.
+ */
+ property var displayAlternativeKeys: effectiveAlternativeKeys
+
+ /*! Sets the key code for input method processing.
+
+ The default is Qt.Key_unknown.
+ */
+ property int key: Qt.Key_unknown
+
+ /*! \since QtQuick.VirtualKeyboard 1.3
+
+ This property controls whether the key emits key events for input
+ method processing. When true, the key events are disabled.
+
+ By default, the key event is emitted if the \e key is not unknown
+ or the \e text is not empty.
+ */
+ property bool noKeyEvent: key === Qt.Key_unknown && text.length === 0
+
+ /*! This property holds the active status of the key.
+
+ This property is automatically set to true when the key is pressed.
+ */
+ property bool active: false
+
+ /*! \since QtQuick.VirtualKeyboard 1.3
+
+ Disables key modifiers on the emitted key.
+
+ The default is false.
+ */
+ property bool noModifier: false
+
+ /*! Sets the key repeat attribute.
+
+ If the repeat is enabled, the key will repeat the input events while held down.
+ The repeat should not be used if alternativeKeys is also set.
+
+ The default is false.
+ */
+ property bool repeat: false
+
+ /*! Sets the highlighted status of the key.
+
+ The default is false.
+ */
+ property bool highlighted: false
+
+ /*! Sets the function key attribute.
+
+ The default is false.
+ */
+ property bool functionKey: false
+
+ /*! Sets the show preview attribute.
+
+ By default, the character preview popup is not shown for function keys.
+ */
+ property bool showPreview: enabled && !functionKey && !keyboard.navigationModeActive
+
+ /*! This property holds the pressed status of the key.
+
+ The pressed status can only be true if the key is both enabled and active.
+ When the key state becomes pressed, it triggers a key down event for the
+ input engine. A key up event is triggered when the key is released.
+ */
+ property bool pressed: enabled && active
+
+ /*! This property holds the uppercase status of the key.
+
+ By default, this property reflects the uppercase status of the keyboard.
+ */
+ property bool uppercased: InputContext.uppercase && !noModifier
+
+ /*! Sets the key panel delegate for the key.
+
+ This property is essential for key decoration. Without a key panel delegate,
+ the key is invisible. This property should be assigned in the inherited key type.
+ */
+ property alias keyPanelDelegate: keyPanel.sourceComponent
+
+ /*!
+ \since QtQuick.VirtualKeyboard 1.1
+
+ This property holds the sound effect to be played on key press.
+
+ This property is read-only since the sound effects are defined in the keyboard style.
+ */
+ readonly property url soundEffect: keyPanel.item ? keyPanel.item.soundEffect : ""
+
+ onSoundEffectChanged: keyboard.soundEffect.register(soundEffect)
+
+ Layout.minimumWidth: keyPanel.implicitWidth
+ Layout.minimumHeight: keyPanel.implicitHeight
+ Layout.preferredWidth: weight
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ Loader {
+ id: keyPanel
+ anchors.fill: parent
+ onLoaded: keyPanel.item.control = keyItem
+ }
+
+ /*! This signal is triggered when the key is pressed, allowing custom processing
+ of key.
+ */
+ signal clicked
+}
diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt
new file mode 100644
index 00000000..4510bbcd
--- /dev/null
+++ b/src/components/CMakeLists.txt
@@ -0,0 +1,61 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## VirtualKeyboard.Components Module:
+#####################################################################
+
+set(qml_files
+ AlternativeKeys.qml
+ BackspaceKey.qml
+ BaseKey.qml
+ ChangeLanguageKey.qml
+ CharacterPreviewBubble.qml
+ EnterKey.qml
+ FillerKey.qml
+ FlickKey.qml
+ FunctionPopupList.qml
+ HandwritingModeKey.qml
+ HideKeyboardKey.qml
+ InputModeKey.qml
+ Key.qml
+ Keyboard.qml
+ KeyboardColumn.qml
+ KeyboardLayout.qml
+ KeyboardLayoutLoader.qml
+ KeyboardRow.qml
+ ModeKey.qml
+ MultiSoundEffect.qml
+ MultitapInputMethod.qml
+ NumberKey.qml
+ PopupList.qml
+ SelectionControl.qml
+ ShadowInputControl.qml
+ ShiftKey.qml
+ SpaceKey.qml
+ SymbolModeKey.qml
+ TraceInputArea.qml
+ TraceInputKey.qml
+ WordCandidatePopupList.qml
+)
+
+qt_internal_add_qml_module(qtvkbcomponentsplugin
+ URI "QtQuick.VirtualKeyboard.Components"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2 1
+ PLUGIN_TARGET qtvkbcomponentsplugin
+ DEPENDENCIES
+ QtQuick/auto
+ QtQuick.Layouts/auto
+ QtQuick.VirtualKeyboard.Settings/auto
+ QML_FILES
+ ${qml_files}
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::VirtualKeyboard
+ Qt::VirtualKeyboardSettings
+ NO_GENERATE_CPP_EXPORTS
+)
diff --git a/src/components/ChangeLanguageKey.qml b/src/components/ChangeLanguageKey.qml
new file mode 100644
index 00000000..ad14bbe4
--- /dev/null
+++ b/src/components/ChangeLanguageKey.qml
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+/*!
+ \qmltype ChangeLanguageKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits BaseKey
+
+ \brief Change language key for keyboard layouts.
+
+ This key changes the current input language in the list of supported
+ languages. The key has two function modes:
+
+ \list
+ \li Popup mode
+ \li Toggle mode
+ \endlist
+
+ The popup mode is enabled by the \l {KeyboardStyle::languagePopupListEnabled} property.
+ If enabled, a key press will open a popup list with available languages. Otherwise
+ it will cycle to the next available input language.
+*/
+
+BaseKey {
+ /*! If this property is true, the input language is only
+ changed between the languages providing custom layout.
+
+ For example, if only the English and Arabic languages
+ provide digits layout, then other locales using the
+ shared default layout are ignored.
+
+ The default is false.
+ */
+ property bool customLayoutsOnly: false
+
+ id: changeLanguageKey
+ keyType: QtVirtualKeyboard.KeyType.ChangeLanguageKey
+ objectName: "changeLanguageKey"
+ functionKey: true
+ highlighted: true
+ displayText: keyboard.locale.split("_")[0]
+ keyPanelDelegate: keyboard.style ? keyboard.style.languageKeyPanel : undefined
+ onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.ChangeLanguage, customLayoutsOnly)
+ enabled: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.KeyboardFunction.ChangeLanguage, customLayoutsOnly)
+ visible: VirtualKeyboardSettings.visibleFunctionKeys & QtVirtualKeyboard.KeyboardFunctionKeys.Language
+}
diff --git a/src/components/CharacterPreviewBubble.qml b/src/components/CharacterPreviewBubble.qml
new file mode 100644
index 00000000..8f09d465
--- /dev/null
+++ b/src/components/CharacterPreviewBubble.qml
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+Item {
+ property bool active
+ property Item activeKey: keyboard.activeKey
+
+ visible: active && activeKey !== undefined && activeKey !== null && activeKey.showPreview
+ z: 1
+
+ Loader {
+ id: characterPreview
+ anchors.fill: parent
+ sourceComponent: keyboard.style.characterPreviewDelegate
+ }
+
+ onActiveKeyChanged: {
+ if (characterPreview.item !== null) {
+ if (!activeKey) {
+ characterPreview.item.text = ""
+ return
+ }
+
+ characterPreview.item.text = Qt.binding(function() {
+ if (!activeKey)
+ return ""
+ var displayText = (activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) ? activeKey.text : activeKey.displayText
+ return InputContext.uppercase ? displayText.toUpperCase() : displayText
+ })
+ if (activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) {
+ if (characterPreview.item.hasOwnProperty("flickLeft")) {
+ characterPreview.item.flickLeft = activeKey.flickLeft
+ characterPreview.item.flickRight = activeKey.flickRight
+ characterPreview.item.flickTop = activeKey.flickTop
+ characterPreview.item.flickBottom = activeKey.flickBottom
+ }
+ } else {
+ if (characterPreview.item.hasOwnProperty("flickLeft")) {
+ characterPreview.item.flickLeft = ""
+ characterPreview.item.flickRight = ""
+ characterPreview.item.flickTop = ""
+ characterPreview.item.flickBottom = ""
+ }
+ }
+ width = activeKey.width
+ height = activeKey.height
+ var position = keyboard.mapFromItem(activeKey, 0, 0)
+ x = position.x
+ y = position.y - height - keyboard.style.characterPreviewMargin
+ }
+ }
+}
diff --git a/src/components/EnterKey.qml b/src/components/EnterKey.qml
new file mode 100644
index 00000000..39ef8599
--- /dev/null
+++ b/src/components/EnterKey.qml
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype EnterKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits BaseKey
+
+ \brief Enter key for keyboard layouts.
+
+ Sends an enter key for input method processing.
+*/
+
+BaseKey {
+ /*! This property holds the action id for the enter key.
+
+ */
+ readonly property int actionId: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.actionId : EnterKeyAction.None
+
+ keyType: QtVirtualKeyboard.KeyType.EnterKey
+ text: "\n"
+ displayText: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.label : ""
+ key: Qt.Key_Return
+ showPreview: false
+ highlighted: true
+ enabled: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.enabled : true
+ keyPanelDelegate: keyboard.style ? keyboard.style.enterKeyPanel : undefined
+}
diff --git a/src/components/FillerKey.qml b/src/components/FillerKey.qml
new file mode 100644
index 00000000..54c400a5
--- /dev/null
+++ b/src/components/FillerKey.qml
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype FillerKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits BaseKey
+
+ \brief Filler key for keyboard layouts.
+
+ This key can be used as a filler in the keyboard layout.
+*/
+
+BaseKey {
+ keyType: QtVirtualKeyboard.KeyType.FillerKey
+ showPreview: false
+}
diff --git a/src/components/FlickKey.qml b/src/components/FlickKey.qml
new file mode 100644
index 00000000..e9afb492
--- /dev/null
+++ b/src/components/FlickKey.qml
@@ -0,0 +1,96 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype FlickKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Key
+ \since QtQuick.VirtualKeyboard 6.1
+
+ \brief Flick key for keyboard layouts.
+
+ Allows to enter an alternative character in a four-way gesture.
+ Characters are taken from the alternate keys starting with the
+ key at index \c 0 (excluding the main key text) and the positions
+ are filled in the following order: left, top, bottom, right.
+*/
+
+Key {
+
+ property int __key
+ property string __text
+ property point pt1
+ readonly property real __centerRadius: width * 0.4
+ readonly property var flickKeys: {
+ var keys = InputContext.uppercase ? alternativeKeys.toUpperCase() : alternativeKeys.toLowerCase()
+ var textIndex = keys.indexOf(InputContext.uppercase ? __text.toUpperCase() : __text.toLowerCase())
+ if (textIndex === -1)
+ return keys
+ return keys.slice(0, textIndex).concat(keys.slice(textIndex + 1))
+ }
+ property string flickLeft: flickKeys.length > 0 ? flickKeys[0] : ""
+ property string flickTop: flickKeys.length > 2 ? flickKeys[1] : ""
+ property string flickBottom: flickKeys.length > 3 ? flickKeys[3] : (flickKeys.length > 2 ? flickKeys[2] : "")
+ property string flickRight: flickKeys.length > 3 ? flickKeys[2] : (flickKeys.length === 2 ? flickKeys[1] : "")
+
+ keyType: QtVirtualKeyboard.KeyType.FlickKey
+
+ Component.onCompleted: {
+ __key = key
+ __text = text
+ }
+
+ onActiveChanged: {
+ key = __key
+ text = __text
+ }
+
+ function __angle(pt2) {
+ var dx = pt2.x - pt1.x
+ var dy = pt2.y - pt1.y
+ var theta = Math.atan2(-dy, dx) * 360 / (2 * Math.PI)
+ var theta_normalized = theta < 0 ? theta + 360 : theta
+ return theta_normalized >= 360 ? 0 : theta_normalized
+ }
+
+ function __distance(pt2) {
+ var dx = pt2.x - pt1.x
+ dx = dx * dx
+ var dy = pt2.y - pt1.y
+ dy = dy * dy
+ return Math.sqrt(dx + dy)
+ }
+
+ function press(x, y) {
+ pt1 = Qt.point(x, y)
+ }
+
+ function update(x, y) {
+ var pt = Qt.point(x, y)
+ var distance = __distance(pt)
+ if (distance < __centerRadius) {
+ return
+ }
+ var currentText
+ var angle = __angle(pt)
+ if (angle < 45 || angle > 315) {
+ currentText = flickRight
+ } else if (angle < 135) {
+ currentText = flickTop
+ } else if (angle < 225) {
+ currentText = flickLeft
+ } else {
+ currentText = flickBottom
+ }
+ if (currentText.length === 1 && text !== currentText) {
+ key = currentText.toUpperCase().charCodeAt(0)
+ text = currentText
+ }
+ }
+}
diff --git a/src/components/FunctionPopupList.qml b/src/components/FunctionPopupList.qml
new file mode 100644
index 00000000..ed617656
--- /dev/null
+++ b/src/components/FunctionPopupList.qml
@@ -0,0 +1,110 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+Item {
+ property bool active
+ property alias listView: listView
+ property point origin
+ signal clicked
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
+
+ z: 1
+ visible: active
+ anchors.fill: parent
+
+ ListModel {
+ id: listModel
+ }
+
+ ListView {
+ id: listView
+ spacing: 0
+ model: listModel
+ currentIndex: -1
+ delegate: keyboard.style.functionPopupListDelegate
+ highlight: keyboard.style.functionPopupListHighlight ? keyboard.style.functionPopupListHighlight : defaultHighlight
+ highlightMoveDuration: 0
+ highlightResizeDuration: 0
+ keyNavigationWraps: true
+ orientation: ListView.Horizontal
+ width: contentItem.childrenRect.width
+ height: contentItem.childrenRect.height
+ x: {
+ var result = origin.x
+ if (count > 0) {
+ const item = itemAtIndex(0)
+ if (item) {
+ result -= Math.round(item.width / 2)
+ }
+ }
+ return result
+ }
+ y: origin.y - height
+ Component {
+ id: defaultHighlight
+ Item {}
+ }
+ }
+
+ Loader {
+ id: backgroundLoader
+ sourceComponent: keyboard.style.functionPopupListBackground
+ anchors.fill: listView
+ z: -1
+ Binding {
+ target: backgroundLoader.item
+ property: "view"
+ value: listView
+ when: backgroundLoader.item && backgroundLoader.item.hasOwnProperty("view")
+ }
+ }
+
+ onClicked: {
+ if (active && listView.currentIndex >= 0 && listView.currentIndex < listView.model.count) {
+ const listElement = listView.model.get(listView.currentIndex)
+ keyboard.doKeyboardFunction(listElement.keyboardFunction)
+ }
+ }
+
+ function open(key, originX, originY) {
+ listModel.clear()
+ for (const keyboardFunction of [
+ QtVirtualKeyboard.KeyboardFunction.HideInputPanel,
+ QtVirtualKeyboard.KeyboardFunction.ChangeLanguage,
+ QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode,
+ ]) {
+ const functionKey = InputContext.priv.keyboardFunctionKey(keyboardFunction)
+ if (keyboard.isKeyboardFunctionAvailable(keyboardFunction) &&
+ !(VirtualKeyboardSettings.visibleFunctionKeys & functionKey)) {
+ const listElement = {
+ keyboardFunction: keyboardFunction
+ }
+ listModel.append(listElement)
+ }
+ }
+ listView.currentIndex = (listModel.count > 0) ? 0 : -1
+ origin = Qt.binding(function() {
+ return Qt.point(Math.min(Math.max(0, originX), width - listView.width), originY)
+ })
+ active = listView.currentIndex !== -1
+ return active
+ }
+
+ function move(pt) {
+ var listPt = mapToItem(listView, pt.x, pt.y)
+ var newIndex = listView.indexAt(listPt.x, Math.max(1, Math.min(listView.height - 1, listPt.y)))
+ if (newIndex !== listView.currentIndex) {
+ listView.currentIndex = newIndex
+ }
+ }
+
+ function close() {
+ listView.currentIndex = -1
+ active = false
+ }
+}
diff --git a/src/components/HandwritingModeKey.qml b/src/components/HandwritingModeKey.qml
new file mode 100644
index 00000000..520f431d
--- /dev/null
+++ b/src/components/HandwritingModeKey.qml
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype HandwritingModeKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Key
+ \since QtQuick.VirtualKeyboard 2.0
+
+ \brief Hand writing mode key for keyboard layouts.
+
+ This key toggles between the handwriting mode layout and the main layout.
+
+ The key is automatically hidden from the keyboard layout if handwriting support
+ is not enabled for the virtual keyboard.
+*/
+
+Key {
+ keyType: QtVirtualKeyboard.KeyType.HandwritingModeKey
+ key: Qt.Key_Context2
+ displayText: "HWR"
+ functionKey: true
+ highlighted: true
+ visible: keyboard.isKeyboardFunctionAvailable(QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode)
+ onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode)
+ keyPanelDelegate: keyboard.style ? keyboard.style.handwritingKeyPanel : undefined
+}
diff --git a/src/components/HideKeyboardKey.qml b/src/components/HideKeyboardKey.qml
new file mode 100644
index 00000000..bbf16b95
--- /dev/null
+++ b/src/components/HideKeyboardKey.qml
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+/*!
+ \qmltype HideKeyboardKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits BaseKey
+
+ \brief Hide keyboard key for keyboard layouts.
+
+ This key hides the keyboard from the user when pressed.
+*/
+
+BaseKey {
+ keyType: QtVirtualKeyboard.KeyType.HideKeyboardKey
+ functionKey: true
+ highlighted: true
+ onClicked: keyboard.doKeyboardFunction(QtVirtualKeyboard.KeyboardFunction.HideInputPanel)
+ keyPanelDelegate: keyboard.style ? keyboard.style.hideKeyPanel : undefined
+ visible: VirtualKeyboardSettings.visibleFunctionKeys & QtVirtualKeyboard.KeyboardFunctionKeys.Hide
+}
diff --git a/src/components/InputModeKey.qml b/src/components/InputModeKey.qml
new file mode 100644
index 00000000..d51c8429
--- /dev/null
+++ b/src/components/InputModeKey.qml
@@ -0,0 +1,103 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype InputModeKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Key
+ \since QtQuick.VirtualKeyboard 2.3
+
+ \brief Input mode key for keyboard layouts.
+
+ This key toggles between available \l {QVirtualKeyboardInputEngine::inputModes} {InputEngine.inputModes}.
+*/
+
+Key {
+ keyType: QtVirtualKeyboard.KeyType.InputModeKey
+ key: Qt.Key_Mode_switch
+ noKeyEvent: true
+ functionKey: true
+ highlighted: true
+ text: InputContext.inputEngine.inputMode < inputModeNameList.length ?
+ inputModeNameList[InputContext.inputEngine.inputMode] : "ABC"
+ onClicked: InputContext.inputEngine.inputMode = __nextInputMode(InputContext.inputEngine.inputMode)
+ keyPanelDelegate: keyboard.style ? keyboard.style.symbolKeyPanel : undefined
+ enabled: inputModeCount > 1
+
+ /*!
+ List of input mode names.
+
+ The default list contains all known input modes for \l {QVirtualKeyboardInputEngine::inputMode} {InputEngine.inputMode}.
+ */
+ property var inputModeNameList: [
+ "ABC", // InputEngine.InputMode.Latin
+ "123", // InputEngine.InputMode.Numeric
+ "123", // InputEngine.InputMode.Dialable
+ "拼音", // InputEngine.InputMode.Pinyin
+ "倉頡", // InputEngine.InputMode.Cangjie
+ "注音", // InputEngine.InputMode.Zhuyin
+ "한글", // InputEngine.InputMode.Hangul
+ "かな", // InputEngine.InputMode.Hiragana
+ "カナ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ "ΑΒΓ", // InputEngine.InputMode.Greek
+ "АБВ", // InputEngine.InputMode.Cyrillic
+ "\u0623\u200C\u0628\u200C\u062C", // InputEngine.InputMode.Arabic
+ "\u05D0\u05D1\u05D2", // InputEngine.InputMode.Hebrew
+ "中文", // InputEngine.InputMode.ChineseHandwriting
+ "日本語", // InputEngine.InputMode.JapaneseHandwriting
+ "한국어", // InputEngine.InputMode.KoreanHandwriting
+ "กขค", // InputEngine.InputMode.Thai
+ "笔画", // InputEngine.InputMode.Stroke
+ "ABC", // InputEngine.InputMode.Romaji
+ ]
+
+ /*!
+ List of input modes to toggle.
+
+ This property allows to define a custom list of input modes to
+ toggle.
+
+ The default list contains all the available input modes.
+ */
+ property var inputModes: InputContext.inputEngine.inputModes
+
+ /*!
+ This read-only property reflects the actual number of input modes
+ the user can cycle through this key.
+ */
+ readonly property int inputModeCount: __inputModes !== undefined ? __inputModes.length : 0
+
+ property var __inputModes: __filterInputModes([].concat(InputContext.inputEngine.inputModes), inputModes)
+
+ onInputModesChanged: {
+ // Check that the current input mode is included in our list
+ if (keyboard.active && InputContext.inputEngine.inputMode !== -1 &&
+ __inputModes !== undefined && __inputModes.length > 0 &&
+ __inputModes.indexOf(InputContext.inputEngine.inputMode) === -1)
+ InputContext.inputEngine.inputMode = __inputModes[0]
+ }
+
+ function __nextInputMode(inputMode) {
+ if (!enabled)
+ return inputMode
+ var inputModeIndex = __inputModes.indexOf(inputMode) + 1
+ if (inputModeIndex >= __inputModes.length)
+ inputModeIndex = 0
+ return __inputModes[inputModeIndex]
+ }
+
+ function __filterInputModes(inputModes, filter) {
+ for (var i = 0; i < inputModes.length; i++) {
+ if (filter.indexOf(inputModes[i]) === -1)
+ inputModes.splice(i, 1)
+ }
+ return inputModes
+ }
+}
diff --git a/src/components/Key.qml b/src/components/Key.qml
new file mode 100644
index 00000000..7005a30e
--- /dev/null
+++ b/src/components/Key.qml
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype Key
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits BaseKey
+
+ \brief Regular character key for keyboard layouts.
+
+ This key emits the key code and key text for input method processing.
+*/
+
+BaseKey {
+ id: keyItem
+ keyType: QtVirtualKeyboard.KeyType.Key
+ key: !functionKey && text.length > 0 ? text.toUpperCase().charCodeAt(0) : Qt.Key_unknown
+ keyPanelDelegate: keyboard.style ? keyboard.style.keyPanel : undefined
+}
diff --git a/src/components/Keyboard.qml b/src/components/Keyboard.qml
new file mode 100644
index 00000000..45ca8dca
--- /dev/null
+++ b/src/components/Keyboard.qml
@@ -0,0 +1,1828 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
+import QtQml
+import QtQuick.Layouts
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Styles
+import QtQuick.VirtualKeyboard.Settings
+import QtQuick.VirtualKeyboard.Plugins
+import Qt.labs.folderlistmodel
+
+Item {
+ id: keyboard
+ objectName: "keyboard"
+
+ property alias style: styleLoader.item
+ property alias wordCandidateView: wordCandidateView
+ property alias shadowInputControl: shadowInputControl
+ property alias alternativeKeys: alternativeKeys
+ property alias characterPreview: characterPreview
+ property alias wordCandidateContextMenu: wordCandidateContextMenu
+ property alias fullScreenModeSelectionControl: fullScreenModeSelectionControl
+ property alias naviationHighlight: naviationHighlight
+ property alias keyboardInputArea: keyboardInputArea
+ property Item activeKey: null
+ property TouchPoint activeTouchPoint
+ property int localeIndex: -1
+ property var availableLocaleIndices: []
+ property var availableCustomLocaleIndices: []
+ property string locale: localeIndex >= 0 && localeIndex < layoutsModel.count ? layoutsModel.get(localeIndex, "fileName") : ""
+ property string inputLocale
+ property int defaultLocaleIndex: -1
+ readonly property bool latinOnly: InputContext.inputMethodHints & (Qt.ImhLatinOnly | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)
+ readonly property bool preferNumbers: InputContext.inputMethodHints & Qt.ImhPreferNumbers
+ readonly property bool dialableCharactersOnly: InputContext.inputMethodHints & Qt.ImhDialableCharactersOnly
+ readonly property bool formattedNumbersOnly: InputContext.inputMethodHints & Qt.ImhFormattedNumbersOnly
+ readonly property bool digitsOnly: InputContext.inputMethodHints & Qt.ImhDigitsOnly
+ property string layout
+ property string layoutType: {
+ if (keyboard.handwritingMode) return "handwriting"
+ if (keyboard.dialableCharactersOnly) return "dialpad"
+ if (keyboard.formattedNumbersOnly) return "numbers"
+ if (keyboard.digitsOnly) return "digits"
+ if (keyboard.symbolMode) return "symbols"
+ return "main"
+ }
+ property bool active: Qt.inputMethod.visible
+ property bool handwritingMode
+ property bool fullScreenHandwritingMode
+ property bool symbolMode
+ property bool fullScreenMode: VirtualKeyboardSettings.fullScreenMode
+ property var defaultInputMethod: initDefaultInputMethod()
+ property var plainInputMethod: PlainInputMethod {}
+ property var customInputMethod: null
+ property var customInputMethodSharedLayouts: []
+ property int defaultInputMode: InputEngine.InputMode.Latin
+ property bool inputMethodNeedsReset: true
+ property bool inputModeNeedsReset: true
+ property bool navigationModeActive: false
+ readonly property bool languagePopupListActive: languagePopupList.enabled
+ property alias soundEffect: soundEffect
+ property alias keyboardLayoutLoader: keyboardLayoutLoader
+ property real screenHeight: parent.parent ? parent.parent.height : Screen.height
+ property bool noAnimations
+ property int pressAndHoldDelay: 500
+
+ function initDefaultInputMethod() {
+ try {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; DefaultInputMethod {}', keyboard, "defaultInputMethod")
+ } catch (e) { }
+ return plainInputMethod
+ }
+
+ Component.onCompleted: InputContext.priv.registerInputPanel(parent)
+
+ width: keyboardBackground.width
+ height: keyboardBackground.height
+ onActiveChanged: {
+ hideLanguagePopup()
+ if (active && symbolMode && !preferNumbers)
+ symbolMode = false
+ keyboardInputArea.reset()
+ wordCandidateViewAutoHideTimer.stop()
+ }
+ onActiveKeyChanged: {
+ if (InputContext.inputEngine.activeKey !== Qt.Key_unknown)
+ InputContext.inputEngine.virtualKeyCancel()
+ }
+ Connections {
+ target: VirtualKeyboardSettings
+ function onLocaleChanged() {
+ updateDefaultLocale()
+ localeIndex = defaultLocaleIndex
+ }
+ function onActiveLocalesChanged() {
+ updateDefaultLocale()
+ if (!isValidLocale(localeIndex) || VirtualKeyboardSettings.locale)
+ localeIndex = defaultLocaleIndex
+ }
+ function onDefaultInputMethodDisabledChanged() {
+ updateInputMethod()
+ }
+ }
+ onAvailableLocaleIndicesChanged: hideLanguagePopup()
+ onAvailableCustomLocaleIndicesChanged: hideLanguagePopup()
+ onLocaleChanged: {
+ hideLanguagePopup()
+ inputMethodNeedsReset = true
+ inputModeNeedsReset = true
+ updateLayout()
+ }
+ onInputLocaleChanged: {
+ if (Qt.locale(inputLocale).name !== "C")
+ InputContext.priv.locale = inputLocale
+ }
+ onLayoutChanged: hideLanguagePopup()
+ onLayoutTypeChanged: {
+ updateAvailableLocaleIndices()
+ updateLayout()
+ }
+ onLatinOnlyChanged: inputModeNeedsReset = true
+ onPreferNumbersChanged: {
+ keyboard.symbolMode = !keyboard.handwritingMode && preferNumbers
+ inputModeNeedsReset = true
+ }
+ onDialableCharactersOnlyChanged: inputModeNeedsReset = true
+ onFormattedNumbersOnlyChanged: inputModeNeedsReset = true
+ onDigitsOnlyChanged: inputModeNeedsReset = true
+ onHandwritingModeChanged: if (!keyboard.handwritingMode) keyboard.fullScreenHandwritingMode = false
+ onFullScreenHandwritingModeChanged: if (keyboard.fullScreenHandwritingMode) keyboard.handwritingMode = true
+ onLanguagePopupListActiveChanged: {
+ if (languagePopupListActive && navigationModeActive)
+ keyboardInputArea.initialKey = null
+ }
+
+ Connections {
+ target: InputContext
+ function onInputMethodHintsChanged() {
+ if (InputContext.priv.focus)
+ updateInputMethod()
+ }
+ }
+ Connections {
+ target: InputContext.priv
+ function onInputItemChanged() {
+ keyboard.hideLanguagePopup()
+ if (active && symbolMode && !preferNumbers)
+ symbolMode = false
+ }
+ function onFocusChanged() {
+ if (InputContext.priv.focus)
+ updateInputMethod()
+ }
+ function onNavigationKeyPressed(key, isAutoRepeat) {
+ var initialKey
+ var direction = wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ? 1 : -1
+ switch (key) {
+ case Qt.Key_Left:
+ if (keyboard.navigationModeActive && !keyboardInputArea.initialKey) {
+ if (languagePopupListActive) {
+ hideLanguagePopup()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ break
+ }
+ if (alternativeKeys.active) {
+ if (alternativeKeys.listView.currentIndex > 0) {
+ alternativeKeys.listView.decrementCurrentIndex()
+ } else {
+ alternativeKeys.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ break
+ }
+ if (functionPopupList.active) {
+ if (functionPopupList.listView.currentIndex > 0) {
+ functionPopupList.listView.decrementCurrentIndex()
+ } else {
+ functionPopupList.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ break
+ }
+ if (wordCandidateContextMenu.active) {
+ hideWordCandidateContextMenu()
+ break
+ }
+ if (wordCandidateView.count) {
+ if (wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight &&
+ wordCandidateView.currentIndex > 0) {
+ wordCandidateView.decrementCurrentIndex()
+ } else if (wordCandidateView.effectiveLayoutDirection == Qt.RightToLeft &&
+ wordCandidateView.currentIndex + 1 < wordCandidateView.count) {
+ wordCandidateView.incrementCurrentIndex()
+ } else {
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ initialKey = keyboardInputArea.initialKey
+ while (keyboardInputArea.navigateToNextKey(0, 1 * direction, false))
+ initialKey = keyboardInputArea.initialKey
+ while (keyboardInputArea.navigateToNextKey(1, 0, false))
+ initialKey = keyboardInputArea.initialKey
+ keyboardInputArea.initialKey = initialKey
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ break
+ }
+ }
+ initialKey = keyboardInputArea.initialKey
+ if (!keyboardInputArea.navigateToNextKey(-1 * direction, 0, false)) {
+ keyboardInputArea.initialKey = initialKey
+ if (!keyboardInputArea.navigateToNextKey(0, -1 * direction, false)) {
+ if (wordCandidateView.count) {
+ wordCandidateView.currentIndex =
+ wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ?
+ (wordCandidateView.count - 1) : 0
+ break
+ }
+ keyboardInputArea.initialKey = initialKey
+ keyboardInputArea.navigateToNextKey(0, -1 * direction, true)
+ }
+ keyboardInputArea.navigateToNextKey(-1 * direction, 0, true)
+ }
+ break
+ case Qt.Key_Up:
+ if (languagePopupListActive) {
+ if (languagePopupList.currentIndex > 0) {
+ languagePopupList.decrementCurrentIndex()
+ } else if (languagePopupList.keyNavigationWraps) {
+ languagePopupList.currentIndex = languagePopupList.count - 1
+ } else {
+ hideLanguagePopup()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ } else if (alternativeKeys.active) {
+ alternativeKeys.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ } else if (functionPopupList.active) {
+ functionPopupList.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ } else if (wordCandidateContextMenu.active) {
+ if (wordCandidateContextMenuList.currentIndex > 0) {
+ wordCandidateContextMenuList.decrementCurrentIndex()
+ } else if (wordCandidateContextMenuList.keyNavigationWraps && wordCandidateContextMenuList.count > 1) {
+ wordCandidateContextMenuList.currentIndex = wordCandidateContextMenuList.count - 1
+ } else {
+ hideWordCandidateContextMenu()
+ }
+ } else if (keyboard.navigationModeActive && !keyboardInputArea.initialKey && wordCandidateView.count) {
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ initialKey = keyboardInputArea.initialKey
+ if (!keyboardInputArea.navigateToNextKey(0, -1, false)) {
+ keyboardInputArea.initialKey = initialKey
+ keyboardInputArea.navigateToNextKey(0, -1, true)
+ } else {
+ keyboardInputArea.navigateToNextKey(0, 1, false)
+ }
+ } else if (!keyboardInputArea.navigateToNextKey(0, -1, !keyboard.navigationModeActive || !keyboardInputArea.initialKey || wordCandidateView.count == 0)) {
+ if (wordCandidateView.currentIndex === -1)
+ wordCandidateView.incrementCurrentIndex()
+ }
+ break
+ case Qt.Key_Right:
+ if (keyboard.navigationModeActive && !keyboardInputArea.initialKey) {
+ if (languagePopupListActive) {
+ hideLanguagePopup()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ break
+ }
+ if (alternativeKeys.active) {
+ if (alternativeKeys.listView.currentIndex + 1 < alternativeKeys.listView.count) {
+ alternativeKeys.listView.incrementCurrentIndex()
+ } else {
+ alternativeKeys.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ break
+ }
+ if (functionPopupList.active) {
+ if (functionPopupList.listView.currentIndex + 1 < functionPopupList.listView.count) {
+ functionPopupList.listView.incrementCurrentIndex()
+ } else {
+ functionPopupList.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ break
+ }
+ if (wordCandidateContextMenu.active) {
+ hideWordCandidateContextMenu()
+ break
+ }
+ if (wordCandidateView.count) {
+ if (wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight &&
+ wordCandidateView.currentIndex + 1 < wordCandidateView.count) {
+ wordCandidateView.incrementCurrentIndex()
+ } else if (wordCandidateView.effectiveLayoutDirection == Qt.RightToLeft &&
+ wordCandidateView.currentIndex > 0) {
+ wordCandidateView.decrementCurrentIndex()
+ } else {
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ initialKey = keyboardInputArea.initialKey
+ while (keyboardInputArea.navigateToNextKey(0, -1 * direction, false))
+ initialKey = keyboardInputArea.initialKey;
+ while (keyboardInputArea.navigateToNextKey(-1, 0, false))
+ initialKey = keyboardInputArea.initialKey;
+ keyboardInputArea.initialKey = initialKey
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ break
+ }
+ }
+ initialKey = keyboardInputArea.initialKey
+ if (!keyboardInputArea.navigateToNextKey(1 * direction, 0, false)) {
+ keyboardInputArea.initialKey = initialKey
+ if (!keyboardInputArea.navigateToNextKey(0, 1 * direction, false)) {
+ if (wordCandidateView.count) {
+ wordCandidateView.currentIndex =
+ wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ?
+ 0 : (wordCandidateView.count - 1)
+ break
+ }
+ keyboardInputArea.initialKey = initialKey
+ keyboardInputArea.navigateToNextKey(0, 1 * direction, true)
+ }
+ keyboardInputArea.navigateToNextKey(1 * direction, 0, true)
+ }
+ break
+ case Qt.Key_Down:
+ if (languagePopupListActive) {
+ if (languagePopupList.currentIndex + 1 < languagePopupList.count) {
+ languagePopupList.incrementCurrentIndex()
+ } else if (languagePopupList.keyNavigationWraps) {
+ languagePopupList.currentIndex = 0
+ } else {
+ hideLanguagePopup()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ } else if (alternativeKeys.active) {
+ alternativeKeys.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ } else if (functionPopupList.active) {
+ functionPopupList.close()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ } else if (wordCandidateContextMenu.active) {
+ if (wordCandidateContextMenuList.currentIndex + 1 < wordCandidateContextMenuList.count) {
+ wordCandidateContextMenuList.incrementCurrentIndex()
+ } else if (wordCandidateContextMenuList.keyNavigationWraps && wordCandidateContextMenuList.count > 1) {
+ wordCandidateContextMenuList.currentIndex = 0
+ } else {
+ hideWordCandidateContextMenu()
+ keyboardInputArea.setActiveKey(null)
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ } else if (keyboard.navigationModeActive && !keyboardInputArea.initialKey && wordCandidateView.count) {
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ initialKey = keyboardInputArea.initialKey
+ if (!keyboardInputArea.navigateToNextKey(0, 1, false)) {
+ keyboardInputArea.initialKey = initialKey
+ keyboardInputArea.navigateToNextKey(0, 1, true)
+ } else {
+ keyboardInputArea.navigateToNextKey(0, -1, false)
+ }
+ } else if (!keyboardInputArea.navigateToNextKey(0, 1, !keyboard.navigationModeActive || !keyboardInputArea.initialKey || wordCandidateView.count == 0)) {
+ if (wordCandidateView.currentIndex === -1)
+ wordCandidateView.incrementCurrentIndex()
+ }
+ break
+ case Qt.Key_Return:
+ if (!keyboard.navigationModeActive)
+ break
+ if (languagePopupListActive) {
+ if (!isAutoRepeat) {
+ languagePopupList.model.selectItem(languagePopupList.currentIndex)
+ keyboardInputArea.reset()
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ } else if (keyboardInputArea.initialKey) {
+ if (!isAutoRepeat) {
+ pressAndHoldTimer.restart()
+ keyboardInputArea.setActiveKey(keyboardInputArea.initialKey)
+ keyboardInputArea.press(keyboardInputArea.initialKey, true)
+ }
+ } else if (!wordCandidateContextMenu.active && wordCandidateView.count > 0) {
+ if (!isAutoRepeat) {
+ pressAndHoldTimer.restart()
+ }
+ }
+ break
+ default:
+ break
+ }
+ }
+ function onNavigationKeyReleased(key, isAutoRepeat) {
+ switch (key) {
+ case Qt.Key_Return:
+ if (!keyboard.navigationModeActive) {
+ if (languagePopupListActive)
+ languagePopupList.model.selectItem(languagePopupList.currentIndex)
+ break
+ }
+ if (isAutoRepeat)
+ break
+ if (!languagePopupListActive && !alternativeKeys.active && !functionPopupList.active && !wordCandidateContextMenu.active && keyboard.activeKey) {
+ keyboardInputArea.release(keyboard.activeKey)
+ pressAndHoldTimer.stop()
+ alternativeKeys.close()
+ functionPopupList.close()
+ keyboardInputArea.setActiveKey(null)
+ if (!languagePopupListActive && keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ } else if (wordCandidateContextMenu.active) {
+ if (!wordCandidateContextMenu.openedByNavigationKeyLongPress) {
+ wordCandidateContextMenu.selectCurrentItem()
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ } else {
+ wordCandidateContextMenu.openedByNavigationKeyLongPress = false
+ }
+ } else if (alternativeKeys.active) {
+ if (!alternativeKeys.openedByNavigationKeyLongPress) {
+ alternativeKeys.clicked()
+ alternativeKeys.close()
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ keyboardInputArea.reset()
+ } else {
+ alternativeKeys.openedByNavigationKeyLongPress = false
+ }
+ } else if (functionPopupList.active) {
+ if (!functionPopupList.openedByNavigationKeyLongPress) {
+ functionPopupList.clicked()
+ functionPopupList.close()
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ keyboardInputArea.reset()
+ } else {
+ functionPopupList.openedByNavigationKeyLongPress = false
+ }
+ } else if (!wordCandidateContextMenu.active && wordCandidateView.count > 0) {
+ wordCandidateView.model.selectItem(wordCandidateView.currentIndex)
+ if (!InputContext.preeditText.length)
+ keyboardInputArea.navigateToNextKey(0, 1, true)
+ }
+ break
+ default:
+ break
+ }
+ }
+ }
+ Connections {
+ target: InputContext.inputEngine
+ function onVirtualKeyClicked(key, text, modifiers, isAutoRepeat) {
+ if (isAutoRepeat && keyboard.activeKey)
+ soundEffect.play(keyboard.activeKey.soundEffect)
+ if (key !== Qt.Key_unknown && keyboardInputArea.dragSymbolMode) {
+ keyboardInputArea.dragSymbolMode = false
+ keyboard.symbolMode = false
+ } else if (key === Qt.Key_Space) {
+ var surroundingText = InputContext.surroundingText.trim()
+ if (InputContext.priv.shiftHandler.sentenceEndingCharacters.indexOf(surroundingText.charAt(surroundingText.length-1)) >= 0)
+ keyboard.symbolMode = false
+ }
+ }
+ }
+ FolderListModel {
+ id: layoutsModel
+ nameFilters: ["$"]
+ folder: VirtualKeyboardSettings.layoutPath
+ }
+ Connections {
+ target: layoutsModel
+ function onCountChanged() {
+ updateDefaultLocale()
+ localeIndex = defaultLocaleIndex
+ }
+ }
+ AlternativeKeys {
+ id: alternativeKeys
+ objectName: "alternativeKeys"
+ // Add some extra margin for decoration
+ property real horizontalMargin: style.alternateKeysListItemWidth
+ property real verticalMargin: style.alternateKeysListItemHeight
+ property rect previewRect: Qt.rect(keyboard.x + alternativeKeys.listView.x - horizontalMargin,
+ keyboard.y + alternativeKeys.listView.y - verticalMargin,
+ alternativeKeys.listView.width + horizontalMargin * 2,
+ alternativeKeys.listView.height + verticalMargin * 2)
+ property bool openedByNavigationKeyLongPress
+ onVisibleChanged: {
+ if (visible)
+ InputContext.priv.previewRectangle = Qt.binding(function() {return previewRect})
+ else
+ openedByNavigationKeyLongPress = false
+ InputContext.priv.previewVisible = visible
+ }
+ }
+ FunctionPopupList {
+ id: functionPopupList
+ property bool openedByNavigationKeyLongPress
+ }
+ Timer {
+ id: pressAndHoldTimer
+ interval: keyboard.pressAndHoldDelay
+ onTriggered: {
+ if (keyboard.activeKey && keyboard.activeKey === keyboardInputArea.initialKey) {
+ var origin = keyboard.mapFromItem(activeKey, activeKey.width / 2, 0)
+ if (keyboard.activeKey.smallText === "\u2699" &&
+ functionPopupList.open(keyboard.activeKey, origin.x, origin.y)) {
+ InputContext.inputEngine.virtualKeyCancel()
+ keyboardInputArea.initialKey = null
+ functionPopupList.openedByNavigationKeyLongPress = keyboard.navigationModeActive
+ } else if (alternativeKeys.open(keyboard.activeKey, origin.x, origin.y)) {
+ InputContext.inputEngine.virtualKeyCancel()
+ keyboardInputArea.initialKey = null
+ alternativeKeys.openedByNavigationKeyLongPress = keyboard.navigationModeActive
+ } else if (keyboard.activeKey.key === Qt.Key_Context1 && !keyboard.symbolMode) {
+ InputContext.inputEngine.virtualKeyCancel()
+ keyboardInputArea.dragSymbolMode = true
+ keyboard.symbolMode = true
+ keyboardInputArea.initialKey = null
+ if (keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ } else if (keyboardInputArea.dragSymbolMode &&
+ keyboard.activeKey &&
+ keyboard.activeKey.functionKey &&
+ !keyboard.activeKey.repeat) {
+ InputContext.inputEngine.virtualKeyCancel()
+ keyboardInputArea.click(keyboard.activeKey)
+ keyboardInputArea.initialKey = null
+ if (keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
+ keyboardInputArea.navigateToNextKey(0, 0, false)
+ } else if (!wordCandidateContextMenu.active && keyboard.navigationModeActive) {
+ wordCandidateContextMenu.show(wordCandidateView.currentIndex)
+ wordCandidateContextMenu.openedByNavigationKeyLongPress = keyboard.navigationModeActive
+ }
+ }
+ }
+ Timer {
+ id: releaseInaccuracyTimer
+ interval: 500
+ onTriggered: {
+ if (keyboardInputArea.pressed && activeTouchPoint && !alternativeKeys.active && !keyboardInputArea.dragSymbolMode && !functionPopupList.active) {
+ var key = keyboardInputArea.keyOnPoint(activeTouchPoint.x, activeTouchPoint.y)
+ if (key !== keyboard.activeKey) {
+ InputContext.inputEngine.virtualKeyCancel()
+ keyboardInputArea.setActiveKey(key)
+ keyboardInputArea.press(key, false)
+ }
+ }
+ }
+ }
+ CharacterPreviewBubble {
+ id: characterPreview
+ objectName: "characterPreviewBubble"
+ active: keyboardInputArea.pressed && !alternativeKeys.active && !functionPopupList.active
+ property rect previewRect: Qt.rect(keyboard.x + characterPreview.x,
+ keyboard.y + characterPreview.y,
+ characterPreview.width,
+ characterPreview.height)
+ }
+ Binding {
+ target: InputContext.priv
+ property: "previewRectangle"
+ value: characterPreview.previewRect
+ when: characterPreview.visible
+ restoreMode: Binding.RestoreBinding
+ }
+ Binding {
+ target: InputContext.priv
+ property: "previewRectangle"
+ value: languagePopupList.previewRect
+ when: languagePopupListActive
+ restoreMode: Binding.RestoreBinding
+ }
+ Binding {
+ target: InputContext.priv
+ property: "previewVisible"
+ value: characterPreview.visible || languagePopupListActive
+ restoreMode: Binding.RestoreBinding
+ }
+ Loader {
+ id: styleLoader
+ source: VirtualKeyboardSettings.style
+ Binding {
+ target: styleLoader.item
+ property: "keyboardHeight"
+ value: keyboardInnerContainer.height
+ restoreMode: Binding.RestoreBinding
+ }
+ }
+ Loader {
+ id: naviationHighlight
+ objectName: "naviationHighlight"
+ property var highlightItem: {
+ if (keyboard.navigationModeActive) {
+ if (languagePopupListActive) {
+ return languagePopupList.highlightItem
+ } else if (keyboardInputArea.initialKey) {
+ return keyboardInputArea.initialKey
+ } else if (alternativeKeys.listView.count > 0) {
+ return alternativeKeys.listView.highlightItem
+ } else if (functionPopupList.listView.count > 0) {
+ return functionPopupList.listView.highlightItem
+ } else if (wordCandidateContextMenu.active) {
+ return wordCandidateContextMenuList.highlightItem
+ } else if (wordCandidateView.count > 0) {
+ return wordCandidateView.highlightItem
+ }
+ }
+ return keyboard
+ }
+ // Note: without "highlightItem.x - highlightItem.x" the binding does not work for alternativeKeys
+ property var highlightItemOffset: highlightItem ? keyboard.mapFromItem(highlightItem, highlightItem.x - highlightItem.x, highlightItem.y - highlightItem.y) : ({x:0, y:0})
+ property int moveDuration: !keyboard.noAnimations ? 200 : 0
+ property int resizeDuration: !keyboard.noAnimations ? 200 : 0
+ z: 2
+ x: highlightItemOffset.x
+ y: highlightItemOffset.y
+ width: highlightItem ? highlightItem.width : 0
+ height: highlightItem ? highlightItem.height : 0
+ visible: keyboard.navigationModeActive && highlightItem !== null && highlightItem !== keyboard
+ sourceComponent: keyboard.style.navigationHighlight
+ Behavior on x {
+ NumberAnimation { id: xAnimation; duration: naviationHighlight.moveDuration; easing.type: Easing.OutCubic }
+ }
+ Behavior on y {
+ NumberAnimation { id: yAnimation; duration: naviationHighlight.moveDuration; easing.type: Easing.OutCubic }
+ }
+ Behavior on width {
+ NumberAnimation { id: widthAnimation; duration: naviationHighlight.resizeDuration; easing.type: Easing.OutCubic }
+ }
+ Behavior on height {
+ NumberAnimation { id: heightAnimation; duration: naviationHighlight.resizeDuration; easing.type: Easing.OutCubic }
+ }
+ }
+
+ ShadowInputControl {
+ id: shadowInputControl
+ objectName: "shadowInputControl"
+ z: -3
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: wordCandidateView.top
+ height: keyboard.screenHeight -
+ keyboard.height -
+ wordCandidateView.height
+ visible: fullScreenMode && (shadowInputControlVisibleTimer.running || InputContext.animating)
+
+ Connections {
+ target: keyboard
+ function onActiveChanged() {
+ if (keyboard.active)
+ shadowInputControlVisibleTimer.start()
+ else
+ shadowInputControlVisibleTimer.stop()
+ }
+ }
+
+ Timer {
+ id: shadowInputControlVisibleTimer
+ interval: 2147483647
+ repeat: true
+ }
+
+ MouseArea {
+ onPressed: keyboard.hideLanguagePopup()
+ anchors.fill: parent
+ enabled: languagePopupList.enabled
+ }
+ }
+
+ SelectionControl {
+ id: fullScreenModeSelectionControl
+ objectName: "fullScreenModeSelectionControl"
+ inputContext: InputContext.priv.shadow
+ anchors.top: shadowInputControl.top
+ anchors.left: shadowInputControl.left
+ enabled: keyboard.enabled && fullScreenMode
+ }
+
+ ListView {
+ id: wordCandidateView
+ objectName: "wordCandidateView"
+ clip: true
+ z: -2
+ property bool empty: true
+ readonly property bool visibleCondition: (((!wordCandidateView.empty || wordCandidateViewAutoHideTimer.running) &&
+ InputContext.inputEngine.wordCandidateListVisibleHint) || VirtualKeyboardSettings.wordCandidateList.alwaysVisible) &&
+ keyboard.active
+ readonly property real visibleYOffset: -height
+ readonly property real currentYOffset: visibleCondition ? visibleYOffset : 0
+ height: style ? style.selectionListHeight : 0
+ anchors.left: parent.left
+ anchors.right: parent.right
+ spacing: 0
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapToItem
+ delegate: style.selectionListDelegate
+ highlight: style.selectionListHighlight ? style.selectionListHighlight : defaultHighlight
+ highlightMoveDuration: 0
+ highlightResizeDuration: 0
+ add: !keyboard.noAnimations ? style.selectionListAdd : null
+ remove: !keyboard.noAnimations ? style.selectionListRemove : null
+ keyNavigationWraps: true
+ model: InputContext.inputEngine.wordCandidateListModel
+ onCurrentItemChanged: if (currentItem) soundEffect.register(currentItem.soundEffect)
+ Connections {
+ target: wordCandidateView.model ? wordCandidateView.model : null
+ function onActiveItemChanged(index) { wordCandidateView.currentIndex = index }
+ function onItemSelected() { if (wordCandidateView.currentItem) soundEffect.play(wordCandidateView.currentItem.soundEffect) }
+ function onCountChanged() {
+ var empty = wordCandidateView.model.count === 0
+ if (empty)
+ wordCandidateViewAutoHideTimer.restart()
+ else
+ wordCandidateViewAutoHideTimer.stop()
+ wordCandidateView.empty = empty
+ keyboard.hideWordCandidateContextMenu()
+ }
+ }
+ Connections {
+ target: InputContext.priv
+ function onInputItemChanged() { wordCandidateViewAutoHideTimer.stop() }
+ }
+ Connections {
+ target: InputContext.inputEngine
+ function onWordCandidateListVisibleHintChanged() { wordCandidateViewAutoHideTimer.stop() }
+ }
+ Timer {
+ id: wordCandidateViewAutoHideTimer
+ interval: VirtualKeyboardSettings.wordCandidateList.autoHideDelay
+ }
+ Loader {
+ sourceComponent: style.selectionListBackground
+ anchors.fill: parent
+ z: -1
+ }
+ Component {
+ id: defaultHighlight
+ Item {}
+ }
+ states: [
+ State {
+ name: "visible"
+ when: wordCandidateView.visibleCondition
+ PropertyChanges {
+ target: wordCandidateView
+ y: wordCandidateView.visibleYOffset
+ }
+ },
+ State {
+ name: "alwaysVisible"
+ when: keyboard.fullScreenMode || VirtualKeyboardSettings.wordCandidateList.alwaysVisible
+ PropertyChanges {
+ target: wordCandidateView
+ y: wordCandidateView.visibleYOffset
+ }
+ }
+ ]
+ transitions: Transition {
+ id: wordCandidateViewTransition
+ from: ""
+ to: "visible"
+ enabled: !InputContext.animating && !keyboard.noAnimations
+ reversible: true
+ ParallelAnimation {
+ NumberAnimation {
+ properties: "y"
+ duration: 250
+ easing.type: Easing.InOutQuad
+ }
+ }
+ }
+
+ function longPressItem(index) {
+ return keyboard.showWordCandidateContextMenu(index)
+ }
+ }
+
+ Item {
+ id: soundEffect
+ property var __sounds: ({})
+ property bool available: false
+
+ signal playingChanged(url source, bool playing)
+
+ Connections {
+ target: VirtualKeyboardSettings
+ function onStyleNameChanged() {
+ soundEffect.__sounds = {}
+ soundEffect.available = false
+ }
+ }
+
+ function play(sound) {
+ if (enabled && sound != Qt.resolvedUrl("")) {
+ var soundId = Qt.md5(sound)
+ var multiSoundEffect = __sounds[soundId]
+ if (!multiSoundEffect)
+ multiSoundEffect = register(sound)
+ if (multiSoundEffect)
+ multiSoundEffect.play()
+ }
+ }
+
+ function register(sound) {
+ var multiSoundEffect = null
+ if (enabled && sound != Qt.resolvedUrl("")) {
+ var soundId = Qt.md5(sound)
+ multiSoundEffect = __sounds[soundId]
+ if (!multiSoundEffect) {
+ multiSoundEffect = Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard; MultiSoundEffect {}', soundEffect)
+ if (multiSoundEffect) {
+ multiSoundEffect.playingChanged.connect(soundEffect.playingChanged)
+ multiSoundEffect.source = sound
+ __sounds[soundId] = multiSoundEffect
+ available = true
+ }
+ }
+ }
+ return multiSoundEffect
+ }
+ }
+
+ Loader {
+ id: keyboardBackground
+ z: -1
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: keyboardInnerContainer.height
+ sourceComponent: style.keyboardBackground
+
+ Item {
+ id: keyboardInnerContainer
+ z: 1
+ width: Math.round(keyboardBackground.width)
+ height: style ? Math.round(style.keyboardDesignHeight * width / style.keyboardDesignWidth) : 0
+ anchors.horizontalCenter: parent.horizontalCenter
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
+
+ KeyboardObserver {
+ id: keyboardObserver
+
+ function scanLayout() {
+ if (keyboardLayoutLoader.item == null)
+ return null
+
+ return keyboardLayoutLoader.item.scanLayout()
+ }
+ }
+
+ Component.onCompleted: InputContext.priv.setKeyboardObserver(keyboardObserver)
+
+ onWidthChanged: notifyLayoutChanged()
+ onHeightChanged: notifyLayoutChanged()
+
+ Loader {
+ id: keyboardLayoutLoader
+ objectName: "keyboardLayoutLoader"
+
+ anchors.fill: parent
+ anchors.leftMargin: Math.round(style.keyboardRelativeLeftMargin * parent.width)
+ anchors.rightMargin: Math.round(style.keyboardRelativeRightMargin * parent.width)
+ anchors.topMargin: Math.round(style.keyboardRelativeTopMargin * parent.height)
+ anchors.bottomMargin: Math.round(style.keyboardRelativeBottomMargin * parent.height)
+
+ Binding {
+ target: keyboardLayoutLoader
+ property: "source"
+ value: keyboard.layout
+ when: keyboard.width > 0 && keyboard.layout.length > 0
+ restoreMode: Binding.RestoreNone
+ }
+
+ onItemChanged: {
+ if (!item)
+ return
+
+ // Reset input mode if the new layout wants to override it
+ if (item.inputMode !== -1)
+ inputModeNeedsReset = true
+
+ if (!InputContext.inputEngine.inputMethod)
+ updateInputMethod()
+
+ notifyLayoutChanged()
+ }
+
+ MultiPointTouchArea {
+ id: keyboardInputArea
+ objectName: "keyboardInputArea"
+
+ property Item initialKey: null
+ property bool dragSymbolMode
+ property real releaseMargin: initialKey !== null ? Math.min(initialKey.width / 3, initialKey.height / 3) : 0
+ property point navigationCursor: Qt.point(-1, -1)
+
+ anchors.fill: keyboardLayoutLoader
+
+ Connections {
+ target: keyboardLayoutLoader
+ function onLoaded() {
+ if (keyboard.navigationModeActive &&
+ keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
+ keyboard.navigationModeActive = keyboardInputArea.navigateToNextKey(0, 0, false)
+ }
+ }
+ Connections {
+ target: keyboard
+ function onNavigationModeActiveChanged() {
+ if (!keyboard.navigationModeActive) {
+ keyboardInputArea.navigationCursor = Qt.point(-1, -1)
+ keyboardInputArea.reset()
+ }
+ }
+ }
+
+ function press(key, isRealPress) {
+ if (key && key.enabled) {
+ if (!key.noKeyEvent)
+ InputContext.inputEngine.virtualKeyPress(key.key, key.uppercased ? key.text.toUpperCase() : key.text, key.uppercased ? Qt.ShiftModifier : 0, key.repeat && !dragSymbolMode)
+ if (isRealPress)
+ soundEffect.play(key.soundEffect)
+ }
+ }
+ function release(key) {
+ if (key && key.enabled) {
+ if (!key.noKeyEvent)
+ InputContext.inputEngine.virtualKeyRelease(key.key, key.uppercased ? key.text.toUpperCase() : key.text, key.uppercased ? Qt.ShiftModifier : 0)
+ key.clicked()
+ }
+ }
+ function click(key) {
+ if (key && key.enabled) {
+ if (!key.noKeyEvent)
+ InputContext.inputEngine.virtualKeyClick(key.key, InputContext.uppercase ? key.text.toUpperCase() : key.text, InputContext.uppercase ? Qt.ShiftModifier : 0)
+ key.clicked()
+ }
+ }
+ function setActiveKey(activeKey) {
+ if (keyboard.activeKey === activeKey)
+ return
+ if (keyboard.activeKey) {
+ if (keyboard.activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey)
+ keyboard.activeKey.onKeyChanged.disconnect(onFlickKeyKeyChanged)
+ keyboard.activeKey.active = false
+ }
+ keyboard.activeKey = activeKey
+ if (keyboard.activeKey) {
+ keyboard.activeKey.active = true
+ }
+ }
+ function keyOnPoint(px, py) {
+ var parentItem = keyboardLayoutLoader
+ var child = parentItem.childAt(px, py)
+ while (child !== null) {
+ var position = parentItem.mapToItem(child, px, py)
+ px = position.x; py = position.y
+ parentItem = child
+ child = parentItem.childAt(px, py)
+ if (child && child.key !== undefined)
+ return child
+ }
+ return null
+ }
+ function hitInitialKey(x, y, margin) {
+ if (!initialKey)
+ return false
+ var position = initialKey.mapFromItem(keyboardInputArea, x, y)
+ return (position.x > -margin
+ && position.y > -margin
+ && position.x < initialKey.width + margin
+ && position.y < initialKey.height + margin)
+ }
+ function containsPoint(touchPoints, point) {
+ if (!point)
+ return false
+ for (var i in touchPoints)
+ if (touchPoints[i].pointId == point.pointId)
+ return true
+ return false
+ }
+ function releaseActiveKey() {
+ if (alternativeKeys.active) {
+ alternativeKeys.clicked()
+ } else if (functionPopupList.active) {
+ functionPopupList.clicked()
+ } else if (keyboard.activeKey) {
+ release(keyboard.activeKey)
+ }
+ reset()
+ }
+ function reset() {
+ releaseInaccuracyTimer.stop()
+ pressAndHoldTimer.stop()
+ setActiveKey(null)
+ activeTouchPoint = null
+ alternativeKeys.close()
+ functionPopupList.close()
+ if (dragSymbolMode) {
+ keyboard.symbolMode = false
+ dragSymbolMode = false
+ }
+ }
+ function nextKeyInNavigation(dX, dY, wrapEnabled) {
+ var nextKey = null, x, y, itemOffset
+ if (dX !== 0 || dY !== 0) {
+ var offsetX, offsetY
+ for (offsetX = dX, offsetY = dY;
+ Math.abs(offsetX) < width && Math.abs(offsetY) < height;
+ offsetX += dX, offsetY += dY) {
+ x = navigationCursor.x + offsetX
+ if (x < 0) {
+ if (!wrapEnabled)
+ break
+ x += width
+ } else if (x >= width) {
+ if (!wrapEnabled)
+ break
+ x -= width
+ }
+ y = navigationCursor.y + offsetY
+ if (y < 0) {
+ if (!wrapEnabled)
+ break
+ y += height
+ } else if (y >= height) {
+ if (!wrapEnabled)
+ break
+ y -= height
+ }
+ nextKey = keyOnPoint(x, y)
+ if (nextKey) {
+ // Check if key is visible. Only the visible keys have keyPanelDelegate set.
+ if (nextKey != initialKey && nextKey.hasOwnProperty("keyPanelDelegate") && nextKey.keyPanelDelegate)
+ break
+ // Jump over the item to reduce the number of iterations in this loop
+ itemOffset = mapToItem(nextKey, x, y)
+ if (dX > 0)
+ offsetX += nextKey.width - itemOffset.x
+ else if (dX < 0)
+ offsetX -= itemOffset.x
+ else if (dY > 0)
+ offsetY += nextKey.height - itemOffset.y
+ else if (dY < 0)
+ offsetY -= itemOffset.y
+ }
+ nextKey = null
+ }
+ } else {
+ nextKey = keyOnPoint(navigationCursor.x, navigationCursor.y)
+ }
+ if (nextKey) {
+ itemOffset = mapFromItem(nextKey, nextKey.width / 2, nextKey.height / 2)
+ if (dX) {
+ x = itemOffset.x
+ } else if (dY) {
+ y = itemOffset.y
+ } else {
+ x = itemOffset.x
+ y = itemOffset.y
+ }
+ navigationCursor = Qt.point(x, y)
+ }
+ return nextKey
+ }
+ function navigateToNextKey(dX, dY, wrapEnabled) {
+ // Resolve initial landing point of the navigation cursor
+ if (!keyboard.navigationModeActive || keyboard.navigationCursor === Qt.point(-1, -1)) {
+ if (dX > 0)
+ navigationCursor = Qt.point(0, height / 2)
+ else if (dX < 0)
+ navigationCursor = Qt.point(width, height / 2)
+ else if (dY > 0)
+ navigationCursor = Qt.point(width / 2, 0)
+ else if (dY < 0)
+ navigationCursor = Qt.point(width / 2, height)
+ else
+ navigationCursor = Qt.point(width / 2, height / 2)
+ keyboard.navigationModeActive = true
+ }
+ if (dX && dY) {
+ initialKey = nextKeyInNavigation(dX, 0, wrapEnabled)
+ if (initialKey || wrapEnabled)
+ initialKey = nextKeyInNavigation(0, dY, wrapEnabled)
+ } else {
+ initialKey = nextKeyInNavigation(dX, dY, wrapEnabled)
+ }
+ return initialKey !== null
+ }
+
+ function onFlickKeyKeyChanged() {
+ InputContext.inputEngine.virtualKeyCancel()
+ press(activeKey, false)
+ }
+
+ onPressed: (touchPoints) => {
+ keyboard.navigationModeActive = false
+
+ // Immediately release any pending key that the user might be
+ // holding (and about to release) when a second key is pressed.
+ if (activeTouchPoint)
+ releaseActiveKey();
+
+ for (var i in touchPoints) {
+ // Release any key pressed by a previous iteration of the loop.
+ if (containsPoint(touchPoints, activeTouchPoint))
+ releaseActiveKey();
+
+ initialKey = keyOnPoint(touchPoints[i].x, touchPoints[i].y)
+ if (!initialKey)
+ continue
+ activeTouchPoint = touchPoints[i]
+ if (initialKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) {
+ initialKey.press(activeTouchPoint.x, activeTouchPoint.y)
+ initialKey.onKeyChanged.connect(onFlickKeyKeyChanged)
+ } else {
+ releaseInaccuracyTimer.start()
+ pressAndHoldTimer.start()
+ }
+ setActiveKey(initialKey)
+ press(initialKey, true)
+ }
+ }
+ onUpdated: (touchPoints) => {
+ if (!containsPoint(touchPoints, activeTouchPoint))
+ return
+
+ if (alternativeKeys.active) {
+ alternativeKeys.move(mapToItem(alternativeKeys, activeTouchPoint.x, 0).x)
+ } else if (functionPopupList.active) {
+ functionPopupList.move(mapToItem(functionPopupList, activeTouchPoint.x, activeTouchPoint.y))
+ } else if (activeKey && activeKey.keyType === QtVirtualKeyboard.KeyType.FlickKey) {
+ activeKey.update(activeTouchPoint.x, activeTouchPoint.y)
+ } else {
+ var key = null
+ if (releaseInaccuracyTimer.running) {
+ if (hitInitialKey(activeTouchPoint.x, activeTouchPoint.y, releaseMargin)) {
+ key = initialKey
+ } else if (initialKey) {
+ releaseInaccuracyTimer.stop()
+ initialKey = null
+ }
+ }
+ if (key === null) {
+ key = keyOnPoint(activeTouchPoint.x, activeTouchPoint.y)
+ }
+ if (key !== keyboard.activeKey) {
+ InputContext.inputEngine.virtualKeyCancel()
+ setActiveKey(key)
+ press(key, false)
+ if (dragSymbolMode) {
+ if (key && key.functionKey && key.key !== Qt.Key_Context1)
+ pressAndHoldTimer.restart()
+ else
+ pressAndHoldTimer.stop()
+ }
+ }
+ }
+ }
+ onReleased: (touchPoints) => {
+ if (containsPoint(touchPoints, activeTouchPoint)) {
+ if (dragSymbolMode) {
+ var key = keyOnPoint(activeTouchPoint.x, activeTouchPoint.y)
+ if (key && key.key === Qt.Key_Context1) {
+ dragSymbolMode = false
+ InputContext.inputEngine.virtualKeyCancel()
+ reset()
+ return
+ }
+ }
+ releaseActiveKey();
+ }
+ }
+ onCanceled: (touchPoints) => {
+ if (containsPoint(touchPoints, activeTouchPoint))
+ reset()
+ }
+ }
+ }
+ }
+ }
+
+ Item {
+ id: languagePopup
+ z: 1
+ anchors.fill: parent
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
+
+ MouseArea {
+ onPressed: keyboard.hideLanguagePopup()
+ anchors.fill: parent
+ enabled: languagePopupList.enabled
+ }
+
+ PopupList {
+ id: languagePopupList
+ objectName: "languagePopupList"
+ z: 2
+ anchors.left: parent.left
+ anchors.top: parent.top
+ enabled: false
+ model: languageListModel
+ delegate: keyboard.style ? keyboard.style.languageListDelegate : null
+ highlight: keyboard.style ? keyboard.style.languageListHighlight : defaultHighlight
+ add: keyboard.style && !keyboard.noAnimations ? keyboard.style.languageListAdd : null
+ remove: keyboard.style && !keyboard.noAnimations ? keyboard.style.languageListRemove : null
+ property rect previewRect: Qt.rect(keyboard.x + languagePopupList.x,
+ keyboard.y + languagePopupList.y,
+ languagePopupList.width,
+ languagePopupList.height)
+ }
+
+ Loader {
+ sourceComponent: keyboard.style.languageListBackground
+ anchors.fill: languagePopupList
+ z: -1
+ visible: languagePopupList.visible
+ }
+
+ ListModel {
+ id: languageListModel
+
+ function selectItem(index) {
+ languagePopupList.currentIndex = index
+ keyboard.soundEffect.play(languagePopupList.currentItem.soundEffect)
+ changeLanguageTimer.newLocaleIndex = languageListModel.get(index).localeIndex
+ changeLanguageTimer.start()
+ }
+ }
+
+ Timer {
+ id: changeLanguageTimer
+ interval: 1
+ property int newLocaleIndex
+ onTriggered: {
+ if (languagePopupListActive) {
+ hideLanguagePopup()
+ start()
+ } else {
+ localeIndex = newLocaleIndex
+ }
+ }
+ }
+
+ function show(locales, parentItem, customLayoutsOnly) {
+ if (!languagePopupList.enabled) {
+ languageListModel.clear()
+ for (var i = 0; i < locales.length; i++) {
+ languageListModel.append({localeName: locales[i].name, displayName: locales[i].locale.nativeLanguageName, localeIndex: locales[i].index})
+ if (locales[i].index === keyboard.localeIndex)
+ languagePopupList.currentIndex = i
+ }
+ languagePopupList.positionViewAtIndex(languagePopupList.currentIndex, ListView.Center)
+ if (parentItem) {
+ languagePopupList.anchors.leftMargin = Qt.binding(function() {
+ const newLeftMargin = Math.round(keyboard.mapFromItem(parentItem, (parentItem.width - languagePopupList.width) / 2, 0).x)
+ return Math.min(Math.max(0, newLeftMargin), keyboard.width - languagePopupList.width)
+ })
+ languagePopupList.anchors.topMargin = Qt.binding(function() {return Math.round(keyboard.mapFromItem(parentItem, 0, -languagePopupList.height).y)})
+ } else {
+ languagePopupList.anchors.leftMargin = Qt.binding(function() {return Math.round((keyboard.width - languagePopupList.width) / 2)})
+ languagePopupList.anchors.topMargin = Qt.binding(function() {return Math.round((keyboard.height - languagePopupList.height) / 2)})
+ }
+ }
+ languagePopupList.enabled = true
+ }
+
+ function hide() {
+ if (languagePopupList.enabled) {
+ languagePopupList.enabled = false
+ languagePopupList.anchors.leftMargin = undefined
+ languagePopupList.anchors.topMargin = undefined
+ languageListModel.clear()
+ }
+ }
+ }
+
+ function showLanguagePopup(parentItem, customLayoutsOnly) {
+ var locales = keyboard.listLocales(customLayoutsOnly, parent.externalLanguageSwitchEnabled)
+ if (parent.externalLanguageSwitchEnabled) {
+ var currentIndex = 0
+ for (var i = 0; i < locales.length; i++) {
+ if (locales[i] === keyboard.locale) {
+ currentIndex = i
+ break
+ }
+ }
+ parent.externalLanguageSwitch(locales, currentIndex)
+ return
+ }
+ languagePopup.show(locales, parentItem, customLayoutsOnly)
+ }
+
+ function hideLanguagePopup() {
+ languagePopup.hide()
+ }
+
+ MouseArea {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: keyboard.screenHeight
+ onPressed: keyboard.hideWordCandidateContextMenu()
+ enabled: wordCandidateContextMenuList.enabled
+ }
+
+ Item {
+ id: wordCandidateContextMenu
+ objectName: "wordCandidateContextMenu"
+ z: 1
+ anchors.fill: parent
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
+ property int previousWordCandidateIndex: -1
+ readonly property bool active: wordCandidateContextMenuList.visible
+ property bool openedByNavigationKeyLongPress
+
+ PopupList {
+ id: wordCandidateContextMenuList
+ objectName: "wordCandidateContextMenuList"
+ z: 2
+ anchors.left: parent.left
+ anchors.top: parent.top
+ enabled: false
+ model: wordCandidateContextMenuListModel
+ property rect previewRect: Qt.rect(keyboard.x + wordCandidateContextMenuList.x,
+ keyboard.y + wordCandidateContextMenuList.y,
+ wordCandidateContextMenuList.width,
+ wordCandidateContextMenuList.height)
+ }
+
+ ListModel {
+ id: wordCandidateContextMenuListModel
+
+ function selectItem(index) {
+ wordCandidateContextMenu.previousWordCandidateIndex = -1
+ wordCandidateContextMenuList.currentIndex = index
+ keyboard.soundEffect.play(wordCandidateContextMenuList.currentItem.soundEffect)
+ switch (get(index).action) {
+ case "remove":
+ wordCandidateView.model.removeItem(wordCandidateView.currentIndex)
+ break
+ }
+ keyboard.hideWordCandidateContextMenu()
+ }
+ }
+
+ function show(wordCandidateIndex) {
+ if (wordCandidateContextMenu.enabled)
+ wordCandidateContextMenu.hide()
+
+ wordCandidateContextMenuListModel.clear()
+
+ var canRemoveSuggestion = wordCandidateView.model.dataAt(wordCandidateIndex, SelectionListModel.Role.CanRemoveSuggestion)
+ if (canRemoveSuggestion) {
+ var dictionaryType = wordCandidateView.model.dataAt(wordCandidateIndex, SelectionListModel.Role.Dictionary)
+ var removeItemText;
+ switch (dictionaryType) {
+ case SelectionListModel.DictionaryType.User:
+ //~ VirtualKeyboard Context menu for word suggestion if it can be removed from the user dictionary.
+ removeItemText = qsTr("Remove from dictionary")
+ break
+ case SelectionListModel.DictionaryType.Default:
+ // Fallthrough
+ default:
+ //~ VirtualKeyboard Context menu for word suggestion if it can be removed from the default dictionary.
+ removeItemText = qsTr("Block word")
+ break
+ }
+ wordCandidateContextMenuListModel.append({action: "remove", display: removeItemText, wordCompletionLength: 0})
+ }
+
+ if (wordCandidateContextMenuListModel.count === 0)
+ return
+
+ previousWordCandidateIndex = wordCandidateView.currentIndex
+ wordCandidateView.currentIndex = wordCandidateIndex
+
+ wordCandidateContextMenuList.anchors.leftMargin = Qt.binding(function() {
+ if (!wordCandidateView.currentItem)
+ return 0
+ var leftBorder = Math.round(wordCandidateView.mapFromItem(wordCandidateView.currentItem, (wordCandidateView.currentItem.width - wordCandidateContextMenuList.width) / 2, 0).x)
+ var rightBorder = Math.round(wordCandidateContextMenuList.parent.width - wordCandidateContextMenuList.width)
+ return Math.max(0, Math.min(leftBorder, rightBorder))
+ })
+
+ wordCandidateContextMenuList.enabled = true
+ }
+
+ function hide() {
+ if (wordCandidateContextMenuList.enabled) {
+ if (previousWordCandidateIndex !== -1) {
+ wordCandidateView.currentIndex = previousWordCandidateIndex
+ previousWordCandidateIndex = -1
+ }
+ wordCandidateContextMenuList.enabled = false
+ wordCandidateContextMenuList.anchors.leftMargin = undefined
+ wordCandidateContextMenuListModel.clear()
+ }
+ openedByNavigationKeyLongPress = false
+ }
+
+ function selectCurrentItem() {
+ if (active && wordCandidateContextMenuList.currentIndex !== -1)
+ wordCandidateContextMenuListModel.selectItem(wordCandidateContextMenuList.currentIndex)
+ }
+ }
+
+ function showWordCandidateContextMenu(wordCandidateIndex) {
+ wordCandidateContextMenu.show(wordCandidateIndex)
+ }
+
+ function hideWordCandidateContextMenu() {
+ wordCandidateContextMenu.hide()
+ }
+
+ function updateInputMethod() {
+ if (!keyboardLayoutLoader.item)
+ return
+ if (!InputContext.priv.focus)
+ return
+
+ // Reset the custom input method if it is not included in the list of shared layouts
+ if (customInputMethod && !inputMethodNeedsReset && customInputMethodSharedLayouts.indexOf(layoutType) === -1)
+ inputMethodNeedsReset = true
+
+ var customInputMethodToDestroy = null
+ if (inputMethodNeedsReset) {
+ if (customInputMethod) {
+ // Postpones the destruction of the custom input method after creating a new one
+ // and after assigning it to the input engine. This allows the input method to clear
+ // its state before destroying.
+ customInputMethodToDestroy = customInputMethod
+ customInputMethod = null
+ }
+ customInputMethodSharedLayouts = []
+ inputMethodNeedsReset = false
+ }
+
+ var inputMethod = null
+ var inputMode = InputContext.inputEngine.inputMode
+
+ // Use input method from keyboard layout
+ if (keyboardLayoutLoader.item.inputMethod) {
+ inputMethod = keyboardLayoutLoader.item.inputMethod
+ } else if (!customInputMethod) {
+ try {
+ customInputMethod = keyboardLayoutLoader.item.createInputMethod()
+ if (customInputMethod) {
+ // Pull the list of shared layouts from the keyboard layout
+ if (keyboardLayoutLoader.item.sharedLayouts)
+ customInputMethodSharedLayouts = customInputMethodSharedLayouts.concat(keyboardLayoutLoader.item.sharedLayouts)
+
+ // Make sure the current layout is included in the list
+ if (customInputMethodSharedLayouts.indexOf(layoutType) === -1)
+ customInputMethodSharedLayouts.push(layoutType)
+
+ // Reset input mode, since inputEngine.inputModes is updated
+ inputModeNeedsReset = true
+ }
+ } catch (e) {
+ console.error(e.message)
+ }
+ }
+ if (!inputMethod) {
+ if (customInputMethod) {
+ inputMethod = customInputMethod
+ } else if (!VirtualKeyboardSettings.defaultInputMethodDisabled) {
+ inputMethod = defaultInputMethod
+ } else {
+ inputMethod = plainInputMethod
+ }
+ }
+
+ var inputMethodChanged = InputContext.inputEngine.inputMethod !== inputMethod
+ if (inputMethodChanged) {
+ InputContext.inputEngine.inputMethod = inputMethod
+ }
+
+ if (InputContext.inputEngine.inputMethod) {
+ var inputModes = InputContext.inputEngine.inputModes
+ if (inputModes.length > 0) {
+ // Reset to default input mode if the input locale has changed
+ if (inputModeNeedsReset) {
+ inputMode = inputModes[0]
+
+ // Check the current layout for input mode override
+ if (keyboardLayoutLoader.item.inputMode !== -1)
+ inputMode = keyboardLayoutLoader.item.inputMode
+
+ // Update input mode automatically in handwriting mode
+ if (keyboard.handwritingMode) {
+ if (keyboard.dialableCharactersOnly && inputModes.indexOf(InputEngine.InputMode.Dialable) !== -1)
+ inputMode = InputEngine.InputMode.Dialable
+ else if ((keyboard.formattedNumbersOnly || keyboard.digitsOnly) && inputModes.indexOf(InputEngine.InputMode.Numeric) !== -1)
+ inputMode = InputEngine.InputMode.Numeric
+ else if (keyboardLayoutLoader.item.inputMode === -1)
+ inputMode = inputModes[0]
+ }
+
+ // Check the input method hints for input mode overrides
+ if (latinOnly)
+ inputMode = InputEngine.InputMode.Latin
+ if (preferNumbers)
+ inputMode = InputEngine.InputMode.Numeric
+ }
+
+ // Make sure the input mode is supported by the current input method
+ if (inputModes.indexOf(inputMode) === -1)
+ inputMode = inputModes[0]
+
+ if (InputContext.inputEngine.inputMode !== inputMode || inputMethodChanged || inputModeNeedsReset) {
+ InputContext.priv.setKeyboardObserver(keyboardObserver)
+ InputContext.inputEngine.inputMode = inputMode
+ }
+
+ inputModeNeedsReset = false
+ }
+ }
+
+ if (customInputMethodToDestroy !== null)
+ customInputMethodToDestroy.destroy()
+
+ // Clear the toggle shift timer
+ InputContext.priv.shiftHandler.clearToggleShiftTimer()
+ }
+
+ function updateLayout() {
+ var newLayout
+ newLayout = findLayout(locale, layoutType)
+ if (!newLayout.length) {
+ newLayout = findLayout(locale, "main")
+ }
+ layout = newLayout
+ inputLocale = locale
+ updateInputMethod()
+ }
+
+ function updateDefaultLocale() {
+ updateAvailableLocaleIndices()
+ if (layoutsModel.count > 0) {
+ var defaultLocales = []
+ if (isValidLocale(VirtualKeyboardSettings.locale))
+ defaultLocales.push(VirtualKeyboardSettings.locale)
+ if (isValidLocale(InputContext.locale))
+ defaultLocales.push(InputContext.locale)
+ if (VirtualKeyboardSettings.activeLocales.length > 0 && isValidLocale(VirtualKeyboardSettings.activeLocales[0]))
+ defaultLocales.push(VirtualKeyboardSettings.activeLocales[0])
+ if (VirtualKeyboardSettings.availableLocales.indexOf("en_GB") !== -1)
+ defaultLocales.push("en_GB")
+ if (availableLocaleIndices.length > 0)
+ defaultLocales.push(layoutsModel.get(availableLocaleIndices[0], "fileName"))
+ var newDefaultLocaleIndex = -1
+ for (var i = 0; i < defaultLocales.length; i++) {
+ newDefaultLocaleIndex = findLocale(defaultLocales[i], -1)
+ if (availableLocaleIndices.indexOf(newDefaultLocaleIndex) !== -1)
+ break;
+ newDefaultLocaleIndex = -1
+ }
+ defaultLocaleIndex = newDefaultLocaleIndex
+ } else {
+ defaultLocaleIndex = -1
+ }
+ }
+
+ function filterLocaleIndices(filterCb) {
+ var localeIndices = []
+ for (var i = 0; i < layoutsModel.count; i++) {
+ if (localeIndices.indexOf(i) === -1) {
+ var localeName = layoutsModel.get(i, "fileName")
+ if (filterCb(localeName) && findLayout(localeName, "main"))
+ localeIndices.push(i)
+ }
+ }
+ return localeIndices
+ }
+
+ function updateAvailableLocaleIndices() {
+ // Update list of all available locales
+ var fallbackIndex = findFallbackIndex()
+ var newIndices = filterLocaleIndices(function(localeName) {
+ return isValidLocale(localeName)
+ })
+
+ // Handle case where the VirtualKeyboardSettings.activeLocales contains no valid entries
+ // Fetch all locales by ignoring active locales setting
+ var ignoreActiveLocales = newIndices.length === 0
+ if (ignoreActiveLocales) {
+ newIndices = filterLocaleIndices(function(localeName) {
+ return isValidLocale(localeName, ignoreActiveLocales)
+ })
+ }
+
+ // Fetch matching locale names
+ var newAvailableLocales = []
+ for (var i = 0; i < newIndices.length; i++) {
+ newAvailableLocales.push(layoutsModel.get(newIndices[i], "fileName"))
+ }
+
+ newAvailableLocales.sort()
+
+ var sortOrder = !ignoreActiveLocales && VirtualKeyboardSettings.activeLocales.length > 0 ?
+ VirtualKeyboardSettings.activeLocales :
+ newAvailableLocales
+
+ newIndices.sort(function(localeIndexA, localeIndexB) {
+ var localeNameA = layoutsModel.get(localeIndexA, "fileName")
+ var localeNameB = layoutsModel.get(localeIndexB, "fileName")
+ var sortIndexA = sortOrder.indexOf(localeNameA)
+ var sortIndexB = sortOrder.indexOf(localeNameB)
+ return sortIndexA - sortIndexB
+ })
+
+ availableLocaleIndices = newIndices
+ InputContext.priv.updateAvailableLocales(newAvailableLocales)
+
+ // Update list of custom locale indices
+ newIndices = []
+ for (i = 0; i < availableLocaleIndices.length; i++) {
+ if (availableLocaleIndices[i] === localeIndex ||
+ layoutExists(layoutsModel.get(availableLocaleIndices[i], "fileName"), layoutType))
+ newIndices.push(availableLocaleIndices[i])
+ }
+ availableCustomLocaleIndices = newIndices
+ }
+
+ function listLocales(customLayoutsOnly, localeNameOnly) {
+ var locales = []
+ var localeIndices = customLayoutsOnly ? availableCustomLocaleIndices : availableLocaleIndices
+ for (var i = 0; i < localeIndices.length; i++) {
+ var layoutFolder = layoutsModel.get(localeIndices[i], "fileName")
+ if (localeNameOnly)
+ locales.push(layoutFolder)
+ else
+ locales.push({locale:Qt.locale(layoutFolder), index:localeIndices[i], name:layoutFolder})
+ }
+ return locales
+ }
+
+ function nextLocaleIndex(customLayoutsOnly) {
+ var newLocaleIndex = localeIndex
+ var localeIndices = customLayoutsOnly ? availableCustomLocaleIndices : availableLocaleIndices
+ var i = localeIndices.indexOf(localeIndex)
+ if (i !== -1) {
+ i = (i + 1) % localeIndices.length
+ newLocaleIndex = localeIndices[i]
+ }
+ return newLocaleIndex
+ }
+
+ function changeInputLanguage(customLayoutsOnly) {
+ var newLocaleIndex = nextLocaleIndex(customLayoutsOnly)
+ if (newLocaleIndex !== -1 && newLocaleIndex !== localeIndex)
+ localeIndex = newLocaleIndex
+ }
+
+ function canChangeInputLanguage(customLayoutsOnly) {
+ if (customLayoutsOnly)
+ return availableCustomLocaleIndices.length > 1
+ return availableLocaleIndices.length > 1
+ }
+
+ function findLocale(localeName, defaultValue) {
+ var languageCode = localeName.substring(0, 3) // Including the '_' delimiter
+ var languageMatch = -1
+ for (var i = 0; i < layoutsModel.count; i++) {
+ if (!layoutsModel.isFolder(i))
+ continue
+ var layoutFolder = layoutsModel.get(i, "fileName")
+ if (layoutFolder === localeName)
+ return i
+ if (languageMatch == -1 && layoutFolder.substring(0, 3) === languageCode)
+ languageMatch = i
+ }
+ return (languageMatch != -1) ? languageMatch : defaultValue
+ }
+
+ function findFallbackIndex() {
+ for (var i = 0; i < layoutsModel.count; i++) {
+ var layoutFolder = layoutsModel.get(i, "fileName")
+ if (layoutFolder === "fallback")
+ return i
+ }
+ return -1
+ }
+
+ function isValidLocale(localeNameOrIndex, ignoreActiveLocales) {
+ var localeName
+ if (typeof localeNameOrIndex == "number") {
+ if (localeNameOrIndex < 0 || localeNameOrIndex >= layoutsModel.count)
+ return false
+ localeName = layoutsModel.get(localeNameOrIndex, "fileName")
+ } else {
+ localeName = localeNameOrIndex
+ }
+
+ if (!localeName)
+ return false
+
+ if (localeName === "fallback")
+ return false
+
+ if (Qt.locale(localeName).name === "C")
+ return false
+
+ if (ignoreActiveLocales !== true &&
+ VirtualKeyboardSettings.activeLocales.length > 0 &&
+ VirtualKeyboardSettings.activeLocales.indexOf(localeName) === -1)
+ return false
+
+ return true
+ }
+
+ function getLayoutFile(localeName, layoutType) {
+ if (localeName === "" || layoutType === "")
+ return ""
+ return layoutsModel.folder + "/" + localeName + "/" + layoutType + ".qml"
+ }
+
+ function getFallbackFile(localeName, layoutType) {
+ if (localeName === "" || layoutType === "")
+ return ""
+ return layoutsModel.folder + "/" + localeName + "/" + layoutType + ".fallback"
+ }
+
+ function layoutExists(localeName, layoutType) {
+ var result = InputContext.priv.fileExists(getLayoutFile(localeName, layoutType))
+ if (!result && layoutType === "handwriting")
+ result = InputContext.priv.fileExists(getFallbackFile(localeName, layoutType))
+ return result
+ }
+
+ function findLayout(localeName, layoutType) {
+ var layoutFile = getLayoutFile(localeName, layoutType)
+ if (InputContext.priv.fileExists(layoutFile))
+ return layoutFile
+ var fallbackFile = getFallbackFile(localeName, layoutType)
+ if (InputContext.priv.fileExists(fallbackFile)) {
+ layoutFile = getLayoutFile("fallback", layoutType)
+ if (InputContext.priv.fileExists(layoutFile))
+ return layoutFile
+ }
+ return ""
+ }
+
+ function isHandwritingAvailable() {
+ if (VirtualKeyboardSettings.handwritingModeDisabled)
+ return false
+ return VirtualKeyboardFeatures.Handwriting && layoutExists(locale, "handwriting")
+ }
+
+ function setHandwritingMode(enabled, resetInputMode) {
+ if (VirtualKeyboardSettings.handwritingModeDisabled)
+ return
+ if (enabled && resetInputMode)
+ inputModeNeedsReset = true
+ handwritingMode = enabled
+ }
+
+ function notifyLayoutChanged() {
+ Qt.callLater(function() {
+ if (keyboardLayoutLoader.item != null) keyboardObserver.layoutChanged()
+ })
+ }
+
+ function doKeyboardFunction(keyboardFunction) {
+ if (!isKeyboardFunctionAvailable(keyboardFunction))
+ return
+ switch (keyboardFunction) {
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
+ InputContext.priv.hideInputPanel()
+ break
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
+ if (style.languagePopupListEnabled) {
+ if (!languagePopupListActive) {
+ showLanguagePopup(activeKey, false)
+ } else {
+ hideLanguagePopup()
+ }
+ } else {
+ const customLayoutsOnly = arguments.length == 2 && arguments[1]
+ changeInputLanguage(customLayoutsOnly)
+ }
+ break
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
+ setHandwritingMode(!handwritingMode)
+ break
+ default:
+ console.warn("Unknown keyboard function '%1'".arg(keyboardFunction))
+ break
+ }
+ }
+
+ function isKeyboardFunctionAvailable(keyboardFunction) {
+ switch (keyboardFunction) {
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
+ return true
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
+ const customLayoutsOnly = arguments.length == 2 && arguments[1]
+ return canChangeInputLanguage(customLayoutsOnly)
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
+ return isHandwritingAvailable()
+ default:
+ return false
+ }
+ }
+
+ function isFunctionPopupListAvailable() {
+ const allFunctionKeys = QtVirtualKeyboard.KeyboardFunctionKeys.Hide |
+ QtVirtualKeyboard.KeyboardFunctionKeys.Language
+ return (VirtualKeyboardSettings.visibleFunctionKeys & allFunctionKeys) !== allFunctionKeys ||
+ isHandwritingAvailable()
+ }
+}
diff --git a/src/components/KeyboardColumn.qml b/src/components/KeyboardColumn.qml
new file mode 100644
index 00000000..1c5c14eb
--- /dev/null
+++ b/src/components/KeyboardColumn.qml
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+
+/*!
+ \qmltype KeyboardColumn
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \inherits ColumnLayout
+
+ \brief Keyboard column for keyboard layouts.
+
+ This type can be used in special cases where multiple columns
+ are added to a single keyboard layout.
+*/
+
+ColumnLayout {
+ /*! Sets the key weight for all children keys.
+
+ The default value is inherited from the parent element
+ in the layout hierarchy.
+ */
+ property real keyWeight: parent ? parent.keyWeight : undefined
+
+ /*! \since QtQuick.VirtualKeyboard 2.0
+
+ Sets the \c smallTextVisible for all children keys.
+
+ The default value is inherited from the parent element
+ in the layout hierarchy.
+ */
+ property bool smallTextVisible: parent ? parent.smallTextVisible : false
+
+ spacing: 0
+}
diff --git a/src/components/KeyboardLayout.qml b/src/components/KeyboardLayout.qml
new file mode 100644
index 00000000..f47ff01d
--- /dev/null
+++ b/src/components/KeyboardLayout.qml
@@ -0,0 +1,163 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype KeyboardLayout
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \inherits ColumnLayout
+
+ \brief Keyboard layout.
+
+ This type is the root element of the keyboard layout.
+ Use this element to build a new keyboard layout.
+
+ Example:
+
+ \code
+ import QtQuick
+ import QtQuick.Layouts
+ import QtQuick.VirtualKeyboard
+
+ // file: layouts/en_GB/main.qml
+
+ KeyboardLayout {
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ }
+ }
+ \endcode
+*/
+
+ColumnLayout {
+ id: root
+
+ /*! Sets the input method to be used in this layout.
+
+ This property allows a custom input method to be
+ used in this layout.
+ */
+ property var inputMethod
+
+ /*! This function may be overridden by the keyboard layout
+ to create the input method object dynamically. The default
+ implementation returns \c null.
+
+ The input method object created by this function can outlive
+ keyboard layout transitions in certain cases. In particular,
+ this applies to the transitions between the layouts listed in
+ the sharedLayouts property.
+ */
+ function createInputMethod() {
+ return null
+ }
+
+ /*! List of layout names which share the input method created
+ by the createInputMethod() function.
+
+ If the list is empty (the default) the input method is not
+ shared with any other layout and will be destroyed when the
+ layout changes.
+
+ The list should contain only the name of the layout type,
+ e.g., ['symbols']. The current layout does not have to be
+ included in the list.
+ */
+ property var sharedLayouts
+
+ /*! Sets the input mode to be used in this layout.
+
+ By default, the virtual keyboard attempts to preserve
+ the current input mode when switching to a different
+ keyboard layout.
+
+ If the current input mode is not valid in the current
+ context, the default input mode is specified by the
+ input method.
+ */
+ property int inputMode: -1
+
+ /*! Sets the key weight for all children keys.
+
+ The default value is inherited from the parent element
+ in the layout hierarchy.
+ */
+ property real keyWeight
+
+ /*! \since QtQuick.VirtualKeyboard 2.0
+
+ Sets the \c smallTextVisible for all children keys.
+
+ The default value is inherited from the parent element
+ in the layout hierarchy.
+ */
+ property bool smallTextVisible
+
+ spacing: 0
+
+ function scanLayout() {
+ var layout = {
+ width: root.width,
+ height: root.height,
+ keys: []
+ }
+ __scanLayoutRecursive(this, layout)
+ return layout
+ }
+
+ function __scanLayoutRecursive(parent, layout) {
+ for (var i in parent.children) {
+ var child = parent.children[i]
+ if (child.keyType !== undefined) {
+ var pos = mapFromItem(child, 0, 0)
+ var key = {
+ left: pos.x,
+ top: pos.y,
+ width: child.width,
+ height: child.height,
+ keyType: child.keyType,
+ key: child.key,
+ text: child.text,
+ altKeys: child.effectiveAlternativeKeys,
+ isFunctionKey: child.functionKey,
+ noKeyEvent: child.noKeyEvent
+ }
+ if (key.left + key.width > layout.width)
+ layout.width = key.left + key.width
+ if (key.top + key.height > layout.height)
+ layout.height = key.top + key.height
+ layout.keys.push(key)
+ } else {
+ __scanLayoutRecursive(child, layout)
+ }
+ }
+ }
+}
diff --git a/src/components/KeyboardLayoutLoader.qml b/src/components/KeyboardLayoutLoader.qml
new file mode 100644
index 00000000..9c31ff1f
--- /dev/null
+++ b/src/components/KeyboardLayoutLoader.qml
@@ -0,0 +1,115 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype KeyboardLayoutLoader
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \inherits Loader
+ \since QtQuick.VirtualKeyboard 1.1
+
+ \brief Allows dynamic loading of keyboard layout.
+
+ This type is useful for keyboard layouts consisting of multiple pages of keys.
+
+ A single keyboard layout (a page) is defined by using the Component
+ as a container. The active keyboard layout can then be changed by
+ setting the sourceComponent property to a different value.
+
+ Example:
+
+ \code
+ import QtQuick
+ import QtQuick.Layouts
+ import QtQuick.VirtualKeyboard
+
+ // file: layouts/en_GB/symbols.qml
+
+ KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ // Keyboard layout definition for page 1
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ // Keyboard layout definition for page 2
+ }
+ }
+ }
+ \endcode
+*/
+
+Loader {
+ /*! Sets the input method for all the keyboard layouts loaded
+ in this context.
+
+ The input method can either be set separately for each keyboard
+ layout, or commonly at this context. If set separately, then this
+ property should not be modified.
+ */
+ property var inputMethod: item ? item.inputMethod : null
+
+ /*! This function may be overridden by the keyboard layout
+ to create the input method object dynamically. The default
+ implementation forwards the call to the child keyboard
+ layout.
+
+ The input method object created by this function can outlive
+ keyboard layout transitions in certain cases. In particular,
+ this applies to the transitions between the layouts listed in
+ the sharedLayouts property.
+ */
+ function createInputMethod() {
+ return item ? item.createInputMethod() : null
+ }
+
+ /*! List of layout names which share the input method created
+ by the createInputMethod() function.
+
+ If the list is empty (the default) the input method is not
+ shared with any other layout and will be destroyed when the
+ layout changes.
+
+ The list should contain only the name of the layout type,
+ e.g., ['symbols']. The current layout does not have to be
+ included in the list.
+ */
+ property var sharedLayouts: item ? item.sharedLayouts : null
+
+ /*! Sets the input mode for all the keyboard layouts loaded
+ in this context.
+
+ The input mode can either be set separately for each keyboard
+ layout, or commonly at this context. If set separately, then this
+ property should not be modified.
+ */
+ property int inputMode: item ? item.inputMode : -1
+
+ property int __updateCount
+
+ active: parent !== null
+
+ onItemChanged: {
+ if (parent && item && __updateCount++ > 0) {
+ if (!keyboard.inputMethodNeedsReset)
+ keyboard.updateInputMethod()
+ keyboard.notifyLayoutChanged()
+ }
+ }
+
+ function scanLayout() {
+ if (item === null)
+ return null
+ return item.scanLayout()
+ }
+}
diff --git a/src/components/KeyboardRow.qml b/src/components/KeyboardRow.qml
new file mode 100644
index 00000000..30dc1663
--- /dev/null
+++ b/src/components/KeyboardRow.qml
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+
+/*!
+ \qmltype KeyboardRow
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \inherits RowLayout
+
+ \brief Keyboard row for keyboard layouts.
+
+ Specifies a row of keys in the keyboard layout.
+*/
+
+RowLayout {
+ /*! Sets the key weight for all children keys.
+
+ The default value is inherited from the parent element
+ in the layout hierarchy.
+ */
+ property real keyWeight: parent ? parent.keyWeight : undefined
+
+ /*! \since QtQuick.VirtualKeyboard 2.0
+
+ Sets the \c smallTextVisible for all children keys.
+
+ The default value is inherited from the parent element
+ in the layout hierarchy.
+ */
+ property bool smallTextVisible: parent ? parent.smallTextVisible : false
+
+ spacing: 0
+}
diff --git a/src/components/ModeKey.qml b/src/components/ModeKey.qml
new file mode 100644
index 00000000..63134c13
--- /dev/null
+++ b/src/components/ModeKey.qml
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype ModeKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Key
+ \since QtQuick.VirtualKeyboard 2.0
+
+ \brief Generic mode key for keyboard layouts.
+
+ This key provides generic mode button functionality.
+
+ A key press toggles the current mode without emitting key event
+ for input method processing.
+
+ ModeKey can be used in situations where a particular mode is switched
+ "ON / OFF", and where the mode change does not require changing the
+ keyboard layout. When this component is used, the \l { BaseKey::displayText } { displayText } should
+ remain the same regardless of the mode, because the keyboard style
+ visualizes the status.
+*/
+
+Key {
+ /*! This property provides the current mode.
+
+ The default is false.
+ */
+ property bool mode
+ keyType: QtVirtualKeyboard.KeyType.ModeKey
+ noKeyEvent: true
+ functionKey: true
+ highlighted: true
+ onClicked: mode = !mode
+ keyPanelDelegate: keyboard.style ? keyboard.style.modeKeyPanel : undefined
+}
diff --git a/src/components/MultiSoundEffect.qml b/src/components/MultiSoundEffect.qml
new file mode 100644
index 00000000..d038b19b
--- /dev/null
+++ b/src/components/MultiSoundEffect.qml
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtMultimedia
+
+Item {
+ id: multiSoundEffect
+ property url source
+ property int maxInstances: 2
+ property var __cachedInstances
+ property int __currentIndex: 0
+
+ signal playingChanged(url source, bool playing)
+
+ Component {
+ id: soundEffectComp
+ SoundEffect {
+ source: multiSoundEffect.source
+ onPlayingChanged: multiSoundEffect.playingChanged(source, playing)
+ }
+ }
+
+ onSourceChanged: {
+ __cachedInstances = []
+ __currentIndex = 0
+ if (source != Qt.resolvedUrl("")) {
+ var i
+ for (i = 0; i < maxInstances; i++) {
+ var soundEffect = soundEffectComp.createObject(multiSoundEffect)
+ if (soundEffect === null)
+ return
+ __cachedInstances.push(soundEffect)
+ }
+ }
+ }
+
+ function play() {
+ if (__cachedInstances === undefined || __cachedInstances.length === 0)
+ return
+ if (__cachedInstances[__currentIndex].playing) {
+ __cachedInstances[__currentIndex].stop()
+ __currentIndex = (__currentIndex + 1) % __cachedInstances.length
+ }
+ __cachedInstances[__currentIndex].play()
+ }
+}
diff --git a/src/components/MultitapInputMethod.qml b/src/components/MultitapInputMethod.qml
new file mode 100644
index 00000000..8e4ad4d7
--- /dev/null
+++ b/src/components/MultitapInputMethod.qml
@@ -0,0 +1,106 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+InputMethod {
+ property string multitapSequence
+ property int multitapIndex: -1
+
+ onMultitapSequenceChanged: selectionListChanged(SelectionListModel.Type.WordCandidateList)
+ onMultitapIndexChanged: selectionListActiveItemChanged(SelectionListModel.Type.WordCandidateList, multitapIndex)
+
+ property variant multiTapTimer: Timer {
+ interval: 1200
+ onTriggered: {
+ update()
+ }
+ }
+
+ function inputModes(locale) {
+ return [InputEngine.InputMode.Latin, InputEngine.InputMode.Numeric, InputEngine.InputMode.Dialable];
+ }
+
+ function setInputMode(locale, inputMode) {
+ return true
+ }
+
+ function setTextCase(textCase) {
+ return true
+ }
+
+ function reset() {
+ multiTapTimer.stop()
+ multitapIndex = -1
+ multitapSequence = ""
+ }
+
+ function update() {
+ multiTapTimer.stop()
+ multitapIndex = -1
+ multitapSequence = ""
+ if (inputContext !== null && inputContext.preeditText.length > 0) {
+ inputContext.commit()
+ }
+ }
+
+ function keyEvent(key, text, modifiers) {
+ var accept = false
+ switch (key) {
+ case Qt.Key_Enter:
+ case Qt.Key_Return:
+ case Qt.Key_Tab:
+ update()
+ break
+ case Qt.Key_Backspace:
+ if (inputContext.preeditText.length > 0) {
+ inputContext.clear()
+ update()
+ accept = true
+ }
+ break
+ default:
+ if (key !== inputEngine.previousKey) {
+ update()
+ }
+ multitapSequence = text
+ if (multitapSequence.length > 1) {
+ multitapIndex = multiTapTimer.running ? (multitapIndex + 1) % multitapSequence.length : 0
+ inputContext.preeditText = multitapSequence.charAt(multitapIndex)
+ multiTapTimer.restart()
+ } else {
+ inputContext.commit(text)
+ }
+ accept = true
+ break
+ }
+ return accept;
+ }
+
+ function selectionLists() {
+ return [SelectionListModel.Type.WordCandidateList];
+ }
+
+ function selectionListItemCount(type) {
+ return multitapSequence.length > 1 ? multitapSequence.length : 0
+ }
+
+ function selectionListData(type, index, role) {
+ var result = null
+ switch (role) {
+ case SelectionListModel.Role.Display:
+ result = multitapSequence.charAt(index)
+ break
+ default:
+ break
+ }
+ return result
+ }
+
+ function selectionListItemSelected(type, index) {
+ multitapIndex = index
+ inputContext.preeditText = multitapSequence.charAt(multitapIndex)
+ update()
+ }
+}
diff --git a/src/components/NumberKey.qml b/src/components/NumberKey.qml
new file mode 100644
index 00000000..2a55d824
--- /dev/null
+++ b/src/components/NumberKey.qml
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype NumberKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Key
+
+ \brief Specialized number key for keyboard layouts.
+
+ This key emits the key code and key text for input method processing.
+ A NumberKey differs from a normal \l Key in that it does not show a
+ character preview.
+*/
+
+Key {
+ showPreview: false
+ keyType: QtVirtualKeyboard.KeyType.NumberKey
+}
diff --git a/src/components/PopupList.qml b/src/components/PopupList.qml
new file mode 100644
index 00000000..56f45187
--- /dev/null
+++ b/src/components/PopupList.qml
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+ListView {
+ property int maxVisibleItems: 5
+ readonly property int preferredVisibleItems: count < maxVisibleItems ? count : maxVisibleItems
+ readonly property real contentWidth: contentItem.childrenRect.width
+ property alias defaultHighlight: defaultHighlight
+
+ clip: true
+ visible: enabled && count > 0
+ width: contentWidth
+ height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
+ orientation: ListView.Vertical
+ snapMode: ListView.SnapToItem
+ delegate: keyboard.style.popupListDelegate
+ highlight: keyboard.style.popupListHighlight ? keyboard.style.popupListHighlight : defaultHighlight
+ highlightMoveDuration: 0
+ highlightResizeDuration: 0
+ add: !keyboard.noAnimations ? keyboard.style.popupListAdd : null
+ remove: !keyboard.noAnimations ? keyboard.style.popupListRemove : null
+ keyNavigationWraps: true
+
+ onCurrentItemChanged: if (currentItem) keyboard.soundEffect.register(currentItem.soundEffect)
+
+ Component {
+ id: defaultHighlight
+ Item {}
+ }
+}
diff --git a/src/components/SelectionControl.qml b/src/components/SelectionControl.qml
new file mode 100644
index 00000000..3708b4c8
--- /dev/null
+++ b/src/components/SelectionControl.qml
@@ -0,0 +1,74 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+Item {
+ id: root
+ property bool handleIsMoving: false
+ property var inputContext: InputContext
+ visible: enabled && (inputContext.selectionControlVisible || handleIsMoving) && !InputContext.animating
+
+ Loader {
+ id: anchorHandle
+ sourceComponent: keyboard.style.selectionHandle
+ x: visible ? inputContext.anchorRectangle.x - width/2 : 0
+ y: visible ? inputContext.anchorRectangle.y + inputContext.anchorRectangle.height : 0
+
+ Behavior on opacity {
+ NumberAnimation { duration: 200 }
+ }
+ opacity: inputContext !== null && inputContext.anchorRectIntersectsClipRect ? 1.0 : 0.0
+
+ MouseArea {
+ width: parent.width * 2
+ height: width * 1.12
+ anchors.centerIn: parent
+ onPositionChanged: {
+ // we don't move the handles, the handles will move as the selection changes.
+ // The middle of a handle is mapped to the middle of the line above it
+ root.handleIsMoving = true
+ var xx = x + anchorHandle.x + mouse.x
+ var yy = y + anchorHandle.y + mouse.y - (anchorHandle.height + inputContext.anchorRectangle.height)/2
+ var x2 = cursorHandle.x + cursorHandle.width/2
+ var y2 = cursorHandle.y - inputContext.cursorRectangle.height/2
+ inputContext.setSelectionOnFocusObject(Qt.point(xx,yy), Qt.point(x2,y2))
+ }
+ onReleased: {
+ root.handleIsMoving = false
+ }
+ }
+ }
+
+ // selection cursor handle
+ Loader {
+ id: cursorHandle
+ sourceComponent: keyboard.style.selectionHandle
+ x: visible ? inputContext.cursorRectangle.x - width/2 : 0
+ y: visible ? inputContext.cursorRectangle.y + inputContext.cursorRectangle.height : 0
+
+ Behavior on opacity {
+ NumberAnimation { duration: 200 }
+ }
+ opacity: inputContext !== null && inputContext.cursorRectIntersectsClipRect ? 1.0 : 0.0
+
+ MouseArea {
+ width: parent.width * 2
+ height: width * 1.12
+ anchors.centerIn: parent
+ onPositionChanged: {
+ // we don't move the handles, the handles will move as the selection changes.
+ root.handleIsMoving = true
+ var xx = anchorHandle.x + anchorHandle.width/2
+ var yy = anchorHandle.y - inputContext.anchorRectangle.height/2
+ var x2 = x + cursorHandle.x + mouse.x
+ var y2 = y + cursorHandle.y + mouse.y - (cursorHandle.height + inputContext.cursorRectangle.height)/2
+ inputContext.setSelectionOnFocusObject(Qt.point(xx, yy), Qt.point(x2, y2))
+ }
+ onReleased: {
+ root.handleIsMoving = false
+ }
+ }
+ }
+}
diff --git a/src/components/ShadowInputControl.qml b/src/components/ShadowInputControl.qml
new file mode 100644
index 00000000..064a93fa
--- /dev/null
+++ b/src/components/ShadowInputControl.qml
@@ -0,0 +1,129 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
+import QtQml
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+Item {
+ id: control
+ property alias textEdit: shadowInput
+
+ enabled: keyboard.active && VirtualKeyboardSettings.fullScreenMode
+
+ MouseArea {
+ anchors.fill: parent
+ }
+
+ onXChanged: InputContext.priv.shadow.updateSelectionProperties()
+ onYChanged: InputContext.priv.shadow.updateSelectionProperties()
+
+ Loader {
+ sourceComponent: keyboard.style.fullScreenInputContainerBackground
+ anchors.fill: parent
+ Loader {
+ id: fullScreenInputBackground
+ sourceComponent: keyboard.style.fullScreenInputBackground
+ anchors.fill: parent
+ anchors.margins: keyboard.style.fullScreenInputMargins
+ z: 1
+ Flickable {
+ id: flickable
+ clip: true
+ z: 2
+ width: parent.width
+ height: parent.height
+ flickableDirection: Flickable.HorizontalFlick
+ interactive: contentWidth > width
+ contentWidth: shadowInput.width
+ onContentXChanged: InputContext.priv.shadow.updateSelectionProperties()
+
+ function ensureVisible(rectangle) {
+ if (contentX >= rectangle.x)
+ contentX = rectangle.x
+ else if (contentX + width <= rectangle.x + rectangle.width)
+ contentX = rectangle.x + rectangle.width - width;
+ }
+
+ TextInput {
+ id: shadowInput
+ objectName: "shadowInput"
+ property bool blinkStatus: true
+ width: Math.max(flickable.width, implicitWidth)
+ height: implicitHeight
+ anchors.verticalCenter: parent.verticalCenter
+ leftPadding: keyboard.style.fullScreenInputPadding
+ rightPadding: keyboard.style.fullScreenInputPadding
+ activeFocusOnPress: false
+ font: keyboard.style.fullScreenInputFont
+ inputMethodHints: InputContext.inputMethodHints
+ cursorDelegate: keyboard.style.fullScreenInputCursor
+ passwordCharacter: keyboard.style.fullScreenInputPasswordCharacter
+ color: keyboard.style.fullScreenInputColor
+ selectionColor: keyboard.style.fullScreenInputSelectionColor
+ selectedTextColor: keyboard.style.fullScreenInputSelectedTextColor
+ echoMode: (InputContext.inputMethodHints & Qt.ImhHiddenText) ? TextInput.Password : TextInput.Normal
+ selectByMouse: !!InputContext.inputItem && !!InputContext.inputItem.selectByMouse
+ onCursorPositionChanged: {
+ cursorSyncTimer.restart()
+ blinkStatus = true
+ if (cursorTimer.running)
+ cursorTimer.restart()
+ }
+ onSelectionStartChanged: cursorSyncTimer.restart()
+ onSelectionEndChanged: cursorSyncTimer.restart()
+ onCursorRectangleChanged: flickable.ensureVisible(cursorRectangle)
+
+ function getAnchorPosition() {
+ if (selectionStart == selectionEnd)
+ return cursorPosition
+ else if (selectionStart == cursorPosition)
+ return selectionEnd
+ else
+ return selectionStart
+ }
+
+ Timer {
+ id: cursorSyncTimer
+ interval: 0
+ onTriggered: {
+ var anchorPosition = shadowInput.getAnchorPosition()
+ if (anchorPosition !== InputContext.anchorPosition || shadowInput.cursorPosition !== InputContext.cursorPosition)
+ InputContext.priv.forceCursorPosition(anchorPosition, shadowInput.cursorPosition)
+ }
+ }
+
+ Timer {
+ id: cursorTimer
+ interval: Qt.styleHints.cursorFlashTime / 2
+ repeat: true
+ running: control.visible
+ onTriggered: shadowInput.blinkStatus = !shadowInput.blinkStatus
+ }
+ }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ if (VirtualKeyboardSettings.fullScreenMode) {
+ InputContext.priv.shadow.inputItem = shadowInput
+ }
+ }
+ Connections {
+ target: VirtualKeyboardSettings
+ function onFullScreenModeChanged() {
+ InputContext.priv.shadow.inputItem = VirtualKeyboardSettings.fullScreenMode ? shadowInput : null
+ }
+ }
+ Connections {
+ target: InputContext.priv.shadow
+ function onInputItemChanged() {
+ cursorSyncTimer.stop()
+ if (!InputContext.priv.shadow.inputItem)
+ shadowInput.clear()
+ }
+ }
+}
diff --git a/src/components/ShiftKey.qml b/src/components/ShiftKey.qml
new file mode 100644
index 00000000..a2623395
--- /dev/null
+++ b/src/components/ShiftKey.qml
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype ShiftKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits BaseKey
+
+ \brief Shift key for keyboard layouts.
+
+ This key changes the shift state of the keyboard.
+*/
+
+BaseKey {
+ id: shiftKey
+ keyType: QtVirtualKeyboard.KeyType.ShiftKey
+ key: Qt.Key_Shift
+ enabled: InputContext.priv.shiftHandler.toggleShiftEnabled
+ highlighted: true
+ functionKey: true
+ keyPanelDelegate: keyboard.style ? keyboard.style.shiftKeyPanel : undefined
+ onClicked: InputContext.priv.shiftHandler.toggleShift()
+}
diff --git a/src/components/SpaceKey.qml b/src/components/SpaceKey.qml
new file mode 100644
index 00000000..d8313a6c
--- /dev/null
+++ b/src/components/SpaceKey.qml
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype SpaceKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Key
+
+ \brief Space key for keyboard layouts.
+
+ This key emits a space for input method processing.
+*/
+
+Key {
+ keyType: QtVirtualKeyboard.KeyType.SpaceKey
+ text: " "
+ displayText: ""
+ repeat: true
+ showPreview: false
+ highlighted: true
+ key: Qt.Key_Space
+ keyPanelDelegate: keyboard.style ? keyboard.style.spaceKeyPanel : undefined
+}
diff --git a/src/components/SymbolModeKey.qml b/src/components/SymbolModeKey.qml
new file mode 100644
index 00000000..662ce8ac
--- /dev/null
+++ b/src/components/SymbolModeKey.qml
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype SymbolModeKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Key
+
+ \brief Symbol mode key for keyboard layouts.
+
+ This key toggles between the symbol mode layout and the main layout.
+*/
+
+Key {
+ keyType: QtVirtualKeyboard.KeyType.SymbolModeKey
+ key: Qt.Key_Context1
+ displayText: "&123"
+ functionKey: true
+ highlighted: true
+ onClicked: keyboard.symbolMode = !keyboard.symbolMode
+ keyPanelDelegate: keyboard.style ? keyboard.style.symbolKeyPanel : undefined
+}
diff --git a/src/components/TraceInputArea.qml b/src/components/TraceInputArea.qml
new file mode 100644
index 00000000..2e403170
--- /dev/null
+++ b/src/components/TraceInputArea.qml
@@ -0,0 +1,198 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+
+/*!
+ \qmltype TraceInputArea
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \inherits MultiPointTouchArea
+ \since QtQuick.VirtualKeyboard 2.0
+
+ \brief A specialized MultiPointTouchArea for collecting touch input data.
+
+ This type handles the trace interaction between the touch screen and the input engine.
+
+ The traces are rendered using the delegate from the
+ \l {KeyboardStyle::}{traceCanvasDelegate} property of the current
+ \l KeyboardStyle.
+*/
+
+MultiPointTouchArea {
+ id: traceInputArea
+
+ /*! Pattern recognition mode of this input area.
+
+ The default value is \l {InputEngine::patternRecognitionModes} {InputEngine.PatternRecognitionMode.None}.
+ */
+ property int patternRecognitionMode: InputEngine.PatternRecognitionMode.None
+
+ /*! List of horizontal rulers in the input area.
+
+ The rulers are defined as a number of pixels from the top edge of the boundingBox.
+
+ Here is an example that demonstrates how to define rulers:
+
+ \code
+ horizontalRulers: [boundingBox.height / 3, boundingBox.height / 3 * 2]
+ verticalRulers: [boundingBox.width / 3, boundingBox.width / 3 * 2]
+ \endcode
+ */
+ property var horizontalRulers
+
+ /*! List of vertical rulers in the input area.
+
+ The rulers are defined as a number of pixels from the left edge of the boundingBox.
+ */
+ property var verticalRulers
+
+ /*! Bounding box for the trace input.
+
+ This property is readonly and is automatically updated based on the item size
+ and margins.
+ */
+ readonly property rect boundingBox: (width > 0 && height > 0) ?
+ Qt.rect(traceInputArea.x + traceInputArea.anchors.leftMargin,
+ traceInputArea.y + traceInputArea.anchors.topMargin,
+ traceInputArea.width,
+ traceInputArea.height) :
+ Qt.rect(0, 0, 0, 0)
+
+ /*! Canvas type of this trace input area.
+
+ This property can be used to distinguish between different types of canvases.
+ For example, in full screen handwriting mode this property is set to \c "fullscreen", and
+ in keyboard handwriting mode this property is set to \c "keyboard".
+ */
+ property string canvasType
+
+ property var __activeTraceCanvases: ({})
+ property var __traceCanvasList: ([])
+ property var __recycledTraceCanvasList: ([])
+
+ Component.onCompleted: {
+ for (var i = 0; i < 6; i++) {
+ __recycledTraceCanvasList.push(__createTraceCanvas())
+ }
+ }
+
+ function __getTraceCanvas() {
+ while (__recycledTraceCanvasList.length == 0 &&
+ __traceCanvasList.length >= 15 &&
+ !__traceCanvasList.shift().recycle()) {}
+
+ return __recycledTraceCanvasList.length > 0 ?
+ __recycledTraceCanvasList.pop() :
+ __createTraceCanvas()
+ }
+
+ function __createTraceCanvas() {
+ var traceCanvas = keyboard.style.traceCanvasDelegate.createObject(traceInputArea)
+ traceCanvas.onRecycle.connect(__onTraceCanvasRecycled)
+ traceCanvas.anchors.fill = traceCanvas.parent
+ return traceCanvas
+ }
+
+ function __onTraceCanvasRecycled(traceCanvas) {
+ var index = __traceCanvasList.findIndex(function(otherCanvas) {
+ return traceCanvas === otherCanvas
+ })
+ if (index !== -1) {
+ __traceCanvasList.splice(index, index + 1)
+ }
+ __recycledTraceCanvasList.push(traceCanvas)
+ }
+
+ property var __traceCaptureDeviceInfo:
+ ({
+ channels: ['t'],
+ sampleRate: 60,
+ uniform: false,
+ latency: 0.0,
+ dpi: Screen.pixelDensity * 25.4
+ })
+ property var __traceScreenInfo:
+ ({
+ boundingBox: traceInputArea.boundingBox,
+ horizontalRulers: traceInputArea.horizontalRulers,
+ verticalRulers: traceInputArea.verticalRulers,
+ canvasType: traceInputArea.canvasType
+ })
+
+ enabled: patternRecognitionMode !== InputEngine.PatternRecognitionMode.None && InputContext.inputEngine.patternRecognitionModes.indexOf(patternRecognitionMode) !== -1
+
+ onPressed: (touchPoints) => {
+ if (!keyboard.style.traceCanvasDelegate)
+ return
+ for (var i = 0; i < touchPoints.length; i++) {
+ var traceId = touchPoints[i].pointId
+ var trace = InputContext.inputEngine.traceBegin(traceId, patternRecognitionMode, __traceCaptureDeviceInfo, __traceScreenInfo)
+ if (trace) {
+ var traceCanvas = __getTraceCanvas()
+ if (traceCanvas) {
+ traceCanvas.trace = trace
+ var index = trace.addPoint(Qt.point(touchPoints[i].x, touchPoints[i].y))
+ if (trace.channels.indexOf('t') !== -1) {
+ var dt = new Date()
+ trace.setChannelData('t', index, dt.getTime())
+ }
+ __activeTraceCanvases[traceId] = traceCanvas
+ } else {
+ __activeTraceCanvases[traceId] = null
+ }
+ } else {
+ __activeTraceCanvases[traceId] = null
+ }
+ }
+ }
+
+ onUpdated: (touchPoints) => {
+ for (var i = 0; i < touchPoints.length; i++) {
+ var traceId = touchPoints[i].pointId
+ var traceCanvas = __activeTraceCanvases[traceId]
+ if (traceCanvas) {
+ var trace = traceCanvas.trace
+ var index = trace.addPoint(Qt.point(touchPoints[i].x, touchPoints[i].y))
+ if (trace.channels.indexOf('t') !== -1) {
+ var dt = new Date()
+ trace.setChannelData('t', index, dt.getTime())
+ }
+ }
+ }
+ }
+
+ onReleased: (touchPoints) => {
+ for (var i = 0; i < touchPoints.length; i++) {
+ var traceId = touchPoints[i].pointId
+ var traceCanvas = __activeTraceCanvases[traceId]
+ if (traceCanvas) {
+ if (traceCanvas.trace) {
+ traceCanvas.trace.final = true
+ InputContext.inputEngine.traceEnd(traceCanvas.trace)
+ }
+ __traceCanvasList.push(traceCanvas)
+ __activeTraceCanvases[traceId] = null
+ }
+ }
+ }
+
+ onCanceled: (touchPoints) => {
+ for (var i = 0; i < touchPoints.length; i++) {
+ var traceId = touchPoints[i].pointId
+ var traceCanvas = __activeTraceCanvases[traceId]
+ if (traceCanvas) {
+ if (traceCanvas.trace) {
+ traceCanvas.trace.final = true
+ traceCanvas.trace.canceled = true
+ InputContext.inputEngine.traceEnd(traceCanvas.trace)
+ }
+ __traceCanvasList.push(traceCanvas)
+ __activeTraceCanvases[traceId] = null
+ }
+ }
+ }
+}
diff --git a/src/components/TraceInputKey.qml b/src/components/TraceInputKey.qml
new file mode 100644
index 00000000..dc1cb47c
--- /dev/null
+++ b/src/components/TraceInputKey.qml
@@ -0,0 +1,92 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+
+/*!
+ \qmltype TraceInputKey
+ \inqmlmodule QtQuick.VirtualKeyboard.Components
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-components-qml
+ \ingroup qtvirtualkeyboard-key-types
+ \inherits Item
+ \since QtQuick.VirtualKeyboard 2.0
+
+ \brief A specialized key for collecting touch input data.
+
+ This type can be placed in the keyboard layout. It collects
+ and renders touch input data (trace) from the key area.
+*/
+
+Item {
+ id: traceInputKey
+
+ /*! Sets the key weight value which determines the relative size of the key.
+
+ Use this property to change the key size in the layout.
+
+ The default value is inherited from the parent element
+ of the key in the layout hierarchy.
+ */
+ property real weight: parent.keyWeight
+
+ /*! Pattern recognition mode of this input area.
+
+ The default value is \l {InputEngine::patternRecognitionModes} {InputEngine.PatternRecognitionMode.None}.
+ */
+ property alias patternRecognitionMode: traceInputArea.patternRecognitionMode
+
+ /*! List of horizontal rulers in the input area.
+
+ The rulers are defined as a number of pixels from the top edge of the bounding box.
+
+ Here is an example that demonstrates how to define rulers:
+
+ \code
+ horizontalRulers: [boundingBox.height / 3, boundingBox.height / 3 * 2]
+ verticalRulers: [boundingBox.width / 3, boundingBox.width / 3 * 2]
+ \endcode
+ */
+ property alias horizontalRulers: traceInputArea.horizontalRulers
+
+ /*! List of vertical rulers in the input area.
+
+ The rulers are defined as a number of pixels from the left edge of the bounding box.
+ */
+ property alias verticalRulers: traceInputArea.verticalRulers
+
+ /*! Bounding box for the trace input.
+
+ This property is readonly and is automatically updated based on the item size
+ and margins.
+ */
+ readonly property alias boundingBox: traceInputArea.boundingBox
+
+ /*! Canvas type of this trace input area.
+
+ This property can be used to distinguish between different types of canvases.
+ The default value is \c "keyboard".
+ */
+ property alias canvasType: traceInputArea.canvasType
+
+ Layout.minimumWidth: traceInputKeyPanel.implicitWidth
+ Layout.minimumHeight: traceInputKeyPanel.implicitHeight
+ Layout.preferredWidth: weight
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ canvasType: "keyboard"
+
+ Loader {
+ id: traceInputKeyPanel
+ sourceComponent: keyboard.style.traceInputKeyPanelDelegate
+ anchors.fill: parent
+ onLoaded: traceInputKeyPanel.item.control = traceInputKey
+ }
+
+ TraceInputArea {
+ id: traceInputArea
+ anchors.fill: traceInputKeyPanel
+ anchors.margins: traceInputKeyPanel.item ? traceInputKeyPanel.item.traceMargins : 0
+ }
+}
diff --git a/src/components/WordCandidatePopupList.qml b/src/components/WordCandidatePopupList.qml
new file mode 100644
index 00000000..a9c802a5
--- /dev/null
+++ b/src/components/WordCandidatePopupList.qml
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
+import QtQml
+import QtQuick.VirtualKeyboard
+
+PopupList {
+ id: wordCandidatePopupList
+
+ readonly property int preferredVisibleItems: {
+ if (!currentItem)
+ return 0
+ var maxHeight = flipVertical ? Qt.inputMethod.cursorRectangle.y : parent.height - Qt.inputMethod.cursorRectangle.height - Qt.inputMethod.cursorRectangle.y
+ var result = Math.min(count, maxVisibleItems)
+ while (result > 2 && result * currentItem.height > maxHeight)
+ --result
+ return result
+ }
+ readonly property bool flipVertical: currentItem &&
+ Qt.inputMethod.cursorRectangle.y + (Qt.inputMethod.cursorRectangle.height / 2) > (parent.height / 2) &&
+ Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height + (currentItem.height * 2) > parent.height
+
+ height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
+ Binding {
+ target: wordCandidatePopupList
+ property: "x"
+ value: Math.round(Qt.inputMethod.cursorRectangle.x -
+ (wordCandidatePopupList.currentItem ?
+ (wordCandidatePopupList.currentItem.hasOwnProperty("cursorAnchor") ?
+ wordCandidatePopupList.currentItem.cursorAnchor : wordCandidatePopupList.currentItem.width) : 0))
+ when: wordCandidatePopupList.visible
+ restoreMode: Binding.RestoreBinding
+ }
+ Binding {
+ target: wordCandidatePopupList
+ property: "y"
+ value: Math.round(wordCandidatePopupList.flipVertical ? Qt.inputMethod.cursorRectangle.y - wordCandidatePopupList.height : Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height)
+ when: wordCandidatePopupList.visible
+ restoreMode: Binding.RestoreBinding
+ }
+ model: enabled ? InputContext.inputEngine.wordCandidateListModel : null
+
+ onContentWidthChanged: viewResizeTimer.restart()
+
+ Timer {
+ id: viewResizeTimer
+ interval: 0
+ repeat: false
+ onTriggered: wordCandidatePopupList.width = wordCandidatePopupList.contentWidth
+ }
+
+ Connections {
+ target: wordCandidatePopupList.model ? wordCandidatePopupList.model : null
+ function onActiveItemChanged(index) { wordCandidatePopupList.currentIndex = index }
+ function onItemSelected() { if (wordCandidatePopupList.currentItem) keyboard.soundEffect.play(wordCandidatePopupList.currentItem.soundEffect) }
+ }
+}
diff --git a/src/import/CMakeLists.txt b/src/import/CMakeLists.txt
deleted file mode 100644
index aff7cacf..00000000
--- a/src/import/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Generated from import.pro.
-
-#####################################################################
-## qtquickvirtualkeyboardplugin Plugin:
-#####################################################################
-
-qt_add_qml_module(qtquickvirtualkeyboardplugin
- URI "QtQuick.VirtualKeyboard"
- VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}"
- CLASSNAME QtQuickVirtualKeyboardPlugin
- DEPENDENCIES
- QtQuick/2.0
- QtQuick.Window/2.2
- QtQuick.Layouts/1.0
- Qt.labs.folderlistmodel/2.1
- QtQuick.VirtualKeyboard.Settings/2.2
- QtQuick.VirtualKeyboard.Styles/2.2
- SKIP_TYPE_REGISTRATION
- SOURCES
- qtquickvirtualkeyboardplugin.cpp qtquickvirtualkeyboardplugin.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
- Qt::VirtualKeyboardPrivate
-)
-
-#### Keys ignored in scope 1:.:.:import.pro:<TRUE>:
-# IMPORT_VERSION = "2.$$QT_MINOR_VERSION"
-# OTHER_FILES = "dependencies.json" "plugins.qmltypes" "qmldir"
-# TARGETPATH = "QtQuick/VirtualKeyboard"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:import.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
-
-#### Keys ignored in scope 3:.:.:import.pro:NOT CMAKE_CROSSCOMPILING AND ( build_pass OR NOT debug_and_release ):
-# QMAKE_EXTRA_TARGETS = "qmltypes"
-# qmltypes.commands = "$$QMPPLUGINDUMP_ENV" "$$QMLPLUGINDUMP" "-defaultplatform" "-nonrelocatable" "-dependencies" "$$PWD/dependencies.json" "QtQuick.VirtualKeyboard" "$$IMPORT_VERSION" ">" "$$PWD/plugins.qmltypes"
-
-#### Keys ignored in scope 4:.:.:import.pro:NOT WIN32:
-# QMPPLUGINDUMP_ENV = "QT_IM_MODULE=qtvirtualkeyboard"
diff --git a/src/import/dependencies.json b/src/import/dependencies.json
deleted file mode 100644
index f5bc2b31..00000000
--- a/src/import/dependencies.json
+++ /dev/null
@@ -1,22 +0,0 @@
-[
- {
- "name": "QtQuick",
- "type": "module",
- "version": "2.0"
- },
- {
- "name": "QtQuick.Window",
- "type": "module",
- "version": "2.2"
- },
- {
- "name": "QtQuick.Layouts",
- "type": "module",
- "version": "1.0"
- },
- {
- "name": "Qt.labs.folderlistmodel",
- "type": "module",
- "version": "2.1"
- }
-]
diff --git a/src/import/import.pro b/src/import/import.pro
deleted file mode 100644
index 297efde4..00000000
--- a/src/import/import.pro
+++ /dev/null
@@ -1,34 +0,0 @@
-TARGET = qtquickvirtualkeyboardplugin
-TARGETPATH = QtQuick/VirtualKeyboard
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
-QT += qml quick virtualkeyboard-private
-
-CONFIG += no_cxx_module
-
-SOURCES += \
- qtquickvirtualkeyboardplugin.cpp
-
-HEADERS += \
- qtquickvirtualkeyboardplugin.h
-
-OTHER_FILES += \
- dependencies.json \
- plugins.qmltypes \
- qmldir
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-}
-
-load(qml_plugin)
-
-# qmltypes target override (requires QT_IM_MODULE=qtvirtualkeyboard, -defaultplatform and
-# $$PWD/dependencies.json)
-!cross_compile:if(build_pass|!debug_and_release) {
- qtPrepareTool(QMLPLUGINDUMP, qmlplugindump)
- # Note for win32 you need to set QT_IM_MODULE=qtvirtualkeyboard environment variable manually
- !win32: QMPPLUGINDUMP_ENV = "QT_IM_MODULE=qtvirtualkeyboard"
- qmltypes.commands = $$QMPPLUGINDUMP_ENV $$QMLPLUGINDUMP -defaultplatform -nonrelocatable -dependencies $$PWD/dependencies.json QtQuick.VirtualKeyboard $$IMPORT_VERSION > $$PWD/plugins.qmltypes
- QMAKE_EXTRA_TARGETS += qmltypes
-}
diff --git a/src/import/plugins.qmltypes b/src/import/plugins.qmltypes
deleted file mode 100644
index 9bdb3bd5..00000000
--- a/src/import/plugins.qmltypes
+++ /dev/null
@@ -1,2444 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -defaultplatform -nonrelocatable -dependencies dependencies.json QtQuick.VirtualKeyboard 2.14'
-
-Module {
- dependencies: [
- "Qt.labs.folderlistmodel 2.1",
- "QtQuick 2.0",
- "QtQuick.Layouts 1.0",
- "QtQuick.Window 2.2"
- ]
- Component {
- name: "QAbstractItemModel"
- prototype: "QObject"
- Enum {
- name: "LayoutChangeHint"
- values: {
- "NoLayoutChangeHint": 0,
- "VerticalSortHint": 1,
- "HorizontalSortHint": 2
- }
- }
- Enum {
- name: "CheckIndexOption"
- values: {
- "NoOption": 0,
- "IndexIsValid": 1,
- "DoNotUseParent": 2,
- "ParentIsInvalid": 4
- }
- }
- Signal {
- name: "dataChanged"
- Parameter { name: "topLeft"; type: "QModelIndex" }
- Parameter { name: "bottomRight"; type: "QModelIndex" }
- Parameter { name: "roles"; type: "QList<int>" }
- }
- Signal {
- name: "dataChanged"
- Parameter { name: "topLeft"; type: "QModelIndex" }
- Parameter { name: "bottomRight"; type: "QModelIndex" }
- }
- Signal {
- name: "headerDataChanged"
- Parameter { name: "orientation"; type: "Qt::Orientation" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "layoutChanged"
- Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
- Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
- }
- Signal {
- name: "layoutChanged"
- Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
- }
- Signal { name: "layoutChanged" }
- Signal {
- name: "layoutAboutToBeChanged"
- Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
- Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
- }
- Signal {
- name: "layoutAboutToBeChanged"
- Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
- }
- Signal { name: "layoutAboutToBeChanged" }
- Signal {
- name: "rowsAboutToBeInserted"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "rowsInserted"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "rowsAboutToBeRemoved"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "rowsRemoved"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "columnsAboutToBeInserted"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "columnsInserted"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "columnsAboutToBeRemoved"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal {
- name: "columnsRemoved"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "first"; type: "int" }
- Parameter { name: "last"; type: "int" }
- }
- Signal { name: "modelAboutToBeReset" }
- Signal { name: "modelReset" }
- Signal {
- name: "rowsAboutToBeMoved"
- Parameter { name: "sourceParent"; type: "QModelIndex" }
- Parameter { name: "sourceStart"; type: "int" }
- Parameter { name: "sourceEnd"; type: "int" }
- Parameter { name: "destinationParent"; type: "QModelIndex" }
- Parameter { name: "destinationRow"; type: "int" }
- }
- Signal {
- name: "rowsMoved"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- Parameter { name: "destination"; type: "QModelIndex" }
- Parameter { name: "row"; type: "int" }
- }
- Signal {
- name: "columnsAboutToBeMoved"
- Parameter { name: "sourceParent"; type: "QModelIndex" }
- Parameter { name: "sourceStart"; type: "int" }
- Parameter { name: "sourceEnd"; type: "int" }
- Parameter { name: "destinationParent"; type: "QModelIndex" }
- Parameter { name: "destinationColumn"; type: "int" }
- }
- Signal {
- name: "columnsMoved"
- Parameter { name: "parent"; type: "QModelIndex" }
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- Parameter { name: "destination"; type: "QModelIndex" }
- Parameter { name: "column"; type: "int" }
- }
- Method { name: "submit"; type: "bool" }
- Method { name: "revert" }
- Method {
- name: "hasIndex"
- type: "bool"
- Parameter { name: "row"; type: "int" }
- Parameter { name: "column"; type: "int" }
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "hasIndex"
- type: "bool"
- Parameter { name: "row"; type: "int" }
- Parameter { name: "column"; type: "int" }
- }
- Method {
- name: "index"
- type: "QModelIndex"
- Parameter { name: "row"; type: "int" }
- Parameter { name: "column"; type: "int" }
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "index"
- type: "QModelIndex"
- Parameter { name: "row"; type: "int" }
- Parameter { name: "column"; type: "int" }
- }
- Method {
- name: "parent"
- type: "QModelIndex"
- Parameter { name: "child"; type: "QModelIndex" }
- }
- Method {
- name: "sibling"
- type: "QModelIndex"
- Parameter { name: "row"; type: "int" }
- Parameter { name: "column"; type: "int" }
- Parameter { name: "idx"; type: "QModelIndex" }
- }
- Method {
- name: "rowCount"
- type: "int"
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method { name: "rowCount"; type: "int" }
- Method {
- name: "columnCount"
- type: "int"
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method { name: "columnCount"; type: "int" }
- Method {
- name: "hasChildren"
- type: "bool"
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method { name: "hasChildren"; type: "bool" }
- Method {
- name: "data"
- type: "QVariant"
- Parameter { name: "index"; type: "QModelIndex" }
- Parameter { name: "role"; type: "int" }
- }
- Method {
- name: "data"
- type: "QVariant"
- Parameter { name: "index"; type: "QModelIndex" }
- }
- Method {
- name: "setData"
- type: "bool"
- Parameter { name: "index"; type: "QModelIndex" }
- Parameter { name: "value"; type: "QVariant" }
- Parameter { name: "role"; type: "int" }
- }
- Method {
- name: "setData"
- type: "bool"
- Parameter { name: "index"; type: "QModelIndex" }
- Parameter { name: "value"; type: "QVariant" }
- }
- Method {
- name: "headerData"
- type: "QVariant"
- Parameter { name: "section"; type: "int" }
- Parameter { name: "orientation"; type: "Qt::Orientation" }
- Parameter { name: "role"; type: "int" }
- }
- Method {
- name: "headerData"
- type: "QVariant"
- Parameter { name: "section"; type: "int" }
- Parameter { name: "orientation"; type: "Qt::Orientation" }
- }
- Method {
- name: "fetchMore"
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "canFetchMore"
- type: "bool"
- Parameter { name: "parent"; type: "QModelIndex" }
- }
- Method {
- name: "flags"
- type: "Qt::ItemFlags"
- Parameter { name: "index"; type: "QModelIndex" }
- }
- Method {
- name: "match"
- type: "QModelIndexList"
- Parameter { name: "start"; type: "QModelIndex" }
- Parameter { name: "role"; type: "int" }
- Parameter { name: "value"; type: "QVariant" }
- Parameter { name: "hits"; type: "int" }
- Parameter { name: "flags"; type: "Qt::MatchFlags" }
- }
- Method {
- name: "match"
- type: "QModelIndexList"
- Parameter { name: "start"; type: "QModelIndex" }
- Parameter { name: "role"; type: "int" }
- Parameter { name: "value"; type: "QVariant" }
- Parameter { name: "hits"; type: "int" }
- }
- Method {
- name: "match"
- type: "QModelIndexList"
- Parameter { name: "start"; type: "QModelIndex" }
- Parameter { name: "role"; type: "int" }
- Parameter { name: "value"; type: "QVariant" }
- }
- }
- Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" }
- Component {
- name: "QVirtualKeyboardAbstractInputMethod"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard/AbstractInputMethod 1.0",
- "QtQuick.VirtualKeyboard/AbstractInputMethod 2.0"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
- Signal {
- name: "selectionListChanged"
- Parameter { name: "type"; type: "QVirtualKeyboardSelectionListModel::Type" }
- }
- Signal {
- name: "selectionListActiveItemChanged"
- Parameter { name: "type"; type: "QVirtualKeyboardSelectionListModel::Type" }
- Parameter { name: "index"; type: "int" }
- }
- Signal { name: "selectionListsChanged" }
- Method { name: "reset" }
- Method { name: "update" }
- }
- Component {
- name: "QVirtualKeyboardInputContext"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard/InputContext 1.0",
- "QtQuick.VirtualKeyboard/InputContext 2.0"
- ]
- isCreatable: false
- isSingleton: true
- exportMetaObjectRevisions: [0, 0]
- Property { name: "shift"; type: "bool"; isReadonly: true }
- Property { name: "shiftActive"; revision: 4; type: "bool"; isReadonly: true }
- Property { name: "capsLock"; type: "bool"; isReadonly: true }
- Property { name: "capsLockActive"; revision: 4; type: "bool"; isReadonly: true }
- Property { name: "uppercase"; type: "bool"; isReadonly: true }
- Property { name: "anchorPosition"; type: "int"; isReadonly: true }
- Property { name: "cursorPosition"; type: "int"; isReadonly: true }
- Property { name: "inputMethodHints"; type: "Qt::InputMethodHints"; isReadonly: true }
- Property { name: "preeditText"; type: "string" }
- Property { name: "surroundingText"; type: "string"; isReadonly: true }
- Property { name: "selectedText"; type: "string"; isReadonly: true }
- Property { name: "anchorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "animating"; type: "bool" }
- Property { name: "locale"; type: "string"; isReadonly: true }
- Property { name: "inputItem"; type: "QObject"; isReadonly: true; isPointer: true }
- Property {
- name: "inputEngine"
- type: "QVirtualKeyboardInputEngine"
- isReadonly: true
- isPointer: true
- }
- Property { name: "selectionControlVisible"; type: "bool"; isReadonly: true }
- Property { name: "anchorRectIntersectsClipRect"; type: "bool"; isReadonly: true }
- Property { name: "cursorRectIntersectsClipRect"; type: "bool"; isReadonly: true }
- Property {
- name: "priv"
- type: "QVirtualKeyboardInputContextPrivate"
- isReadonly: true
- isPointer: true
- }
- Method {
- name: "sendKeyClick"
- Parameter { name: "key"; type: "int" }
- Parameter { name: "text"; type: "string" }
- Parameter { name: "modifiers"; type: "int" }
- }
- Method {
- name: "sendKeyClick"
- Parameter { name: "key"; type: "int" }
- Parameter { name: "text"; type: "string" }
- }
- Method { name: "commit" }
- Method {
- name: "commit"
- Parameter { name: "text"; type: "string" }
- Parameter { name: "replaceFrom"; type: "int" }
- Parameter { name: "replaceLength"; type: "int" }
- }
- Method {
- name: "commit"
- Parameter { name: "text"; type: "string" }
- Parameter { name: "replaceFrom"; type: "int" }
- }
- Method {
- name: "commit"
- Parameter { name: "text"; type: "string" }
- }
- Method { name: "clear" }
- Method {
- name: "setSelectionOnFocusObject"
- Parameter { name: "anchorPos"; type: "QPointF" }
- Parameter { name: "cursorPos"; type: "QPointF" }
- }
- }
- Component {
- name: "QVirtualKeyboardInputContextPrivate"
- prototype: "QObject"
- exports: ["QtQuick.VirtualKeyboard/InputContextPrivate 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "State"
- values: {
- "Reselect": 1,
- "InputMethodEvent": 2,
- "KeyEvent": 4,
- "InputMethodClick": 8,
- "SyncShadowInput": 16
- }
- }
- Property { name: "focus"; type: "bool" }
- Property { name: "keyboardRectangle"; type: "QRectF" }
- Property { name: "previewRectangle"; type: "QRectF" }
- Property { name: "previewVisible"; type: "bool" }
- Property { name: "locale"; type: "string" }
- Property { name: "inputItem"; type: "QObject"; isReadonly: true; isPointer: true }
- Property {
- name: "shiftHandler"
- type: "QtVirtualKeyboard::ShiftHandler"
- isReadonly: true
- isPointer: true
- }
- Property {
- name: "shadow"
- type: "QtVirtualKeyboard::ShadowInputContext"
- isReadonly: true
- isPointer: true
- }
- Property { name: "inputMethods"; type: "QStringList"; isReadonly: true }
- Signal {
- name: "navigationKeyPressed"
- Parameter { name: "key"; type: "int" }
- Parameter { name: "isAutoRepeat"; type: "bool" }
- }
- Signal {
- name: "navigationKeyReleased"
- Parameter { name: "key"; type: "int" }
- Parameter { name: "isAutoRepeat"; type: "bool" }
- }
- Method { name: "hideInputPanel" }
- Method {
- name: "updateAvailableLocales"
- Parameter { name: "availableLocales"; type: "QStringList" }
- }
- Method {
- name: "forceCursorPosition"
- Parameter { name: "anchorPosition"; type: "int" }
- Parameter { name: "cursorPosition"; type: "int" }
- }
- Method {
- name: "fileExists"
- type: "bool"
- Parameter { name: "fileUrl"; type: "QUrl" }
- }
- Method {
- name: "hasEnterKeyAction"
- type: "bool"
- Parameter { name: "item"; type: "QObject"; isPointer: true }
- }
- }
- Component {
- name: "QVirtualKeyboardInputEngine"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard/InputEngine 1.0",
- "QtQuick.VirtualKeyboard/InputEngine 2.0"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
- Enum {
- name: "TextCase"
- values: {
- "Lower": 0,
- "Upper": 1
- }
- }
- Enum {
- name: "InputMode"
- values: {
- "Latin": 0,
- "Numeric": 1,
- "Dialable": 2,
- "Pinyin": 3,
- "Cangjie": 4,
- "Zhuyin": 5,
- "Hangul": 6,
- "Hiragana": 7,
- "Katakana": 8,
- "FullwidthLatin": 9,
- "Greek": 10,
- "Cyrillic": 11,
- "Arabic": 12,
- "Hebrew": 13,
- "ChineseHandwriting": 14,
- "JapaneseHandwriting": 15,
- "KoreanHandwriting": 16,
- "Thai": 17
- }
- }
- Enum {
- name: "PatternRecognitionMode"
- values: {
- "None": 0,
- "PatternRecognitionDisabled": 0,
- "Handwriting": 1,
- "HandwritingRecoginition": 1
- }
- }
- Enum {
- name: "ReselectFlag"
- values: {
- "WordBeforeCursor": 1,
- "WordAfterCursor": 2,
- "WordAtCursor": 3
- }
- }
- Property { name: "activeKey"; type: "Qt::Key"; isReadonly: true }
- Property { name: "previousKey"; type: "Qt::Key"; isReadonly: true }
- Property { name: "inputMethod"; type: "QVirtualKeyboardAbstractInputMethod"; isPointer: true }
- Property { name: "inputModes"; type: "QList<int>"; isReadonly: true }
- Property { name: "inputMode"; type: "InputMode" }
- Property { name: "patternRecognitionModes"; type: "QList<int>"; isReadonly: true }
- Property {
- name: "wordCandidateListModel"
- type: "QVirtualKeyboardSelectionListModel"
- isReadonly: true
- isPointer: true
- }
- Property { name: "wordCandidateListVisibleHint"; type: "bool"; isReadonly: true }
- Signal {
- name: "virtualKeyClicked"
- Parameter { name: "key"; type: "Qt::Key" }
- Parameter { name: "text"; type: "string" }
- Parameter { name: "modifiers"; type: "Qt::KeyboardModifiers" }
- Parameter { name: "isAutoRepeat"; type: "bool" }
- }
- Signal {
- name: "activeKeyChanged"
- Parameter { name: "key"; type: "Qt::Key" }
- }
- Signal {
- name: "previousKeyChanged"
- Parameter { name: "key"; type: "Qt::Key" }
- }
- Signal { name: "inputMethodReset" }
- Signal { name: "inputMethodUpdate" }
- Method {
- name: "virtualKeyPress"
- type: "bool"
- Parameter { name: "key"; type: "Qt::Key" }
- Parameter { name: "text"; type: "string" }
- Parameter { name: "modifiers"; type: "Qt::KeyboardModifiers" }
- Parameter { name: "repeat"; type: "bool" }
- }
- Method { name: "virtualKeyCancel" }
- Method {
- name: "virtualKeyRelease"
- type: "bool"
- Parameter { name: "key"; type: "Qt::Key" }
- Parameter { name: "text"; type: "string" }
- Parameter { name: "modifiers"; type: "Qt::KeyboardModifiers" }
- }
- Method {
- name: "virtualKeyClick"
- type: "bool"
- Parameter { name: "key"; type: "Qt::Key" }
- Parameter { name: "text"; type: "string" }
- Parameter { name: "modifiers"; type: "Qt::KeyboardModifiers" }
- }
- Method {
- name: "traceBegin"
- type: "QVirtualKeyboardTrace*"
- Parameter { name: "traceId"; type: "int" }
- Parameter { name: "patternRecognitionMode"; type: "PatternRecognitionMode" }
- Parameter { name: "traceCaptureDeviceInfo"; type: "QVariantMap" }
- Parameter { name: "traceScreenInfo"; type: "QVariantMap" }
- }
- Method {
- name: "traceEnd"
- type: "bool"
- Parameter { name: "trace"; type: "QVirtualKeyboardTrace"; isPointer: true }
- }
- Method {
- name: "reselect"
- type: "bool"
- Parameter { name: "cursorPosition"; type: "int" }
- Parameter { name: "reselectFlags"; type: "ReselectFlags" }
- }
- }
- Component {
- name: "QVirtualKeyboardSelectionListModel"
- prototype: "QAbstractListModel"
- exports: [
- "QtQuick.VirtualKeyboard/SelectionListModel 1.0",
- "QtQuick.VirtualKeyboard/SelectionListModel 2.0"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
- Enum {
- name: "Type"
- values: {
- "WordCandidateList": 0
- }
- }
- Enum {
- name: "Role"
- values: {
- "Display": 0,
- "DisplayRole": 0,
- "WordCompletionLength": 257,
- "WordCompletionLengthRole": 257,
- "Dictionary": 258,
- "CanRemoveSuggestion": 259
- }
- }
- Enum {
- name: "DictionaryType"
- values: {
- "Default": 0,
- "User": 1
- }
- }
- Property { name: "count"; type: "int"; isReadonly: true }
- Signal {
- name: "activeItemChanged"
- Parameter { name: "index"; type: "int" }
- }
- Signal {
- name: "itemSelected"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "selectItem"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "removeItem"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "dataAt"
- type: "QVariant"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "role"; type: "Role" }
- }
- Method {
- name: "dataAt"
- type: "QVariant"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QVirtualKeyboardTrace"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard/Trace 2.0",
- "QtQuick.VirtualKeyboard/Trace 2.4"
- ]
- exportMetaObjectRevisions: [0, 0]
- Property { name: "traceId"; type: "int" }
- Property { name: "channels"; type: "QStringList" }
- Property { name: "length"; type: "int"; isReadonly: true }
- Property { name: "final"; type: "bool" }
- Property { name: "canceled"; type: "bool" }
- Property { name: "opacity"; type: "double" }
- Signal {
- name: "traceIdChanged"
- Parameter { name: "traceId"; type: "int" }
- }
- Signal {
- name: "lengthChanged"
- Parameter { name: "length"; type: "int" }
- }
- Signal {
- name: "finalChanged"
- Parameter { name: "isFinal"; type: "bool" }
- }
- Signal {
- name: "canceledChanged"
- Parameter { name: "isCanceled"; type: "bool" }
- }
- Signal {
- name: "opacityChanged"
- Parameter { name: "opacity"; type: "double" }
- }
- Method {
- name: "points"
- type: "QVariantList"
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method {
- name: "points"
- type: "QVariantList"
- Parameter { name: "pos"; type: "int" }
- }
- Method { name: "points"; type: "QVariantList" }
- Method {
- name: "addPoint"
- type: "int"
- Parameter { name: "point"; type: "QPointF" }
- }
- Method {
- name: "setChannelData"
- Parameter { name: "channel"; type: "string" }
- Parameter { name: "index"; type: "int" }
- Parameter { name: "data"; type: "QVariant" }
- }
- Method {
- name: "channelData"
- type: "QVariantList"
- Parameter { name: "channel"; type: "string" }
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method {
- name: "channelData"
- type: "QVariantList"
- Parameter { name: "channel"; type: "string" }
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "channelData"
- type: "QVariantList"
- Parameter { name: "channel"; type: "string" }
- }
- }
- Component {
- name: "QtVirtualKeyboard::EnterKeyAction"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard/EnterKeyAction 1.0",
- "QtQuick.VirtualKeyboard/EnterKeyAction 2.0"
- ]
- exportMetaObjectRevisions: [0, 0]
- attachedType: "QtVirtualKeyboard::EnterKeyActionAttachedType"
- Enum {
- name: "Id"
- values: {
- "None": 0,
- "Go": 1,
- "Search": 2,
- "Send": 3,
- "Next": 4,
- "Done": 5
- }
- }
- }
- Component {
- name: "QtVirtualKeyboard::EnterKeyActionAttachedType"
- prototype: "QObject"
- Property { name: "actionId"; type: "int" }
- Property { name: "label"; type: "string" }
- Property { name: "enabled"; type: "bool" }
- }
- Component {
- name: "QtVirtualKeyboard::HangulInputMethod"
- prototype: "QVirtualKeyboardAbstractInputMethod"
- exports: [
- "QtQuick.VirtualKeyboard.Plugins/HangulInputMethod 1.3",
- "QtQuick.VirtualKeyboard.Plugins/HangulInputMethod 2.0"
- ]
- exportMetaObjectRevisions: [0, 0]
- }
- Component {
- name: "QtVirtualKeyboard::InputMethod"
- prototype: "QVirtualKeyboardAbstractInputMethod"
- exports: [
- "QtQuick.VirtualKeyboard/InputMethod 1.0",
- "QtQuick.VirtualKeyboard/InputMethod 2.0"
- ]
- exportMetaObjectRevisions: [0, 0]
- Property {
- name: "inputContext"
- type: "QVirtualKeyboardInputContext"
- isReadonly: true
- isPointer: true
- }
- Property {
- name: "inputEngine"
- type: "QVirtualKeyboardInputEngine"
- isReadonly: true
- isPointer: true
- }
- }
- Component {
- name: "QtVirtualKeyboard::OpenWnnInputMethod"
- prototype: "QVirtualKeyboardAbstractInputMethod"
- exports: [
- "QtQuick.VirtualKeyboard.Plugins/JapaneseInputMethod 1.3",
- "QtQuick.VirtualKeyboard.Plugins/JapaneseInputMethod 2.0"
- ]
- exportMetaObjectRevisions: [0, 0]
- }
- Component {
- name: "QtVirtualKeyboard::PinyinInputMethod"
- prototype: "QVirtualKeyboardAbstractInputMethod"
- exports: [
- "QtQuick.VirtualKeyboard.Plugins/PinyinInputMethod 1.1",
- "QtQuick.VirtualKeyboard.Plugins/PinyinInputMethod 2.0"
- ]
- exportMetaObjectRevisions: [0, 0]
- }
- Component {
- name: "QtVirtualKeyboard::PlainInputMethod"
- prototype: "QVirtualKeyboardAbstractInputMethod"
- exports: [
- "QtQuick.VirtualKeyboard.Plugins/PlainInputMethod 1.0",
- "QtQuick.VirtualKeyboard.Plugins/PlainInputMethod 2.0",
- "QtQuick.VirtualKeyboard.Plugins/PlainInputMethod 2.3"
- ]
- exportMetaObjectRevisions: [0, 0, 0]
- }
- Component {
- name: "QtVirtualKeyboard::ShadowInputContext"
- prototype: "QObject"
- exports: ["QtQuick.VirtualKeyboard/ShadowInputContext 2.2"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "inputItem"; type: "QObject"; isPointer: true }
- Property { name: "anchorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "anchorRectIntersectsClipRect"; type: "bool"; isReadonly: true }
- Property { name: "cursorRectIntersectsClipRect"; type: "bool"; isReadonly: true }
- Property { name: "selectionControlVisible"; type: "bool"; isReadonly: true }
- Method {
- name: "setSelectionOnFocusObject"
- Parameter { name: "anchorPos"; type: "QPointF" }
- Parameter { name: "cursorPos"; type: "QPointF" }
- }
- Method { name: "updateSelectionProperties" }
- }
- Component {
- name: "QtVirtualKeyboard::ShiftHandler"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard/ShiftHandler 1.0",
- "QtQuick.VirtualKeyboard/ShiftHandler 2.0"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0, 0]
- Property { name: "sentenceEndingCharacters"; type: "string" }
- Property { name: "autoCapitalizationEnabled"; type: "bool"; isReadonly: true }
- Property { name: "toggleShiftEnabled"; type: "bool"; isReadonly: true }
- Property { name: "shiftActive"; type: "bool" }
- Property { name: "capsLockActive"; type: "bool" }
- Property { name: "uppercase"; type: "bool"; isReadonly: true }
- Method { name: "toggleShift" }
- Method { name: "clearToggleShiftTimer" }
- }
- Component {
- name: "QtVirtualKeyboard::TCInputMethod"
- prototype: "QVirtualKeyboardAbstractInputMethod"
- exports: ["QtQuick.VirtualKeyboard.Plugins/TCInputMethod 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "simplified"; type: "bool" }
- }
- Component {
- name: "QtVirtualKeyboard::ThaiInputMethod"
- prototype: "QVirtualKeyboardAbstractInputMethod"
- exports: ["QtQuick.VirtualKeyboard.Plugins/ThaiInputMethod 2.3"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/AlternativeKeys 1.0"
- exports: ["QtQuick.VirtualKeyboard/AlternativeKeys 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "highlightIndex"; type: "int" }
- Property { name: "keyCode"; type: "int" }
- Property { name: "origin"; type: "QPointF" }
- Property { name: "listView"; type: "QQuickListView"; isReadonly: true; isPointer: true }
- Signal { name: "clicked" }
- Method {
- name: "open"
- type: "QVariant"
- Parameter { name: "key"; type: "QVariant" }
- Parameter { name: "originX"; type: "QVariant" }
- Parameter { name: "originY"; type: "QVariant" }
- }
- Method {
- name: "move"
- type: "QVariant"
- Parameter { name: "mouseX"; type: "QVariant" }
- }
- Method { name: "close"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/AlternativeKeys 2.0"
- exports: ["QtQuick.VirtualKeyboard/AlternativeKeys 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "highlightIndex"; type: "int" }
- Property { name: "keyCode"; type: "int" }
- Property { name: "origin"; type: "QPointF" }
- Property { name: "listView"; type: "QQuickListView"; isReadonly: true; isPointer: true }
- Signal { name: "clicked" }
- Method {
- name: "open"
- type: "QVariant"
- Parameter { name: "key"; type: "QVariant" }
- Parameter { name: "originX"; type: "QVariant" }
- Parameter { name: "originY"; type: "QVariant" }
- }
- Method {
- name: "move"
- type: "QVariant"
- Parameter { name: "mouseX"; type: "QVariant" }
- }
- Method { name: "close"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/BackspaceKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/BackspaceKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/BackspaceKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/BackspaceKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/BaseKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/BaseKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/BaseKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/BaseKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/ChangeLanguageKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/ChangeLanguageKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "customLayoutsOnly"; type: "bool" }
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/ChangeLanguageKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/ChangeLanguageKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "customLayoutsOnly"; type: "bool" }
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/CharacterPreviewBubble 1.0"
- exports: ["QtQuick.VirtualKeyboard/CharacterPreviewBubble 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "activeKey"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/CharacterPreviewBubble 2.0"
- exports: ["QtQuick.VirtualKeyboard/CharacterPreviewBubble 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "active"; type: "bool" }
- Property { name: "activeKey"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/EnterKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/EnterKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "actionId"; type: "int"; isReadonly: true }
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/EnterKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/EnterKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "actionId"; type: "int"; isReadonly: true }
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/FillerKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/FillerKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/FillerKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/FillerKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/HandwritingInputPanel 2.0"
- exports: ["QtQuick.VirtualKeyboard/HandwritingInputPanel 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "inputPanel"; type: "QVariant" }
- Property { name: "available"; type: "bool" }
- Property { name: "active"; type: "bool" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/HandwritingModeKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/HandwritingModeKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/HideKeyboardKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/HideKeyboardKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/HideKeyboardKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/HideKeyboardKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputModeKey 2.3"
- exports: ["QtQuick.VirtualKeyboard/InputModeKey 2.3"]
- exportMetaObjectRevisions: [3]
- isComposite: true
- defaultProperty: "data"
- Property { name: "inputModeNameList"; type: "QVariant" }
- Property { name: "inputModes"; type: "QVariant" }
- Property { name: "inputModeCount"; type: "int"; isReadonly: true }
- Property { name: "__inputModes"; type: "QVariant" }
- Method {
- name: "__nextInputMode"
- type: "QVariant"
- Parameter { name: "inputMode"; type: "QVariant" }
- }
- Method {
- name: "__filterInputModes"
- type: "QVariant"
- Parameter { name: "inputModes"; type: "QVariant" }
- Parameter { name: "filter"; type: "QVariant" }
- }
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 1.0"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 1.2"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.2"]
- exportMetaObjectRevisions: [2]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 1.3"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 1.3"]
- exportMetaObjectRevisions: [3]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.0"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.1"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.2"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.2"]
- exportMetaObjectRevisions: [2]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.3"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.3"]
- exportMetaObjectRevisions: [3]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/InputPanel 2.4"
- exports: ["QtQuick.VirtualKeyboard/InputPanel 2.4"]
- exportMetaObjectRevisions: [4]
- isComposite: true
- defaultProperty: "data"
- Property { name: "externalLanguageSwitchEnabled"; type: "bool" }
- Property { name: "desktopPanel"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "keyboard"; type: "Keyboard_QMLTYPE_22"; isReadonly: true; isPointer: true }
- Signal {
- name: "externalLanguageSwitch"
- Parameter { name: "localeList"; type: "QVariant" }
- Parameter { name: "currentIndex"; type: "int" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/Key 1.0"
- exports: ["QtQuick.VirtualKeyboard/Key 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/Key 2.0"
- exports: ["QtQuick.VirtualKeyboard/Key 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/Keyboard 1.0"
- exports: ["QtQuick.VirtualKeyboard/Keyboard 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "activeKey"; type: "QVariant" }
- Property { name: "activeTouchPoint"; type: "QQuickTouchPoint"; isPointer: true }
- Property { name: "localeIndex"; type: "int" }
- Property { name: "availableLocaleIndices"; type: "QVariant" }
- Property { name: "availableCustomLocaleIndices"; type: "QVariant" }
- Property { name: "locale"; type: "string" }
- Property { name: "inputLocale"; type: "string" }
- Property { name: "defaultLocaleIndex"; type: "int" }
- Property { name: "latinOnly"; type: "bool"; isReadonly: true }
- Property { name: "preferNumbers"; type: "bool"; isReadonly: true }
- Property { name: "dialableCharactersOnly"; type: "bool"; isReadonly: true }
- Property { name: "formattedNumbersOnly"; type: "bool"; isReadonly: true }
- Property { name: "digitsOnly"; type: "bool"; isReadonly: true }
- Property { name: "layout"; type: "string" }
- Property { name: "layoutType"; type: "string" }
- Property { name: "active"; type: "bool" }
- Property { name: "handwritingMode"; type: "bool" }
- Property { name: "fullScreenHandwritingMode"; type: "bool" }
- Property { name: "symbolMode"; type: "bool" }
- Property { name: "fullScreenMode"; type: "bool" }
- Property { name: "defaultInputMethod"; type: "QVariant" }
- Property { name: "plainInputMethod"; type: "QVariant" }
- Property { name: "customInputMethod"; type: "QVariant" }
- Property { name: "customInputMethodSharedLayouts"; type: "QVariant" }
- Property { name: "defaultInputMode"; type: "int" }
- Property { name: "inputMethodNeedsReset"; type: "bool" }
- Property { name: "inputModeNeedsReset"; type: "bool" }
- Property { name: "navigationModeActive"; type: "bool" }
- Property { name: "languagePopupListActive"; type: "bool"; isReadonly: true }
- Property { name: "style"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "wordCandidateView"; type: "QQuickListView"; isReadonly: true; isPointer: true }
- Property {
- name: "shadowInputControl"
- type: "ShadowInputControl_QMLTYPE_16"
- isReadonly: true
- isPointer: true
- }
- Property { name: "soundEffect"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Method { name: "initDefaultInputMethod"; type: "QVariant" }
- Method {
- name: "showLanguagePopup"
- type: "QVariant"
- Parameter { name: "parentItem"; type: "QVariant" }
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method { name: "hideLanguagePopup"; type: "QVariant" }
- Method {
- name: "showWordCandidateContextMenu"
- type: "QVariant"
- Parameter { name: "wordCandidateIndex"; type: "QVariant" }
- }
- Method { name: "hideWordCandidateContextMenu"; type: "QVariant" }
- Method { name: "updateInputMethod"; type: "QVariant" }
- Method { name: "updateLayout"; type: "QVariant" }
- Method { name: "updateDefaultLocale"; type: "QVariant" }
- Method {
- name: "filterLocaleIndices"
- type: "QVariant"
- Parameter { name: "filterCb"; type: "QVariant" }
- }
- Method { name: "updateAvailableLocaleIndices"; type: "QVariant" }
- Method {
- name: "listLocales"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- Parameter { name: "localeNameOnly"; type: "QVariant" }
- }
- Method {
- name: "nextLocaleIndex"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method {
- name: "changeInputLanguage"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method {
- name: "canChangeInputLanguage"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method {
- name: "findLocale"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "defaultValue"; type: "QVariant" }
- }
- Method { name: "findFallbackIndex"; type: "QVariant" }
- Method {
- name: "isValidLocale"
- type: "QVariant"
- Parameter { name: "localeNameOrIndex"; type: "QVariant" }
- Parameter { name: "ignoreActiveLocales"; type: "QVariant" }
- }
- Method {
- name: "getLayoutFile"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method {
- name: "getFallbackFile"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method {
- name: "layoutExists"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method {
- name: "findLayout"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method { name: "isHandwritingAvailable"; type: "QVariant" }
- Method {
- name: "setHandwritingMode"
- type: "QVariant"
- Parameter { name: "enabled"; type: "QVariant" }
- Parameter { name: "resetInputMode"; type: "QVariant" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/Keyboard 2.0"
- exports: ["QtQuick.VirtualKeyboard/Keyboard 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "activeKey"; type: "QVariant" }
- Property { name: "activeTouchPoint"; type: "QQuickTouchPoint"; isPointer: true }
- Property { name: "localeIndex"; type: "int" }
- Property { name: "availableLocaleIndices"; type: "QVariant" }
- Property { name: "availableCustomLocaleIndices"; type: "QVariant" }
- Property { name: "locale"; type: "string" }
- Property { name: "inputLocale"; type: "string" }
- Property { name: "defaultLocaleIndex"; type: "int" }
- Property { name: "latinOnly"; type: "bool"; isReadonly: true }
- Property { name: "preferNumbers"; type: "bool"; isReadonly: true }
- Property { name: "dialableCharactersOnly"; type: "bool"; isReadonly: true }
- Property { name: "formattedNumbersOnly"; type: "bool"; isReadonly: true }
- Property { name: "digitsOnly"; type: "bool"; isReadonly: true }
- Property { name: "layout"; type: "string" }
- Property { name: "layoutType"; type: "string" }
- Property { name: "active"; type: "bool" }
- Property { name: "handwritingMode"; type: "bool" }
- Property { name: "fullScreenHandwritingMode"; type: "bool" }
- Property { name: "symbolMode"; type: "bool" }
- Property { name: "fullScreenMode"; type: "bool" }
- Property { name: "defaultInputMethod"; type: "QVariant" }
- Property { name: "plainInputMethod"; type: "QVariant" }
- Property { name: "customInputMethod"; type: "QVariant" }
- Property { name: "customInputMethodSharedLayouts"; type: "QVariant" }
- Property { name: "defaultInputMode"; type: "int" }
- Property { name: "inputMethodNeedsReset"; type: "bool" }
- Property { name: "inputModeNeedsReset"; type: "bool" }
- Property { name: "navigationModeActive"; type: "bool" }
- Property { name: "languagePopupListActive"; type: "bool"; isReadonly: true }
- Property { name: "style"; type: "QObject"; isReadonly: true; isPointer: true }
- Property { name: "wordCandidateView"; type: "QQuickListView"; isReadonly: true; isPointer: true }
- Property {
- name: "shadowInputControl"
- type: "ShadowInputControl_QMLTYPE_16"
- isReadonly: true
- isPointer: true
- }
- Property { name: "soundEffect"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Method { name: "initDefaultInputMethod"; type: "QVariant" }
- Method {
- name: "showLanguagePopup"
- type: "QVariant"
- Parameter { name: "parentItem"; type: "QVariant" }
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method { name: "hideLanguagePopup"; type: "QVariant" }
- Method {
- name: "showWordCandidateContextMenu"
- type: "QVariant"
- Parameter { name: "wordCandidateIndex"; type: "QVariant" }
- }
- Method { name: "hideWordCandidateContextMenu"; type: "QVariant" }
- Method { name: "updateInputMethod"; type: "QVariant" }
- Method { name: "updateLayout"; type: "QVariant" }
- Method { name: "updateDefaultLocale"; type: "QVariant" }
- Method {
- name: "filterLocaleIndices"
- type: "QVariant"
- Parameter { name: "filterCb"; type: "QVariant" }
- }
- Method { name: "updateAvailableLocaleIndices"; type: "QVariant" }
- Method {
- name: "listLocales"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- Parameter { name: "localeNameOnly"; type: "QVariant" }
- }
- Method {
- name: "nextLocaleIndex"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method {
- name: "changeInputLanguage"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method {
- name: "canChangeInputLanguage"
- type: "QVariant"
- Parameter { name: "customLayoutsOnly"; type: "QVariant" }
- }
- Method {
- name: "findLocale"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "defaultValue"; type: "QVariant" }
- }
- Method { name: "findFallbackIndex"; type: "QVariant" }
- Method {
- name: "isValidLocale"
- type: "QVariant"
- Parameter { name: "localeNameOrIndex"; type: "QVariant" }
- Parameter { name: "ignoreActiveLocales"; type: "QVariant" }
- }
- Method {
- name: "getLayoutFile"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method {
- name: "getFallbackFile"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method {
- name: "layoutExists"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method {
- name: "findLayout"
- type: "QVariant"
- Parameter { name: "localeName"; type: "QVariant" }
- Parameter { name: "layoutType"; type: "QVariant" }
- }
- Method { name: "isHandwritingAvailable"; type: "QVariant" }
- Method {
- name: "setHandwritingMode"
- type: "QVariant"
- Parameter { name: "enabled"; type: "QVariant" }
- Parameter { name: "resetInputMode"; type: "QVariant" }
- }
- }
- Component {
- prototype: "QQuickColumnLayout"
- name: "QtQuick.VirtualKeyboard/KeyboardColumn 1.0"
- exports: ["QtQuick.VirtualKeyboard/KeyboardColumn 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "keyWeight"; type: "double" }
- Property { name: "smallTextVisible"; type: "bool" }
- }
- Component {
- prototype: "QQuickColumnLayout"
- name: "QtQuick.VirtualKeyboard/KeyboardColumn 2.0"
- exports: ["QtQuick.VirtualKeyboard/KeyboardColumn 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "keyWeight"; type: "double" }
- Property { name: "smallTextVisible"; type: "bool" }
- }
- Component {
- prototype: "QQuickColumnLayout"
- name: "QtQuick.VirtualKeyboard/KeyboardLayout 1.0"
- exports: ["QtQuick.VirtualKeyboard/KeyboardLayout 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "inputMethod"; type: "QVariant" }
- Property { name: "sharedLayouts"; type: "QVariant" }
- Property { name: "inputMode"; type: "int" }
- Property { name: "keyWeight"; type: "double" }
- Property { name: "smallTextVisible"; type: "bool" }
- Method { name: "createInputMethod"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickColumnLayout"
- name: "QtQuick.VirtualKeyboard/KeyboardLayout 2.0"
- exports: ["QtQuick.VirtualKeyboard/KeyboardLayout 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "inputMethod"; type: "QVariant" }
- Property { name: "sharedLayouts"; type: "QVariant" }
- Property { name: "inputMode"; type: "int" }
- Property { name: "keyWeight"; type: "double" }
- Property { name: "smallTextVisible"; type: "bool" }
- Method { name: "createInputMethod"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickLoader"
- name: "QtQuick.VirtualKeyboard/KeyboardLayoutLoader 1.1"
- exports: ["QtQuick.VirtualKeyboard/KeyboardLayoutLoader 1.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "inputMethod"; type: "QVariant" }
- Property { name: "sharedLayouts"; type: "QVariant" }
- Property { name: "inputMode"; type: "int" }
- Property { name: "__updateCount"; type: "int" }
- Method { name: "createInputMethod"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickLoader"
- name: "QtQuick.VirtualKeyboard/KeyboardLayoutLoader 2.0"
- exports: ["QtQuick.VirtualKeyboard/KeyboardLayoutLoader 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "inputMethod"; type: "QVariant" }
- Property { name: "sharedLayouts"; type: "QVariant" }
- Property { name: "inputMode"; type: "int" }
- Property { name: "__updateCount"; type: "int" }
- Method { name: "createInputMethod"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickRowLayout"
- name: "QtQuick.VirtualKeyboard/KeyboardRow 1.0"
- exports: ["QtQuick.VirtualKeyboard/KeyboardRow 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "keyWeight"; type: "double" }
- Property { name: "smallTextVisible"; type: "bool" }
- }
- Component {
- prototype: "QQuickRowLayout"
- name: "QtQuick.VirtualKeyboard/KeyboardRow 2.0"
- exports: ["QtQuick.VirtualKeyboard/KeyboardRow 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "keyWeight"; type: "double" }
- Property { name: "smallTextVisible"; type: "bool" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/ModeKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/ModeKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "mode"; type: "bool" }
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/MultiSoundEffect 1.1"
- exports: ["QtQuick.VirtualKeyboard/MultiSoundEffect 1.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "source"; type: "QUrl" }
- Property { name: "maxInstances"; type: "int" }
- Property { name: "__cachedInstances"; type: "QVariant" }
- Property { name: "__currentIndex"; type: "int" }
- Signal {
- name: "playingChanged"
- Parameter { name: "source"; type: "QUrl" }
- Parameter { name: "playing"; type: "bool" }
- }
- Method { name: "play"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/MultiSoundEffect 2.0"
- exports: ["QtQuick.VirtualKeyboard/MultiSoundEffect 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "source"; type: "QUrl" }
- Property { name: "maxInstances"; type: "int" }
- Property { name: "__cachedInstances"; type: "QVariant" }
- Property { name: "__currentIndex"; type: "int" }
- Signal {
- name: "playingChanged"
- Parameter { name: "source"; type: "QUrl" }
- Parameter { name: "playing"; type: "bool" }
- }
- Method { name: "play"; type: "QVariant" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard/MultitapInputMethod 1.0"
- exports: ["QtQuick.VirtualKeyboard/MultitapInputMethod 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- Property { name: "multitapSequence"; type: "string" }
- Property { name: "multitapIndex"; type: "int" }
- Property { name: "multiTapTimer"; type: "QVariant" }
- Method {
- name: "inputModes"
- type: "QVariant"
- Parameter { name: "locale"; type: "QVariant" }
- }
- Method {
- name: "setInputMode"
- type: "QVariant"
- Parameter { name: "locale"; type: "QVariant" }
- Parameter { name: "inputMode"; type: "QVariant" }
- }
- Method {
- name: "setTextCase"
- type: "QVariant"
- Parameter { name: "textCase"; type: "QVariant" }
- }
- Method { name: "reset"; type: "QVariant" }
- Method { name: "update"; type: "QVariant" }
- Method {
- name: "keyEvent"
- type: "QVariant"
- Parameter { name: "key"; type: "QVariant" }
- Parameter { name: "text"; type: "QVariant" }
- Parameter { name: "modifiers"; type: "QVariant" }
- }
- Method { name: "selectionLists"; type: "QVariant" }
- Method {
- name: "selectionListItemCount"
- type: "QVariant"
- Parameter { name: "type"; type: "QVariant" }
- }
- Method {
- name: "selectionListData"
- type: "QVariant"
- Parameter { name: "type"; type: "QVariant" }
- Parameter { name: "index"; type: "QVariant" }
- Parameter { name: "role"; type: "QVariant" }
- }
- Method {
- name: "selectionListItemSelected"
- type: "QVariant"
- Parameter { name: "type"; type: "QVariant" }
- Parameter { name: "index"; type: "QVariant" }
- }
- Property {
- name: "inputContext"
- type: "QVirtualKeyboardInputContext"
- isReadonly: true
- isPointer: true
- }
- Property {
- name: "inputEngine"
- type: "QVirtualKeyboardInputEngine"
- isReadonly: true
- isPointer: true
- }
- Signal {
- name: "selectionListChanged"
- Parameter { name: "type"; type: "QVirtualKeyboardSelectionListModel::Type" }
- }
- Signal {
- name: "selectionListActiveItemChanged"
- Parameter { name: "type"; type: "QVirtualKeyboardSelectionListModel::Type" }
- Parameter { name: "index"; type: "int" }
- }
- Signal { name: "selectionListsChanged" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard/MultitapInputMethod 2.0"
- exports: ["QtQuick.VirtualKeyboard/MultitapInputMethod 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- Property { name: "multitapSequence"; type: "string" }
- Property { name: "multitapIndex"; type: "int" }
- Property { name: "multiTapTimer"; type: "QVariant" }
- Method {
- name: "inputModes"
- type: "QVariant"
- Parameter { name: "locale"; type: "QVariant" }
- }
- Method {
- name: "setInputMode"
- type: "QVariant"
- Parameter { name: "locale"; type: "QVariant" }
- Parameter { name: "inputMode"; type: "QVariant" }
- }
- Method {
- name: "setTextCase"
- type: "QVariant"
- Parameter { name: "textCase"; type: "QVariant" }
- }
- Method { name: "reset"; type: "QVariant" }
- Method { name: "update"; type: "QVariant" }
- Method {
- name: "keyEvent"
- type: "QVariant"
- Parameter { name: "key"; type: "QVariant" }
- Parameter { name: "text"; type: "QVariant" }
- Parameter { name: "modifiers"; type: "QVariant" }
- }
- Method { name: "selectionLists"; type: "QVariant" }
- Method {
- name: "selectionListItemCount"
- type: "QVariant"
- Parameter { name: "type"; type: "QVariant" }
- }
- Method {
- name: "selectionListData"
- type: "QVariant"
- Parameter { name: "type"; type: "QVariant" }
- Parameter { name: "index"; type: "QVariant" }
- Parameter { name: "role"; type: "QVariant" }
- }
- Method {
- name: "selectionListItemSelected"
- type: "QVariant"
- Parameter { name: "type"; type: "QVariant" }
- Parameter { name: "index"; type: "QVariant" }
- }
- Property {
- name: "inputContext"
- type: "QVirtualKeyboardInputContext"
- isReadonly: true
- isPointer: true
- }
- Property {
- name: "inputEngine"
- type: "QVirtualKeyboardInputEngine"
- isReadonly: true
- isPointer: true
- }
- Signal {
- name: "selectionListChanged"
- Parameter { name: "type"; type: "QVirtualKeyboardSelectionListModel::Type" }
- }
- Signal {
- name: "selectionListActiveItemChanged"
- Parameter { name: "type"; type: "QVirtualKeyboardSelectionListModel::Type" }
- Parameter { name: "index"; type: "int" }
- }
- Signal { name: "selectionListsChanged" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/NumberKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/NumberKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/NumberKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/NumberKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickListView"
- name: "QtQuick.VirtualKeyboard/PopupList 2.3"
- exports: ["QtQuick.VirtualKeyboard/PopupList 2.3"]
- exportMetaObjectRevisions: [3]
- isComposite: true
- defaultProperty: "data"
- Property { name: "maxVisibleItems"; type: "int" }
- Property { name: "preferredVisibleItems"; type: "int"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "background"; type: "QQmlComponent"; isPointer: true }
- Property { name: "defaultHighlight"; type: "QQmlComponent"; isReadonly: true; isPointer: true }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/SelectionControl 2.1"
- exports: ["QtQuick.VirtualKeyboard/SelectionControl 2.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- defaultProperty: "data"
- Property { name: "handleIsMoving"; type: "bool" }
- Property { name: "inputContext"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/ShiftKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/ShiftKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/ShiftKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/ShiftKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/SpaceKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/SpaceKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/SpaceKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/SpaceKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/SymbolModeKey 1.0"
- exports: ["QtQuick.VirtualKeyboard/SymbolModeKey 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/SymbolModeKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/SymbolModeKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "text"; type: "string" }
- Property { name: "displayText"; type: "string" }
- Property { name: "smallText"; type: "string" }
- Property { name: "smallTextVisible"; type: "bool" }
- Property { name: "alternativeKeys"; type: "QVariant" }
- Property { name: "effectiveAlternativeKeys"; type: "QVariant"; isReadonly: true }
- Property { name: "effectiveAlternativeKeysHighlightIndex"; type: "int"; isReadonly: true }
- Property { name: "key"; type: "int" }
- Property { name: "noKeyEvent"; type: "bool" }
- Property { name: "active"; type: "bool" }
- Property { name: "noModifier"; type: "bool" }
- Property { name: "repeat"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- Property { name: "functionKey"; type: "bool" }
- Property { name: "showPreview"; type: "bool" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "uppercased"; type: "bool" }
- Property { name: "soundEffect"; type: "QUrl"; isReadonly: true }
- Property { name: "keyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Signal { name: "clicked" }
- }
- Component {
- prototype: "QQuickMultiPointTouchArea"
- name: "QtQuick.VirtualKeyboard/TraceInputArea 2.0"
- exports: ["QtQuick.VirtualKeyboard/TraceInputArea 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "patternRecognitionMode"; type: "int" }
- Property { name: "horizontalRulers"; type: "QVariant" }
- Property { name: "verticalRulers"; type: "QVariant" }
- Property { name: "boundingBox"; type: "QRectF"; isReadonly: true }
- Property { name: "canvasType"; type: "string" }
- Property { name: "__traceCanvasList"; type: "QVariant" }
- Property { name: "__traceCaptureDeviceInfo"; type: "QVariant" }
- Property { name: "__traceScreenInfo"; type: "QVariant" }
- Method {
- name: "findTraceCanvasById"
- type: "QVariant"
- Parameter { name: "traceId"; type: "QVariant" }
- }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard/TraceInputKey 2.0"
- exports: ["QtQuick.VirtualKeyboard/TraceInputKey 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "weight"; type: "double" }
- Property { name: "patternRecognitionMode"; type: "int" }
- Property { name: "horizontalRulers"; type: "QVariant" }
- Property { name: "verticalRulers"; type: "QVariant" }
- Property { name: "boundingBox"; type: "QRectF"; isReadonly: true }
- Property { name: "canvasType"; type: "string" }
- }
- Component {
- prototype: "QQuickListView"
- name: "QtQuick.VirtualKeyboard/WordCandidatePopupList 2.0"
- exports: ["QtQuick.VirtualKeyboard/WordCandidatePopupList 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "preferredVisibleItems"; type: "int"; isReadonly: true }
- Property { name: "flipVertical"; type: "bool"; isReadonly: true }
- Property { name: "maxVisibleItems"; type: "int" }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "background"; type: "QQmlComponent"; isPointer: true }
- Property { name: "defaultHighlight"; type: "QQmlComponent"; isReadonly: true; isPointer: true }
- }
-}
diff --git a/src/import/qmldir b/src/import/qmldir
deleted file mode 100644
index e1110f1a..00000000
--- a/src/import/qmldir
+++ /dev/null
@@ -1,10 +0,0 @@
-module QtQuick.VirtualKeyboard
-plugin qtquickvirtualkeyboardplugin
-classname QtQuickVirtualKeyboardPlugin
-typeinfo plugins.qmltypes
-depends QtQuick 2.0
-depends QtQuick.Window 2.2
-depends QtQuick.Layouts 1.0
-depends Qt.labs.folderlistmodel 2.1
-depends QtQuick.VirtualKeyboard.Settings 2.2
-depends QtQuick.VirtualKeyboard.Styles 2.2
diff --git a/src/import/qtquickvirtualkeyboardplugin.cpp b/src/import/qtquickvirtualkeyboardplugin.cpp
deleted file mode 100644
index 73fc8e82..00000000
--- a/src/import/qtquickvirtualkeyboardplugin.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtquickvirtualkeyboardplugin.h"
-
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
-#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
-#include <QtVirtualKeyboard/private/shifthandler_p.h>
-#include <QtVirtualKeyboard/private/inputmethod_p.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardselectionlistmodel.h>
-#include <QtVirtualKeyboard/private/enterkeyaction_p.h>
-#include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
-#include <QtVirtualKeyboard/private/shadowinputcontext_p.h>
-#include <QtVirtualKeyboard/private/qvirtualkeyboard_staticplugin_p.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-static QObject *createInputContextModule(QQmlEngine *engine, QJSEngine *scriptEngine)
-{
- Q_UNUSED(engine);
- Q_UNUSED(scriptEngine);
- return new QVirtualKeyboardInputContext();
-}
-
-void QtQuickVirtualKeyboardPlugin::registerTypes(const char *uri)
-{
-#if defined(QT_STATICPLUGIN)
- Q_VKB_IMPORT_PLUGIN(QtQuick2Plugin)
- Q_VKB_IMPORT_PLUGIN(QtQuick2WindowPlugin)
- Q_VKB_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
- Q_VKB_IMPORT_PLUGIN(QmlFolderListModelPlugin)
- Q_VKB_IMPORT_PLUGIN(QtQuickVirtualKeyboardSettingsPlugin)
- Q_VKB_IMPORT_PLUGIN(QtQuickVirtualKeyboardStylesPlugin)
-#endif
-
- qmlRegisterSingletonType<QVirtualKeyboardInputContext>(uri, 1, 0, "InputContext", createInputContextModule);
- qmlRegisterSingletonType<QVirtualKeyboardInputContext>(uri, 2, 0, "InputContext", createInputContextModule);
- qmlRegisterUncreatableType<QVirtualKeyboardInputContextPrivate>(uri, 1, 0, "InputContextPrivate", QLatin1String("Cannot create input context private"));
- qmlRegisterUncreatableType<QVirtualKeyboardInputEngine>(uri, 1, 0, "InputEngine", QLatin1String("Cannot create input method engine"));
- qmlRegisterUncreatableType<QVirtualKeyboardInputEngine>(uri, 2, 0, "InputEngine", QLatin1String("Cannot create input method engine"));
- qRegisterMetaType<ShiftHandler *>("ShiftHandler*");
- qmlRegisterUncreatableType<ShiftHandler>(uri, 1, 0, "ShiftHandler", QLatin1String("Cannot create shift handler"));
- qmlRegisterUncreatableType<ShiftHandler>(uri, 2, 0, "ShiftHandler", QLatin1String("Cannot create shift handler"));
- qmlRegisterUncreatableType<QVirtualKeyboardSelectionListModel>(uri, 1, 0, "SelectionListModel", QLatin1String("Cannot create selection list model"));
- qmlRegisterUncreatableType<QVirtualKeyboardSelectionListModel>(uri, 2, 0, "SelectionListModel", QLatin1String("Cannot create selection list model"));
- qmlRegisterUncreatableType<QVirtualKeyboardAbstractInputMethod>(uri, 1, 0, "AbstractInputMethod", QLatin1String("Cannot create abstract input method"));
- qmlRegisterUncreatableType<QVirtualKeyboardAbstractInputMethod>(uri, 2, 0, "AbstractInputMethod", QLatin1String("Cannot create abstract input method"));
- qmlRegisterType<InputMethod>(uri, 1, 0, "InputMethod");
- qmlRegisterType<InputMethod>(uri, 2, 0, "InputMethod");
- qmlRegisterAnonymousType<EnterKeyActionAttachedType>(uri, 1);
- qmlRegisterAnonymousType<EnterKeyActionAttachedType>(uri, 2);
- qmlRegisterType<EnterKeyAction>(uri, 1, 0, "EnterKeyAction");
- qmlRegisterType<EnterKeyAction>(uri, 2, 0, "EnterKeyAction");
- qmlRegisterType<QVirtualKeyboardTrace>(uri, 2, 0, "Trace");
- qmlRegisterType<QVirtualKeyboardTrace>(uri, 2, 4, "Trace");
- qRegisterMetaType<ShadowInputContext *>("ShadowInputContext*");
- qmlRegisterUncreatableType<ShadowInputContext>(uri, 2, 2, "ShadowInputContext", QLatin1String("Cannot create shadow input context"));
-
- const QString path(QStringLiteral("qrc:///QtQuick/VirtualKeyboard/content/"));
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 1, 0, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 1, 2, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 1, 3, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 2, 0, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 2, 1, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 2, 2, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 2, 3, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("InputPanel.qml")), uri, 2, 4, "InputPanel");
- qmlRegisterType(QUrl(path + QLatin1String("HandwritingInputPanel.qml")), uri, 2, 0, "HandwritingInputPanel");
- const QString componentsPath = path + QStringLiteral("components/");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("AlternativeKeys.qml")), uri, 1, 0, "AlternativeKeys");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("AlternativeKeys.qml")), uri, 2, 0, "AlternativeKeys");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BackspaceKey.qml")), uri, 1, 0, "BackspaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BackspaceKey.qml")), uri, 2, 0, "BackspaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BaseKey.qml")), uri, 1, 0, "BaseKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("BaseKey.qml")), uri, 2, 0, "BaseKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ChangeLanguageKey.qml")), uri, 1, 0, "ChangeLanguageKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ChangeLanguageKey.qml")), uri, 2, 0, "ChangeLanguageKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("CharacterPreviewBubble.qml")), uri, 1, 0, "CharacterPreviewBubble");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("CharacterPreviewBubble.qml")), uri, 2, 0, "CharacterPreviewBubble");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("EnterKey.qml")), uri, 1, 0, "EnterKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("EnterKey.qml")), uri, 2, 0, "EnterKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("FillerKey.qml")), uri, 1, 0, "FillerKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("FillerKey.qml")), uri, 2, 0, "FillerKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("HideKeyboardKey.qml")), uri, 1, 0, "HideKeyboardKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("HideKeyboardKey.qml")), uri, 2, 0, "HideKeyboardKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardColumn.qml")), uri, 1, 0, "KeyboardColumn");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardColumn.qml")), uri, 2, 0, "KeyboardColumn");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayout.qml")), uri, 1, 0, "KeyboardLayout");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayout.qml")), uri, 2, 0, "KeyboardLayout");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayoutLoader.qml")), uri, 1, 1, "KeyboardLayoutLoader");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardLayoutLoader.qml")), uri, 2, 0, "KeyboardLayoutLoader");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Keyboard.qml")), uri, 1, 0, "Keyboard");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Keyboard.qml")), uri, 2, 0, "Keyboard");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardRow.qml")), uri, 1, 0, "KeyboardRow");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("KeyboardRow.qml")), uri, 2, 0, "KeyboardRow");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Key.qml")), uri, 1, 0, "Key");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("Key.qml")), uri, 2, 0, "Key");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ModeKey.qml")), uri, 2, 0, "ModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultiSoundEffect.qml")), uri, 1, 1, "MultiSoundEffect");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultiSoundEffect.qml")), uri, 2, 0, "MultiSoundEffect");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultitapInputMethod.qml")), uri, 1, 0, "MultitapInputMethod");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("MultitapInputMethod.qml")), uri, 2, 0, "MultitapInputMethod");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("NumberKey.qml")), uri, 1, 0, "NumberKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("NumberKey.qml")), uri, 2, 0, "NumberKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ShiftKey.qml")), uri, 1, 0, "ShiftKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("ShiftKey.qml")), uri, 2, 0, "ShiftKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SpaceKey.qml")), uri, 1, 0, "SpaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SpaceKey.qml")), uri, 2, 0, "SpaceKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SymbolModeKey.qml")), uri, 1, 0, "SymbolModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SymbolModeKey.qml")), uri, 2, 0, "SymbolModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("HandwritingModeKey.qml")), uri, 2, 0, "HandwritingModeKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("TraceInputArea.qml")), uri, 2, 0, "TraceInputArea");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("TraceInputKey.qml")), uri, 2, 0, "TraceInputKey");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("WordCandidatePopupList.qml")), uri, 2, 0, "WordCandidatePopupList");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("PopupList.qml")), uri, 2, 3, "PopupList");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("SelectionControl.qml")), uri, 2, 1, "SelectionControl");
- qmlRegisterType(QUrl(componentsPath + QLatin1String("InputModeKey.qml")), uri, 2, 3, "InputModeKey");
-
- // The minor version used to be the current Qt 5 minor. For compatibility it is the last
- // Qt 5 release.
- qmlRegisterModule(uri, 2, 15);
-}
-
-QT_END_NAMESPACE
diff --git a/src/import/qtquickvirtualkeyboardplugin.h b/src/import/qtquickvirtualkeyboardplugin.h
deleted file mode 100644
index 14d64b8a..00000000
--- a/src/import/qtquickvirtualkeyboardplugin.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTQUICKVIRTUALKEYBOARDPLUGIN_H
-#define QTQUICKVIRTUALKEYBOARDPLUGIN_H
-
-#include <QQmlExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtQuickVirtualKeyboardPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- QtQuickVirtualKeyboardPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override;
-};
-
-QT_END_NAMESPACE
-
-#endif // QTQUICKVIRTUALKEYBOARDPLUGIN_H
-
diff --git a/src/layouts/CMakeLists.txt b/src/layouts/CMakeLists.txt
new file mode 100644
index 00000000..0a64ff97
--- /dev/null
+++ b/src/layouts/CMakeLists.txt
@@ -0,0 +1,361 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_qml_module(qtvkblayoutsplugin
+ URI "QtQuick.VirtualKeyboard.Layouts"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2 1
+ PLUGIN_TARGET qtvkblayoutsplugin
+ NO_PLUGIN_OPTIONAL
+ NO_GENERATE_CPP_EXPORTS
+)
+
+set(LAYOUT_FILES
+ fallback/dialpad.qml
+ fallback/digits.qml
+ fallback/main.qml
+ fallback/numbers.qml
+ fallback/symbols.qml
+)
+if (FEATURE_vkb_lang_en_GB)
+ list(APPEND LAYOUT_FILES
+ en_GB/dialpad.fallback
+ en_GB/digits.fallback
+ en_GB/main.fallback
+ en_GB/numbers.fallback
+ en_GB/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_en_US)
+ list(APPEND LAYOUT_FILES
+ en_US/dialpad.fallback
+ en_US/digits.fallback
+ en_US/main.fallback
+ en_US/numbers.fallback
+ en_US/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_ar_AR)
+ list(APPEND LAYOUT_FILES
+ ar_AR/dialpad.fallback
+ ar_AR/digits.qml
+ ar_AR/main.qml
+ ar_AR/numbers.qml
+ ar_AR/symbols.qml
+ )
+endif()
+if(FEATURE_vkb_lang_bg_BG)
+ list(APPEND LAYOUT_FILES
+ bg_BG/dialpad.fallback
+ bg_BG/digits.fallback
+ bg_BG/main.qml
+ bg_BG/numbers.fallback
+ bg_BG/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_cs_CZ)
+ list(APPEND LAYOUT_FILES
+ cs_CZ/dialpad.fallback
+ cs_CZ/digits.fallback
+ cs_CZ/main.qml
+ cs_CZ/numbers.fallback
+ cs_CZ/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_da_DK)
+ list(APPEND LAYOUT_FILES
+ da_DK/dialpad.fallback
+ da_DK/digits.fallback
+ da_DK/main.qml
+ da_DK/numbers.fallback
+ da_DK/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_de_DE)
+ list(APPEND LAYOUT_FILES
+ de_DE/dialpad.fallback
+ de_DE/digits.fallback
+ de_DE/main.qml
+ de_DE/numbers.fallback
+ de_DE/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_el_GR)
+ list(APPEND LAYOUT_FILES
+ el_GR/dialpad.fallback
+ el_GR/digits.fallback
+ el_GR/main.qml
+ el_GR/numbers.fallback
+ el_GR/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_es_ES)
+ list(APPEND LAYOUT_FILES
+ es_ES/dialpad.fallback
+ es_ES/digits.fallback
+ es_ES/main.qml
+ es_ES/numbers.fallback
+ es_ES/symbols.qml
+ )
+endif()
+if(FEATURE_vkb_lang_es_MX)
+ list(APPEND LAYOUT_FILES
+ es_MX/dialpad.fallback
+ es_MX/digits.fallback
+ es_MX/main.qml
+ es_MX/numbers.fallback
+ es_MX/symbols.qml
+ )
+endif()
+if(FEATURE_vkb_lang_et_EE)
+ list(APPEND LAYOUT_FILES
+ et_EE/dialpad.fallback
+ et_EE/digits.fallback
+ et_EE/main.qml
+ et_EE/numbers.fallback
+ et_EE/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_fa_FA)
+ list(APPEND LAYOUT_FILES
+ fa_FA/dialpad.fallback
+ fa_FA/digits.qml
+ fa_FA/main.qml
+ fa_FA/numbers.qml
+ fa_FA/symbols.qml
+ )
+endif()
+if(FEATURE_vkb_lang_fi_FI)
+ list(APPEND LAYOUT_FILES
+ fi_FI/dialpad.fallback
+ fi_FI/digits.fallback
+ fi_FI/main.qml
+ fi_FI/numbers.fallback
+ fi_FI/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_fr_CA)
+ list(APPEND LAYOUT_FILES
+ fr_CA/dialpad.fallback
+ fr_CA/digits.fallback
+ fr_CA/main.qml
+ fr_CA/numbers.fallback
+ fr_CA/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_fr_FR)
+ list(APPEND LAYOUT_FILES
+ fr_FR/dialpad.fallback
+ fr_FR/digits.fallback
+ fr_FR/main.qml
+ fr_FR/numbers.fallback
+ fr_FR/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_he_IL)
+ list(APPEND LAYOUT_FILES
+ he_IL/dialpad.fallback
+ he_IL/digits.fallback
+ he_IL/main.qml
+ he_IL/numbers.fallback
+ he_IL/symbols.qml
+ )
+endif()
+if(FEATURE_vkb_lang_hi_IN)
+ list(APPEND LAYOUT_FILES
+ hi_IN/dialpad.fallback
+ hi_IN/digits.fallback
+ hi_IN/main.qml
+ hi_IN/numbers.fallback
+ hi_IN/symbols.qml
+ )
+endif()
+if(FEATURE_vkb_lang_hr_HR)
+ list(APPEND LAYOUT_FILES
+ hr_HR/dialpad.fallback
+ hr_HR/digits.fallback
+ hr_HR/main.qml
+ hr_HR/numbers.fallback
+ hr_HR/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_hu_HU)
+ list(APPEND LAYOUT_FILES
+ hu_HU/dialpad.fallback
+ hu_HU/digits.fallback
+ hu_HU/main.qml
+ hu_HU/numbers.fallback
+ hu_HU/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_id_ID)
+ list(APPEND LAYOUT_FILES
+ id_ID/dialpad.fallback
+ id_ID/digits.fallback
+ id_ID/main.fallback
+ id_ID/numbers.fallback
+ id_ID/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_it_IT)
+ list(APPEND LAYOUT_FILES
+ it_IT/dialpad.fallback
+ it_IT/digits.fallback
+ it_IT/main.qml
+ it_IT/numbers.fallback
+ it_IT/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_nb_NO)
+ list(APPEND LAYOUT_FILES
+ nb_NO/dialpad.fallback
+ nb_NO/digits.fallback
+ nb_NO/main.qml
+ nb_NO/numbers.fallback
+ nb_NO/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_ms_MY)
+ list(APPEND LAYOUT_FILES
+ ms_MY/dialpad.fallback
+ ms_MY/digits.fallback
+ ms_MY/main.fallback
+ ms_MY/numbers.fallback
+ ms_MY/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_nl_NL)
+ list(APPEND LAYOUT_FILES
+ nl_NL/dialpad.fallback
+ nl_NL/digits.fallback
+ nl_NL/main.fallback
+ nl_NL/numbers.fallback
+ nl_NL/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_pl_PL)
+ list(APPEND LAYOUT_FILES
+ pl_PL/dialpad.fallback
+ pl_PL/digits.fallback
+ pl_PL/main.qml
+ pl_PL/numbers.fallback
+ pl_PL/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_pt_BR)
+ list(APPEND LAYOUT_FILES
+ pt_BR/dialpad.fallback
+ pt_BR/digits.fallback
+ pt_BR/main.qml
+ pt_BR/numbers.fallback
+ pt_BR/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_pt_PT)
+ list(APPEND LAYOUT_FILES
+ pt_PT/dialpad.fallback
+ pt_PT/digits.fallback
+ pt_PT/main.qml
+ pt_PT/numbers.fallback
+ pt_PT/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_ro_RO)
+ list(APPEND LAYOUT_FILES
+ ro_RO/dialpad.fallback
+ ro_RO/digits.fallback
+ ro_RO/main.qml
+ ro_RO/numbers.fallback
+ ro_RO/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_ru_RU)
+ list(APPEND LAYOUT_FILES
+ ru_RU/dialpad.fallback
+ ru_RU/digits.fallback
+ ru_RU/main.qml
+ ru_RU/numbers.fallback
+ ru_RU/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_sk_SK)
+ list(APPEND LAYOUT_FILES
+ sk_SK/dialpad.fallback
+ sk_SK/digits.fallback
+ sk_SK/main.qml
+ sk_SK/numbers.fallback
+ sk_SK/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_sl_SI)
+ list(APPEND LAYOUT_FILES
+ sl_SI/dialpad.fallback
+ sl_SI/digits.fallback
+ sl_SI/main.qml
+ sl_SI/numbers.fallback
+ sl_SI/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_sq_AL)
+ list(APPEND LAYOUT_FILES
+ sq_AL/dialpad.fallback
+ sq_AL/digits.fallback
+ sq_AL/main.qml
+ sq_AL/numbers.fallback
+ sq_AL/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_sr_SP)
+ list(APPEND LAYOUT_FILES
+ sr_SP/dialpad.fallback
+ sr_SP/digits.fallback
+ sr_SP/main.qml
+ sr_SP/numbers.fallback
+ sr_SP/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_sv_SE)
+ list(APPEND LAYOUT_FILES
+ sv_SE/dialpad.fallback
+ sv_SE/digits.fallback
+ sv_SE/main.qml
+ sv_SE/numbers.fallback
+ sv_SE/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_tr_TR)
+ list(APPEND LAYOUT_FILES
+ tr_TR/dialpad.fallback
+ tr_TR/digits.fallback
+ tr_TR/main.qml
+ tr_TR/numbers.fallback
+ tr_TR/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_uk_UA)
+ list(APPEND LAYOUT_FILES
+ uk_UA/dialpad.fallback
+ uk_UA/digits.fallback
+ uk_UA/main.qml
+ uk_UA/numbers.fallback
+ uk_UA/symbols.fallback
+ )
+endif()
+if(FEATURE_vkb_lang_vi_VN)
+ list(APPEND LAYOUT_FILES
+ vi_VN/dialpad.fallback
+ vi_VN/digits.fallback
+ vi_VN/main.qml
+ vi_VN/numbers.fallback
+ vi_VN/symbols.qml
+ )
+endif()
+
+if(QT_FEATURE_vkb_layouts)
+ qt_internal_add_resource(qtvkblayoutsplugin "qmake_virtualkeyboard_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ FILES
+ ${LAYOUT_FILES}
+ )
+endif()
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/dialpad.fallback b/src/layouts/ar_AR/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ar_AR/dialpad.fallback
+++ b/src/layouts/ar_AR/dialpad.fallback
diff --git a/src/layouts/ar_AR/digits.qml b/src/layouts/ar_AR/digits.qml
new file mode 100644
index 00000000..3b9788a2
--- /dev/null
+++ b/src/layouts/ar_AR/digits.qml
@@ -0,0 +1,100 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.VirtualKeyboard.Plugins
+
+KeyboardLayout {
+ inputMethod: PlainInputMethod {}
+ inputMode: InputEngine.InputMode.Numeric
+
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: height
+ KeyboardRow {
+ Key {
+ key: 0x0667
+ text: "\u0667"
+ alternativeKeys: "\u06677"
+ }
+ Key {
+ key: 0x0668
+ text: "\u0668"
+ alternativeKeys: "\u06688"
+ }
+ Key {
+ key: 0x0669
+ text: "\u0669"
+ alternativeKeys: "\u06699"
+ }
+ BackspaceKey {}
+ }
+ KeyboardRow {
+ Key {
+ key: 0x0664
+ text: "\u0664"
+ alternativeKeys: "\u06644"
+ }
+ Key {
+ key: 0x0665
+ text: "\u0665"
+ alternativeKeys: "\u06655"
+ }
+ Key {
+ key: 0x0666
+ text: "\u0666"
+ alternativeKeys: "\u06666"
+ }
+ Key {
+ text: " "
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: 0x0661
+ text: "\u0661"
+ alternativeKeys: "\u06611"
+ }
+ Key {
+ key: 0x0662
+ text: "\u0662"
+ alternativeKeys: "\u06622"
+ }
+ Key {
+ key: 0x0663
+ text: "\u0663"
+ alternativeKeys: "\u06633"
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ }
+ KeyboardRow {
+ ChangeLanguageKey {
+ customLayoutsOnly: true
+ visible: true
+ }
+ Key {
+ key: 0x0660
+ text: "\u0660"
+ alternativeKeys: "\u06600"
+ }
+ Key {
+ key: Qt.Key_Comma
+ text: "\u066B"
+ alternativeKeys: "\u066B,."
+ }
+ EnterKey {}
+ }
+ }
+}
diff --git a/src/layouts/ar_AR/handwriting.qml b/src/layouts/ar_AR/handwriting.qml
new file mode 100644
index 00000000..e93dfab7
--- /dev/null
+++ b/src/layouts/ar_AR/handwriting.qml
@@ -0,0 +1,74 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+ inputMode: InputEngine.InputMode.Arabic
+ readonly property bool alphabeticInputMode: [InputEngine.InputMode.Latin, InputEngine.InputMode.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ inputModeNameList: [
+ "ABC", // InputEngine.InputMode.Latin
+ "\u0660\u0661\u0662", // InputEngine.InputMode.Numeric
+ "123", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "", // InputEngine.InputMode.Hiragana
+ "", // InputEngine.InputMode.Katakana
+ "", // InputEngine.InputMode.FullwidthLatin
+ "", // InputEngine.InputMode.Greek
+ "", // InputEngine.InputMode.Cyrillic
+ "\u0623\u200C\u0628\u200C\u062C", // InputEngine.InputMode.Arabic
+ ]
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ alphabeticInputMode ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: alphabeticInputMode ? "#%&*/\\\"'=+-_:;,.?!<>() " : "#%&*/\\\"'=+-_:\u061B\u060C.\u061F!<>() "
+ smallText: alphabeticInputMode ? "!?" : "\u061F!"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/ar_AR/main.qml b/src/layouts/ar_AR/main.qml
new file mode 100644
index 00000000..d31bd2cc
--- /dev/null
+++ b/src/layouts/ar_AR/main.qml
@@ -0,0 +1,205 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Arabic
+ keyWeight: 160
+ smallTextVisible: true
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\u0636"
+ alternativeKeys: "1\u0636\u0661"
+ }
+ Key {
+ id: normalKey
+ text: "\u0635"
+ alternativeKeys: "2\u0635\u0662"
+ }
+ Key {
+ text: "\u062B"
+ alternativeKeys: "3\u062B\u0663"
+ }
+ Key {
+ text: "\u0642"
+ alternativeKeys: "4\u0642\u0664"
+ }
+ Key {
+ text: "\u0641"
+ alternativeKeys: "5\u0641\u0665"
+ }
+ Key {
+ text: "\u063A"
+ alternativeKeys: "6\u063A\u0666"
+ }
+ Key {
+ text: "\u0639"
+ alternativeKeys: "7\u0639\u0667"
+ }
+ Key {
+ text: "\u0647"
+ alternativeKeys: "8\u0647\u0668"
+ }
+ Key {
+ text: "\u062E"
+ alternativeKeys: "9\u062E\u0669"
+ }
+ Key {
+ text: "\u062D"
+ alternativeKeys: "0\u062D\u0660"
+ }
+ Key {
+ text: "\u062C"
+ alternativeKeys: "\u062C\u0686"
+ }
+ Key {
+ text: "\u062F"
+ alternativeKeys: "\u062F\uFDFC"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u0634"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u0633"
+ }
+ Key {
+ text: "\u064A"
+ }
+ Key {
+ text: "\u0628"
+ alternativeKeys: "\u0628\u067E"
+ }
+ Key {
+ text: "\u0644"
+ alternativeKeys: ["\u0644\u0623", "\u0644\u0622", "\u0644", "\u0644\u0627", "\u0644\u0625"]
+ }
+ Key {
+ text: "\u0627"
+ alternativeKeys: "\u0625\u0627\u0623\u0622"
+ }
+ Key {
+ text: "\u062A"
+ }
+ Key {
+ text: "\u0646"
+ }
+ Key {
+ text: "\u0645"
+ }
+ Key {
+ text: "\u0643"
+ alternativeKeys: "\u0643\u06AF"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u0630"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u0626"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u0621"
+ }
+ Key {
+ text: "\u0624"
+ }
+ Key {
+ text: "\u0631"
+ }
+ Key {
+ text: "\u0649"
+ }
+ Key {
+ text: "\u0629"
+ }
+ Key {
+ text: "\u0648"
+ }
+ Key {
+ text: "\u0632"
+ }
+ Key {
+ text: "\u0637"
+ }
+ Key {
+ text: "\u0638"
+ alternativeKeys: "\u064E\u064C\u0650\u064D\u0651\u0652\u0670\u0653\u0640\u0638\u064B\u064F"
+ smallText: "\u25CC\u0650 "
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ displayText: "\u0661\u0662\u0663\u061F"
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u060C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!,\u060C\u061B.\u061F"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/layouts/ar_AR/numbers.qml b/src/layouts/ar_AR/numbers.qml
new file mode 100644
index 00000000..a9dec1f8
--- /dev/null
+++ b/src/layouts/ar_AR/numbers.qml
@@ -0,0 +1,173 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.VirtualKeyboard.Plugins
+
+KeyboardLayout {
+ inputMethod: PlainInputMethod {}
+ inputMode: InputEngine.InputMode.Numeric
+
+ KeyboardRow {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 3
+ KeyboardRow {
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_division
+ text: "\u00F7"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "\u00D7"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 8
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height
+ KeyboardRow {
+ Key {
+ key: 0x0667
+ text: "\u0667"
+ alternativeKeys: "\u06677"
+ }
+ Key {
+ key: 0x0668
+ text: "\u0668"
+ alternativeKeys: "\u06688"
+ }
+ Key {
+ key: 0x0669
+ text: "\u0669"
+ alternativeKeys: "\u06699"
+ }
+ BackspaceKey {}
+ }
+ KeyboardRow {
+ Key {
+ key: 0x0664
+ text: "\u0664"
+ alternativeKeys: "\u06644"
+ }
+ Key {
+ key: 0x0665
+ text: "\u0665"
+ alternativeKeys: "\u06655"
+ }
+ Key {
+ key: 0x0666
+ text: "\u0666"
+ alternativeKeys: "\u06666"
+ }
+ Key {
+ text: " "
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: 0x0661
+ text: "\u0661"
+ alternativeKeys: "\u06611"
+ }
+ Key {
+ key: 0x0662
+ text: "\u0662"
+ alternativeKeys: "\u06622"
+ }
+ Key {
+ key: 0x0663
+ text: "\u0663"
+ alternativeKeys: "\u06633"
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ }
+ KeyboardRow {
+ ChangeLanguageKey {
+ customLayoutsOnly: true
+ visible: true
+ }
+ Key {
+ key: 0x0660
+ text: "\u0660"
+ alternativeKeys: "\u06600"
+ }
+ Key {
+ key: Qt.Key_Comma
+ text: "\u066B"
+ alternativeKeys: "\u066B,."
+ }
+ EnterKey {}
+ }
+ }
+ }
+}
diff --git a/src/layouts/ar_AR/symbols.qml b/src/layouts/ar_AR/symbols.qml
new file mode 100644
index 00000000..a28a96e8
--- /dev/null
+++ b/src/layouts/ar_AR/symbols.qml
@@ -0,0 +1,365 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ smallTextVisible: true
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: 0x0661
+ text: "\u0661"
+ alternativeKeys: "\u06611"
+ }
+ Key {
+ id: normalKey
+ key: 0x0662
+ text: "\u0662"
+ alternativeKeys: "\u06622"
+ }
+ Key {
+ key: 0x0663
+ text: "\u0663"
+ alternativeKeys: "\u06633"
+ }
+ Key {
+ key: 0x0664
+ text: "\u0664"
+ alternativeKeys: "\u06644"
+ }
+ Key {
+ key: 0x0665
+ text: "\u0665"
+ alternativeKeys: "\u06655"
+ }
+ Key {
+ key: 0x0666
+ text: "\u0666"
+ alternativeKeys: "\u06666"
+ }
+ Key {
+ key: 0x0667
+ text: "\u0667"
+ alternativeKeys: "\u06677"
+ }
+ Key {
+ key: 0x0668
+ text: "\u0668"
+ alternativeKeys: "\u06688"
+ }
+ Key {
+ key: 0x0669
+ text: "\u0669"
+ alternativeKeys: "\u06699"
+ }
+ Key {
+ key: 0x0660
+ text: "\u0660"
+ alternativeKeys: "\u06600"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: "\u061B"
+ alternativeKeys: "\u061B;"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "\u061F"
+ alternativeKeys: "\u061F?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\u0623\u200C\u0628\u200C\u062C"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u060C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!,\u060C."
+ highlighted: true
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ smallTextVisible: true
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0xA2
+ text: "¢"
+ }
+ Key {
+ key: 0xA5
+ text: "¥"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\u0623\u200C\u0628\u200C\u062C"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u060C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/dialpad.fallback b/src/layouts/bg_BG/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/bg_BG/dialpad.fallback
+++ b/src/layouts/bg_BG/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/digits.fallback b/src/layouts/bg_BG/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/bg_BG/digits.fallback
+++ b/src/layouts/bg_BG/digits.fallback
diff --git a/src/layouts/bg_BG/handwriting.qml b/src/layouts/bg_BG/handwriting.qml
new file mode 100644
index 00000000..3a75a2ce
--- /dev/null
+++ b/src/layouts/bg_BG/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/bg_BG/main.qml b/src/layouts/bg_BG/main.qml
new file mode 100644
index 00000000..d2d6ed67
--- /dev/null
+++ b/src/layouts/bg_BG/main.qml
@@ -0,0 +1,373 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayoutLoader {
+ sharedLayouts: ['symbols']
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
+ Component {
+ id: cyrillicLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "я"
+ }
+ Key {
+ id: normalKey
+ text: "в"
+ }
+ Key {
+ text: "е"
+ }
+ Key {
+ text: "р"
+ }
+ Key {
+ text: "т"
+ }
+ Key {
+ text: "ъ"
+ }
+ Key {
+ text: "у"
+ }
+ Key {
+ text: "и"
+ }
+ Key {
+ text: "о"
+ }
+ Key {
+ text: "п"
+ }
+ Key {
+ text: "ч"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "а"
+ }
+ Key {
+ text: "с"
+ }
+ Key {
+ text: "д"
+ }
+ Key {
+ text: "ф"
+ }
+ Key {
+ text: "г"
+ }
+ Key {
+ text: "х"
+ }
+ Key {
+ text: "й"
+ }
+ Key {
+ text: "к"
+ }
+ Key {
+ text: "л"
+ }
+ Key {
+ text: "ш"
+ }
+ Key {
+ text: "щ"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ text: "з"
+ }
+ Key {
+ text: "ь"
+ }
+ Key {
+ text: "ц"
+ }
+ Key {
+ text: "ж"
+ }
+ Key {
+ text: "б"
+ }
+ Key {
+ text: "н"
+ }
+ Key {
+ text: "м"
+ }
+ Key {
+ text: "ю"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: latinLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "êeëèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "ŕrř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "ţtŧť"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "ÿyýŷ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "űūũûüuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îïīĩiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "œøõôöòóo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)) ? "a@äåãâàá" : "aäåãâàá"
+ smallTextVisible: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly))
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "šsşś"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dđď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ alternativeKeys: "ġgģĝğ"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "ĺŀłļľl"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zžż"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "çcċčć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "ņńnň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/numbers.fallback b/src/layouts/bg_BG/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/bg_BG/numbers.fallback
+++ b/src/layouts/bg_BG/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/symbols.fallback b/src/layouts/bg_BG/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/bg_BG/symbols.fallback
+++ b/src/layouts/bg_BG/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/dialpad.fallback b/src/layouts/cs_CZ/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/cs_CZ/dialpad.fallback
+++ b/src/layouts/cs_CZ/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/digits.fallback b/src/layouts/cs_CZ/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/cs_CZ/digits.fallback
+++ b/src/layouts/cs_CZ/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/handwriting.fallback b/src/layouts/cs_CZ/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/da_DK/handwriting.fallback
+++ b/src/layouts/cs_CZ/handwriting.fallback
diff --git a/src/layouts/cs_CZ/main.qml b/src/layouts/cs_CZ/main.qml
new file mode 100644
index 00000000..fbc3df33
--- /dev/null
+++ b/src/layouts/cs_CZ/main.qml
@@ -0,0 +1,201 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eéě"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "rř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "tť"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "uúů"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ií"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "oóö"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aåäá"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sš"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "yý"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "cćč"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "nń"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/numbers.fallback b/src/layouts/cs_CZ/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/cs_CZ/numbers.fallback
+++ b/src/layouts/cs_CZ/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/symbols.fallback b/src/layouts/cs_CZ/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/cs_CZ/symbols.fallback
+++ b/src/layouts/cs_CZ/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/dialpad.fallback b/src/layouts/da_DK/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/da_DK/dialpad.fallback
+++ b/src/layouts/da_DK/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/digits.fallback b/src/layouts/da_DK/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/da_DK/digits.fallback
+++ b/src/layouts/da_DK/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/handwriting.fallback b/src/layouts/da_DK/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/de_DE/handwriting.fallback
+++ b/src/layouts/da_DK/handwriting.fallback
diff --git a/src/layouts/da_DK/main.qml b/src/layouts/da_DK/main.qml
new file mode 100644
index 00000000..4fa091fa
--- /dev/null
+++ b/src/layouts/da_DK/main.qml
@@ -0,0 +1,202 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ií"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "oó"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: Qt.Key_Aring
+ text: "å"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aá"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_AE
+ text: "æ"
+ alternativeKeys: "æǽ"
+ }
+ Key {
+ key: Qt.Key_Ooblique
+ text: "ø"
+ alternativeKeys: "øǿ"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ ShiftKey {
+ weight: 240
+ }
+ FillerKey {
+ weight: 80
+ }
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ weight: 80
+ }
+ BackspaceKey {
+ weight: 240
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/da_DK/numbers.fallback b/src/layouts/da_DK/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/da_DK/numbers.fallback
+++ b/src/layouts/da_DK/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/da_DK/symbols.fallback b/src/layouts/da_DK/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/da_DK/symbols.fallback
+++ b/src/layouts/da_DK/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/dialpad.fallback b/src/layouts/de_DE/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/de_DE/dialpad.fallback
+++ b/src/layouts/de_DE/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/digits.fallback b/src/layouts/de_DE/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/de_DE/digits.fallback
+++ b/src/layouts/de_DE/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/handwriting.fallback b/src/layouts/de_DE/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_GB/handwriting.fallback
+++ b/src/layouts/de_DE/handwriting.fallback
diff --git a/src/layouts/de_DE/main.qml b/src/layouts/de_DE/main.qml
new file mode 100644
index 00000000..729d8111
--- /dev/null
+++ b/src/layouts/de_DE/main.qml
@@ -0,0 +1,197 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: Qt.Key_Udiaeresis
+ text: "ü"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sß"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Odiaeresis
+ text: "ö"
+ }
+ Key {
+ key: Qt.Key_Adiaeresis
+ text: "ä"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ ShiftKey {
+ weight: 240
+ }
+ FillerKey {
+ weight: 80
+ }
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ weight: 80
+ }
+ BackspaceKey {
+ weight: 240
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/de_DE/numbers.fallback b/src/layouts/de_DE/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/de_DE/numbers.fallback
+++ b/src/layouts/de_DE/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/de_DE/symbols.fallback b/src/layouts/de_DE/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/de_DE/symbols.fallback
+++ b/src/layouts/de_DE/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/el_GR/dialpad.fallback b/src/layouts/el_GR/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/el_GR/dialpad.fallback
+++ b/src/layouts/el_GR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/el_GR/digits.fallback b/src/layouts/el_GR/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/el_GR/digits.fallback
+++ b/src/layouts/el_GR/digits.fallback
diff --git a/src/layouts/el_GR/handwriting.qml b/src/layouts/el_GR/handwriting.qml
new file mode 100644
index 00000000..43f10410
--- /dev/null
+++ b/src/layouts/el_GR/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Greek ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/el_GR/main.qml b/src/layouts/el_GR/main.qml
new file mode 100644
index 00000000..fce6d15a
--- /dev/null
+++ b/src/layouts/el_GR/main.qml
@@ -0,0 +1,383 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayoutLoader {
+ sharedLayouts: ['symbols']
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Greek ? greekLayout : latinLayout
+ Component {
+ id: greekLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "ς"
+ }
+ Key {
+ id: normalKey
+ text: "ε"
+ alternativeKeys: "εέ"
+ }
+ Key {
+ text: "ρ"
+ }
+ Key {
+ text: "τ"
+ }
+ Key {
+ text: "ψ"
+ }
+ Key {
+ text: "υ"
+ alternativeKeys: "υύϋΰ"
+ }
+ Key {
+ text: "θ"
+ }
+ Key {
+ text: "ι"
+ alternativeKeys: "ιίϊΐ"
+ }
+ Key {
+ text: "ο"
+ alternativeKeys: "οό"
+ }
+ Key {
+ text: "π"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "α"
+ alternativeKeys: "αά"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "σ"
+ }
+ Key {
+ text: "δ"
+ }
+ Key {
+ text: "φ"
+ }
+ Key {
+ text: "γ"
+ }
+ Key {
+ text: "η"
+ alternativeKeys: "ηή"
+ }
+ Key {
+ text: "ξ"
+ }
+ Key {
+ text: "κ"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "λ"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ text: "ζ"
+ }
+ Key {
+ text: "χ"
+ }
+ Key {
+ text: "ψ"
+ }
+ Key {
+ text: "ω"
+ alternativeKeys: "ωώ"
+ }
+ Key {
+ text: "β"
+ }
+ Key {
+ text: "ν"
+ }
+ Key {
+ text: "μ"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ inputModes: [InputEngine.InputMode.Greek, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: latinLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "êeëèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "ŕrř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "ţtŧť"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "ÿyýŷ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "űūũûüuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îïīĩiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "œøõôöòóo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)) ? "a@äåãâàá" : "aäåãâàá"
+ smallTextVisible: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly))
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "šsşś"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dđď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ alternativeKeys: "ġgģĝğ"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "ĺŀłļľl"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zžż"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "çcċčć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "ņńnň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ inputModes: [InputEngine.InputMode.Greek, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/el_GR/numbers.fallback b/src/layouts/el_GR/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/el_GR/numbers.fallback
+++ b/src/layouts/el_GR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/el_GR/symbols.fallback b/src/layouts/el_GR/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/el_GR/symbols.fallback
+++ b/src/layouts/el_GR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/dialpad.fallback b/src/layouts/en_GB/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_GB/dialpad.fallback
+++ b/src/layouts/en_GB/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/digits.fallback b/src/layouts/en_GB/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_GB/digits.fallback
+++ b/src/layouts/en_GB/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/handwriting.fallback b/src/layouts/en_GB/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_US/handwriting.fallback
+++ b/src/layouts/en_GB/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/main.fallback b/src/layouts/en_GB/main.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_GB/main.fallback
+++ b/src/layouts/en_GB/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/numbers.fallback b/src/layouts/en_GB/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_GB/numbers.fallback
+++ b/src/layouts/en_GB/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_GB/symbols.fallback b/src/layouts/en_GB/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_GB/symbols.fallback
+++ b/src/layouts/en_GB/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/dialpad.fallback b/src/layouts/en_US/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_US/dialpad.fallback
+++ b/src/layouts/en_US/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/digits.fallback b/src/layouts/en_US/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_US/digits.fallback
+++ b/src/layouts/en_US/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/handwriting.fallback b/src/layouts/en_US/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/et_EE/handwriting.fallback
+++ b/src/layouts/en_US/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/main.fallback b/src/layouts/en_US/main.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_US/main.fallback
+++ b/src/layouts/en_US/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/numbers.fallback b/src/layouts/en_US/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_US/numbers.fallback
+++ b/src/layouts/en_US/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/en_US/symbols.fallback b/src/layouts/en_US/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/en_US/symbols.fallback
+++ b/src/layouts/en_US/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_ES/dialpad.fallback b/src/layouts/es_ES/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/es_ES/dialpad.fallback
+++ b/src/layouts/es_ES/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_ES/digits.fallback b/src/layouts/es_ES/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/es_ES/digits.fallback
+++ b/src/layouts/es_ES/digits.fallback
diff --git a/src/layouts/es_ES/handwriting.qml b/src/layouts/es_ES/handwriting.qml
new file mode 100644
index 00000000..038933b7
--- /dev/null
+++ b/src/layouts/es_ES/handwriting.qml
@@ -0,0 +1,54 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.¿?¡! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/es_ES/main.qml b/src/layouts/es_ES/main.qml
new file mode 100644
index 00000000..8f5b6be0
--- /dev/null
+++ b/src/layouts/es_ES/main.qml
@@ -0,0 +1,186 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "ēęėëeêèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "üûuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ïįîiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "öõôoòóº"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "äãaâàáª"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Ntilde
+ text: "ñ"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "čcçć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!¿¡.?"
+ smallText: "¡¿"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/es_ES/numbers.fallback b/src/layouts/es_ES/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/es_ES/numbers.fallback
+++ b/src/layouts/es_ES/numbers.fallback
diff --git a/src/layouts/es_ES/symbols.qml b/src/layouts/es_ES/symbols.qml
new file mode 100644
index 00000000..3c89d487
--- /dev/null
+++ b/src/layouts/es_ES/symbols.qml
@@ -0,0 +1,360 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_exclamdown
+ text: "¡"
+ alternativeKeys: "¡!"
+ }
+ Key {
+ key: Qt.Key_questiondown
+ text: "¿"
+ alternativeKeys: "¿?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0xA2
+ text: "¢"
+ }
+ Key {
+ key: 0xA5
+ text: "¥"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? "АБВ" : "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/es_MX/dialpad.fallback b/src/layouts/es_MX/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/es_MX/dialpad.fallback
+++ b/src/layouts/es_MX/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/es_MX/digits.fallback b/src/layouts/es_MX/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/es_MX/digits.fallback
+++ b/src/layouts/es_MX/digits.fallback
diff --git a/src/layouts/es_MX/handwriting.qml b/src/layouts/es_MX/handwriting.qml
new file mode 100644
index 00000000..038933b7
--- /dev/null
+++ b/src/layouts/es_MX/handwriting.qml
@@ -0,0 +1,54 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.¿?¡! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/es_MX/main.qml b/src/layouts/es_MX/main.qml
new file mode 100644
index 00000000..8f5b6be0
--- /dev/null
+++ b/src/layouts/es_MX/main.qml
@@ -0,0 +1,186 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "ēęėëeêèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "üûuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ïįîiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "öõôoòóº"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "äãaâàáª"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Ntilde
+ text: "ñ"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "čcçć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!¿¡.?"
+ smallText: "¡¿"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/es_MX/numbers.fallback b/src/layouts/es_MX/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/es_MX/numbers.fallback
+++ b/src/layouts/es_MX/numbers.fallback
diff --git a/src/layouts/es_MX/symbols.qml b/src/layouts/es_MX/symbols.qml
new file mode 100644
index 00000000..ee119d83
--- /dev/null
+++ b/src/layouts/es_MX/symbols.qml
@@ -0,0 +1,360 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_exclamdown
+ text: "¡"
+ alternativeKeys: "¡!"
+ }
+ Key {
+ key: Qt.Key_questiondown
+ text: "¿"
+ alternativeKeys: "¿?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0xA2
+ text: "¢"
+ }
+ Key {
+ key: 0xA5
+ text: "¥"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? "АБВ" : "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/et_EE/dialpad.fallback b/src/layouts/et_EE/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/et_EE/dialpad.fallback
+++ b/src/layouts/et_EE/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/digits.fallback b/src/layouts/et_EE/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/et_EE/digits.fallback
+++ b/src/layouts/et_EE/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/handwriting.fallback b/src/layouts/et_EE/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fi_FI/handwriting.fallback
+++ b/src/layouts/et_EE/handwriting.fallback
diff --git a/src/layouts/et_EE/main.qml b/src/layouts/et_EE/main.qml
new file mode 100644
index 00000000..bebb17b9
--- /dev/null
+++ b/src/layouts/et_EE/main.qml
@@ -0,0 +1,199 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "óöo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: Qt.Key_Udiaeresis
+ text: "ü"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sš"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Otilde
+ text: "õ"
+ }
+ Key {
+ key: Qt.Key_Adiaeresis
+ text: "ä"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ ShiftKey {
+ weight: 240
+ }
+ FillerKey {
+ weight: 80
+ }
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ weight: 80
+ }
+ BackspaceKey {
+ weight: 240
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/et_EE/numbers.fallback b/src/layouts/et_EE/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/et_EE/numbers.fallback
+++ b/src/layouts/et_EE/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/et_EE/symbols.fallback b/src/layouts/et_EE/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/et_EE/symbols.fallback
+++ b/src/layouts/et_EE/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/dialpad.fallback b/src/layouts/fa_FA/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fa_FA/dialpad.fallback
+++ b/src/layouts/fa_FA/dialpad.fallback
diff --git a/src/layouts/fa_FA/digits.qml b/src/layouts/fa_FA/digits.qml
new file mode 100644
index 00000000..05046448
--- /dev/null
+++ b/src/layouts/fa_FA/digits.qml
@@ -0,0 +1,89 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.VirtualKeyboard.Plugins
+
+KeyboardLayout {
+ inputMethod: PlainInputMethod {}
+ inputMode: InputEngine.InputMode.Numeric
+
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: height
+ KeyboardRow {
+ Key {
+ text: "\u06F7"
+ alternativeKeys: "\u06F77"
+ }
+ Key {
+ text: "\u06F8"
+ alternativeKeys: "\u06F88"
+ }
+ Key {
+ text: "\u06F9"
+ alternativeKeys: "\u06F99"
+ }
+ BackspaceKey {}
+ }
+ KeyboardRow {
+ Key {
+ text: "\u06F4"
+ alternativeKeys: "\u06F44"
+ }
+ Key {
+ text: "\u06F5"
+ alternativeKeys: "\u06F55"
+ }
+ Key {
+ text: "\u06F6"
+ alternativeKeys: "\u06F66"
+ }
+ Key {
+ text: " "
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u06F1"
+ alternativeKeys: "\u06F11"
+ }
+ Key {
+ text: "\u06F2"
+ alternativeKeys: "\u06F22"
+ }
+ Key {
+ text: "\u06F3"
+ alternativeKeys: "\u06F33"
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ }
+ KeyboardRow {
+ ChangeLanguageKey {
+ customLayoutsOnly: true
+ }
+ Key {
+ text: "\u06F0"
+ alternativeKeys: "\u06F00"
+ }
+ Key {
+ key: Qt.Key_Comma
+ text: "\u066B"
+ alternativeKeys: "\u066B,."
+ }
+ EnterKey {}
+ }
+ }
+}
diff --git a/src/layouts/fa_FA/handwriting.qml b/src/layouts/fa_FA/handwriting.qml
new file mode 100644
index 00000000..d75a4b03
--- /dev/null
+++ b/src/layouts/fa_FA/handwriting.qml
@@ -0,0 +1,74 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+ inputMode: InputEngine.InputMode.Arabic
+ readonly property bool alphabeticInputMode: [InputEngine.InputMode.Latin, InputEngine.InputMode.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ inputModeNameList: [
+ "ABC", // InputEngine.InputMode.Latin
+ "\u0660\u0661\u0662", // InputEngine.InputMode.Numeric
+ "123", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "", // InputEngine.InputMode.Hiragana
+ "", // InputEngine.InputMode.Katakana
+ "", // InputEngine.InputMode.FullwidthLatin
+ "", // InputEngine.InputMode.Greek
+ "", // InputEngine.InputMode.Cyrillic
+ "\u0627\u200C\u0628\u200C\u067E", // InputEngine.InputMode.Arabic
+ ]
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ alphabeticInputMode ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: alphabeticInputMode ? "#%&*/\\\"'=+-_:;,.?!<>() " : "#%&*/\\\"'=+-_:\u061B\u060C.\u061F!<>() "
+ smallText: alphabeticInputMode ? "!?" : "\u061F!"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/fa_FA/main.qml b/src/layouts/fa_FA/main.qml
new file mode 100644
index 00000000..7f865fb9
--- /dev/null
+++ b/src/layouts/fa_FA/main.qml
@@ -0,0 +1,172 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Arabic
+ keyWeight: 160
+ smallTextVisible: true
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\u0635"
+ alternativeKeys: "1\u0635\u0636\u0661"
+ smallText: "\u0636\u0661"
+ }
+ Key {
+ id: normalKey
+ text: "\u0642"
+ alternativeKeys: "2\u0642\u0662"
+ }
+ Key {
+ text: "\u0641"
+ alternativeKeys: "3\u0641\u0663"
+ }
+ Key {
+ text: "\u063A"
+ alternativeKeys: "4\u063A\u0664"
+ }
+ Key {
+ text: "\u0639"
+ alternativeKeys: "5\u0639\u0665"
+ }
+ Key {
+ text: "\u0647"
+ alternativeKeys: "6\u0647\u0666"
+ }
+ Key {
+ text: "\u062E"
+ alternativeKeys: "7\u062E\u0667"
+ }
+ Key {
+ text: "\u062D"
+ alternativeKeys: "8\u062D\u0668"
+ }
+ Key {
+ text: "\u062C"
+ alternativeKeys: "9\u062C\u0669"
+ }
+ Key {
+ text: "\u0686"
+ alternativeKeys: "0\u0686\u0660"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u0634"
+ }
+ Key {
+ text: "\u0633"
+ }
+ Key {
+ text: "\u06CC"
+ }
+ Key {
+ text: "\u0628"
+ }
+ Key {
+ text: "\u0644"
+ }
+ Key {
+ text: "\u0627"
+ alternativeKeys: "\u0625\u0627\u0623\u0622"
+ }
+ Key {
+ text: "\u062A"
+ alternativeKeys: "\u062A\u062B"
+ }
+ Key {
+ text: "\u0646"
+ }
+ Key {
+ text: "\u0645"
+ }
+ Key {
+ text: "\u06A9"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u200C"
+ alternativeKeys: "\u200C\u200D"
+ displayText: "\u25C2\u205E\u25B8"
+ displayAlternativeKeys: ["\u25B8\u205E\u25C2"]
+ highlighted: true
+ }
+ Key {
+ text: "\u064E"
+ alternativeKeys: "\u064C\u064E\u064F\u0652\u064B\u064D\u0640\u0651\u0650"
+ smallText: "\u25CC\u064F "
+ }
+ Key {
+ text: "\u0637"
+ alternativeKeys: "\u0637\u0638"
+ }
+ Key {
+ text: "\u0632"
+ alternativeKeys: "\u0632\u0698"
+ }
+ Key {
+ text: "\u0631"
+ }
+ Key {
+ text: "\u0630"
+ }
+ Key {
+ text: "\u062F"
+ }
+ Key {
+ text: "\u0648"
+ alternativeKeys: "\u0624\u0648\u0621"
+ }
+ Key {
+ text: "\u06AF"
+ alternativeKeys: "\u06AF\u067E"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ displayText: "\u0661\u0662\u0663\u061F"
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u060C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!,\u060C\u061B.\u061F"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/layouts/fa_FA/numbers.qml b/src/layouts/fa_FA/numbers.qml
new file mode 100644
index 00000000..98178d61
--- /dev/null
+++ b/src/layouts/fa_FA/numbers.qml
@@ -0,0 +1,163 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.VirtualKeyboard.Plugins
+
+KeyboardLayout {
+ inputMethod: PlainInputMethod {}
+ inputMode: InputEngine.InputMode.Numeric
+
+ KeyboardRow {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 3
+ KeyboardRow {
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_division
+ text: "\u00F7"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "\u00D7"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 8
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height
+ KeyboardRow {
+ Key {
+ text: "\u06F7"
+ alternativeKeys: "\u06F77"
+ }
+ Key {
+ text: "\u06F8"
+ alternativeKeys: "\u06F88"
+ }
+ Key {
+ text: "\u06F9"
+ alternativeKeys: "\u06F99"
+ }
+ BackspaceKey {}
+ }
+ KeyboardRow {
+ Key {
+ text: "\u06F4"
+ alternativeKeys: "\u06F44"
+ }
+ Key {
+ text: "\u06F5"
+ alternativeKeys: "\u06F55"
+ }
+ Key {
+ text: "\u06F6"
+ alternativeKeys: "\u06F66"
+ }
+ Key {
+ text: " "
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u06F1"
+ alternativeKeys: "\u06F11"
+ }
+ Key {
+ text: "\u06F2"
+ alternativeKeys: "\u06F22"
+ }
+ Key {
+ text: "\u06F3"
+ alternativeKeys: "\u06F33"
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ }
+ KeyboardRow {
+ ChangeLanguageKey {
+ customLayoutsOnly: true
+ visible: true
+ }
+ Key {
+ text: "\u06F0"
+ alternativeKeys: "\u06F00"
+ }
+ Key {
+ key: Qt.Key_Comma
+ text: "\u066B"
+ alternativeKeys: "\u066B,."
+ }
+ EnterKey {}
+ }
+ }
+ }
+}
diff --git a/src/layouts/fa_FA/symbols.qml b/src/layouts/fa_FA/symbols.qml
new file mode 100644
index 00000000..407542fe
--- /dev/null
+++ b/src/layouts/fa_FA/symbols.qml
@@ -0,0 +1,363 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ smallTextVisible: true
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\u06F1"
+ alternativeKeys: "\u06F11"
+ }
+ Key {
+ id: normalKey
+ text: "\u06F2"
+ alternativeKeys: "\u06F22"
+ }
+ Key {
+ text: "\u06F3"
+ alternativeKeys: "\u06F33"
+ }
+ Key {
+ text: "\u06F4"
+ alternativeKeys: "\u06F44"
+ }
+ Key {
+ text: "\u06F5"
+ alternativeKeys: "\u06F55"
+ }
+ Key {
+ text: "\u06F6"
+ alternativeKeys: "\u06F66"
+ }
+ Key {
+ text: "\u06F7"
+ alternativeKeys: "\u06F77"
+ }
+ Key {
+ text: "\u06F8"
+ alternativeKeys: "\u06F88"
+ }
+ Key {
+ text: "\u06F9"
+ alternativeKeys: "\u06F99"
+ }
+ Key {
+ text: "\u06F0"
+ alternativeKeys: "\u06F00"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: "\u061B"
+ alternativeKeys: "\u061B;"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "\u061F"
+ alternativeKeys: "\u061F?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\u0627\u200C\u0628\u200C\u067E"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u060C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!,\u060C."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ smallTextVisible: true
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0xA2
+ text: "¢"
+ }
+ Key {
+ key: 0xFDFC
+ text: "\uFDFC"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\u0627\u200C\u0628\u200C\u067E"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u060C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/layouts/fallback/dialpad.qml b/src/layouts/fallback/dialpad.qml
new file mode 100644
index 00000000..4a3db8ee
--- /dev/null
+++ b/src/layouts/fallback/dialpad.qml
@@ -0,0 +1,90 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.VirtualKeyboard.Plugins
+
+KeyboardLayout {
+ inputMethod: PlainInputMethod {}
+ inputMode: InputEngine.InputMode.Numeric
+
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: height
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ BackspaceKey {}
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ text: " "
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ alternativeKeys: "*+"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ Key {
+ text: "#"
+ key: Qt.Key_NumberSign
+ }
+ EnterKey {}
+ }
+ }
+}
diff --git a/src/layouts/fallback/digits.qml b/src/layouts/fallback/digits.qml
new file mode 100644
index 00000000..21afcb42
--- /dev/null
+++ b/src/layouts/fallback/digits.qml
@@ -0,0 +1,91 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.VirtualKeyboard.Plugins
+
+KeyboardLayout {
+ inputMethod: PlainInputMethod {}
+ inputMode: InputEngine.InputMode.Numeric
+
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: height
+ KeyboardRow {
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ BackspaceKey {}
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ text: " "
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ }
+ KeyboardRow {
+ ChangeLanguageKey {
+ customLayoutsOnly: true
+ visible: true
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ Key {
+ // The decimal key, if it is not "," then we fallback to
+ // "." in case it is an unhandled different result
+ key: Qt.locale().decimalPoint === "," ? Qt.Key_Comma : Qt.Key_Period
+ text: Qt.locale().decimalPoint === "," ? "," : "."
+ }
+ EnterKey {}
+ }
+ }
+}
diff --git a/src/layouts/fallback/handwriting.qml b/src/layouts/fallback/handwriting.qml
new file mode 100644
index 00000000..9f3c9cfb
--- /dev/null
+++ b/src/layouts/fallback/handwriting.qml
@@ -0,0 +1,54 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/fallback/main.qml b/src/layouts/fallback/main.qml
new file mode 100644
index 00000000..bcc6dba8
--- /dev/null
+++ b/src/layouts/fallback/main.qml
@@ -0,0 +1,203 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "êeëèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "ŕrř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "ţtŧť"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "ÿyýŷ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "űūũûüuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îïīĩiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "œøõôöòóo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aäåãâàá"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "šsşś"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dđď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ alternativeKeys: "ġgģĝğ"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "ĺŀłļľl"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zžż"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "çcċčć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "ņńnň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/layouts/fallback/numbers.qml b/src/layouts/fallback/numbers.qml
new file mode 100644
index 00000000..80671df1
--- /dev/null
+++ b/src/layouts/fallback/numbers.qml
@@ -0,0 +1,163 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.VirtualKeyboard.Plugins
+
+KeyboardLayout {
+ inputMethod: PlainInputMethod {}
+ inputMode: InputEngine.InputMode.Numeric
+
+ KeyboardRow {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 3
+ KeyboardRow {
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ Key {
+ key: Qt.Key_Comma
+ text: ","
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_division
+ text: "\u00F7"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "\u00D7"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 8
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height
+ KeyboardRow {
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ BackspaceKey {}
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ text: " "
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ }
+ KeyboardRow {
+ ChangeLanguageKey {
+ customLayoutsOnly: true
+ visible: true
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: ".,"
+ }
+ EnterKey {}
+ }
+ }
+ }
+}
diff --git a/src/layouts/fallback/symbols.qml b/src/layouts/fallback/symbols.qml
new file mode 100644
index 00000000..4f0c1233
--- /dev/null
+++ b/src/layouts/fallback/symbols.qml
@@ -0,0 +1,358 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? "АБВ" : "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0xA2
+ text: "¢"
+ }
+ Key {
+ key: 0xA5
+ text: "¥"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? "АБВ" : "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/dialpad.fallback b/src/layouts/fi_FI/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fi_FI/dialpad.fallback
+++ b/src/layouts/fi_FI/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/digits.fallback b/src/layouts/fi_FI/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fi_FI/digits.fallback
+++ b/src/layouts/fi_FI/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/handwriting.fallback b/src/layouts/fi_FI/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_CA/handwriting.fallback
+++ b/src/layouts/fi_FI/handwriting.fallback
diff --git a/src/layouts/fi_FI/main.qml b/src/layouts/fi_FI/main.qml
new file mode 100644
index 00000000..61f76491
--- /dev/null
+++ b/src/layouts/fi_FI/main.qml
@@ -0,0 +1,196 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: Qt.Key_Aring
+ text: "å"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Odiaeresis
+ text: "ö"
+ }
+ Key {
+ key: Qt.Key_Adiaeresis
+ text: "ä"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ ShiftKey {
+ weight: 240
+ }
+ FillerKey {
+ weight: 80
+ }
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ weight: 80
+ }
+ BackspaceKey {
+ weight: 240
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/numbers.fallback b/src/layouts/fi_FI/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fi_FI/numbers.fallback
+++ b/src/layouts/fi_FI/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/symbols.fallback b/src/layouts/fi_FI/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fi_FI/symbols.fallback
+++ b/src/layouts/fi_FI/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/dialpad.fallback b/src/layouts/fr_CA/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_CA/dialpad.fallback
+++ b/src/layouts/fr_CA/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/digits.fallback b/src/layouts/fr_CA/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_CA/digits.fallback
+++ b/src/layouts/fr_CA/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/handwriting.fallback b/src/layouts/fr_CA/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_FR/handwriting.fallback
+++ b/src/layouts/fr_CA/handwriting.fallback
diff --git a/src/layouts/fr_CA/main.qml b/src/layouts/fr_CA/main.qml
new file mode 100644
index 00000000..fa96b77d
--- /dev/null
+++ b/src/layouts/fr_CA/main.qml
@@ -0,0 +1,195 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "éèeêë"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "yÿ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "ùuûü"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îiï"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "ôoœ"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aàâæ"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "cç"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/numbers.fallback b/src/layouts/fr_CA/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_CA/numbers.fallback
+++ b/src/layouts/fr_CA/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/symbols.fallback b/src/layouts/fr_CA/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_CA/symbols.fallback
+++ b/src/layouts/fr_CA/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/dialpad.fallback b/src/layouts/fr_FR/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_FR/dialpad.fallback
+++ b/src/layouts/fr_FR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/digits.fallback b/src/layouts/fr_FR/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_FR/digits.fallback
+++ b/src/layouts/fr_FR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/handwriting.fallback b/src/layouts/fr_FR/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/id_ID/handwriting.fallback
+++ b/src/layouts/fr_FR/handwriting.fallback
diff --git a/src/layouts/fr_FR/main.qml b/src/layouts/fr_FR/main.qml
new file mode 100644
index 00000000..fda6eb57
--- /dev/null
+++ b/src/layouts/fr_FR/main.qml
@@ -0,0 +1,183 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aàâæ"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "éèeêë"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "yÿ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "ùuûü"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îiï"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "ôoœ"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "cç"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/numbers.fallback b/src/layouts/fr_FR/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_FR/numbers.fallback
+++ b/src/layouts/fr_FR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/symbols.fallback b/src/layouts/fr_FR/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/fr_FR/symbols.fallback
+++ b/src/layouts/fr_FR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/he_IL/dialpad.fallback b/src/layouts/he_IL/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/he_IL/dialpad.fallback
+++ b/src/layouts/he_IL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/he_IL/digits.fallback b/src/layouts/he_IL/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/he_IL/digits.fallback
+++ b/src/layouts/he_IL/digits.fallback
diff --git a/src/layouts/he_IL/handwriting.qml b/src/layouts/he_IL/handwriting.qml
new file mode 100644
index 00000000..5eb39268
--- /dev/null
+++ b/src/layouts/he_IL/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Hebrew ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/he_IL/main.qml b/src/layouts/he_IL/main.qml
new file mode 100644
index 00000000..f2aa3322
--- /dev/null
+++ b/src/layouts/he_IL/main.qml
@@ -0,0 +1,392 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayoutLoader {
+ sharedLayouts: ['symbols']
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? hebrewLayout : latinLayout
+ Component {
+ id: hebrewLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ alternativeKeys: "'\""
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u05E7"
+ alternativeKeys: "\u05B3\u05E7\u05B8\u05BB"
+ }
+ Key {
+ text: "\u05E8"
+ }
+ Key {
+ text: "\u05D0"
+ }
+ Key {
+ text: "\u05D8"
+ }
+ Key {
+ text: "\u05D5"
+ alternativeKeys: [ "\u05D5", "\u05D5\u05B9", "\u05D5\u05BC" ]
+ }
+ Key {
+ text: "\u05DF"
+ }
+ Key {
+ text: "\u05DD"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u05E4"
+ alternativeKeys: "\u05B2\u05B7\u05E4"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u05E9"
+ alternativeKeys: [ "\u05E9", "\u05B0", "\u05E9\u05C2", "\u05E9\u05C1" ]
+ }
+ Key {
+ id: normalKey
+ text: "\u05D3"
+ alternativeKeys: "\u05D3\u05BC"
+ }
+ Key {
+ text: "\u05D2"
+ alternativeKeys: [ "\u05D2", "\u05D2\u05F3" ]
+ }
+ Key {
+ text: "\u05DB"
+ }
+ Key {
+ text: "\u05E2"
+ }
+ Key {
+ text: "\u05D9"
+ alternativeKeys: [ "\u05D9", "\u05F2\u05B7" ]
+ }
+ Key {
+ text: "\u05D7"
+ alternativeKeys: [ "\u05B9", "\u05D7", "\u05D7\u05F3", "\u05B4" ]
+ }
+ Key {
+ text: "\u05DC"
+ }
+ Key {
+ text: "\u05DA"
+ }
+ Key {
+ text: "\u05E3"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u05D6"
+ alternativeKeys: [ "\u05D6", "\u05D6\u05F3" ]
+ }
+ Key {
+ text: "\u05E1"
+ alternativeKeys: "\u05E1\u05B6\u05B1"
+ }
+ Key {
+ text: "\u05D1"
+ }
+ Key {
+ text: "\u05D4"
+ }
+ Key {
+ text: "\u05E0"
+ }
+ Key {
+ text: "\u05DE"
+ }
+ Key {
+ text: "\u05E6"
+ alternativeKeys: [ "\u05E6", "\u05E6\u05F3", "\u05B5" ]
+ }
+ Key {
+ text: "\u05EA"
+ alternativeKeys: [ "\u05EA", "\u05EA\u05F3" ]
+ }
+ Key {
+ text: "\u05E5"
+ alternativeKeys: [ "\u05E5", "\u05E5\u05F3" ]
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ inputModes: [InputEngine.InputMode.Hebrew, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: latinLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "êeëèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "ŕrř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "ţtŧť"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "ÿyýŷ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "űūũûüuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îïīĩiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "œøõôöòóo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)) ? "a@äåãâàá" : "aäåãâàá"
+ smallTextVisible: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly))
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "šsşś"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dđď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ alternativeKeys: "ġgģĝğ"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "ĺŀłļľl"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zžż"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "çcċčć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "ņńnň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ inputModes: [InputEngine.InputMode.Hebrew, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/he_IL/numbers.fallback b/src/layouts/he_IL/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/he_IL/numbers.fallback
+++ b/src/layouts/he_IL/numbers.fallback
diff --git a/src/layouts/he_IL/symbols.qml b/src/layouts/he_IL/symbols.qml
new file mode 100644
index 00000000..ddeb3573
--- /dev/null
+++ b/src/layouts/he_IL/symbols.qml
@@ -0,0 +1,358 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ alternativeKeys: "$¢"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ text: "₪"
+ }
+ Key {
+ key: 0xA5
+ text: "¥"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/dialpad.fallback b/src/layouts/hi_IN/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hi_IN/dialpad.fallback
+++ b/src/layouts/hi_IN/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/digits.fallback b/src/layouts/hi_IN/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hi_IN/digits.fallback
+++ b/src/layouts/hi_IN/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/handwriting.fallback b/src/layouts/hi_IN/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/it_IT/handwriting.fallback
+++ b/src/layouts/hi_IN/handwriting.fallback
diff --git a/src/layouts/hi_IN/main.qml b/src/layouts/hi_IN/main.qml
new file mode 100644
index 00000000..c9512cc9
--- /dev/null
+++ b/src/layouts/hi_IN/main.qml
@@ -0,0 +1,191 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ smallTextVisible: true
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\u0914"
+ alternativeKeys: "\u0914\u094C\u0967"
+ }
+ Key {
+ id: normalKey
+ text: "\u0910"
+ alternativeKeys: "\u0910\u0948\u0968"
+ }
+ Key {
+ text: "\u0906"
+ alternativeKeys: "\u0906\u093E\u0969"
+ }
+ Key {
+ text: "\u0908"
+ alternativeKeys: "\u0908\u0940\u096A"
+ }
+ Key {
+ text: "\u090A"
+ alternativeKeys: "\u090A\u0942\u096B"
+ }
+ Key {
+ text: "\u092C"
+ alternativeKeys: "\u092C\u092D\u096C"
+ }
+ Key {
+ text: "\u0939"
+ alternativeKeys: "\u0939\u096D"
+ }
+ Key {
+ text: "\u0917"
+ alternativeKeys: "\u0917\u0918\u096E"
+ }
+ Key {
+ text: "\u0926"
+ alternativeKeys: "\u0926\u0927\u096F"
+ }
+ Key {
+ text: "\u091C"
+ alternativeKeys: "\u0966\u091E\u091D\u091C"
+ }
+ Key {
+ text: "\u0921"
+ alternativeKeys: "\u0921\u0922"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u0913"
+ alternativeKeys: "\u0913\u094B"
+ }
+ Key {
+ text: "\u090F"
+ alternativeKeys: "\u090F\u0947"
+ }
+ Key {
+ text: "\u0905"
+ }
+ Key {
+ text: "\u0907"
+ alternativeKeys: "\u0907\u093F"
+ }
+ Key {
+ text: "\u0909"
+ alternativeKeys: "\u0909\u0941"
+ }
+ Key {
+ text: "\u092A"
+ alternativeKeys: "\u092A\u092B"
+ }
+ Key {
+ text: "\u0930"
+ alternativeKeys: "\u0930\u090B\u0943"
+ }
+ Key {
+ text: "\u0915"
+ alternativeKeys: "\u0915\u0916"
+ }
+ Key {
+ text: "\u0924"
+ alternativeKeys: ["\u0924", "\u0925", "\u0924\u094D\u0930"]
+ }
+ Key {
+ text: "\u091A"
+ alternativeKeys: "\u091A\u091B"
+ }
+ Key {
+ text: "\u091F"
+ alternativeKeys: "\u091F\u0920"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u200C"
+ alternativeKeys: "\u200C\u200D"
+ displayText: "\u25C2\u205E\u25B8"
+ displayAlternativeKeys: ["\u25B8\u205E\u25C2"]
+ highlighted: true
+ }
+ Key {
+ text: "\u0911"
+ alternativeKeys: "\u0911\u0949"
+ }
+ Key {
+ text: "\u094D"
+ alternativeKeys: "\u094D\u0945\u090D"
+ }
+ Key {
+ text: "\u0902"
+ alternativeKeys: "\u093C\u0902\u0903\u0901\u093D"
+ }
+ Key {
+ text: "\u092E"
+ alternativeKeys: "\u092E\u0950"
+ }
+ Key {
+ text: "\u0928"
+ alternativeKeys: "\u0919\u0928\u0923\u091E"
+ }
+ Key {
+ text: "\u0935"
+ }
+ Key {
+ text: "\u0932"
+ alternativeKeys: "\u0932\u0933"
+ }
+ Key {
+ text: "\u0938"
+ alternativeKeys: ["\u0936\u094D\u0930", "\u0938", "\u0936", "\u0937"]
+ }
+ Key {
+ text: "\u092F"
+ alternativeKeys: "\u0943"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ displayText: "&\u0967\u0968\u0969"
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/numbers.fallback b/src/layouts/hi_IN/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hi_IN/numbers.fallback
+++ b/src/layouts/hi_IN/numbers.fallback
diff --git a/src/layouts/hi_IN/symbols.qml b/src/layouts/hi_IN/symbols.qml
new file mode 100644
index 00000000..15e46e8a
--- /dev/null
+++ b/src/layouts/hi_IN/symbols.qml
@@ -0,0 +1,368 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "\u0967"
+ alternativeKeys: "\u09671"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "\u0968"
+ alternativeKeys: "\u09682"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "\u0969"
+ alternativeKeys: "\u09693"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "\u096A"
+ alternativeKeys: "\u096A4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "\u096B"
+ alternativeKeys: "\u096B5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "\u096C"
+ alternativeKeys: "\u096C6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "\u096D"
+ alternativeKeys: "\u096D7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "\u096E"
+ alternativeKeys: "\u096E8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "\u096F"
+ alternativeKeys: "\u096F9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "\u0966"
+ alternativeKeys: "\u09660"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\u0915\u0916\u0917"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0xA2
+ text: "¢"
+ }
+ Key {
+ key: 0x20B9
+ text: "\u20B9"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\u0915\u0916\u0917"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/dialpad.fallback b/src/layouts/hr_HR/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hr_HR/dialpad.fallback
+++ b/src/layouts/hr_HR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/digits.fallback b/src/layouts/hr_HR/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hr_HR/digits.fallback
+++ b/src/layouts/hr_HR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/handwriting.fallback b/src/layouts/hr_HR/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ms_MY/handwriting.fallback
+++ b/src/layouts/hr_HR/handwriting.fallback
diff --git a/src/layouts/hr_HR/main.qml b/src/layouts/hr_HR/main.qml
new file mode 100644
index 00000000..283cc6d7
--- /dev/null
+++ b/src/layouts/hr_HR/main.qml
@@ -0,0 +1,190 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "oö"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: 0x160
+ text: "š"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aåä"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: 0x10C
+ text: "č"
+ }
+ Key {
+ key: 0x106
+ text: "ć"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ Key {
+ key: 0x110
+ text: "đ"
+ }
+ Key {
+ key: 0x17D
+ text: "ž"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/numbers.fallback b/src/layouts/hr_HR/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hr_HR/numbers.fallback
+++ b/src/layouts/hr_HR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/symbols.fallback b/src/layouts/hr_HR/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hr_HR/symbols.fallback
+++ b/src/layouts/hr_HR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/dialpad.fallback b/src/layouts/hu_HU/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hu_HU/dialpad.fallback
+++ b/src/layouts/hu_HU/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/digits.fallback b/src/layouts/hu_HU/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hu_HU/digits.fallback
+++ b/src/layouts/hu_HU/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/handwriting.fallback b/src/layouts/hu_HU/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nb_NO/handwriting.fallback
+++ b/src/layouts/hu_HU/handwriting.fallback
diff --git a/src/layouts/hu_HU/main.qml b/src/layouts/hu_HU/main.qml
new file mode 100644
index 00000000..0def7493
--- /dev/null
+++ b/src/layouts/hu_HU/main.qml
@@ -0,0 +1,195 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "úűuü"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ií"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "óőoö"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aåäá"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sš"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/numbers.fallback b/src/layouts/hu_HU/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hu_HU/numbers.fallback
+++ b/src/layouts/hu_HU/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/symbols.fallback b/src/layouts/hu_HU/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/hu_HU/symbols.fallback
+++ b/src/layouts/hu_HU/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/dialpad.fallback b/src/layouts/id_ID/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/id_ID/dialpad.fallback
+++ b/src/layouts/id_ID/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/digits.fallback b/src/layouts/id_ID/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/id_ID/digits.fallback
+++ b/src/layouts/id_ID/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/handwriting.fallback b/src/layouts/id_ID/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nl_NL/handwriting.fallback
+++ b/src/layouts/id_ID/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/main.fallback b/src/layouts/id_ID/main.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/id_ID/main.fallback
+++ b/src/layouts/id_ID/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/numbers.fallback b/src/layouts/id_ID/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/id_ID/numbers.fallback
+++ b/src/layouts/id_ID/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/id_ID/symbols.fallback b/src/layouts/id_ID/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/id_ID/symbols.fallback
+++ b/src/layouts/id_ID/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/dialpad.fallback b/src/layouts/it_IT/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/it_IT/dialpad.fallback
+++ b/src/layouts/it_IT/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/digits.fallback b/src/layouts/it_IT/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/it_IT/digits.fallback
+++ b/src/layouts/it_IT/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/handwriting.fallback b/src/layouts/it_IT/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pl_PL/handwriting.fallback
+++ b/src/layouts/it_IT/handwriting.fallback
diff --git a/src/layouts/it_IT/main.qml b/src/layouts/it_IT/main.qml
new file mode 100644
index 00000000..54cacad7
--- /dev/null
+++ b/src/layouts/it_IT/main.qml
@@ -0,0 +1,193 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "uùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "iìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "oòó"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aàá"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/it_IT/numbers.fallback b/src/layouts/it_IT/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/it_IT/numbers.fallback
+++ b/src/layouts/it_IT/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/it_IT/symbols.fallback b/src/layouts/it_IT/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/it_IT/symbols.fallback
+++ b/src/layouts/it_IT/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/dialpad.fallback b/src/layouts/ja_JP/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ja_JP/dialpad.fallback
+++ b/src/layouts/ja_JP/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/digits.fallback b/src/layouts/ja_JP/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ja_JP/digits.fallback
+++ b/src/layouts/ja_JP/digits.fallback
diff --git a/src/layouts/ja_JP/handwriting.qml b/src/layouts/ja_JP/handwriting.qml
new file mode 100644
index 00000000..c8d5acd3
--- /dev/null
+++ b/src/layouts/ja_JP/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.JapaneseHandwriting ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "。"
+ alternativeKeys: "‘’“”~…—\",.:;、。?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/ja_JP/main.qml b/src/layouts/ja_JP/main.qml
new file mode 100644
index 00000000..18680c99
--- /dev/null
+++ b/src/layouts/ja_JP/main.qml
@@ -0,0 +1,453 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; JapaneseInputMethod {}', parent, "japaneseInputMethod")
+ }
+ sharedLayouts: ['symbols']
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.FullwidthLatin ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Left
+ Layout.preferredWidth: normalKeyWidth / 2
+ Layout.fillWidth: false
+ displayText: "\u2190"
+ repeat: true
+ noModifier: true
+ functionKey: true
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_Right
+ Layout.preferredWidth: normalKeyWidth / 2
+ Layout.fillWidth: false
+ displayText: "\u2192"
+ repeat: true
+ noModifier: true
+ functionKey: true
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_Period
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "\uFF51"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "\uFF57"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "\uFF45"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "\uFF52"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "\uFF54"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "\uFF59"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "\uFF55"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "\uFF49"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "\uFF4F"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "\uFF50"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "\uFF41"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "\uFF53"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "\uFF44"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "\uFF46"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "\uFF47"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "\uFF48"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "\uFF4A"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "\uFF4B"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "\uFF4C"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "\uFF5A"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "\uFF58"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "\uFF43"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "\uFF56"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "\uFF42"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "\uFF4E"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "\uFF4D"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Left
+ weight: normalKeyWidth / 2
+ Layout.fillWidth: false
+ displayText: "\u2190"
+ repeat: true
+ noModifier: true
+ functionKey: true
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_Right
+ weight: normalKeyWidth / 2
+ Layout.fillWidth: false
+ displayText: "\u2192"
+ repeat: true
+ noModifier: true
+ functionKey: true
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/numbers.fallback b/src/layouts/ja_JP/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ja_JP/numbers.fallback
+++ b/src/layouts/ja_JP/numbers.fallback
diff --git a/src/layouts/ja_JP/symbols.qml b/src/layouts/ja_JP/symbols.qml
new file mode 100644
index 00000000..c84134fb
--- /dev/null
+++ b/src/layouts/ja_JP/symbols.qml
@@ -0,0 +1,486 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; JapaneseInputMethod {}', parent, "symbols.qml")
+ }
+ sharedLayouts: ['main']
+ property int page
+ readonly property int numPages: 3
+ readonly property string inputModeName: {
+ switch (InputContext.inputEngine.inputMode) {
+ case InputEngine.Katakana:
+ return "アイウ"
+ case InputEngine.Hiragana:
+ return "あいう"
+ default:
+ return "ABC"
+ }
+ }
+ sourceComponent: {
+ switch (page) {
+ case 2: return page3
+ case 1: return page2
+ default: return page1
+ }
+ }
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "("
+ }
+ Key {
+ key: Qt.Key_1
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "“"
+ }
+ Key {
+ text: "”"
+ }
+ Key {
+ text: "、"
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "~"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: inputModeName
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "—"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "½"
+ alternativeKeys: "½¼¾"
+ }
+ Key {
+ id: normalKey
+ text: "'"
+ }
+ Key {
+ text: "/"
+ }
+ Key {
+ text: "\\"
+ }
+ Key {
+ text: "|"
+ }
+ Key {
+ text: "["
+ }
+ Key {
+ text: "]"
+ }
+ Key {
+ text: "{"
+ }
+ Key {
+ text: "}"
+ }
+ Key {
+ text: "·"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "<"
+ }
+ Key {
+ text: ">"
+ }
+ Key {
+ text: ","
+ }
+ Key {
+ text: "."
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "="
+ }
+ Key {
+ text: "~"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "\""
+ }
+ Key {
+ text: "§"
+ }
+ Key {
+ text: "^"
+ }
+ Key {
+ text: "$"
+ }
+ Key {
+ text: "¥"
+ }
+ Key {
+ text: "€"
+ }
+ Key {
+ text: "£"
+ }
+ Key {
+ text: "¢"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: inputModeName
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "。"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page3
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\"
+ }
+ Key {
+ id: normalKey
+ text: "/"
+ }
+ Key {
+ text: "("
+ }
+ Key {
+ text: ")"
+ }
+ Key {
+ text: "〔"
+ }
+ Key {
+ text: "〕"
+ }
+ Key {
+ text: "〈"
+ }
+ Key {
+ text: "〉"
+ }
+ Key {
+ text: "《"
+ }
+ Key {
+ text: "》"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "→"
+ }
+ Key {
+ text: "←"
+ }
+ Key {
+ text: "↑"
+ }
+ Key {
+ text: "↓"
+ }
+ Key {
+ text: "■"
+ }
+ Key {
+ text: "□"
+ }
+ Key {
+ text: "●"
+ }
+ Key {
+ text: "○"
+ }
+ Key {
+ text: "【"
+ }
+ Key {
+ text: "】"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "『"
+ }
+ Key {
+ text: "』"
+ }
+ Key {
+ text: "「"
+ }
+ Key {
+ text: "」"
+ }
+ Key {
+ text: "★"
+ }
+ Key {
+ text: "☆"
+ }
+ Key {
+ text: "◆"
+ }
+ Key {
+ text: "◇"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: inputModeName
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "…"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/dialpad.fallback b/src/layouts/ko_KR/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ko_KR/dialpad.fallback
+++ b/src/layouts/ko_KR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/digits.fallback b/src/layouts/ko_KR/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ko_KR/digits.fallback
+++ b/src/layouts/ko_KR/digits.fallback
diff --git a/src/layouts/ko_KR/handwriting.qml b/src/layouts/ko_KR/handwriting.qml
new file mode 100644
index 00000000..5502517d
--- /dev/null
+++ b/src/layouts/ko_KR/handwriting.qml
@@ -0,0 +1,73 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+ inputMode: preferredInputMode()
+
+ Connections {
+ target: InputContext
+ function onInputMethodHintsChanged() {
+ var newInputMode = preferredInputMode()
+ if (InputContext.inputEngine.inputModes.indexOf(newInputMode) !== -1)
+ InputContext.inputEngine.inputMode = newInputMode
+ }
+ }
+
+ function preferredInputMode() {
+ return InputContext.inputMethodHints &
+ (Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
+ Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.KoreanHandwriting
+ }
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.KoreanHandwriting ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/ko_KR/main.qml b/src/layouts/ko_KR/main.qml
new file mode 100644
index 00000000..b04c6310
--- /dev/null
+++ b/src/layouts/ko_KR/main.qml
@@ -0,0 +1,334 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HangulInputMethod {}', parent, "main.qml")
+ }
+ sourceComponent: InputContext.shiftActive ? page2 : page1
+ sharedLayouts: ['symbols']
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\u3142"
+ alternativeKeys: "\u3142\u3143"
+ }
+ Key {
+ id: normalKey
+ text: "\u3148"
+ alternativeKeys: "\u3148\u3149"
+ }
+ Key {
+ text: "\u3137"
+ alternativeKeys: "\u3137\u3138"
+ }
+ Key {
+ text: "\u3131"
+ alternativeKeys: "\u3131\u3132"
+ }
+ Key {
+ text: "\u3145"
+ alternativeKeys: "\u3145\u3146"
+ }
+ Key {
+ text: "\u315B"
+ }
+ Key {
+ text: "\u3155"
+ }
+ Key {
+ text: "\u3151"
+ }
+ Key {
+ text: "\u3150"
+ alternativeKeys: "\u3150\u3152"
+ }
+ Key {
+ text: "\u3154"
+ alternativeKeys: "\u3154\u3156"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u3141"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u3134"
+ }
+ Key {
+ text: "\u3147"
+ }
+ Key {
+ text: "\u3139"
+ }
+ Key {
+ text: "\u314E"
+ }
+ Key {
+ text: "\u3157"
+ }
+ Key {
+ text: "\u3153"
+ }
+ Key {
+ text: "\u314F"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u3163"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ text: "\u314B"
+ }
+ Key {
+ text: "\u314C"
+ }
+ Key {
+ text: "\u314A"
+ }
+ Key {
+ text: "\u314D"
+ }
+ Key {
+ text: "\u3160"
+ }
+ Key {
+ text: "\u315C"
+ }
+ Key {
+ text: "\u3161"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\u3143"
+ }
+ Key {
+ id: normalKey
+ text: "\u3149"
+ }
+ Key {
+ text: "\u3138"
+ }
+ Key {
+ text: "\u3132"
+ }
+ Key {
+ text: "\u3146"
+ }
+ Key {
+ text: "\u315B"
+ }
+ Key {
+ text: "\u3155"
+ }
+ Key {
+ text: "\u3151"
+ }
+ Key {
+ text: "\u3152"
+ }
+ Key {
+ text: "\u3156"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u3141"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u3134"
+ }
+ Key {
+ text: "\u3147"
+ }
+ Key {
+ text: "\u3139"
+ }
+ Key {
+ text: "\u314E"
+ }
+ Key {
+ text: "\u3157"
+ }
+ Key {
+ text: "\u3153"
+ }
+ Key {
+ text: "\u314F"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u3163"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ text: "\u314B"
+ }
+ Key {
+ text: "\u314C"
+ }
+ Key {
+ text: "\u314A"
+ }
+ Key {
+ text: "\u314D"
+ }
+ Key {
+ text: "\u3160"
+ }
+ Key {
+ text: "\u315C"
+ }
+ Key {
+ text: "\u3161"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/numbers.fallback b/src/layouts/ko_KR/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ko_KR/numbers.fallback
+++ b/src/layouts/ko_KR/numbers.fallback
diff --git a/src/layouts/ko_KR/symbols.qml b/src/layouts/ko_KR/symbols.qml
new file mode 100644
index 00000000..c7e0890c
--- /dev/null
+++ b/src/layouts/ko_KR/symbols.qml
@@ -0,0 +1,362 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HangulInputMethod {}', parent, "symbols.qml")
+ }
+ sharedLayouts: ['main']
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\uD55C\uAE00"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0x20A9
+ text: "\u20A9"
+ }
+ Key {
+ key: 0xA5
+ text: "¥"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "\uD55C\uAE00"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/dialpad.fallback b/src/layouts/ms_MY/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ms_MY/dialpad.fallback
+++ b/src/layouts/ms_MY/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/digits.fallback b/src/layouts/ms_MY/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ms_MY/digits.fallback
+++ b/src/layouts/ms_MY/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/handwriting.fallback b/src/layouts/ms_MY/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_BR/handwriting.fallback
+++ b/src/layouts/ms_MY/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/main.fallback b/src/layouts/ms_MY/main.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ms_MY/main.fallback
+++ b/src/layouts/ms_MY/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/numbers.fallback b/src/layouts/ms_MY/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ms_MY/numbers.fallback
+++ b/src/layouts/ms_MY/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ms_MY/symbols.fallback b/src/layouts/ms_MY/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ms_MY/symbols.fallback
+++ b/src/layouts/ms_MY/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/dialpad.fallback b/src/layouts/nb_NO/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nb_NO/dialpad.fallback
+++ b/src/layouts/nb_NO/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/digits.fallback b/src/layouts/nb_NO/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nb_NO/digits.fallback
+++ b/src/layouts/nb_NO/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/handwriting.fallback b/src/layouts/nb_NO/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_PT/handwriting.fallback
+++ b/src/layouts/nb_NO/handwriting.fallback
diff --git a/src/layouts/nb_NO/main.qml b/src/layouts/nb_NO/main.qml
new file mode 100644
index 00000000..d11349a0
--- /dev/null
+++ b/src/layouts/nb_NO/main.qml
@@ -0,0 +1,202 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eéèê"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "uü"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "oöóòô"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: Qt.Key_Aring
+ text: "å"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aäâá"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Ooblique
+ text: "ø"
+ alternativeKeys: "øö"
+ }
+ Key {
+ key: Qt.Key_AE
+ text: "æ"
+ alternativeKeys: "æä"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ ShiftKey {
+ weight: 240
+ }
+ FillerKey {
+ weight: 80
+ }
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ weight: 80
+ }
+ BackspaceKey {
+ weight: 240
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/numbers.fallback b/src/layouts/nb_NO/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nb_NO/numbers.fallback
+++ b/src/layouts/nb_NO/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/symbols.fallback b/src/layouts/nb_NO/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nb_NO/symbols.fallback
+++ b/src/layouts/nb_NO/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/dialpad.fallback b/src/layouts/nl_NL/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nl_NL/dialpad.fallback
+++ b/src/layouts/nl_NL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/digits.fallback b/src/layouts/nl_NL/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nl_NL/digits.fallback
+++ b/src/layouts/nl_NL/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/handwriting.fallback b/src/layouts/nl_NL/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ru_RU/handwriting.fallback
+++ b/src/layouts/nl_NL/handwriting.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/main.fallback b/src/layouts/nl_NL/main.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nl_NL/main.fallback
+++ b/src/layouts/nl_NL/main.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/numbers.fallback b/src/layouts/nl_NL/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nl_NL/numbers.fallback
+++ b/src/layouts/nl_NL/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/nl_NL/symbols.fallback b/src/layouts/nl_NL/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/nl_NL/symbols.fallback
+++ b/src/layouts/nl_NL/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/dialpad.fallback b/src/layouts/pl_PL/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pl_PL/dialpad.fallback
+++ b/src/layouts/pl_PL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/digits.fallback b/src/layouts/pl_PL/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pl_PL/digits.fallback
+++ b/src/layouts/pl_PL/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/handwriting.fallback b/src/layouts/pl_PL/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sk_SK/handwriting.fallback
+++ b/src/layouts/pl_PL/handwriting.fallback
diff --git a/src/layouts/pl_PL/main.qml b/src/layouts/pl_PL/main.qml
new file mode 100644
index 00000000..933febcb
--- /dev/null
+++ b/src/layouts/pl_PL/main.qml
@@ -0,0 +1,197 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eę"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "oó"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aą"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sś"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "lł"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zźż"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ alternativeKeys: "xź"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "cć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "nń"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/numbers.fallback b/src/layouts/pl_PL/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pl_PL/numbers.fallback
+++ b/src/layouts/pl_PL/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/symbols.fallback b/src/layouts/pl_PL/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pl_PL/symbols.fallback
+++ b/src/layouts/pl_PL/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/dialpad.fallback b/src/layouts/pt_BR/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_BR/dialpad.fallback
+++ b/src/layouts/pt_BR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/digits.fallback b/src/layouts/pt_BR/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_BR/digits.fallback
+++ b/src/layouts/pt_BR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/handwriting.fallback b/src/layouts/pt_BR/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sl_SI/handwriting.fallback
+++ b/src/layouts/pt_BR/handwriting.fallback
diff --git a/src/layouts/pt_BR/main.qml b/src/layouts/pt_BR/main.qml
new file mode 100644
index 00000000..3864a500
--- /dev/null
+++ b/src/layouts/pt_BR/main.qml
@@ -0,0 +1,182 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "ēęėëeêèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "üûuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ïįîiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "öõôoòó"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "äãaâàá"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Ccedilla
+ text: "ç"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "čcć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/numbers.fallback b/src/layouts/pt_BR/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_BR/numbers.fallback
+++ b/src/layouts/pt_BR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/symbols.fallback b/src/layouts/pt_BR/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_BR/symbols.fallback
+++ b/src/layouts/pt_BR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/dialpad.fallback b/src/layouts/pt_PT/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_PT/dialpad.fallback
+++ b/src/layouts/pt_PT/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/digits.fallback b/src/layouts/pt_PT/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_PT/digits.fallback
+++ b/src/layouts/pt_PT/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/handwriting.fallback b/src/layouts/pt_PT/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sq_AL/handwriting.fallback
+++ b/src/layouts/pt_PT/handwriting.fallback
diff --git a/src/layouts/pt_PT/main.qml b/src/layouts/pt_PT/main.qml
new file mode 100644
index 00000000..3864a500
--- /dev/null
+++ b/src/layouts/pt_PT/main.qml
@@ -0,0 +1,182 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "ēęėëeêèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "üûuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ïįîiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "öõôoòó"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "äãaâàá"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Ccedilla
+ text: "ç"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "čcć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/numbers.fallback b/src/layouts/pt_PT/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_PT/numbers.fallback
+++ b/src/layouts/pt_PT/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/symbols.fallback b/src/layouts/pt_PT/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/pt_PT/symbols.fallback
+++ b/src/layouts/pt_PT/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/dialpad.fallback b/src/layouts/ro_RO/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ro_RO/dialpad.fallback
+++ b/src/layouts/ro_RO/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/digits.fallback b/src/layouts/ro_RO/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ro_RO/digits.fallback
+++ b/src/layouts/ro_RO/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/handwriting.fallback b/src/layouts/ro_RO/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sv_SE/handwriting.fallback
+++ b/src/layouts/ro_RO/handwriting.fallback
diff --git a/src/layouts/ro_RO/main.qml b/src/layouts/ro_RO/main.qml
new file mode 100644
index 00000000..68e693bd
--- /dev/null
+++ b/src/layouts/ro_RO/main.qml
@@ -0,0 +1,192 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "tț"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "iî"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aâă"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sș"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/numbers.fallback b/src/layouts/ro_RO/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ro_RO/numbers.fallback
+++ b/src/layouts/ro_RO/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/symbols.fallback b/src/layouts/ro_RO/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ro_RO/symbols.fallback
+++ b/src/layouts/ro_RO/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/dialpad.fallback b/src/layouts/ru_RU/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ru_RU/dialpad.fallback
+++ b/src/layouts/ru_RU/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/digits.fallback b/src/layouts/ru_RU/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ru_RU/digits.fallback
+++ b/src/layouts/ru_RU/digits.fallback
diff --git a/src/layouts/ru_RU/handwriting.qml b/src/layouts/ru_RU/handwriting.qml
new file mode 100644
index 00000000..3a75a2ce
--- /dev/null
+++ b/src/layouts/ru_RU/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/ru_RU/main.qml b/src/layouts/ru_RU/main.qml
new file mode 100644
index 00000000..34bd1e15
--- /dev/null
+++ b/src/layouts/ru_RU/main.qml
@@ -0,0 +1,190 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ sharedLayouts: ['symbols']
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: 0x0419
+ text: "й"
+ }
+ Key {
+ id: normalKey
+ key: 0x0426
+ text: "ц"
+ }
+ Key {
+ key: 0x0423
+ text: "у"
+ }
+ Key {
+ key: 0x041A
+ text: "к"
+ }
+ Key {
+ key: 0x0415
+ text: "е"
+ alternativeKeys: "её"
+ }
+ Key {
+ key: 0x041D
+ text: "н"
+ }
+ Key {
+ key: 0x0413
+ text: "г"
+ }
+ Key {
+ key: 0x0428
+ text: "ш"
+ }
+ Key {
+ key: 0x0429
+ text: "щ"
+ }
+ Key {
+ key: 0x0417
+ text: "з"
+ }
+ Key {
+ key: 0x0425
+ text: "х"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: 0x0424
+ text: "ф"
+ }
+ Key {
+ key: 0x042B
+ text: "ы"
+ }
+ Key {
+ key: 0x0412
+ text: "в"
+ }
+ Key {
+ key: 0x0410
+ text: "а"
+ }
+ Key {
+ key: 0x041F
+ text: "п"
+ }
+ Key {
+ key: 0x0420
+ text: "р"
+ }
+ Key {
+ key: 0x041E
+ text: "о"
+ }
+ Key {
+ key: 0x041B
+ text: "л"
+ }
+ Key {
+ key: 0x0414
+ text: "д"
+ }
+ Key {
+ key: 0x0416
+ text: "ж"
+ }
+ Key {
+ key: 0x042D
+ text: "э"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ }
+ Key {
+ key: 0x042F
+ text: "я"
+ }
+ Key {
+ key: 0x0427
+ text: "ч"
+ }
+ Key {
+ key: 0x0421
+ text: "с"
+ }
+ Key {
+ key: 0x041C
+ text: "м"
+ }
+ Key {
+ key: 0x0418
+ text: "и"
+ }
+ Key {
+ key: 0x0422
+ text: "т"
+ }
+ Key {
+ key: 0x042C
+ text: "ь"
+ alternativeKeys: "ьъ"
+ }
+ Key {
+ key: 0x0411
+ text: "б"
+ }
+ Key {
+ key: 0x042E
+ text: "ю"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/numbers.fallback b/src/layouts/ru_RU/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ru_RU/numbers.fallback
+++ b/src/layouts/ru_RU/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/symbols.fallback b/src/layouts/ru_RU/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/ru_RU/symbols.fallback
+++ b/src/layouts/ru_RU/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/dialpad.fallback b/src/layouts/sk_SK/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sk_SK/dialpad.fallback
+++ b/src/layouts/sk_SK/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/digits.fallback b/src/layouts/sk_SK/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sk_SK/digits.fallback
+++ b/src/layouts/sk_SK/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/handwriting.fallback b/src/layouts/sk_SK/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/th_TH/handwriting.fallback
+++ b/src/layouts/sk_SK/handwriting.fallback
diff --git a/src/layouts/sk_SK/main.qml b/src/layouts/sk_SK/main.qml
new file mode 100644
index 00000000..3b3a85a8
--- /dev/null
+++ b/src/layouts/sk_SK/main.qml
@@ -0,0 +1,202 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "rŕ"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "tť"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "uú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ií"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "oóöô"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aåäá"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sš"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "lĺľ"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "yý"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "cč"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "nň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/numbers.fallback b/src/layouts/sk_SK/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sk_SK/numbers.fallback
+++ b/src/layouts/sk_SK/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/symbols.fallback b/src/layouts/sk_SK/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sk_SK/symbols.fallback
+++ b/src/layouts/sk_SK/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/dialpad.fallback b/src/layouts/sl_SI/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sl_SI/dialpad.fallback
+++ b/src/layouts/sl_SI/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/digits.fallback b/src/layouts/sl_SI/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sl_SI/digits.fallback
+++ b/src/layouts/sl_SI/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/handwriting.fallback b/src/layouts/sl_SI/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/tr_TR/handwriting.fallback
+++ b/src/layouts/sl_SI/handwriting.fallback
diff --git a/src/layouts/sl_SI/main.qml b/src/layouts/sl_SI/main.qml
new file mode 100644
index 00000000..185fecfb
--- /dev/null
+++ b/src/layouts/sl_SI/main.qml
@@ -0,0 +1,197 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eèêëé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "uúü"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "ií"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "òôöoó"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aåäáà"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sš"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dđ"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "cćč"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/numbers.fallback b/src/layouts/sl_SI/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sl_SI/numbers.fallback
+++ b/src/layouts/sl_SI/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/symbols.fallback b/src/layouts/sl_SI/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sl_SI/symbols.fallback
+++ b/src/layouts/sl_SI/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/dialpad.fallback b/src/layouts/sq_AL/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sq_AL/dialpad.fallback
+++ b/src/layouts/sq_AL/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/digits.fallback b/src/layouts/sq_AL/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sq_AL/digits.fallback
+++ b/src/layouts/sq_AL/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/handwriting.fallback b/src/layouts/sq_AL/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/uk_UA/handwriting.fallback
+++ b/src/layouts/sq_AL/handwriting.fallback
diff --git a/src/layouts/sq_AL/main.qml b/src/layouts/sq_AL/main.qml
new file mode 100644
index 00000000..707a181c
--- /dev/null
+++ b/src/layouts/sq_AL/main.qml
@@ -0,0 +1,209 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ readonly property real functionKeyWidth2: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: Qt.Key_Ccedilla
+ text: "ç"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_Ediaeresis
+ text: "ë"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth2
+ Layout.fillWidth: false
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth2
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/numbers.fallback b/src/layouts/sq_AL/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sq_AL/numbers.fallback
+++ b/src/layouts/sq_AL/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/symbols.fallback b/src/layouts/sq_AL/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sq_AL/symbols.fallback
+++ b/src/layouts/sq_AL/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/dialpad.fallback b/src/layouts/sr_SP/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sr_SP/dialpad.fallback
+++ b/src/layouts/sr_SP/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/digits.fallback b/src/layouts/sr_SP/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sr_SP/digits.fallback
+++ b/src/layouts/sr_SP/digits.fallback
diff --git a/src/layouts/sr_SP/handwriting.qml b/src/layouts/sr_SP/handwriting.qml
new file mode 100644
index 00000000..3a75a2ce
--- /dev/null
+++ b/src/layouts/sr_SP/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/sr_SP/main.qml b/src/layouts/sr_SP/main.qml
new file mode 100644
index 00000000..51ce560f
--- /dev/null
+++ b/src/layouts/sr_SP/main.qml
@@ -0,0 +1,371 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayoutLoader {
+ sharedLayouts: ['symbols']
+ sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
+ Component {
+ id: cyrillicLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "љ"
+ }
+ Key {
+ id: normalKey
+ text: "њ"
+ }
+ Key {
+ text: "е"
+ }
+ Key {
+ text: "р"
+ }
+ Key {
+ text: "т"
+ }
+ Key {
+ text: "з"
+ }
+ Key {
+ text: "у"
+ }
+ Key {
+ text: "и"
+ }
+ Key {
+ text: "о"
+ }
+ Key {
+ text: "п"
+ }
+ Key {
+ text: "ш"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "а"
+ }
+ Key {
+ text: "с"
+ }
+ Key {
+ text: "д"
+ }
+ Key {
+ text: "ф"
+ }
+ Key {
+ text: "г"
+ }
+ Key {
+ text: "х"
+ }
+ Key {
+ text: "ј"
+ }
+ Key {
+ text: "к"
+ }
+ Key {
+ text: "л"
+ }
+ Key {
+ text: "ч"
+ }
+ Key {
+ text: "ћ"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ }
+ Key {
+ text: "ѕ"
+ }
+ Key {
+ text: "џ"
+ }
+ Key {
+ text: "ц"
+ }
+ Key {
+ text: "в"
+ }
+ Key {
+ text: "б"
+ }
+ Key {
+ text: "н"
+ }
+ Key {
+ text: "м"
+ }
+ Key {
+ text: "ђ"
+ }
+ Key {
+ text: "ж"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: latinLayout
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "êeëèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "ŕrř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "ţtŧť"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "űūũûüuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îïīĩiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "œøõôöòóo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)) ? "a@äåãâàá" : "aäåãâàá"
+ smallTextVisible: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly))
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "šsşś"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dđď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ alternativeKeys: "ġgģĝğ"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "ĺŀłļľl"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "çcċčć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "ņńnň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/numbers.fallback b/src/layouts/sr_SP/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sr_SP/numbers.fallback
+++ b/src/layouts/sr_SP/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/symbols.fallback b/src/layouts/sr_SP/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sr_SP/symbols.fallback
+++ b/src/layouts/sr_SP/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/dialpad.fallback b/src/layouts/sv_SE/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sv_SE/dialpad.fallback
+++ b/src/layouts/sv_SE/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/digits.fallback b/src/layouts/sv_SE/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sv_SE/digits.fallback
+++ b/src/layouts/sv_SE/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/handwriting.fallback b/src/layouts/sv_SE/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/vi_VN/handwriting.fallback
+++ b/src/layouts/sv_SE/handwriting.fallback
diff --git a/src/layouts/sv_SE/main.qml b/src/layouts/sv_SE/main.qml
new file mode 100644
index 00000000..61f76491
--- /dev/null
+++ b/src/layouts/sv_SE/main.qml
@@ -0,0 +1,196 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ key: Qt.Key_Aring
+ text: "å"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ key: Qt.Key_Odiaeresis
+ text: "ö"
+ }
+ Key {
+ key: Qt.Key_Adiaeresis
+ text: "ä"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ ShiftKey {
+ weight: 240
+ }
+ FillerKey {
+ weight: 80
+ }
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ weight: 80
+ }
+ BackspaceKey {
+ weight: 240
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/numbers.fallback b/src/layouts/sv_SE/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sv_SE/numbers.fallback
+++ b/src/layouts/sv_SE/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/symbols.fallback b/src/layouts/sv_SE/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/sv_SE/symbols.fallback
+++ b/src/layouts/sv_SE/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/dialpad.fallback b/src/layouts/th_TH/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/th_TH/dialpad.fallback
+++ b/src/layouts/th_TH/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/digits.fallback b/src/layouts/th_TH/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/th_TH/digits.fallback
+++ b/src/layouts/th_TH/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/th_TH/numbers.fallback b/src/layouts/th_TH/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/th_TH/numbers.fallback
+++ b/src/layouts/th_TH/handwriting.fallback
diff --git a/src/layouts/th_TH/handwriting.qml b/src/layouts/th_TH/handwriting.qml
new file mode 100644
index 00000000..f6801c7c
--- /dev/null
+++ b/src/layouts/th_TH/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Thai ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/th_TH/main.qml b/src/layouts/th_TH/main.qml
new file mode 100644
index 00000000..87795bd4
--- /dev/null
+++ b/src/layouts/th_TH/main.qml
@@ -0,0 +1,475 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ inputMode: InputEngine.InputMode.Latin
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; ThaiInputMethod {}', parent, "main.qml")
+ }
+ sharedLayouts: [ "symbols" ]
+ sourceComponent: InputContext.shiftActive ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Layout.preferredHeight: 3
+ smallTextVisible: true
+ KeyboardColumn {
+ KeyboardRow {
+ Key {
+ text: "ๅ"
+ alternativeKeys: "ๅ1๑"
+ }
+ Key {
+ id: normalKey
+ text: "/"
+ alternativeKeys: "/2๒"
+ }
+ Key {
+ text: "_"
+ alternativeKeys: "_3๓"
+ }
+ Key {
+ text: "ภ"
+ alternativeKeys: "ภ4๔"
+ }
+ Key {
+ text: "ถ"
+ alternativeKeys: "ถ5๕"
+ }
+ Key {
+ text: "\u0E38"
+ displayText: " \u0E38"
+ alternativeKeys: [ "\u0E38", " \u0E39" ]
+ }
+ Key {
+ text: "\u0E36"
+ displayText: " \u0E36"
+ }
+ Key {
+ text: "ค"
+ alternativeKeys: "ค6๖"
+ }
+ Key {
+ text: "ต"
+ alternativeKeys: "ต7๗"
+ }
+ Key {
+ text: "จ"
+ alternativeKeys: "จ8๘"
+ }
+ Key {
+ text: "ข"
+ alternativeKeys: "๙ข9"
+ }
+ Key {
+ text: "ช"
+ alternativeKeys: "๐ช0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "ๆ"
+ }
+ Key {
+ text: "ไ"
+ alternativeKeys: "ไ\""
+ }
+ Key {
+ text: " ำ"
+ alternativeKeys: " ำฎ"
+ }
+ Key {
+ text: "พ"
+ alternativeKeys: "พฑ"
+ }
+ Key {
+ text: "ะ"
+ alternativeKeys: "ะธ"
+ }
+ Key {
+ text: "\u0E31"
+ displayText: " \u0E31"
+ alternativeKeys: "\u0E31。"
+ }
+ Key {
+ text: "\u0E35"
+ displayText: " \u0E35"
+ alternativeKeys: [ "\u0E35", " \u0E4A" ]
+ }
+ Key {
+ text: "ร"
+ alternativeKeys: "รณ"
+ }
+ Key {
+ text: "น"
+ alternativeKeys: "นฯ"
+ }
+ Key {
+ text: "ย"
+ alternativeKeys: "ยญ"
+ }
+ Key {
+ text: "บ"
+ alternativeKeys: "บฐ"
+ }
+ Key {
+ text: "ล"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "ฟ"
+ alternativeKeys: "ฟฤ"
+ }
+ Key {
+ text: "ห"
+ alternativeKeys: "หฆ"
+ }
+ Key {
+ text: "ก"
+ alternativeKeys: "กฏ"
+ }
+ Key {
+ text: "ด"
+ alternativeKeys: "ดโ"
+ }
+ Key {
+ text: "เ"
+ alternativeKeys: "เฌ"
+ }
+ Key {
+ text: "\u0E49"
+ displayText: " \u0E49"
+ alternativeKeys: [ "\u0E49", " \u0E47" ]
+ }
+ Key {
+ text: "\u0E48"
+ displayText: " \u0E48"
+ alternativeKeys: [ "\u0E48", " \u0E4B" ]
+ }
+ Key {
+ text: "า"
+ alternativeKeys: "าษ"
+ }
+ Key {
+ text: "ส"
+ alternativeKeys: "สศ"
+ }
+ Key {
+ text: "ว"
+ }
+ Key {
+ text: "ง"
+ }
+ Key {
+ text: "ซ"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ }
+ Key {
+ text: "ผ"
+ }
+ Key {
+ text: "ป"
+ }
+ Key {
+ text: "แ"
+ alternativeKeys: "แฉ"
+ }
+ Key {
+ text: "อ"
+ alternativeKeys: "อฮ"
+ }
+ Key {
+ text: "\u0E34"
+ displayText: " \u0E34"
+ alternativeKeys: [ "\u0E34", " \u0E3A" ]
+ }
+ Key {
+ text: "\u0E37"
+ displayText: " \u0E37"
+ alternativeKeys: [ "\u0E37", " \u0E4C" ]
+ }
+ Key {
+ text: "ท"
+ }
+ Key {
+ text: "ม"
+ alternativeKeys: "มฒ"
+ }
+ Key {
+ text: "ใ"
+ alternativeKeys: "ใฬ"
+ }
+ Key {
+ text: "ฝ"
+ alternativeKeys: "ฝฦ"
+ }
+ BackspaceKey {
+ }
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Layout.preferredHeight: 3
+ smallTextVisible: true
+ KeyboardColumn {
+ KeyboardRow {
+ Key {
+ text: "+"
+ }
+ Key {
+ id: normalKey
+ text: "๑"
+ }
+ Key {
+ text: "๒"
+ }
+ Key {
+ text: "๓"
+ }
+ Key {
+ text: "๔"
+ }
+ Key {
+ text: "\u0E39"
+ displayText: " \u0E39"
+ }
+ Key {
+ text: "฿"
+ }
+ Key {
+ text: "๕"
+ }
+ Key {
+ text: "๖"
+ }
+ Key {
+ text: "๗"
+ }
+ Key {
+ text: "๘"
+ }
+ Key {
+ text: "๙"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "๐"
+ }
+ Key {
+ text: "\""
+ }
+ Key {
+ text: "ฎ"
+ }
+ Key {
+ text: "ฑ"
+ }
+ Key {
+ text: "ธ"
+ }
+ Key {
+ text: "。"
+ }
+ Key {
+ text: "\u0E4A"
+ displayText: " \u0E4A"
+ }
+ Key {
+ text: "ณ"
+ }
+ Key {
+ text: "ฯ"
+ }
+ Key {
+ text: "ญ"
+ }
+ Key {
+ text: "ฐ"
+ }
+ Key {
+ text: ","
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "ฤ"
+ }
+ Key {
+ text: "ฆ"
+ }
+ Key {
+ text: "ฏ"
+ }
+ Key {
+ text: "โ"
+ }
+ Key {
+ text: "ฌ"
+ }
+ Key {
+ text: "\u0E47"
+ displayText: " \u0E47"
+ }
+ Key {
+ text: "\u0E4B"
+ displayText: " \u0E4B"
+ }
+ Key {
+ text: "ษ"
+ }
+ Key {
+ text: "ศ"
+ }
+ Key {
+ text: "ซ"
+ }
+ Key {
+ text: "."
+ }
+ Key {
+ text: "ฅ"
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ }
+ Key {
+ text: "("
+ }
+ Key {
+ text: ")"
+ }
+ Key {
+ text: "ฉ"
+ }
+ Key {
+ text: "ฮ"
+ }
+ Key {
+ text: "\u0E3A"
+ displayText: " \u0E3A"
+ }
+ Key {
+ text: "\u0E4C"
+ displayText: " \u0E4C"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "ฒ"
+ }
+ Key {
+ text: "ฬ"
+ }
+ Key {
+ text: "ฦ"
+ }
+ BackspaceKey {
+ }
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/numbers.fallback b/src/layouts/th_TH/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/tr_TR/numbers.fallback
+++ b/src/layouts/th_TH/numbers.fallback
diff --git a/src/layouts/th_TH/symbols.qml b/src/layouts/th_TH/symbols.qml
new file mode 100644
index 00000000..8d50ee44
--- /dev/null
+++ b/src/layouts/th_TH/symbols.qml
@@ -0,0 +1,358 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "กขค"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ alternativeKeys: "$¢"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ text: "฿"
+ }
+ Key {
+ key: 0xA5
+ text: "¥"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "กขค"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/dialpad.fallback b/src/layouts/tr_TR/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/tr_TR/dialpad.fallback
+++ b/src/layouts/tr_TR/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/digits.fallback b/src/layouts/tr_TR/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/tr_TR/digits.fallback
+++ b/src/layouts/tr_TR/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/symbols.fallback b/src/layouts/tr_TR/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/tr_TR/symbols.fallback
+++ b/src/layouts/tr_TR/handwriting.fallback
diff --git a/src/layouts/tr_TR/main.qml b/src/layouts/tr_TR/main.qml
new file mode 100644
index 00000000..ed9adf4f
--- /dev/null
+++ b/src/layouts/tr_TR/main.qml
@@ -0,0 +1,214 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ text: "\u0131"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ Key {
+ text: "ğ"
+ }
+ Key {
+ key: Qt.Key_Udiaeresis
+ text: "ü"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aåä"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sš"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ }
+ Key {
+ text: "ş"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ alternativeKeys: "$¢x₺€¥£"
+ smallTextVisible: true
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ Key {
+ key: Qt.Key_Odiaeresis
+ text: "ö"
+ }
+ Key {
+ key: Qt.Key_Ccedilla
+ text: "ç"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/numbers.fallback b/src/layouts/tr_TR/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/uk_UA/numbers.fallback
+++ b/src/layouts/tr_TR/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/symbols.fallback b/src/layouts/tr_TR/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/uk_UA/symbols.fallback
+++ b/src/layouts/tr_TR/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/dialpad.fallback b/src/layouts/uk_UA/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/uk_UA/dialpad.fallback
+++ b/src/layouts/uk_UA/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/digits.fallback b/src/layouts/uk_UA/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/uk_UA/digits.fallback
+++ b/src/layouts/uk_UA/digits.fallback
diff --git a/src/layouts/uk_UA/handwriting.qml b/src/layouts/uk_UA/handwriting.qml
new file mode 100644
index 00000000..3a75a2ce
--- /dev/null
+++ b/src/layouts/uk_UA/handwriting.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "."
+ alternativeKeys: "<>()/\\\"'=+-_:;,.?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/uk_UA/main.qml b/src/layouts/uk_UA/main.qml
new file mode 100644
index 00000000..79f8b194
--- /dev/null
+++ b/src/layouts/uk_UA/main.qml
@@ -0,0 +1,181 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ sharedLayouts: ['symbols']
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "й"
+ }
+ Key {
+ id: normalKey
+ text: "ц"
+ }
+ Key {
+ text: "у"
+ }
+ Key {
+ text: "к"
+ }
+ Key {
+ text: "е"
+ }
+ Key {
+ text: "н"
+ }
+ Key {
+ text: "г"
+ }
+ Key {
+ text: "ш"
+ }
+ Key {
+ text: "щ"
+ }
+ Key {
+ text: "з"
+ }
+ Key {
+ text: "х"
+ }
+ Key {
+ text: "ї"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "ф"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "і"
+ }
+ Key {
+ text: "в"
+ }
+ Key {
+ text: "а"
+ }
+ Key {
+ text: "п"
+ }
+ Key {
+ text: "р"
+ }
+ Key {
+ text: "о"
+ }
+ Key {
+ text: "л"
+ }
+ Key {
+ text: "д"
+ }
+ Key {
+ text: "ж"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "є"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ }
+ Key {
+ text: "ґ"
+ }
+ Key {
+ text: "я"
+ alternativeKeys: "$¢я₴€¥£"
+ smallTextVisible: true
+ }
+ Key {
+ text: "ч"
+ }
+ Key {
+ text: "с"
+ }
+ Key {
+ text: "м"
+ }
+ Key {
+ text: "и"
+ }
+ Key {
+ text: "т"
+ }
+ Key {
+ text: "ь"
+ }
+ Key {
+ text: "б"
+ }
+ Key {
+ text: "ю"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/numbers.fallback b/src/layouts/uk_UA/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/vi_VN/numbers.fallback
+++ b/src/layouts/uk_UA/numbers.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/dialpad.fallback b/src/layouts/uk_UA/symbols.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/vi_VN/dialpad.fallback
+++ b/src/layouts/uk_UA/symbols.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/dialpad.fallback b/src/layouts/vi_VN/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/zh_CN/dialpad.fallback
+++ b/src/layouts/vi_VN/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/digits.fallback b/src/layouts/vi_VN/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/vi_VN/digits.fallback
+++ b/src/layouts/vi_VN/digits.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/digits.fallback b/src/layouts/vi_VN/handwriting.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/zh_CN/digits.fallback
+++ b/src/layouts/vi_VN/handwriting.fallback
diff --git a/src/layouts/vi_VN/main.qml b/src/layouts/vi_VN/main.qml
new file mode 100644
index 00000000..6ad84093
--- /dev/null
+++ b/src/layouts/vi_VN/main.qml
@@ -0,0 +1,199 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+import QtQuick.Layouts
+
+KeyboardLayout {
+ inputMode: InputEngine.InputMode.Latin
+ sharedLayouts: ["numbers", "digits"]
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "eèéẻẽẹêềếểễệ"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "yỳýỷỹỵ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "ưừứửữựuùúủũụ"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "iìíỉĩị"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "ơờớởỡợòóỏõọoôồốổỗộ"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aàáảãạăằắẳẵặâầấẩẫậ"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "sš"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "dđ"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zž"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "nñ"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ alternativeKeys: "!.?"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/numbers.fallback b/src/layouts/vi_VN/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/zh_CN/numbers.fallback
+++ b/src/layouts/vi_VN/numbers.fallback
diff --git a/src/layouts/vi_VN/symbols.qml b/src/layouts/vi_VN/symbols.qml
new file mode 100644
index 00000000..d297d624
--- /dev/null
+++ b/src/layouts/vi_VN/symbols.qml
@@ -0,0 +1,358 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+ sourceComponent: secondPage ? page2 : page1
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_At
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_NumberSign
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_Percent
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_Ampersand
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_Asterisk
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_Underscore
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_Minus
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_Plus
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_ParenLeft
+ text: "("
+ }
+ Key {
+ key: Qt.Key_ParenRight
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "1/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: Qt.Key_QuoteDbl
+ text: '"'
+ }
+ Key {
+ key: Qt.Key_Less
+ text: "<"
+ }
+ Key {
+ key: Qt.Key_Greater
+ text: ">"
+ }
+ Key {
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Colon
+ text: ":"
+ }
+ Key {
+ key: Qt.Key_Slash
+ text: "/"
+ }
+ Key {
+ key: Qt.Key_Exclam
+ text: "!"
+ }
+ Key {
+ key: Qt.Key_Question
+ text: "?"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "."
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_AsciiTilde
+ text: "~"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_Agrave
+ text: "`"
+ }
+ Key {
+ key: Qt.Key_Bar
+ text: "|"
+ }
+ Key {
+ key: 0x7B
+ text: "·"
+ }
+ Key {
+ key: 0x221A
+ text: "√"
+ }
+ Key {
+ key: Qt.Key_division
+ text: "÷"
+ }
+ Key {
+ key: Qt.Key_multiply
+ text: "×"
+ }
+ Key {
+ key: Qt.Key_onehalf
+ text: "½"
+ alternativeKeys: "¼⅓½¾⅞"
+ }
+ Key {
+ key: Qt.Key_BraceLeft
+ text: "{"
+ }
+ Key {
+ key: Qt.Key_BraceRight
+ text: "}"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Dollar
+ text: "$"
+ }
+ Key {
+ key: 0x20AC
+ text: "€"
+ }
+ Key {
+ key: 0xC2
+ text: "£"
+ }
+ Key {
+ key: 0xA2
+ text: "¢"
+ }
+ Key {
+ key: 0x20AB
+ text: "₫"
+ }
+ Key {
+ key: Qt.Key_AsciiCircum
+ text: "^"
+ }
+ Key {
+ key: Qt.Key_Equal
+ text: "="
+ }
+ Key {
+ key: Qt.Key_section
+ text: "§"
+ }
+ Key {
+ key: Qt.Key_BracketLeft
+ text: "["
+ }
+ Key {
+ key: Qt.Key_BracketRight
+ text: "]"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: "2/2"
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ highlighted: true
+ }
+ Key {
+ key: 0x2122
+ text: '™'
+ }
+ Key {
+ key: 0x00AE
+ text: '®'
+ }
+ Key {
+ key: Qt.Key_guillemotleft
+ text: '«'
+ }
+ Key {
+ key: Qt.Key_guillemotright
+ text: '»'
+ }
+ Key {
+ key: Qt.Key_Semicolon
+ text: ";"
+ }
+ Key {
+ key: 0x201C
+ text: '“'
+ }
+ Key {
+ key: 0x201D
+ text: '”'
+ }
+ Key {
+ key: Qt.Key_Backslash
+ text: "\\"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: 0x2026
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u2026"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/dialpad.fallback b/src/layouts/zh_CN/dialpad.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/zh_TW/dialpad.fallback
+++ b/src/layouts/zh_CN/dialpad.fallback
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/digits.fallback b/src/layouts/zh_CN/digits.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/zh_TW/digits.fallback
+++ b/src/layouts/zh_CN/digits.fallback
diff --git a/src/layouts/zh_CN/handwriting.qml b/src/layouts/zh_CN/handwriting.qml
new file mode 100644
index 00000000..a2548b89
--- /dev/null
+++ b/src/layouts/zh_CN/handwriting.qml
@@ -0,0 +1,73 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+ inputMode: preferredInputMode()
+
+ Connections {
+ target: InputContext
+ function onInputMethodHintsChanged() {
+ var newInputMode = preferredInputMode()
+ if (InputContext.inputEngine.inputModes.indexOf(newInputMode) !== -1)
+ InputContext.inputEngine.inputMode = newInputMode
+ }
+ }
+
+ function preferredInputMode() {
+ return InputContext.inputMethodHints &
+ (Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
+ Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.ChineseHandwriting
+ }
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.ChineseHandwriting ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "。"
+ alternativeKeys: "¥‘’“”~…—\",.:;、。?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/zh_CN/main.qml b/src/layouts/zh_CN/main.qml
new file mode 100644
index 00000000..619c8ee3
--- /dev/null
+++ b/src/layouts/zh_CN/main.qml
@@ -0,0 +1,194 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; PinyinInputMethod {}', parent, "main.qml")
+ }
+ sharedLayouts: ['symbols']
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ Key {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ enabled: InputContext.preeditText.length > 0
+ key: Qt.Key_Apostrophe
+ text: "'"
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0E"
+ alternativeKeys: "\uFF1B\u3001\uFF0E\uFF1A\u3002?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/numbers.fallback b/src/layouts/zh_CN/numbers.fallback
index e69de29b..e69de29b 100644
--- a/src/virtualkeyboard/content/layouts/zh_TW/numbers.fallback
+++ b/src/layouts/zh_CN/numbers.fallback
diff --git a/src/layouts/zh_CN/symbols.qml b/src/layouts/zh_CN/symbols.qml
new file mode 100644
index 00000000..6058b2c1
--- /dev/null
+++ b/src/layouts/zh_CN/symbols.qml
@@ -0,0 +1,476 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; PinyinInputMethod {}', parent, "symbols.qml")
+ }
+ sharedLayouts: ['main']
+ property int page
+ readonly property int numPages: 3
+ sourceComponent: {
+ switch (page) {
+ case 2: return page3
+ case 1: return page2
+ default: return page1
+ }
+ }
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "("
+ }
+ Key {
+ key: Qt.Key_1
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "“"
+ }
+ Key {
+ text: "”"
+ }
+ Key {
+ text: "、"
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "~"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "—"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "½"
+ alternativeKeys: "½¼¾"
+ }
+ Key {
+ id: normalKey
+ text: "'"
+ }
+ Key {
+ text: "/"
+ }
+ Key {
+ text: "\\"
+ }
+ Key {
+ text: "|"
+ }
+ Key {
+ text: "["
+ }
+ Key {
+ text: "]"
+ }
+ Key {
+ text: "{"
+ }
+ Key {
+ text: "}"
+ }
+ Key {
+ text: "·"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "<"
+ }
+ Key {
+ text: ">"
+ }
+ Key {
+ text: ","
+ }
+ Key {
+ text: "."
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "="
+ }
+ Key {
+ text: "~"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "\""
+ }
+ Key {
+ text: "§"
+ }
+ Key {
+ text: "^"
+ }
+ Key {
+ text: "$"
+ }
+ Key {
+ text: "¥"
+ }
+ Key {
+ text: "€"
+ }
+ Key {
+ text: "£"
+ }
+ Key {
+ text: "¢"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "。"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page3
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\"
+ }
+ Key {
+ id: normalKey
+ text: "/"
+ }
+ Key {
+ text: "("
+ }
+ Key {
+ text: ")"
+ }
+ Key {
+ text: "〔"
+ }
+ Key {
+ text: "〕"
+ }
+ Key {
+ text: "〈"
+ }
+ Key {
+ text: "〉"
+ }
+ Key {
+ text: "《"
+ }
+ Key {
+ text: "》"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "→"
+ }
+ Key {
+ text: "←"
+ }
+ Key {
+ text: "↑"
+ }
+ Key {
+ text: "↓"
+ }
+ Key {
+ text: "■"
+ }
+ Key {
+ text: "□"
+ }
+ Key {
+ text: "●"
+ }
+ Key {
+ text: "○"
+ }
+ Key {
+ text: "【"
+ }
+ Key {
+ text: "】"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "『"
+ }
+ Key {
+ text: "』"
+ }
+ Key {
+ text: "「"
+ }
+ Key {
+ text: "」"
+ }
+ Key {
+ text: "★"
+ }
+ Key {
+ text: "☆"
+ }
+ Key {
+ text: "◆"
+ }
+ Key {
+ text: "◇"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "…"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/layouts/zh_TW/dialpad.fallback b/src/layouts/zh_TW/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/layouts/zh_TW/dialpad.fallback
diff --git a/src/layouts/zh_TW/digits.fallback b/src/layouts/zh_TW/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/layouts/zh_TW/digits.fallback
diff --git a/src/layouts/zh_TW/handwriting.qml b/src/layouts/zh_TW/handwriting.qml
new file mode 100644
index 00000000..a2548b89
--- /dev/null
+++ b/src/layouts/zh_TW/handwriting.qml
@@ -0,0 +1,73 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+ inputMode: preferredInputMode()
+
+ Connections {
+ target: InputContext
+ function onInputMethodHintsChanged() {
+ var newInputMode = preferredInputMode()
+ if (InputContext.inputEngine.inputModes.indexOf(newInputMode) !== -1)
+ InputContext.inputEngine.inputMode = newInputMode
+ }
+ }
+
+ function preferredInputMode() {
+ return InputContext.inputMethodHints &
+ (Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
+ Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.ChineseHandwriting
+ }
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.ChineseHandwriting ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "。"
+ alternativeKeys: "¥‘’“”~…—\",.:;、。?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/layouts/zh_TW/main.qml b/src/layouts/zh_TW/main.qml
new file mode 100644
index 00000000..65c481c6
--- /dev/null
+++ b/src/layouts/zh_TW/main.qml
@@ -0,0 +1,459 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; TCInputMethod {}', parent, "main.qml")
+ }
+ sharedLayouts: ['symbols']
+ sourceComponent: {
+ switch (InputContext.inputEngine.inputMode) {
+ case InputEngine.InputMode.Cangjie:
+ return pageCangjie
+ case InputEngine.InputMode.Zhuyin:
+ return pageZhuyin
+ default:
+ return null
+ }
+ }
+ Component {
+ id: pageCangjie
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ smallTextVisible: true
+ KeyboardRow {
+ Key {
+ text: "\u624B"
+ alternativeKeys: "\u624Bq"
+ }
+ Key {
+ id: normalKey
+ text: "\u7530"
+ alternativeKeys: "\u7530w"
+ }
+ Key {
+ text: "\u6C34"
+ alternativeKeys: "\u6C34e"
+ }
+ Key {
+ text: "\u53E3"
+ alternativeKeys: "\u53E3r"
+ }
+ Key {
+ text: "\u5EFF"
+ alternativeKeys: "\u5EFFt"
+ }
+ Key {
+ text: "\u535C"
+ alternativeKeys: "\u535Cy"
+ }
+ Key {
+ text: "\u5C71"
+ alternativeKeys: "\u5C71u"
+ }
+ Key {
+ text: "\u6208"
+ alternativeKeys: "\u6208i"
+ }
+ Key {
+ text: "\u4EBA"
+ alternativeKeys: "\u4EBAo"
+ }
+ Key {
+ text: "\u5FC3"
+ alternativeKeys: "\u5FC3p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u65E5"
+ alternativeKeys: "\u65E5a"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u5C38"
+ alternativeKeys: "\u5C38s"
+ }
+ Key {
+ text: "\u6728"
+ alternativeKeys: "\u6728d"
+ }
+ Key {
+ text: "\u706B"
+ alternativeKeys: "\u706Bf"
+ }
+ Key {
+ text: "\u571F"
+ alternativeKeys: "\u571Fg"
+ }
+ Key {
+ text: "\u7AF9"
+ alternativeKeys: "\u7AF9h"
+ }
+ Key {
+ text: "\u5341"
+ alternativeKeys: "\u5341j"
+ }
+ Key {
+ text: "\u5927"
+ alternativeKeys: "\u5927k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u4E2D"
+ alternativeKeys: "\u4E2Dl"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ModeKey {
+ id: simplifiedModeKey
+ key: Qt.Key_Mode_switch
+ displayText: "速成"
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ Component.onCompleted: updateBinding()
+ Connections {
+ target: InputContext.inputEngine
+ function onInputMethodChanged() { simplifiedModeKey.updateBinding() }
+ }
+ function updateBinding() {
+ if (InputContext.inputEngine.inputMethod && InputContext.inputEngine.inputMethod.hasOwnProperty("simplified")) {
+ simplifiedModeKey.mode = InputContext.inputEngine.inputMethod.simplified
+ InputContext.inputEngine.inputMethod.simplified = Qt.binding(function() { return simplifiedModeKey.mode })
+ }
+ }
+ }
+ Key {
+ text: "\u91CD"
+ alternativeKeys: "\u91CDz"
+ }
+ Key {
+ text: "\u96E3"
+ alternativeKeys: "\u96E3x"
+ }
+ Key {
+ text: "\u91D1"
+ alternativeKeys: "\u91D1c"
+ }
+ Key {
+ text: "\u5973"
+ alternativeKeys: "\u5973v"
+ }
+ Key {
+ text: "\u6708"
+ alternativeKeys: "\u6708b"
+ }
+ Key {
+ text: "\u5F13"
+ alternativeKeys: "\u5F13n"
+ }
+ Key {
+ text: "\u4E00"
+ alternativeKeys: "\u4E00m"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.InputMode.Zhuyin) !== -1
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0E"
+ alternativeKeys: "\uFF1B\u3001\uFF0E\uFF1A\u3002?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: pageZhuyin
+ KeyboardLayout {
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ smallTextVisible: true
+ KeyboardRow {
+ Layout.preferredHeight: 3
+ KeyboardColumn {
+ KeyboardRow {
+ Key {
+ text: "\u3105"
+ alternativeKeys: "\u31051"
+ }
+ Key {
+ id: normalKey
+ text: "\u3109"
+ alternativeKeys: "\u31092"
+ }
+ Key {
+ text: "\u02C7"
+ alternativeKeys: "\u02C73"
+ }
+ Key {
+ text: "\u02CB"
+ alternativeKeys: "\u02CB4"
+ displayText: "`"
+ }
+ Key {
+ text: "\u3113"
+ alternativeKeys: "\u31135"
+ }
+ Key {
+ text: "\u02CA"
+ alternativeKeys: "\u02CA6"
+ displayText: "´"
+ }
+ Key {
+ text: "\u02D9"
+ alternativeKeys: "\u02D97"
+ }
+ Key {
+ text: "\u311A"
+ alternativeKeys: "\u311A8"
+ }
+ Key {
+ text: "\u311E"
+ alternativeKeys: "\u311E9"
+ }
+ Key {
+ text: "\u3122"
+ alternativeKeys: "\u31220"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u3106"
+ alternativeKeys: "\u3106q"
+ }
+ Key {
+ text: "\u310A"
+ alternativeKeys: "\u310Aw"
+ }
+ Key {
+ text: "\u310D"
+ alternativeKeys: "\u310De"
+ }
+ Key {
+ text: "\u3110"
+ alternativeKeys: "\u3110r"
+ }
+ Key {
+ text: "\u3114"
+ alternativeKeys: "\u3114t"
+ }
+ Key {
+ text: "\u3117"
+ alternativeKeys: "\u3117y"
+ }
+ Key {
+ text: "\u3127"
+ alternativeKeys: "\u3127u"
+ }
+ Key {
+ text: "\u311B"
+ alternativeKeys: "\u311Bi"
+ }
+ Key {
+ text: "\u311F"
+ alternativeKeys: "\u311Fo"
+ }
+ Key {
+ text: "\u3123"
+ alternativeKeys: "\u3123p"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u3107"
+ alternativeKeys: "\u3107a"
+ }
+ Key {
+ text: "\u310B"
+ alternativeKeys: "\u310Bs"
+ }
+ Key {
+ text: "\u310E"
+ alternativeKeys: "\u310Ed"
+ }
+ Key {
+ text: "\u3111"
+ alternativeKeys: "\u3111f"
+ }
+ Key {
+ text: "\u3115"
+ alternativeKeys: "\u3115g"
+ }
+ Key {
+ text: "\u3118"
+ alternativeKeys: "\u3118h"
+ }
+ Key {
+ text: "\u3128"
+ alternativeKeys: "\u3128j"
+ }
+ Key {
+ text: "\u311C"
+ alternativeKeys: "\u311Ck"
+ }
+ Key {
+ text: "\u3120"
+ alternativeKeys: "\u3120l"
+ }
+ Key {
+ text: "\u3124"
+ alternativeKeys: "\u3124…"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u3108"
+ alternativeKeys: "\u3108z"
+ }
+ Key {
+ text: "\u310C"
+ alternativeKeys: "\u310Cx"
+ }
+ Key {
+ text: "\u310F"
+ alternativeKeys: "\u310Fc"
+ }
+ Key {
+ text: "\u3112"
+ alternativeKeys: "\u3112v"
+ }
+ Key {
+ text: "\u3116"
+ alternativeKeys: "\u3116b"
+ }
+ Key {
+ text: "\u3119"
+ alternativeKeys: "\u3119n"
+ }
+ Key {
+ text: "\u3129"
+ alternativeKeys: "\u3129m"
+ }
+ Key {
+ text: "\u311D"
+ alternativeKeys: "、\u311D,"
+ }
+ Key {
+ text: "\u3121"
+ alternativeKeys: "。\u3121."
+ }
+ Key {
+ text: "\u3125"
+ alternativeKeys: ";:\u3125\u3126"
+ }
+ }
+ }
+ }
+ KeyboardRow {
+ id: bottomRow
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.InputMode.Zhuyin) !== -1
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0E"
+ alternativeKeys: "\uFF1B\u3001\uFF0E\uFF1A\u3002?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ BackspaceKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/layouts/zh_TW/numbers.fallback b/src/layouts/zh_TW/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/layouts/zh_TW/numbers.fallback
diff --git a/src/layouts/zh_TW/symbols.qml b/src/layouts/zh_TW/symbols.qml
new file mode 100644
index 00000000..9c8dc995
--- /dev/null
+++ b/src/layouts/zh_TW/symbols.qml
@@ -0,0 +1,476 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; TCInputMethod {}', parent, "symbols.qml")
+ }
+ sharedLayouts: ['main']
+ property int page
+ readonly property int numPages: 3
+ sourceComponent: {
+ switch (page) {
+ case 2: return page3
+ case 1: return page2
+ default: return page1
+ }
+ }
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "("
+ }
+ Key {
+ key: Qt.Key_1
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "“"
+ }
+ Key {
+ text: "”"
+ }
+ Key {
+ text: "、"
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "~"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "—"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "½"
+ alternativeKeys: "½¼¾"
+ }
+ Key {
+ id: normalKey
+ text: "'"
+ }
+ Key {
+ text: "/"
+ }
+ Key {
+ text: "\\"
+ }
+ Key {
+ text: "|"
+ }
+ Key {
+ text: "["
+ }
+ Key {
+ text: "]"
+ }
+ Key {
+ text: "{"
+ }
+ Key {
+ text: "}"
+ }
+ Key {
+ text: "·"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "<"
+ }
+ Key {
+ text: ">"
+ }
+ Key {
+ text: ","
+ }
+ Key {
+ text: "."
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "="
+ }
+ Key {
+ text: "~"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "\""
+ }
+ Key {
+ text: "§"
+ }
+ Key {
+ text: "^"
+ }
+ Key {
+ text: "$"
+ }
+ Key {
+ text: "¥"
+ }
+ Key {
+ text: "€"
+ }
+ Key {
+ text: "£"
+ }
+ Key {
+ text: "¢"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "。"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page3
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\"
+ }
+ Key {
+ id: normalKey
+ text: "/"
+ }
+ Key {
+ text: "("
+ }
+ Key {
+ text: ")"
+ }
+ Key {
+ text: "〔"
+ }
+ Key {
+ text: "〕"
+ }
+ Key {
+ text: "〈"
+ }
+ Key {
+ text: "〉"
+ }
+ Key {
+ text: "《"
+ }
+ Key {
+ text: "》"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "→"
+ }
+ Key {
+ text: "←"
+ }
+ Key {
+ text: "↑"
+ }
+ Key {
+ text: "↓"
+ }
+ Key {
+ text: "■"
+ }
+ Key {
+ text: "□"
+ }
+ Key {
+ text: "●"
+ }
+ Key {
+ text: "○"
+ }
+ Key {
+ text: "【"
+ }
+ Key {
+ text: "】"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "『"
+ }
+ Key {
+ text: "』"
+ }
+ Key {
+ text: "「"
+ }
+ Key {
+ text: "」"
+ }
+ Key {
+ text: "★"
+ }
+ Key {
+ text: "☆"
+ }
+ Key {
+ text: "◆"
+ }
+ Key {
+ text: "◇"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "…"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/plugin/CMakeLists.txt b/src/plugin/CMakeLists.txt
index 9046ae58..5d235b9f 100644
--- a/src/plugin/CMakeLists.txt
+++ b/src/plugin/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from plugin.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QVirtualKeyboardPlugin Plugin:
@@ -6,29 +7,22 @@
qt_internal_add_plugin(QVirtualKeyboardPlugin
OUTPUT_NAME qtvirtualkeyboardplugin
- TYPE platforminputcontexts
+ PLUGIN_TYPE platforminputcontexts
+ DEFAULT_IF ANDROID
SOURCES
- extensionloader.cpp extensionloader.h
plugin.cpp plugin.h
DEFINES
QT_ASCII_CAST_WARNINGS
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_FROM_BYTEARRAY
QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
- Qt::Qml
Qt::VirtualKeyboardPrivate
)
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "qtvirtualkeyboard.json"
-# PLUGIN_EXTENDS = "-"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
+qt_internal_extend_target(QVirtualKeyboardPlugin CONDITION WIN32
+ LIBRARIES
+ imm32
+)
diff --git a/src/plugin/extensionloader.cpp b/src/plugin/extensionloader.cpp
deleted file mode 100644
index 6b41f328..00000000
--- a/src/plugin/extensionloader.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "extensionloader.h"
-#include <QtVirtualKeyboard/QVirtualKeyboardExtensionPlugin>
-#include <QtCore/private/qfactoryloader_p.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-QMutex ExtensionLoader::m_mutex;
-QMultiHash<QString, QJsonObject> ExtensionLoader::m_plugins;
-bool ExtensionLoader::m_alreadyDiscovered = false;
-
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QVirtualKeyboardExtensionPluginFactoryInterface_iid,
- QLatin1String("/virtualkeyboard")))
-
-QMultiHash<QString, QJsonObject> ExtensionLoader::plugins(bool reload)
-{
- QMutexLocker lock(&m_mutex);
-
- if (reload == true)
- m_alreadyDiscovered = false;
-
- if (!m_alreadyDiscovered) {
- loadPluginMetadata();
- m_alreadyDiscovered = true;
- }
- return m_plugins;
-}
-
-QJsonObject ExtensionLoader::loadMeta(const QString &extensionName)
-{
- QJsonObject metaData;
- metaData = QJsonObject();
- metaData.insert(QLatin1String("index"), -1);
-
- QList<QJsonObject> candidates = ExtensionLoader::plugins().values(extensionName);
-
- int versionFound = -1;
- int idx = -1;
-
- // figure out which version of the plugin we want
- for (int i = 0; i < candidates.size(); ++i) {
- QJsonObject meta = candidates[i];
- if (meta.contains(QLatin1String("Version"))
- && meta.value(QLatin1String("Version")).isDouble()) {
- int ver = int(meta.value(QLatin1String("Version")).toDouble());
- if (ver > versionFound) {
- versionFound = ver;
- idx = i;
- }
- }
- }
-
- if (idx != -1) {
- metaData = candidates[idx];
- return metaData;
- }
- return QJsonObject();
-}
-
-QVirtualKeyboardExtensionPlugin *ExtensionLoader::loadPlugin(QJsonObject metaData)
-{
- if (int(metaData.value(QLatin1String("index")).toDouble()) < 0) {
- return NULL;
- }
- int idx = int(metaData.value(QLatin1String("index")).toDouble());
- return qobject_cast<QVirtualKeyboardExtensionPlugin *>(loader()->instance(idx));
-}
-
-void ExtensionLoader::loadPluginMetadata()
-{
- QFactoryLoader *l = loader();
- QList<QJsonObject> meta = l->metaData();
- for (int i = 0; i < meta.size(); ++i) {
- QJsonObject obj = meta.at(i).value(QLatin1String("MetaData")).toObject();
- QString name = obj.value(QLatin1String("Name")).toString();
- if (!name.isEmpty()) {
- obj.insert(QLatin1String("index"), i);
- m_plugins.insert(name, obj);
- }
- }
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugin/extensionloader.h b/src/plugin/extensionloader.h
deleted file mode 100644
index 8cdb49bd..00000000
--- a/src/plugin/extensionloader.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef EXTENSIONLOADER_H
-#define EXTENSIONLOADER_H
-
-#include <QMutex>
-#include <QtVirtualKeyboard/QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class ExtensionLoader
-{
- Q_DISABLE_COPY(ExtensionLoader)
-public:
- static QMultiHash<QString, QJsonObject> plugins(bool reload = false);
- static QJsonObject loadMeta(const QString &extensionName);
- static QVirtualKeyboardExtensionPlugin *loadPlugin(QJsonObject metaData);
-
-private:
- static void loadPluginMetadata();
-
-private:
- static QMutex m_mutex;
- static QMultiHash<QString, QJsonObject> m_plugins;
- static bool m_alreadyDiscovered;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // EXTENSIONLOADER_H
diff --git a/src/plugin/plugin.cpp b/src/plugin/plugin.cpp
index 122a671d..6ea93d47 100644
--- a/src/plugin/plugin.cpp
+++ b/src/plugin/plugin.cpp
@@ -1,39 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "plugin.h"
-#include "extensionloader.h"
#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
-#include <QtVirtualKeyboard/private/plaininputmethod_p.h>
-#include <QtVirtualKeyboard/private/qvirtualkeyboard_staticplugin_p.h>
#include <QLoggingCategory>
-#include <QtQml>
+#if defined(Q_OS_WIN)
+#include <qt_windows.h>
+#endif
+#include <qpa/qplatforminputcontextfactory_p.h>
QT_BEGIN_NAMESPACE
@@ -41,9 +15,7 @@ using namespace QtVirtualKeyboard;
Q_LOGGING_CATEGORY(qlcVirtualKeyboard, "qt.virtualkeyboard")
-static const char pluginsUri[] = "QtQuick.VirtualKeyboard.Plugins";
static const char pluginName[] = "qtvirtualkeyboard";
-static const char inputMethodEnvVarName[] = "QT_IM_MODULE";
QStringList QVirtualKeyboardPlugin::keys() const
{
@@ -54,60 +26,18 @@ QPlatformInputContext *QVirtualKeyboardPlugin::create(const QString &system, con
{
Q_UNUSED(paramList);
-#if defined(QT_STATICPLUGIN)
-#if !defined(QT_VIRTUALKEYBOARD_DISABLE_LAYOUTS)
- Q_INIT_RESOURCE(qmake_virtualkeyboard_layouts);
-#endif
- Q_INIT_RESOURCE(virtualkeyboard_content);
-#if !defined(QT_VIRTUALKEYBOARD_NO_BUILTIN_STYLES)
- Q_INIT_RESOURCE(virtualkeyboard_default_style);
- Q_INIT_RESOURCE(virtualkeyboard_retro_style);
-#endif
- Q_VKB_IMPORT_PLUGIN(QtQuickVirtualKeyboardPlugin)
- Q_VKB_IMPORT_PLUGIN(QtQuickVirtualKeyboardSettingsPlugin)
- Q_VKB_IMPORT_PLUGIN(QtQuickVirtualKeyboardStylesPlugin)
-#endif
-
- if (!qEnvironmentVariableIsSet(inputMethodEnvVarName) || qgetenv(inputMethodEnvVarName) != pluginName)
- return Q_NULLPTR;
+ if (!QPlatformInputContextFactory::requested().contains(QLatin1StringView(pluginName)))
+ return nullptr;
if (system.compare(system, QLatin1String(pluginName), Qt::CaseInsensitive) != 0)
- return Q_NULLPTR;
- PlatformInputContext *platformInputContext = new PlatformInputContext();
-
- QStringList inputMethodList;
- inputMethodList.append(QLatin1String("PlainInputMethod"));
- qRegisterMetaType<PlainInputMethod *>("PlainInputMethod*");
- qmlRegisterType<PlainInputMethod>(pluginsUri, 1, 0, "PlainInputMethod");
- qmlRegisterType<PlainInputMethod>(pluginsUri, 2, 0, "PlainInputMethod");
- qmlRegisterType<PlainInputMethod>(pluginsUri, 2, 3, "PlainInputMethod");
-
- QMultiHash<QString, QJsonObject> extensions = ExtensionLoader::plugins();
- for (const QString &extensionName : extensions.uniqueKeys()) {
- QJsonObject metaData = ExtensionLoader::loadMeta(extensionName);
- if (metaData.isEmpty()) {
- qCWarning(qlcVirtualKeyboard) << "Error loading extension - metadata not found!";
- continue;
- }
- const QString inputMethod = metaData.value(QLatin1String("InputMethod")).toString();
- if (!inputMethod.isEmpty() && inputMethodList.contains(inputMethod)) {
- qCWarning(qlcVirtualKeyboard) << "Ignored extension" << extensionName <<
- "by" << metaData.value(QLatin1String("Provider")).toString() <<
- "-" << inputMethod << "is already registered!";
- continue;
- }
- qCDebug(qlcVirtualKeyboard) << "Loading extension" << extensionName;
- QVirtualKeyboardExtensionPlugin *extensionPlugin = ExtensionLoader::loadPlugin(metaData);
- if (extensionPlugin && !inputMethod.isEmpty()) {
- extensionPlugin->registerTypes(pluginsUri);
- inputMethodList.append(inputMethod);
- }
- }
+ return nullptr;
- // Auto-increment the import to stay in sync with ALL future QtQuick minor versions
- qmlRegisterModule(pluginsUri, 2, QT_VERSION_MINOR);
+#if defined(Q_OS_WIN)
+ // QTBUG-93042
+ ImmDisableIME(0);
+#endif
- platformInputContext->setInputMethods(inputMethodList);
+ PlatformInputContext *platformInputContext = new PlatformInputContext();
return platformInputContext;
}
diff --git a/src/plugin/plugin.h b/src/plugin/plugin.h
index c0548e94..cd056d3b 100644
--- a/src/plugin/plugin.h
+++ b/src/plugin/plugin.h
@@ -1,38 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PLUGIN_H
#define PLUGIN_H
#include <qpa/qplatforminputcontextplugin_p.h>
-#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
-#include <QStringList>
QT_BEGIN_NAMESPACE
diff --git a/src/plugin/plugin.pro b/src/plugin/plugin.pro
deleted file mode 100644
index defb3747..00000000
--- a/src/plugin/plugin.pro
+++ /dev/null
@@ -1,36 +0,0 @@
-TARGET = qtvirtualkeyboardplugin
-QT += qml virtualkeyboard-private
-
-SOURCES += \
- plugin.cpp \
- extensionloader.cpp
-
-HEADERS += \
- plugin.h \
- extensionloader.h
-
-OTHER_FILES += \
- qtvirtualkeyboard.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-no-builtin-style {
- DEFINES += QT_VIRTUALKEYBOARD_NO_BUILTIN_STYLES
-}
-disable-layouts {
- DEFINES += QT_VIRTUALKEYBOARD_DISABLE_LAYOUTS
-}
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-}
-
-PLUGIN_TYPE = platforminputcontexts
-PLUGIN_EXTENDS = -
-PLUGIN_CLASS_NAME = QVirtualKeyboardPlugin
-load(qt_plugin)
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 054d3b4b..686a6808 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -1,29 +1,50 @@
-# Generated from plugins.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+set(plugins_imports)
+if(QT_FEATURE_cerence_sdk)
+ add_subdirectory(cerence)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.Cerence/auto)
+endif()
+if(QT_FEATURE_example_hwr)
+ add_subdirectory(example)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.Example/auto)
+endif()
if(QT_FEATURE_hangul)
add_subdirectory(hangul)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.Hangul/auto)
endif()
if(QT_FEATURE_hunspell)
add_subdirectory(hunspell)
-endif()
-if(QT_FEATURE_lipi_toolkit)
- add_subdirectory(lipi-toolkit)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.Hunspell/auto)
endif()
if(QT_FEATURE_openwnn)
add_subdirectory(openwnn)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.OpenWNN/auto)
endif()
-if(QT_FEATURE_pinyin)
+if(QT_FEATURE_pinyin AND NOT QT_FEATURE_cerence_xt9)
add_subdirectory(pinyin)
-endif()
-if(QT_FEATURE_t9write)
- add_subdirectory(t9write)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.Pinyin/auto)
endif()
if(QT_FEATURE_tcime)
add_subdirectory(tcime)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.TCIme/auto)
endif()
-if(QT_FEATURE_vkb_myscript)
+if(QT_FEATURE_myscript)
add_subdirectory(myscript)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.MyScript/auto)
endif()
if(QT_FEATURE_thai)
add_subdirectory(thai)
+ list(APPEND plugins_imports QtQuick.VirtualKeyboard.Plugins.Thai/auto)
endif()
+
+qt_internal_add_qml_module(qtvkbpluginsplugin
+ URI "QtQuick.VirtualKeyboard.Plugins"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbpluginsplugin
+ IMPORTS
+ ${plugins_imports}
+ NO_GENERATE_CPP_EXPORTS
+)
diff --git a/src/plugins/cerence/.gitignore b/src/plugins/cerence/.gitignore
new file mode 100644
index 00000000..5a435361
--- /dev/null
+++ b/src/plugins/cerence/.gitignore
@@ -0,0 +1 @@
+sdk
diff --git a/src/plugins/cerence/CMakeLists.txt b/src/plugins/cerence/CMakeLists.txt
new file mode 100644
index 00000000..ba38d2cb
--- /dev/null
+++ b/src/plugins/cerence/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+set(cerence_imports)
+
+add_subdirectory(cerencecommon)
+if(QT_FEATURE_cerence_hwr)
+ add_subdirectory(hwr)
+ list(APPEND cerence_imports QtQuick.VirtualKeyboard.Plugins.Cerence.HWR/auto)
+endif()
+if(QT_FEATURE_cerence_xt9)
+ add_subdirectory(xt9)
+ list(APPEND cerence_imports QtQuick.VirtualKeyboard.Plugins.Cerence.XT9/auto)
+endif()
+
+qt_internal_add_qml_module(qtvkbcerenceplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Cerence"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbcerenceplugin
+ IMPORTS
+ ${cerence_imports}
+ NO_GENERATE_CPP_EXPORTS
+)
diff --git a/src/plugins/cerence/cerencecommon/CMakeLists.txt b/src/plugins/cerence/cerencecommon/CMakeLists.txt
new file mode 100644
index 00000000..4ebbf4fb
--- /dev/null
+++ b/src/plugins/cerence/cerencecommon/CMakeLists.txt
@@ -0,0 +1,93 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## BundledCerencecommon Generic Library:
+#####################################################################
+
+qt_internal_add_3rdparty_library(BundledCerencecommon
+ QMAKE_LIB_NAME cerencecommon
+ STATIC
+ SOURCES
+ xt9dbfile.cpp xt9dbfile.h
+ xt9ldbmanager.cpp xt9ldbmanager.h
+ PUBLIC_INCLUDE_DIRECTORIES
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::VirtualKeyboardPrivate
+)
+
+qt_internal_extend_target(BundledCerencecommon CONDITION FEATURE_vkb_bundle_cerence OR FEATURE_vkb_bundle_cerence_xt9
+ PUBLIC_DEFINES
+ HAVE_XT9_RESOURCE
+)
+
+qt_internal_extend_target(BundledCerencecommon CONDITION FEATURE_vkb_cerence_xt9_debug
+ PUBLIC_DEFINES
+ XT9_DEBUG
+)
+
+if(FEATURE_vkb_bundle_cerence OR FEATURE_vkb_bundle_cerence_xt9)
+
+ set(qmake_cerencecommondata_db_resource_files)
+
+ foreach(lang IN LISTS valid_languages)
+ if(FEATURE_vkb_lang_${lang})
+ if(${lang} STREQUAL "en_GB")
+ set(ldb_glob "EN*UK*.ldb")
+ elseif(${lang} STREQUAL "en_US")
+ set(ldb_glob "EN*US*.ldb")
+ elseif(${lang} STREQUAL "es_ES")
+ set(ldb_glob "ESusUN_*.ldb")
+ elseif(${lang} STREQUAL "es_MX")
+ set(ldb_glob "ESusUNlatam_*.ldb")
+ elseif(${lang} STREQUAL "fr_FR")
+ set(ldb_glob "FRusUN_*.ldb")
+ elseif(${lang} STREQUAL "fr_CA")
+ set(ldb_glob "FRusUNCA_*.ldb")
+ elseif(${lang} STREQUAL "ko_KR")
+ set(ldb_glob "KOusUN_xt9_ALM3.ldb")
+ elseif(${lang} STREQUAL "pt_PT")
+ set(ldb_glob "PTusUN_*.ldb")
+ elseif(${lang} STREQUAL "pt_BR")
+ set(ldb_glob "PTusUNBR_*.ldb")
+ elseif(${lang} STREQUAL "zh_CN")
+ set(ldb_glob "ZHsbUNps_GB18030_*.ldb")
+ elseif(${lang} STREQUAL "zh_TW")
+ set(ldb_glob "ZHtbUNps_Big5_*.ldb")
+ elseif(${lang} STREQUAL "zh_HK")
+ set(ldb_glob "ZHtbUNps_Big5HKSCS_*.ldb")
+ else()
+ string(SUBSTRING ${lang} 0 2 lang_code)
+ string(TOUPPER lang_code ${lang_code})
+ set(ldb_glob "${lang_code}*.ldb")
+ endif()
+ file(GLOB resource_glob_0 RELATIVE "${CERENCE_XT9_DATAPATH}" "${CERENCE_XT9_DATAPATH}/${ldb_glob}")
+ foreach(file IN LISTS resource_glob_0)
+ set_source_files_properties("${CERENCE_XT9_DATAPATH}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
+ endforeach()
+ list(APPEND qmake_cerencecommondata_db_resource_files ${resource_glob_0})
+ endif()
+ endforeach()
+
+ list(REMOVE_DUPLICATES qmake_cerencecommondata_db_resource_files)
+
+ qt_internal_add_resource(BundledCerencecommon "qmake_cerencecommondata_db"
+ PREFIX
+ "/qt-project.org/imports/QtQuick/VirtualKeyboard/Cerence/Xt9"
+ BASE
+ "${CERENCE_XT9_DATAPATH}"
+ FILES
+ ${qmake_cerencecommondata_db_resource_files}
+ OPTIONS
+ -no-compress
+ )
+else()
+ qt_copy_or_install(
+ DIRECTORY "${CERENCE_XT9_DATAPATH}/"
+ DESTINATION "${VKB_INSTALL_DATA}/cerence/xt9"
+ FILES_MATCHING
+ PATTERN "*.ldb"
+ )
+endif()
diff --git a/src/plugins/cerence/cerencecommon/dummy.txt b/src/plugins/cerence/cerencecommon/dummy.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/plugins/cerence/cerencecommon/dummy.txt
diff --git a/src/plugins/cerence/cerencecommon/xt9dbfile.cpp b/src/plugins/cerence/cerencecommon/xt9dbfile.cpp
new file mode 100644
index 00000000..a4080beb
--- /dev/null
+++ b/src/plugins/cerence/cerencecommon/xt9dbfile.cpp
@@ -0,0 +1,72 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9dbfile.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9DbFile::Xt9DbFile(const QString &fileName) :
+ file(fileName),
+ _data(nullptr),
+ _size(0),
+ _rw(false)
+{
+
+}
+
+QString Xt9DbFile::fileName() const
+{
+ return file.fileName();
+}
+
+const void *Xt9DbFile::roData()
+{
+ if (_data == nullptr) {
+ if (file.open(QIODevice::ReadOnly)) {
+ _rw = false;
+ _size = file.size();
+ _data = file.map(0, _size, QFile::NoOptions);
+ if (!_data) {
+ _size = 0;
+ }
+ file.close();
+ }
+ }
+
+ return _data;
+}
+
+void *Xt9DbFile::rwData(qint64 size)
+{
+ if (_data == nullptr || !_rw) {
+ if (!_rw) {
+ file.unmap(static_cast<uchar *>(_data));
+ _data = nullptr;
+ _rw = false;
+ }
+ if (file.open(QIODevice::ReadWrite)) {
+ _rw = true;
+ _size = file.size();
+ if (_size == 0) {
+ _size = size;
+ file.resize(_size);
+ }
+ _data = file.map(0, _size, QFile::NoOptions);
+ if (!_data) {
+ _size = 0;
+ }
+ file.close();
+ }
+ }
+
+ return _data;
+}
+
+qint64 Xt9DbFile::size() const
+{
+ return _size;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/cerencecommon/xt9dbfile.h b/src/plugins/cerence/cerencecommon/xt9dbfile.h
new file mode 100644
index 00000000..a99aefac
--- /dev/null
+++ b/src/plugins/cerence/cerencecommon/xt9dbfile.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9DBFILE_H
+#define XT9DBFILE_H
+
+#include <QFile>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9DbFile
+{
+public:
+ Xt9DbFile(const QString &fileName);
+
+ QString fileName() const;
+ const void *roData();
+ void *rwData(qint64 size);
+ qint64 size() const;
+
+private:
+ QFile file;
+ void *_data;
+ qint64 _size;
+ bool _rw;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9DBFILE_H
diff --git a/src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp b/src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp
new file mode 100644
index 00000000..6aa7e29a
--- /dev/null
+++ b/src/plugins/cerence/cerencecommon/xt9ldbmanager.cpp
@@ -0,0 +1,167 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9ldbmanager.h"
+#include "xt9dbfile.h"
+#include <QDirIterator>
+#include <QLibraryInfo>
+#include <QMap>
+#include <QtVirtualKeyboard/private/settings_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+const QRegularExpression Xt9LdbManager::ldbRegex = QRegularExpression(QStringLiteral("([A-Z]{2})([a-z]{2})(?:UN)(.*?)(?:_xt9_?)?((?:CJI_|HC_|big_)?ALM3?)?(\\.ldb|\\.phd)"));
+
+Xt9LdbManager::Xt9LdbManager() :
+ _phdEnabled(false)
+{
+ QString xt9LdbPath(qEnvironmentVariable("QT_VIRTUALKEYBOARD_XT9_LDB_PATH"));
+ const QString pathListSep(
+#if defined(Q_OS_WIN32)
+ QStringLiteral(";")
+#else
+ QStringLiteral(":")
+#endif
+ );
+ QStringList userPaths(xt9LdbPath.split(pathListSep, Qt::SkipEmptyParts));
+ const QStringList defaultPaths = userPaths
+ << QDir(QStringLiteral("%1/qtvirtualkeyboard/cerence/xt9/").arg(QLibraryInfo::path(QLibraryInfo::DataPath))).absolutePath()
+ << QLatin1String(":/qt-project.org/imports/QtQuick/VirtualKeyboard/Cerence/Xt9")
+ ;
+ for (const QString &defaultPath : defaultPaths) {
+ addSearchPath(defaultPath);
+ }
+}
+
+void Xt9LdbManager::addSearchPath(const QString &searchPath)
+{
+ if (!searchPaths.contains(searchPath))
+ searchPaths.append(searchPath);
+}
+
+void Xt9LdbManager::setPhdEnabled(bool enabled)
+{
+ _phdEnabled = enabled;
+}
+
+bool Xt9LdbManager::phdEnabled() const
+{
+ return _phdEnabled;
+}
+
+bool Xt9LdbManager::loadDictionary(const QLocale &locale, const void *&data, qint64 &size)
+{
+ const QString language = locale.name();
+ if (ldbMap.contains(language)) {
+ QSharedPointer<Xt9DbFile> ldb = ldbMap[language];
+ if (_phdEnabled || !ldb->fileName().endsWith(QLatin1String(".phd"), Qt::CaseInsensitive)) {
+ data = ldb->roData();
+ size = ldb->size();
+ return true;
+ }
+ }
+
+ QString dictionaryFile = findDictionary(locale);
+ if (!dictionaryFile.isEmpty()) {
+ QSharedPointer<Xt9DbFile> ldb(new Xt9DbFile(dictionaryFile));
+ data = ldb->roData();
+ size = ldb->size();
+ if (data) {
+ ldbMap[language] = ldb;
+ return true;
+ }
+ }
+
+ data = nullptr;
+ size = 0;
+
+ return false;
+}
+
+void Xt9LdbManager::closeAll()
+{
+ ldbMap.clear();
+}
+
+QString Xt9LdbManager::findDictionary(const QLocale &locale) const
+{
+ QStringList languageCountry = locale.name().split(QLatin1String("_"));
+ if (languageCountry.size() != 2)
+ return QString();
+ const QString language_ISO_639_1 = languageCountry[0].toUpper();
+ const QString country = languageCountry[1].toUpper();
+ const QLocale::Script script = locale.script();
+
+ QMap<QString, int> matchedDictionaries;
+ for (const QString &ldbDirectory : searchPaths) {
+ QDirIterator it(ldbDirectory, QDirIterator::NoIteratorFlags);
+ while (it.hasNext()) {
+ QString fileEntry = it.next();
+ const QFileInfo fileInfo(fileEntry);
+
+ if (fileInfo.isDir())
+ continue;
+
+ QString fileName(fileInfo.fileName());
+ fileName.remove(QRegularExpression(QLatin1String("^zzEval_")));
+
+ QRegularExpressionMatch match = ldbRegex.match(fileName);
+ if (!match.hasMatch())
+ continue;
+
+ QString xt9Language = match.captured(1);
+
+ // Special case for language codes not following ISO 639-1
+ if (xt9Language == QLatin1String("NO"))
+ xt9Language = QStringLiteral("NB");
+
+ const QString ext(match.captured(5));
+ if (xt9Language == language_ISO_639_1 &&
+ (ext == QLatin1String(".ldb") || (_phdEnabled && ext == QLatin1String(".phd")))) {
+
+ int score = 1;
+
+ QString xt9CountryOrDetail = match.captured(3);
+ const QString charsetClassifier = match.captured(2);
+ const QString almClassifier = match.captured(4);
+
+ // Special case for country codes not following ISO 639-1
+ if (xt9CountryOrDetail == QLatin1String("UK"))
+ xt9CountryOrDetail = QStringLiteral("GB");
+ else if (xt9CountryOrDetail == QLatin1String("latam"))
+ xt9CountryOrDetail = QStringLiteral("MX");
+ else if (xt9CountryOrDetail.isEmpty() && country == language_ISO_639_1)
+ xt9CountryOrDetail = country;
+
+ if (xt9CountryOrDetail == country ||
+ ((script == QLocale::SimplifiedHanScript && charsetClassifier == QLatin1String("sb")) ||
+ (script == QLocale::TraditionalHanScript && charsetClassifier == QLatin1String("tb"))))
+ ++score;
+
+ if (locale.territory() == QLocale::Taiwan && xt9CountryOrDetail == QLatin1String("ps_Big5_bpmf_pinyin_CJ"))
+ ++score;
+ else if (locale.territory() == QLocale::HongKong && xt9CountryOrDetail == QLatin1String("ps_Big5HKSCS_bpmf_pinyin_CJ"))
+ ++score;
+
+ if (!almClassifier.isEmpty())
+ ++score;
+
+ matchedDictionaries.insert(fileEntry, score);
+ }
+ }
+ }
+
+ if (matchedDictionaries.isEmpty())
+ return QString();
+
+ QList<int> scoreList = matchedDictionaries.values();
+ std::sort(scoreList.begin(), scoreList.end());
+ const int highScore = scoreList.last();
+ const QString bestMatch = matchedDictionaries.key(highScore);
+
+ return bestMatch;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/cerencecommon/xt9ldbmanager.h b/src/plugins/cerence/cerencecommon/xt9ldbmanager.h
new file mode 100644
index 00000000..2d75fc33
--- /dev/null
+++ b/src/plugins/cerence/cerencecommon/xt9ldbmanager.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9LDBMANAGER_H
+#define XT9LDBMANAGER_H
+
+#include <QLocale>
+#include <QSharedPointer>
+#include <QRegularExpression>
+#include <QSet>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9DbFile;
+
+class Xt9LdbManager
+{
+public:
+ Xt9LdbManager();
+
+ void addSearchPath(const QString &ldbDirectory);
+ void setPhdEnabled(bool enabled);
+ bool phdEnabled() const;
+
+ bool loadDictionary(const QLocale &locale, const void *&data, qint64 &size);
+ void closeAll();
+
+ QString findDictionary(const QLocale &locale) const;
+
+private:
+ QStringList searchPaths;
+ QMap<QString, QSharedPointer<Xt9DbFile>> ldbMap;
+ bool _phdEnabled;
+ static const QRegularExpression ldbRegex;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9LDBMANAGER_H
diff --git a/src/plugins/cerence/hwr/CMakeLists.txt b/src/plugins/cerence/hwr/CMakeLists.txt
new file mode 100644
index 00000000..641a943f
--- /dev/null
+++ b/src/plugins/cerence/hwr/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from cerence-hwr.pro.
+
+add_subdirectory(plugin)
diff --git a/src/plugins/cerence/hwr/plugin/CMakeLists.txt b/src/plugins/cerence/hwr/plugin/CMakeLists.txt
new file mode 100644
index 00000000..d566c1eb
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/CMakeLists.txt
@@ -0,0 +1,419 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## QtVirtualKeyboardCerenceHwrPlugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(qtvkbcerencehwrplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Cerence.HWR"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbcerencehwrplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ cerence_hwr_p.h
+ t9writeabstractdictionary_p.h
+ t9writedictionary.cpp t9writedictionary_p.h
+ t9writeinputmethod.cpp t9writeinputmethod_p.h
+ t9writewordcandidate.cpp t9writewordcandidate_p.h
+ t9writeworker.cpp t9writeworker_p.h
+ DEFINES
+ HAVE_CERENCE_HWR
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::BundledCerencecommon
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboardPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# Resources:
+set(qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fallback/handwriting.qml"
+)
+
+if (QT_FEATURE_vkb_lang_en_GB)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/en_GB/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_en_US)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/en_US/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ar_AR)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ar_AR/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_bg_BG)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/bg_BG/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_cs_CZ)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/cs_CZ/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_da_DK)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/da_DK/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_de_DE)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/de_DE/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_el_GR)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/el_GR/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_es_ES)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/es_ES/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_es_MX)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/es_MX/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_et_EE)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/et_EE/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fa_FA)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fa_FA/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fi_FI)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fi_FI/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fr_FR)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fr_FR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fr_CA)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fr_CA/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_he_IL)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/he_IL/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_hr_HR)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/hr_HR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_hu_HU)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/hu_HU/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_id_ID)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/id_ID/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_it_IT)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/it_IT/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ms_MY)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ms_MY/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_nb_NO)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/nb_NO/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_nl_NL)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/nl_NL/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_pl_PL)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/pl_PL/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_pt_BR)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/pt_BR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_pt_PT)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/pt_PT/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ro_RO)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ro_RO/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ru_RU)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ru_RU/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sk_SK)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sk_SK/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sl_SI)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sl_SI/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sq_AL)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sq_AL/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sr_SP)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sr_SP/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sv_SE)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sv_SE/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_th_TH)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/th_TH/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_tr_TR)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/tr_TR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_uk_UA)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/uk_UA/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_vi_VN)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/vi_VN/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ja_JP)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ja_JP/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ko_KR)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ko_KR/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_zh_CN)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_CN/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_zh_TW)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_TW/handwriting.qml"
+ )
+endif()
+
+qt_internal_add_resource(qtvkbcerencehwrplugin "qmake_virtualkeyboard_cerence_hwr_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${VKB_LAYOUTS_BASE}"
+ FILES
+ ${qmake_virtualkeyboard_cerence_hwr_layouts_resource_files}
+)
+
+set(qmake_virtualkeyboard_cerence_hwr_custom_layouts_resource_files)
+if (QT_FEATURE_vkb_lang_zh_HK)
+ list(APPEND qmake_virtualkeyboard_cerence_hwr_custom_layouts_resource_files
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/zh_HK/handwriting.qml"
+ )
+endif()
+
+qt_internal_add_resource(qtvkbcerencehwrplugin "qmake_virtualkeyboard_cerence_hwr_custom_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts"
+ FILES
+ ${qmake_virtualkeyboard_cerence_hwr_custom_layouts_resource_files}
+)
+
+qt_internal_extend_target(qtvkbcerencehwrplugin CONDITION QT_FEATURE_cerence_xt9
+ DEFINES
+ HAVE_XT9
+ LIBRARIES
+ Qt::BundledXt9Common
+)
+
+qt_internal_extend_target(qtvkbcerencehwrplugin CONDITION QT_FEATURE_cerence_hwr_alphabetic
+ DEFINES
+ HAVE_CERENCE_HWR_ALPHABETIC
+ LIBRARIES
+ Cerence::HWR::Alphabetic
+)
+
+qt_internal_extend_target(qtvkbcerencehwrplugin CONDITION QT_FEATURE_cerence_hwr_cjk
+ DEFINES
+ HAVE_CERENCE_HWR_CJK
+ LIBRARIES
+ Cerence::HWR::CJK
+)
+
+qt_internal_extend_target(qtvkbcerencehwrplugin CONDITION FEATURE_vkb_bundle_cerence OR FEATURE_vkb_bundle_cerence_hwr
+ DEFINES
+ HAVE_CERENCE_HWR_RESOURCE
+)
+
+if(FEATURE_vkb_bundle_cerence OR FEATURE_vkb_bundle_cerence_hwr)
+ set(resource_glob_0)
+ if(FEATURE_vkb_lang_ar_AR OR FEATURE_vkb_lang_fa_FA)
+ file(GLOB resource_glob_0 RELATIVE "${CERENCE_HWR_DATAPATH}" "${CERENCE_HWR_DATAPATH}/arabic/*.bin")
+ foreach(file IN LISTS resource_glob_0)
+ set_source_files_properties("${CERENCE_HWR_DATAPATH}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
+ endforeach()
+ endif()
+
+ set(resource_glob_1)
+ if(FEATURE_vkb_lang_he_IL)
+ file(GLOB resource_glob_1 RELATIVE "${CERENCE_HWR_DATAPATH}" "${CERENCE_HWR_DATAPATH}/hebrew/*.bin")
+ foreach(file IN LISTS resource_glob_1)
+ set_source_files_properties("${CERENCE_HWR_DATAPATH}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
+ endforeach()
+ endif()
+
+ set(resource_glob_2)
+ if(FEATURE_vkb_lang_th_TH)
+ file(GLOB resource_glob_2 RELATIVE "${CERENCE_HWR_DATAPATH}" "${CERENCE_HWR_DATAPATH}/thai/*.bin")
+ foreach(file IN LISTS resource_glob_2)
+ set_source_files_properties("${CERENCE_HWR_DATAPATH}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
+ endforeach()
+ endif()
+
+ file(GLOB resource_glob_3 RELATIVE "${CERENCE_HWR_DATAPATH}" "${CERENCE_HWR_DATAPATH}/*.bin")
+ foreach(file IN LISTS resource_glob_3)
+ set_source_files_properties("${CERENCE_HWR_DATAPATH}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
+ endforeach()
+
+ file(GLOB resource_glob_4 RELATIVE "${CERENCE_HWR_DATAPATH}" "${CERENCE_HWR_DATAPATH}/*.hdb")
+ foreach(file IN LISTS resource_glob_4)
+ set_source_files_properties("${CERENCE_HWR_DATAPATH}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
+ endforeach()
+
+ file(GLOB resource_glob_5 RELATIVE "${CERENCE_HWR_DATAPATH}" "${CERENCE_HWR_DATAPATH}/*.phd")
+ foreach(file IN LISTS resource_glob_5)
+ set_source_files_properties("${CERENCE_HWR_DATAPATH}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
+ endforeach()
+
+ # Resources:
+ set(qmake_cerencehwrdata_db_resource_files
+ ${resource_glob_0}
+ ${resource_glob_1}
+ ${resource_glob_2}
+ ${resource_glob_3}
+ ${resource_glob_4}
+ ${resource_glob_5}
+ )
+
+ qt_internal_add_resource(qtvkbcerencehwrplugin "qmake_cerencehwrdata_db"
+ PREFIX
+ "/qt-project.org/imports/QtQuick/VirtualKeyboard/Cerence/Handwriting"
+ BASE
+ "${CERENCE_HWR_DATAPATH}"
+ FILES
+ ${qmake_cerencehwrdata_db_resource_files}
+ OPTIONS
+ -no-compress
+ )
+else()
+ qt_copy_or_install(
+ DIRECTORY "${CERENCE_HWR_DATAPATH}/"
+ DESTINATION "${VKB_INSTALL_DATA}/cerence/handwriting"
+ )
+endif()
+
+if(QT_FEATURE_cerence_hwr_alphabetic AND NOT FEATURE_vkb_cerence_static)
+ qt_copy_or_install(
+ FILES "${CERENCE_HWR_ALPHABETIC_BINARIES}"
+ DESTINATION "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
+ )
+endif()
+
+if(QT_FEATURE_cerence_hwr_cjk AND NOT FEATURE_vkb_cerence_static)
+ qt_copy_or_install(
+ FILES "${CERENCE_HWR_CJK_BINARIES}"
+ DESTINATION "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
+ )
+endif()
diff --git a/src/plugins/cerence/hwr/plugin/cerence_hwr_p.h b/src/plugins/cerence/hwr/plugin/cerence_hwr_p.h
new file mode 100644
index 00000000..020ce209
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/cerence_hwr_p.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef CERENCE_HWR_P_H
+#define CERENCE_HWR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/private/qvirtualkeyboard_global_p.h>
+
+#include "cerence_handwriting_api_version.h"
+#if QT_CONFIG(cerence_hwr_alphabetic)
+#include "decuma_hwr.h"
+#endif
+#if QT_CONFIG(cerence_hwr_cjk)
+#include "decuma_hwr_cjk.h"
+#endif
+
+#if QT_CONFIG(cerence_hwr_cjk) && QT_CONFIG(cerence_hwr_alphabetic)
+#define DECUMA_API(FUNC_NAME) (cjk ? decumaCJK ## FUNC_NAME : decumaUcr ## FUNC_NAME)
+#elif QT_CONFIG(cerence_hwr_cjk)
+#define DECUMA_API(FUNC_NAME) (decumaCJK ## FUNC_NAME)
+#else // QT_CONFIG(cerence_hwr_alphabetic)
+#define DECUMA_API(FUNC_NAME) (decumaUcr ## FUNC_NAME)
+#endif
+
+#endif // CERENCE_HWR_P_H
diff --git a/src/plugins/cerence/hwr/plugin/content/layouts/zh_HK/handwriting.qml b/src/plugins/cerence/hwr/plugin/content/layouts/zh_HK/handwriting.qml
new file mode 100644
index 00000000..a2548b89
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/content/layouts/zh_HK/handwriting.qml
@@ -0,0 +1,73 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; HandwritingInputMethod {}', parent)
+ }
+ sharedLayouts: ['symbols']
+ inputMode: preferredInputMode()
+
+ Connections {
+ target: InputContext
+ function onInputMethodHintsChanged() {
+ var newInputMode = preferredInputMode()
+ if (InputContext.inputEngine.inputModes.indexOf(newInputMode) !== -1)
+ InputContext.inputEngine.inputMode = newInputMode
+ }
+ }
+
+ function preferredInputMode() {
+ return InputContext.inputMethodHints &
+ (Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
+ Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.ChineseHandwriting
+ }
+
+ KeyboardRow {
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ InputModeKey {
+ }
+ ChangeLanguageKey {
+ visible: true
+ }
+ ShiftKey {
+ }
+ HandwritingModeKey {
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 8
+ TraceInputKey {
+ objectName: "hwrInputArea"
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ horizontalRulers:
+ InputContext.inputEngine.inputMode !== InputEngine.InputMode.ChineseHandwriting ? [] :
+ [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
+ }
+ }
+ KeyboardColumn {
+ Layout.preferredWidth: 1
+ Key {
+ key: Qt.Key_Period
+ text: "。"
+ alternativeKeys: "¥‘’“”~…—\",.:;、。?! "
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ BackspaceKey {
+ }
+ EnterKey {
+ }
+ }
+ }
+}
diff --git a/src/plugins/cerence/hwr/plugin/t9writeabstractdictionary_p.h b/src/plugins/cerence/hwr/plugin/t9writeabstractdictionary_p.h
new file mode 100644
index 00000000..757558b5
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writeabstractdictionary_p.h
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef T9WRITEABSTRACTDICTIONARY_P_H
+#define T9WRITEABSTRACTDICTIONARY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class T9WriteAbstractDictionary
+{
+ Q_DISABLE_COPY(T9WriteAbstractDictionary)
+
+protected:
+ T9WriteAbstractDictionary() {}
+
+public:
+ virtual ~T9WriteAbstractDictionary() {}
+
+ virtual bool load() = 0;
+ virtual bool create(qint64 createSize) { Q_UNUSED(createSize) return false; }
+ virtual void close() {}
+ virtual bool convert() { return false; }
+ virtual QString name() const = 0;
+ virtual const void *data() const = 0;
+ virtual qint64 size() const = 0;
+ bool isCompleted() const { return state > 0; }
+
+private:
+ friend class T9WriteDictionaryTask;
+ QAtomicInt state;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // T9WRITEABSTRACTDICTIONARY_P_H
diff --git a/src/plugins/cerence/hwr/plugin/t9writedictionary.cpp b/src/plugins/cerence/hwr/plugin/t9writedictionary.cpp
new file mode 100644
index 00000000..14c3ae2f
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writedictionary.cpp
@@ -0,0 +1,281 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "t9writedictionary_p.h"
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_DECLARE_LOGGING_CATEGORY(lcT9Write)
+
+// T9WriteAbstractSource
+
+T9WriteAbstractSource::T9WriteAbstractSource(const DECUMA_SRC_DICTIONARY_INFO &info) :
+ _info(info)
+{
+}
+
+T9WriteAbstractSource::~T9WriteAbstractSource()
+{
+}
+
+const DECUMA_SRC_DICTIONARY_INFO *T9WriteAbstractSource::info() const
+{
+ return &_info;
+}
+
+// T9WriteFileSource
+
+T9WriteFileSource::T9WriteFileSource(const DECUMA_SRC_DICTIONARY_INFO &info, const QString &fileName) :
+ T9WriteAbstractSource(info),
+ file(fileName),
+ _data(nullptr),
+ _size(0)
+{
+}
+
+bool T9WriteFileSource::load()
+{
+ if (!_data) {
+ if (file.open(QIODevice::ReadOnly)) {
+ _size = file.size();
+ _data = file.map(0, _size, QFile::NoOptions);
+ if (!_data) {
+ _size = 0;
+ qCWarning(lcT9Write) << "Could not read dictionary file" << file.fileName();
+ }
+ file.close();
+ }
+ }
+
+ return _data != nullptr;
+}
+
+bool T9WriteFileSource::create(qint64 createSize)
+{
+ close();
+
+ if (file.open(QIODevice::ReadWrite)) {
+ if (file.resize(createSize)) {
+ _size = file.size();
+ _data = file.map(0, _size, QFile::NoOptions);
+ if (!_data) {
+ _size = 0;
+ qCWarning(lcT9Write) << "Could not read dictionary file" << file.fileName();
+ }
+ } else {
+ qCWarning(lcT9Write) << "Could not resize dictionary file" << file.fileName();
+ }
+ file.close();
+ }
+
+ return _data != nullptr;
+}
+
+void T9WriteFileSource::close()
+{
+ if (_data) {
+ file.unmap(static_cast<uchar *>(_data));
+ _data = nullptr;
+ _size = 0;
+ }
+}
+
+QString T9WriteFileSource::name() const
+{
+ return file.fileName();
+}
+
+const void *T9WriteFileSource::data() const
+{
+ return _data;
+}
+
+qint64 T9WriteFileSource::size() const
+{
+ return _size;
+}
+
+// T9WriteStringSource
+
+T9WriteStringSource::T9WriteStringSource(const DECUMA_SRC_DICTIONARY_INFO &info, const QStringList &source, const QString &name) :
+ T9WriteAbstractSource(info),
+ source(source),
+ _name(name)
+{
+}
+
+bool T9WriteStringSource::load()
+{
+ _data = source.join(QLatin1Char('\r'));
+ return true;
+}
+
+QString T9WriteStringSource::name() const
+{
+ return _name;
+}
+
+const void *T9WriteStringSource::data() const
+{
+ return _data.utf16();
+}
+
+qint64 T9WriteStringSource::size() const
+{
+ return _data.size();
+}
+
+// T9WriteDictionary
+
+T9WriteDictionary::T9WriteDictionary(QSharedPointer<T9WriteAbstractSource> source,
+ DECUMA_SESSION *decumaSession,
+ const DECUMA_MEM_FUNCTIONS &memFuncs,
+ bool cjk) :
+ source(source),
+ decumaSession(decumaSession),
+ memFuncs(memFuncs),
+ cjk(cjk),
+ convertedData(nullptr),
+ convertedSize(0)
+{
+}
+
+T9WriteDictionary::~T9WriteDictionary()
+{
+ if (convertedData) {
+ DECUMA_STATUS status = DECUMA_API(DestroyConvertedDictionary)(&convertedData, &memFuncs);
+ Q_ASSERT(status == decumaNoError);
+ Q_ASSERT(convertedData == nullptr);
+ }
+}
+
+bool T9WriteDictionary::load()
+{
+ return source->load();
+}
+
+bool T9WriteDictionary::convert()
+{
+ if (!source->data() || convertedData)
+ return false;
+
+ DECUMA_STATUS status;
+ status = DECUMA_API(ConvertDictionary)(&convertedData, source->data(), static_cast<DECUMA_UINT32>(source->size()),
+ source->info(), &convertedSize, &memFuncs);
+
+ if (status != decumaNoError) {
+ qCWarning(lcT9Write) << "Could not convert dictionary";
+ }
+
+ return status == decumaNoError;
+}
+
+QString T9WriteDictionary::name() const
+{
+ return source->name();
+}
+
+const void *T9WriteDictionary::data() const
+{
+ return convertedData ? convertedData : source->data();
+}
+
+qint64 T9WriteDictionary::size() const
+{
+ return convertedData ? convertedSize : source->size();
+}
+
+T9WriteDynamicDictionary::T9WriteDynamicDictionary(QSharedPointer<T9WriteAbstractSource> source, int maxWords, const DECUMA_MEM_FUNCTIONS &memFuncs, bool cjk) :
+ source(source),
+ memFuncs(memFuncs),
+ cjk(cjk),
+ _data(nullptr)
+{
+ DECUMA_API(DynamicDictionaryCreate)(&_data, static_cast<DECUMA_UINT32>(maxWords), &memFuncs);
+}
+
+T9WriteDynamicDictionary::~T9WriteDynamicDictionary()
+{
+ if (_data) {
+ DECUMA_API(DynamicDictionaryDestroy)(&_data);
+ }
+}
+
+bool T9WriteDynamicDictionary::load()
+{
+ if (!_data)
+ return false;
+
+ DECUMA_STATUS status;
+ DECUMA_UINT32 nUnprocessedSize = 0;
+ if (source->load()) {
+ status = DECUMA_API(DynamicDictionaryAddWords)(_data, source->data(), static_cast<DECUMA_UINT32>(source->size()), &nUnprocessedSize);
+ if (status) {
+ qCWarning(lcT9Write) << "Could not load words to dynamic dictionary, error" << status;
+ }
+ source->close();
+ }
+
+ return true;
+}
+
+QString T9WriteDynamicDictionary::name() const
+{
+ return source->name();
+}
+
+const void *T9WriteDynamicDictionary::data() const
+{
+ return _data;
+}
+
+qint64 T9WriteDynamicDictionary::size() const
+{
+ return 0;
+}
+
+qint64 T9WriteDynamicDictionary::bufferSize() const
+{
+ DECUMA_UINT32 result = 0;
+ if (_data)
+ DECUMA_API(DynamicDictionaryGetWordsBufferSize)(_data, &result);
+ return result;
+}
+
+void T9WriteDynamicDictionary::save()
+{
+ if (_data) {
+ DECUMA_UINT32 nWordsWritten = 0;
+ DECUMA_UINT32 nBytesWritten = 0;
+ qint64 fileSize = bufferSize();
+ if (source->create(fileSize)) {
+ DECUMA_STATUS status = DECUMA_API(DynamicDictionaryGetWords)(_data, const_cast<void *>(source->data()), static_cast<DECUMA_UINT32>(fileSize), &nWordsWritten, &nBytesWritten);
+ source->close();
+ }
+ }
+}
+
+bool T9WriteDynamicDictionary::hasWord(const QString &word)
+{
+ if (!_data)
+ return false;
+
+ int found = 0;
+ DECUMA_API(DynamicDictionaryHasWord)(_data, word.utf16(), &found);
+
+ return found != 0;
+}
+
+bool T9WriteDynamicDictionary::removeWord(const QString &word)
+{
+ DECUMA_STATUS status;
+
+ status = DECUMA_API(DynamicDictionaryDeleteWord)(_data, word.utf16());
+
+ return !status;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/hwr/plugin/t9writedictionary_p.h b/src/plugins/cerence/hwr/plugin/t9writedictionary_p.h
new file mode 100644
index 00000000..3678d69d
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writedictionary_p.h
@@ -0,0 +1,122 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef T9WRITEDICTIONARY_P_H
+#define T9WRITEDICTIONARY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "t9writeabstractdictionary_p.h"
+#include <QFile>
+#include <QSharedPointer>
+#include "cerence_hwr_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class T9WriteAbstractSource : public T9WriteAbstractDictionary
+{
+public:
+ T9WriteAbstractSource(const DECUMA_SRC_DICTIONARY_INFO &info);
+ virtual ~T9WriteAbstractSource();
+
+ const DECUMA_SRC_DICTIONARY_INFO *info() const;
+
+private:
+ const DECUMA_SRC_DICTIONARY_INFO _info;
+};
+
+class T9WriteFileSource : public T9WriteAbstractSource
+{
+public:
+ T9WriteFileSource(const DECUMA_SRC_DICTIONARY_INFO &info, const QString &fileName);
+
+ bool load() override;
+ bool create(qint64 createSize) override;
+ void close() override;
+
+ QString name() const override;
+ const void *data() const override;
+ qint64 size() const override;
+
+private:
+ QFile file;
+ void *_data;
+ qint64 _size;
+};
+
+class T9WriteStringSource : public T9WriteAbstractSource
+{
+public:
+ T9WriteStringSource(const DECUMA_SRC_DICTIONARY_INFO &info, const QStringList &source, const QString &name);
+
+ bool load() override;
+ QString name() const override;
+ const void *data() const override;
+ qint64 size() const override;
+
+private:
+ QStringList source;
+ QString _data;
+ QString _name;
+};
+
+class T9WriteDictionary : public T9WriteAbstractDictionary
+{
+ Q_DISABLE_COPY(T9WriteDictionary)
+public:
+ explicit T9WriteDictionary(QSharedPointer<T9WriteAbstractSource> source, DECUMA_SESSION *decumaSession, const DECUMA_MEM_FUNCTIONS &memFuncs, bool cjk);
+ ~T9WriteDictionary() override;
+
+ bool load() override;
+ bool convert() override;
+ QString name() const override;
+ const void *data() const override;
+ qint64 size() const override;
+
+private:
+ QSharedPointer<T9WriteAbstractSource> source;
+ DECUMA_SESSION *decumaSession;
+ const DECUMA_MEM_FUNCTIONS &memFuncs;
+ bool cjk;
+ void *convertedData;
+ DECUMA_UINT32 convertedSize;
+};
+
+class T9WriteDynamicDictionary : public T9WriteAbstractDictionary
+{
+ Q_DISABLE_COPY(T9WriteDynamicDictionary)
+public:
+ explicit T9WriteDynamicDictionary(QSharedPointer<T9WriteAbstractSource> source, int maxWords, const DECUMA_MEM_FUNCTIONS &memFuncs, bool cjk);
+ ~T9WriteDynamicDictionary() override;
+
+ bool load() override;
+ QString name() const override;
+ const void *data() const override;
+ qint64 size() const override;
+ qint64 bufferSize() const;
+
+ void save();
+ bool hasWord(const QString &word);
+ bool removeWord(const QString &word);
+
+private:
+ QSharedPointer<T9WriteAbstractSource> source;
+ const DECUMA_MEM_FUNCTIONS &memFuncs;
+ const bool cjk;
+ DECUMA_DYNAMIC_DICTIONARY *_data;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // T9WRITEDICTIONARY_P_H
diff --git a/src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp b/src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp
new file mode 100644
index 00000000..bf0a0807
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writeinputmethod.cpp
@@ -0,0 +1,2824 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "t9writeinputmethod_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
+#include "t9writeworker_p.h"
+#include <QLoggingCategory>
+#include <QDirIterator>
+#include <QCryptographicHash>
+#include <QTime>
+#include <QMetaEnum>
+#include <QtCore/QLibraryInfo>
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <QtVirtualKeyboard/private/handwritinggesturerecognizer_p.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardabstractinputmethod_p.h>
+#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+#include <QtVirtualKeyboard/private/unipentrace_p.h>
+#include <QStandardPaths>
+#endif
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionary.h>
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionarymanager.h>
+
+#include "decumaStatus.h"
+#include "decumaSymbolCategories.h"
+#include "decumaLanguages.h"
+#include "xxchOem.h"
+#include "xt9ldbmanager.h"
+#include "t9writewordcandidate_p.h"
+#ifdef HAVE_XT9
+#include <xt9awime.h>
+#include <xt9cpime.h>
+#include <xt9jime.h>
+#include <xt9kime.h>
+#include <xt9callbacks.h>
+#include <xt9languagemap.h>
+#endif
+
+/* Set to 1 to enable T9 Write log.
+
+ The log is routed to qDebug() and it can be enabled for troubleshooting
+ and when reporting issues. The log must not to be enabled in production
+ build.
+*/
+#define QT_VIRTUALKEYBOARD_CERENCE_HWR_LOG 0
+
+#define CERENCE_HWR_DLM_MAX_WORDS 10000
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(lcT9Write, "qt.virtualkeyboard.cerence-hwr")
+
+class T9WriteCaseFormatter
+{
+public:
+ T9WriteCaseFormatter() :
+ preferLowercase(false)
+ {
+ }
+
+ void clear()
+ {
+ textCaseList.clear();
+ }
+
+ void ensureLength(int length, QVirtualKeyboardInputEngine::TextCase textCase)
+ {
+ if (length <= 0) {
+ textCaseList.clear();
+ return;
+ }
+ while (length < textCaseList.size())
+ textCaseList.removeLast();
+ while (length > textCaseList.size())
+ textCaseList.append(textCase);
+ }
+
+ QString formatString(const QString &str) const
+ {
+ QString result;
+ QVirtualKeyboardInputEngine::TextCase textCase = QVirtualKeyboardInputEngine::TextCase::Lower;
+ for (int i = 0; i < str.length(); ++i) {
+ if (i < textCaseList.size())
+ textCase = textCaseList.at(i);
+ result.append(textCase == QVirtualKeyboardInputEngine::TextCase::Upper ? str.at(i).toUpper() : (preferLowercase ? str.at(i).toLower() : str.at(i)));
+ }
+ return result;
+ }
+
+ bool preferLowercase;
+
+private:
+ QList<QVirtualKeyboardInputEngine::TextCase> textCaseList;
+};
+
+class T9WriteInputMethodPrivate : public QVirtualKeyboardAbstractInputMethodPrivate
+#ifdef HAVE_XT9
+ , public Xt9RequestCallback
+#endif
+{
+public:
+ Q_DECLARE_PUBLIC(T9WriteInputMethod)
+
+ T9WriteInputMethodPrivate(T9WriteInputMethod *q_ptr) :
+ QVirtualKeyboardAbstractInputMethodPrivate(),
+ q_ptr(q_ptr),
+ cjk(false),
+ engineMode(T9WriteInputMethod::EngineMode::Uninitialized),
+ traceListHardLimit(32),
+ attachedDictionary(nullptr),
+ ldbManager(new Xt9LdbManager()),
+ resultId(0),
+ lastResultId(0),
+ resultTimer(0),
+ decumaSession(nullptr),
+ activeWordIndex(-1),
+ arcAdditionStarted(false),
+ ignoreUpdate(false),
+ textCase(QVirtualKeyboardInputEngine::TextCase::Lower)
+#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ , unipenTrace()
+#endif
+ {
+#ifdef HAVE_CERENCE_HWR_RESOURCE
+ Q_INIT_RESOURCE(qmake_cerencecommondata_db);
+ Q_INIT_RESOURCE(qmake_cerencehwrdata_db);
+#endif
+ const QString pathListSep(
+#if defined(Q_OS_WIN32)
+ QStringLiteral(";")
+#else
+ QStringLiteral(":")
+#endif
+ );
+ const QString userHwrDbPath(qEnvironmentVariable("QT_VIRTUALKEYBOARD_CERENCE_HWR_DB_PATH"));
+ defaultHwrDbPaths = userHwrDbPath.split(pathListSep, Qt::SkipEmptyParts)
+ << QDir(QStringLiteral("%1/qtvirtualkeyboard/cerence/handwriting/").arg(QLibraryInfo::path(QLibraryInfo::DataPath))).absolutePath()
+ << QStringLiteral(":/qt-project.org/imports/QtQuick/VirtualKeyboard/Cerence/Handwriting/");
+ ldbManager->setPhdEnabled(true);
+ for (const QString &searchPath : defaultHwrDbPaths) {
+ ldbManager->addSearchPath(searchPath);
+ }
+ }
+
+ static void *decumaMalloc(size_t size, void *pPrivate)
+ {
+ Q_UNUSED(pPrivate);
+ return malloc(size);
+ }
+
+ static void *decumaCalloc(size_t elements, size_t size, void *pPrivate)
+ {
+ Q_UNUSED(pPrivate);
+ return calloc(elements, size);
+ }
+
+ static void decumaFree(void *ptr, void *pPrivate)
+ {
+ Q_UNUSED(pPrivate);
+ free(ptr);
+ }
+
+#if QT_VIRTUALKEYBOARD_CERENCE_HWR_LOG
+ static void decumaLogString(void *pUserData, const char *pLogString, DECUMA_UINT32 nLogStringLength)
+ {
+ static QMutex s_logMutex;
+ static QByteArray s_logString;
+ Q_UNUSED(pUserData);
+ QMutexLocker guard(&s_logMutex);
+ s_logString.append(pLogString, nLogStringLength);
+ if (s_logString.endsWith('\n')) {
+ while (s_logString.endsWith('\n'))
+ s_logString.chop(1);
+ qDebug() << (const char *)s_logString.constData();
+ s_logString.clear();
+ }
+ }
+#endif
+
+ static const char *engineModeToString(T9WriteInputMethod::EngineMode mode)
+ {
+ return QMetaEnum::fromType<T9WriteInputMethod::EngineMode>().key(static_cast<int>(mode));
+ }
+
+ bool initEngine(T9WriteInputMethod::EngineMode newEngineMode)
+ {
+ if (engineMode == newEngineMode)
+ return engineMode != T9WriteInputMethod::EngineMode::Uninitialized;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::initEngine()" << engineModeToString(newEngineMode);
+
+ if (decumaSession)
+ exitEngine();
+
+ if (newEngineMode == T9WriteInputMethod::EngineMode::Uninitialized)
+ return false;
+
+ switch (newEngineMode) {
+ case T9WriteInputMethod::EngineMode::Alphabetic:
+ case T9WriteInputMethod::EngineMode::Arabic:
+ case T9WriteInputMethod::EngineMode::Hebrew:
+ case T9WriteInputMethod::EngineMode::Thai:
+ cjk = false;
+ break;
+ case T9WriteInputMethod::EngineMode::SimplifiedChinese:
+ case T9WriteInputMethod::EngineMode::TraditionalChinese:
+ case T9WriteInputMethod::EngineMode::HongKongChinese:
+ case T9WriteInputMethod::EngineMode::Japanese:
+ case T9WriteInputMethod::EngineMode::Korean:
+ cjk = true;
+ break;
+ default:
+ Q_ASSERT(0 && "Invalid T9WriteInputMethod::EngineMode!");
+ return false;
+ }
+ engineMode = newEngineMode;
+
+ memset(&sessionSettings, 0, sizeof(sessionSettings));
+
+ QString hwrDb = findHwrDb(engineMode);
+ hwrDbFile.setFileName(hwrDb);
+ if (!hwrDbFile.open(QIODevice::ReadOnly)) {
+ qCCritical(lcT9Write) << "Could not open HWR database" << hwrDb;
+ exitEngine();
+ return false;
+ }
+
+ sessionSettings.pStaticDB = reinterpret_cast<DECUMA_STATIC_DB_PTR>(hwrDbFile.map(0, hwrDbFile.size(), QFile::NoOptions));
+ if (!sessionSettings.pStaticDB) {
+ qCCritical(lcT9Write) << "Could not read HWR database" << hwrDb;
+ exitEngine();
+ return false;
+ }
+
+ symbolCategories.append(DECUMA_CATEGORY_ANSI);
+ languageCategories.append(DECUMA_LANG_EN);
+
+ sessionSettings.recognitionMode = mcrMode;
+ sessionSettings.writingDirection = unknownWriting;
+ sessionSettings.charSet.pSymbolCategories = symbolCategories.data();
+ sessionSettings.charSet.nSymbolCategories = static_cast<DECUMA_UINT8>(symbolCategories.size());
+ sessionSettings.charSet.pLanguages = languageCategories.data();
+ sessionSettings.charSet.nLanguages = static_cast<DECUMA_UINT8>(languageCategories.size());
+
+ session = QByteArray(static_cast<int>(DECUMA_API(GetSessionSize)()), 0);
+ decumaSession = reinterpret_cast<DECUMA_SESSION *>(!session.isEmpty() ? session.data() : nullptr);
+
+ DECUMA_STATUS status = DECUMA_API(BeginSession)(decumaSession, &sessionSettings, &memFuncs);
+ Q_ASSERT(status == decumaNoError);
+ if (status != decumaNoError) {
+ qCCritical(lcT9Write) << "Could not initialize engine" << status;
+ exitEngine();
+ return false;
+ }
+
+#if QT_VIRTUALKEYBOARD_CERENCE_HWR_LOG
+ DECUMA_API(StartLogging)(decumaSession, 0, decumaLogString);
+#endif
+
+ worker.reset(new T9WriteWorker(decumaSession, cjk));
+ worker->start();
+
+ Q_Q(T9WriteInputMethod);
+ resultListChangedConnection = QObjectPrivate::connect(
+ q, &T9WriteInputMethod::resultListChanged,
+ this, &T9WriteInputMethodPrivate::processResultCheckTimer,
+ Qt::QueuedConnection);
+ availableDictionariesChangedConnection = QObjectPrivate::connect(QVirtualKeyboardDictionaryManager::instance(),
+ &QVirtualKeyboardDictionaryManager::availableDictionariesChanged,
+ this, &T9WriteInputMethodPrivate::onAvailableDynamicDictionariesChanged);
+ activeDictionariesChangedConnection = QObjectPrivate::connect(QVirtualKeyboardDictionaryManager::instance(),
+ &QVirtualKeyboardDictionaryManager::activeDictionariesChanged,
+ this, &T9WriteInputMethodPrivate::onActiveDynamicDictionariesChanged);
+
+#ifdef HAVE_XT9
+ bindSettings();
+#endif
+
+ return true;
+ }
+
+ void exitEngine()
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::exitEngine()";
+
+#ifdef HAVE_XT9
+ unbindSettings();
+#endif
+
+ QObject::disconnect(resultListChangedConnection);
+ QObject::disconnect(availableDictionariesChangedConnection);
+ QObject::disconnect(activeDictionariesChangedConnection);
+
+ worker.reset();
+
+#ifdef HAVE_XT9
+ xt9Exit();
+#endif
+
+ if (sessionSettings.pStaticDB) {
+ hwrDbFile.unmap(const_cast<uchar *>(reinterpret_cast<const uchar *>(sessionSettings.pStaticDB)));
+ hwrDbFile.close();
+ }
+
+ dlmDeactivate();
+
+ if (attachedDictionary) {
+ detachDictionary(attachedDictionary);
+ attachedDictionary.reset();
+ }
+ loadedDictionary.reset();
+
+ for (auto &dynamicDictionary : attachedDynamicDictionaries) {
+ detachDictionary(dynamicDictionary);
+ }
+ attachedDynamicDictionaries.clear();
+ dynamicDictionaries.clear();
+
+ if (decumaSession) {
+#if QT_VIRTUALKEYBOARD_CERENCE_HWR_LOG
+ DECUMA_API(StopLogging)(decumaSession);
+#endif
+ DECUMA_API(EndSession)(decumaSession);
+ decumaSession = nullptr;
+ session.clear();
+ }
+
+ memset(&sessionSettings, 0, sizeof(sessionSettings));
+
+ symbolCategories.clear();
+ languageCategories.clear();
+
+ ldbManager->closeAll();
+
+ engineMode = T9WriteInputMethod::EngineMode::Uninitialized;
+ cjk = false;
+ }
+
+#ifdef HAVE_XT9
+ void xt9Init(const QLocale &locale, QVirtualKeyboardInputEngine::InputMode inputMode, T9WriteInputMethod::EngineMode newEngineMode)
+ {
+ ET9U32 dwFirstLdbNum = Xt9LanguageMap::languageId(locale);
+ ET9U32 eInputMode = ET9AWInputMode_Default;
+
+ xt9DetachAllDynamicDictionaries();
+
+ switch (newEngineMode) {
+ case T9WriteInputMethod::EngineMode::SimplifiedChinese:
+ case T9WriteInputMethod::EngineMode::TraditionalChinese:
+ case T9WriteInputMethod::EngineMode::HongKongChinese:
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting) {
+ xt9Ime.reset(new Xt9CpIme(this));
+ switch (locale.script()) {
+ case QLocale::SimplifiedHanScript:
+ if (static_cast<Xt9CpIme *>(xt9Ime.data())) {
+ eInputMode = ET9CPMODE_PINYIN;
+ }
+ break;
+ default:
+ break;
+ }
+ } else {
+ if (xt9IsAlphabeticCoreDisabled()) {
+ xt9Exit();
+ return;
+ }
+ xt9Ime.reset(new Xt9AwIme(this));
+ dwFirstLdbNum = ET9LIDEnglish_UK;
+ }
+ break;
+
+ case T9WriteInputMethod::EngineMode::Japanese:
+ xt9Ime.reset(new Xt9JIme(this));
+ eInputMode = ET9AWInputMode_RomajiConversion;
+ break;
+
+ case T9WriteInputMethod::EngineMode::Korean:
+ xt9Ime.reset(new Xt9KIme(this));
+ break;
+
+ default:
+ if (xt9IsAlphabeticCoreDisabled()) {
+ xt9Exit();
+ return;
+ }
+ xt9Ime.reset(new Xt9AwIme(this));
+ break;
+ }
+
+ xt9Ime->ldbManager = ldbManager;
+ xt9Ime->sysInit();
+ xt9Ime->setWorkingDirectory(Settings::instance()->userDataPath());
+ if (xt9DynamicDictionaries.isEmpty())
+ xt9Ime->removeAllIndexes();
+
+ // PHD must be disabled during XT9 init to prevent finding
+ // T9 Write specific dictionary files.
+ ldbManager->setPhdEnabled(false);
+
+ xt9Ime->ldbInit(dwFirstLdbNum, ET9PLIDNone, eInputMode);
+
+ ldbManager->setPhdEnabled(true);
+
+ onDefaultDictionaryDisabledChanged();
+ onAvailableDynamicDictionariesChanged();
+ onActiveDynamicDictionariesChanged();
+ }
+
+ void xt9Exit()
+ {
+ if (xt9Ime)
+ xt9Ime->removeAllIndexes();
+
+ Q_Q(T9WriteInputMethod);
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+ const QStringList availableDictionaries = dictionaryManager->availableDictionaries();
+ for (const QString &dictionaryName : availableDictionaries) {
+ QVirtualKeyboardDictionary *dictionary = dictionaryManager->dictionary(dictionaryName);
+ dictionary->disconnect(q); // lambdas
+ }
+
+ xt9AttachedDynamicDictionaries.clear();
+ xt9DynamicDictionaries.clear();
+ xt9DynamicDictionaryNextId = 0;
+
+ xt9Ime.reset();
+ }
+
+ void bindSettings()
+ {
+ if (!defaultInputMethodDisabledChangedConnection)
+ defaultInputMethodDisabledChangedConnection = QObjectPrivate::connect(
+ Settings::instance(), &Settings::defaultInputMethodDisabledChanged,
+ this, &T9WriteInputMethodPrivate::onXt9AlphabeticCoreDisabledChanged);
+ if (!defaultDictionaryDisabledChangedConnection)
+ defaultDictionaryDisabledChangedConnection = QObjectPrivate::connect(
+ Settings::instance(), &Settings::defaultDictionaryDisabledChanged,
+ this, &T9WriteInputMethodPrivate::onDefaultDictionaryDisabledChanged);
+ if (!userDataResetConnection)
+ userDataResetConnection = QObjectPrivate::connect(
+ Settings::instance(), &Settings::userDataReset,
+ this, &T9WriteInputMethodPrivate::onUserDataReset);
+ }
+
+ void unbindSettings()
+ {
+ QObject::disconnect(defaultInputMethodDisabledChangedConnection);
+ QObject::disconnect(defaultDictionaryDisabledChangedConnection);
+ QObject::disconnect(userDataResetConnection);
+ }
+
+ void onXt9AlphabeticCoreDisabledChanged()
+ {
+ if (xt9IsAlphabeticCoreDisabled()) {
+ xt9Exit();
+ } else if (!xt9Ime) {
+ Q_Q(T9WriteInputMethod);
+ const QVirtualKeyboardInputEngine::InputMode inputMode = q->inputEngine()->inputMode();
+ const QLocale locale = QLocale(q->inputContext()->locale());
+ const DECUMA_UINT32 language = mapToDecumaLanguage(locale, inputMode);
+ const T9WriteInputMethod::EngineMode newEngineMode = mapLocaleToEngineMode(locale, language);
+ xt9Init(locale, inputMode, newEngineMode);
+ }
+ }
+
+ static bool xt9IsAlphabeticCoreDisabled()
+ {
+ Settings *settings = Settings::instance();
+ return settings->isDefaultInputMethodDisabled();
+ }
+
+ void onDefaultDictionaryDisabledChanged()
+ {
+ if (Xt9AwIme *xt9AwIme = dynamic_cast<Xt9AwIme *>(xt9Ime.data()))
+ xt9AwIme->setLdbEnabled(!Settings::instance()->isDefaultDictionaryDisabled());
+ }
+
+ void onUserDataReset()
+ {
+ dlmDeactivate();
+#ifdef HAVE_XT9
+ xt9Exit();
+#endif
+ }
+
+ ET9STATUS request(ET9_Request *const pRequest) override
+ {
+ Q_Q(T9WriteInputMethod);
+
+ switch (pRequest->eType) {
+ case ET9_REQ_BufferContext:
+ {
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ break;
+
+ const ET9U32 dwContextLen = static_cast<ET9U32>(ic->cursorPosition());
+ const ET9U32 dwStartIndex =
+ dwContextLen <= pRequest->data.sBufferContextInfo.dwMaxBufLen ?
+ 0 : dwContextLen - pRequest->data.sBufferContextInfo.dwMaxBufLen;
+
+ pRequest->data.sBufferContextInfo.dwBufLen = dwContextLen - dwStartIndex;
+ const QString surroundingText = ic->surroundingText();
+
+ memcpy(pRequest->data.sBufferContextInfo.psBuf, surroundingText.utf16() + dwStartIndex,
+ pRequest->data.sBufferContextInfo.dwBufLen * sizeof(ET9SYMB));
+
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return ET9STATUS_NONE;
+ }
+
+ bool xt9AllSymbsArePinyin(const QString &symbs) const
+ {
+ bool allSymbsArePinyin = false;
+ for (const QChar &symb : symbs) {
+ const ushort ucs = symb.unicode();
+ allSymbsArePinyin = ET9CPIsPinyinSymbol(ucs);
+ if (!allSymbsArePinyin)
+ break;
+ }
+ return allSymbsArePinyin;
+ }
+
+ bool xt9AttachDictionary(const QString &dictionaryName)
+ {
+ if (!xt9DynamicDictionaries.contains(dictionaryName))
+ return false;
+
+ const quint16 id = xt9DynamicDictionaries.value(dictionaryName);
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::xt9AttachDictionary():" << dictionaryName << id;
+ xt9Ime->mountIndex(id);
+ xt9AttachedDynamicDictionaries[dictionaryName] = id;
+
+ return true;
+ }
+
+ void xt9DetachDictionary(const QString &dictionaryName)
+ {
+ if (!xt9AttachedDynamicDictionaries.contains(dictionaryName))
+ return;
+
+ const quint16 id = xt9AttachedDynamicDictionaries[dictionaryName];
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::xt9DetachDictionary():" << dictionaryName << id;
+ xt9Ime->unmountIndex(id);
+ xt9AttachedDynamicDictionaries.remove(dictionaryName);
+ }
+#endif
+
+#ifdef HAVE_XT9
+ void xt9DetachAllDynamicDictionaries()
+ {
+ if (xt9Ime) {
+ const QStringList dictionaryNames = xt9AttachedDynamicDictionaries.keys();
+ for (const QString &dictionaryName : dictionaryNames) {
+ xt9DetachDictionary(dictionaryName);
+ }
+ }
+ xt9AttachedDynamicDictionaries.clear();
+ }
+#endif
+
+ QStringList xt9BuildSelectionList(const QString &exactWord, int *defaultListIndex)
+ {
+#ifdef HAVE_XT9
+ if (!xt9Ime)
+ return QStringList();
+
+ xt9Ime->cursorMoved();
+
+ Q_Q(T9WriteInputMethod);
+ bool forceLowerCase =
+ engineMode == T9WriteInputMethod::EngineMode::SimplifiedChinese &&
+ q->inputEngine()->inputMode() == QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
+ xt9AllSymbsArePinyin(exactWord);
+
+ ET9ClearAllSymbs(&xt9Ime->sWordSymbInfo);
+ for (const QChar &c : exactWord) {
+ ET9AddExplicitSymb(&xt9Ime->sWordSymbInfo, c.unicode(), 0, !forceLowerCase && c.isUpper() ? ET9SHIFT : ET9NOSHIFT, ET9_NO_ACTIVE_INDEX);
+ }
+
+ ET9SYMB gestureValue = 0;
+ return xt9Ime->buildSelectionList(defaultListIndex, &gestureValue);
+#else
+ return QStringList();
+#endif
+ }
+
+ void appendWordCandidates(QList<T9WriteWordCandidate> &aWordCandidates, int &activeWordIndex, const QString &exactWord, const QStringList &wordCandidatesToAppend, int defaultListIndex, T9WriteWordCandidate::Origin origin) const
+ {
+ for (int index = 0; index < wordCandidatesToAppend.size(); ++index) {
+ const T9WriteWordCandidate wordCandidate(wordCandidatesToAppend[index], index, origin);
+ if (!aWordCandidates.contains(wordCandidate)) {
+ bool isDefaultIndex = defaultListIndex > 0 &&
+ index == defaultListIndex && !cjk &&
+ origin == T9WriteWordCandidate::Origin::XT9;
+ if (isDefaultIndex) {
+ activeWordIndex = qMin(aWordCandidates.size(), 1);
+ aWordCandidates.insert(activeWordIndex, wordCandidate);
+ } else {
+ aWordCandidates.append(wordCandidate);
+ }
+ }
+ }
+
+ if (aWordCandidates.isEmpty()) {
+ aWordCandidates.append(T9WriteWordCandidate(exactWord));
+ }
+ }
+
+ QString findHwrDb(T9WriteInputMethod::EngineMode mode) const
+ {
+ for (const QString &defaultHwrDbPath : defaultHwrDbPaths) {
+ const QString result = findHwrDb(mode, defaultHwrDbPath);
+ if (!result.isEmpty())
+ return result;
+ }
+
+ qCCritical(lcT9Write) << "Could not find HWR database for" << engineModeToString(mode);
+ return QString();
+ }
+
+ QString findHwrDb(T9WriteInputMethod::EngineMode mode, const QString &dir) const
+ {
+ QString hwrDbPath(QDir::fromNativeSeparators(dir));
+ if (!hwrDbPath.endsWith(QLatin1Char('/')))
+ hwrDbPath.append(QLatin1Char('/'));
+ switch (mode) {
+ case T9WriteInputMethod::EngineMode::Alphabetic:
+ hwrDbPath.append(QLatin1String("hwrDB_le.bin"));
+ break;
+ case T9WriteInputMethod::EngineMode::Arabic:
+ hwrDbPath.append(QLatin1String("arabic/hwrDB_le.bin"));
+ break;
+ case T9WriteInputMethod::EngineMode::Hebrew:
+ hwrDbPath.append(QLatin1String("hebrew/hwrDB_le.bin"));
+ break;
+ case T9WriteInputMethod::EngineMode::Thai:
+ hwrDbPath.append(QLatin1String("thai/hwrDB_le.bin"));
+ break;
+ case T9WriteInputMethod::EngineMode::SimplifiedChinese:
+ hwrDbPath.append(QLatin1String("cjk_S_gb18030_le.hdb"));
+ break;
+ case T9WriteInputMethod::EngineMode::TraditionalChinese:
+ case T9WriteInputMethod::EngineMode::HongKongChinese:
+ hwrDbPath.append(QLatin1String("cjk_HK_std_le.hdb"));
+ break;
+ case T9WriteInputMethod::EngineMode::Japanese:
+ hwrDbPath.append(QLatin1String("cjk_J_std_le.hdb"));
+ break;
+ case T9WriteInputMethod::EngineMode::Korean:
+ hwrDbPath.append(QLatin1String("cjk_K_mkt_le.hdb"));
+ break;
+ default:
+ return QString();
+ }
+ if (!QFileInfo::exists(hwrDbPath)) {
+ return QString();
+ }
+ return hwrDbPath;
+ }
+
+ QString findDictionary(const QLocale &locale, DECUMA_SRC_DICTIONARY_TYPE &srcType)
+ {
+ srcType = numberOfSrcDictionaryTypes;
+
+ QString dictionary = ldbManager->findDictionary(locale);
+ if (!dictionary.isEmpty()) {
+ if (dictionary.endsWith(QLatin1String(".ldb"))) {
+ srcType = decumaPortableHWRDictionary;
+ } else if (dictionary.endsWith(QLatin1String(".phd"))) {
+ srcType = decumaPortableHWRDictionary;
+ } else {
+ qCCritical(lcT9Write) << "Incompatible dictionary" << dictionary;
+ dictionary.clear();
+ }
+ }
+
+ return dictionary;
+ }
+
+ bool attachDictionary(const QSharedPointer<T9WriteAbstractDictionary> &dictionary)
+ {
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+ Q_ASSERT(decumaSession != nullptr);
+ Q_ASSERT(dictionary != nullptr);
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::attachDictionary():" << dictionary->name();
+ DECUMA_STATUS status = DECUMA_API(AttachDictionary)(decumaSession, dictionary->data(), static_cast<DECUMA_UINT32>(dictionary->size()));
+ return status == decumaNoError;
+ }
+
+ void detachDictionary(const QSharedPointer<T9WriteAbstractDictionary> &dictionary)
+ {
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+ if (!dictionary)
+ return;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::detachDictionary():" << dictionary->name();
+
+ Q_ASSERT(decumaSession != nullptr);
+ DECUMA_STATUS status = DECUMA_API(DetachDictionary)(decumaSession, dictionary->data());
+ Q_UNUSED(status);
+ Q_ASSERT(status == decumaNoError);
+ }
+
+ bool setInputMode(const QLocale &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+ {
+ Q_Q(T9WriteInputMethod);
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::setInputMode():" << locale << inputMode;
+
+ finishRecognition();
+
+ // All tasks must be completed before changing the session settings
+ if (worker) {
+ worker->waitForAllTasks();
+ dictionaryTask.reset();
+ }
+
+ DECUMA_UINT32 language = mapToDecumaLanguage(locale, inputMode);
+ if (language == DECUMA_LANG_GSMDEFAULT) {
+ qCCritical(lcT9Write) << "Language is not supported" << locale.name();
+ return false;
+ }
+
+ T9WriteInputMethod::EngineMode newEngineMode = mapLocaleToEngineMode(locale, language);
+
+#ifdef HAVE_XT9
+ xt9Init(locale, inputMode, newEngineMode);
+#endif
+
+ if (!initEngine(newEngineMode)) {
+#ifdef HAVE_XT9
+ xt9Exit();
+#endif
+ return false;
+ }
+
+ onAvailableDynamicDictionariesChanged();
+ onActiveDynamicDictionariesChanged();
+
+ const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ if (!inputMethodHints.testFlag(Qt::ImhHiddenText) && !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) &&
+ !inputMethodHints.testFlag(Qt::ImhSensitiveData)) {
+ dlmActivate();
+ }
+
+ int isLanguageSupported = 0;
+ DECUMA_API(DatabaseIsLanguageSupported)(sessionSettings.pStaticDB, language, &isLanguageSupported);
+ if (!isLanguageSupported) {
+ qCCritical(lcT9Write) << "Language is not supported" << locale.name();
+ return false;
+ }
+
+ bool languageChanged = languageCategories.isEmpty() || languageCategories.first() != language;
+ languageCategories.clear();
+ languageCategories.append(language);
+
+ // Add English as secondary language for non-latin languages.
+ // T9 Write requires it for punctuation and latin symbols if
+ // included in the symbol categories.
+ if (locale.script() != QLocale::LatinScript)
+ languageCategories.append(DECUMA_LANG_EN);
+
+ if (!updateSymbolCategories(language, locale, inputMode))
+ return false;
+ updateRecognitionMode(language, locale, inputMode);
+ static const QList<DECUMA_UINT32> rtlLanguages = QList<DECUMA_UINT32>()
+ << DECUMA_LANG_AR << DECUMA_LANG_IW << DECUMA_LANG_FA << DECUMA_LANG_UR;
+ sessionSettings.writingDirection = rtlLanguages.contains(language) ? rightToLeft : leftToRight;
+
+ // Enable multi-threaded recognition if available.
+#ifdef DECUMA_USE_MULTI_THREAD
+ // Note: This feature requires T9 Write v8.0.0 or later,
+ // and feature enabled in the SDK.
+#if CERENCEHANDWRITINGAPIMAJORVERNUM > 28
+ sessionSettings.bUseThreads = 1;
+#else
+ sessionSettings.nMaxThreads = qMax(QThread::idealThreadCount(), 0);
+#endif
+#endif
+
+ qCDebug(lcT9Write) << " -> language categories:" << languageCategories;
+ qCDebug(lcT9Write) << " -> symbol categories:" << symbolCategories;
+ qCDebug(lcT9Write) << " -> recognition mode:" << sessionSettings.recognitionMode;
+
+ // Change session settings
+ sessionSettings.charSet.pSymbolCategories = symbolCategories.data();
+ sessionSettings.charSet.nSymbolCategories = static_cast<DECUMA_UINT8>(symbolCategories.size());
+ sessionSettings.charSet.pLanguages = languageCategories.data();
+ sessionSettings.charSet.nLanguages = static_cast<DECUMA_UINT8>(languageCategories.size());
+ DECUMA_STATUS status = DECUMA_API(ChangeSessionSettings)(decumaSession, &sessionSettings);
+
+ if (status == decumaUnsupportedLanguageInUcrMode || status == decumaUnsupportedSymbolCategoryInUcrMode) {
+ sessionSettings.recognitionMode = mcrMode;
+ status = DECUMA_API(ChangeSessionSettings)(decumaSession, &sessionSettings);
+ }
+
+ if (status != decumaNoError)
+ qCWarning(lcT9Write) << "Failed to configure HWR engine" << status;
+
+ caseFormatter.preferLowercase = q->inputContext()->inputMethodHints().testFlag(Qt::ImhPreferLowercase);
+
+ updateDictionary(language, locale, languageChanged);
+
+ return status == decumaNoError;
+ }
+
+ T9WriteInputMethod::EngineMode mapLocaleToEngineMode(const QLocale &locale, DECUMA_UINT32 language = 0)
+ {
+#ifdef HAVE_CERENCE_HWR_CJK
+ switch (locale.language()) {
+ case QLocale::Chinese: {
+ if (locale.script() == QLocale::TraditionalChineseScript)
+ return locale.territory() == QLocale::HongKong ? T9WriteInputMethod::EngineMode::HongKongChinese : T9WriteInputMethod::EngineMode::TraditionalChinese;
+ return T9WriteInputMethod::EngineMode::SimplifiedChinese;
+ }
+ case QLocale::Japanese:
+ return T9WriteInputMethod::EngineMode::Japanese;
+ case QLocale::Korean:
+ return T9WriteInputMethod::EngineMode::Korean;
+ default:
+ break;
+ }
+#else
+ Q_UNUSED(locale);
+ Q_UNUSED(language);
+#endif
+
+#ifdef HAVE_CERENCE_HWR_ALPHABETIC
+ switch (locale.script()) {
+ case QLocale::ArabicScript:
+ return T9WriteInputMethod::EngineMode::Arabic;
+ case QLocale::HebrewScript:
+ return T9WriteInputMethod::EngineMode::Hebrew;
+ case QLocale::ThaiScript:
+ return language == DECUMA_LANG_EN ? T9WriteInputMethod::EngineMode::Alphabetic
+ : T9WriteInputMethod::EngineMode::Thai;
+ default:
+ return T9WriteInputMethod::EngineMode::Alphabetic;
+ }
+#else
+ return T9WriteInputMethod::EngineMode::Uninitialized;
+#endif
+ }
+
+ DECUMA_UINT32 mapToDecumaLanguage(const QLocale &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+ {
+ struct LanguageMap {
+ QLocale::Language localeLanguage;
+ DECUMA_UINT16 decumaLanguage;
+ };
+ static const LanguageMap languageMap[] = {
+ { QLocale::Language::Afrikaans, DECUMA_LANG_AF },
+ { QLocale::Language::Albanian, DECUMA_LANG_SQ },
+ { QLocale::Language::Arabic, DECUMA_LANG_AR },
+ { QLocale::Language::Azerbaijani, DECUMA_LANG_AZ },
+ { QLocale::Language::Basque, DECUMA_LANG_EU },
+ { QLocale::Language::Belarusian, DECUMA_LANG_BE },
+ { QLocale::Language::Bengali, DECUMA_LANG_BN },
+ { QLocale::Language::Bulgarian, DECUMA_LANG_BG },
+ { QLocale::Language::Catalan, DECUMA_LANG_CA },
+ { QLocale::Language::Chinese, DECUMA_LANG_PRC },
+ { QLocale::Language::Croatian, DECUMA_LANG_HR },
+ { QLocale::Language::Czech, DECUMA_LANG_CS },
+ { QLocale::Language::Danish, DECUMA_LANG_DA },
+ { QLocale::Language::Dutch, DECUMA_LANG_NL },
+ { QLocale::Language::English, DECUMA_LANG_EN },
+ { QLocale::Language::Estonian, DECUMA_LANG_ET },
+ { QLocale::Language::Finnish, DECUMA_LANG_FI },
+ { QLocale::Language::French, DECUMA_LANG_FR },
+ { QLocale::Language::Galician, DECUMA_LANG_GL },
+ { QLocale::Language::German, DECUMA_LANG_DE },
+ { QLocale::Language::Greek, DECUMA_LANG_EL },
+ { QLocale::Language::Gujarati, DECUMA_LANG_GU },
+ { QLocale::Language::Hausa, DECUMA_LANG_HA },
+ { QLocale::Language::Hebrew, DECUMA_LANG_IW },
+ { QLocale::Language::Hindi, DECUMA_LANG_HI },
+ { QLocale::Language::Hungarian, DECUMA_LANG_HU },
+ { QLocale::Language::Icelandic, DECUMA_LANG_IS },
+ { QLocale::Language::Indonesian, DECUMA_LANG_IN },
+ { QLocale::Language::Italian, DECUMA_LANG_IT },
+ { QLocale::Language::Japanese, DECUMA_LANG_JP },
+ { QLocale::Language::Kannada, DECUMA_LANG_KN },
+ { QLocale::Language::Kazakh, DECUMA_LANG_KK },
+ { QLocale::Language::Khmer, DECUMA_LANG_KM },
+ { QLocale::Language::Kirghiz, DECUMA_LANG_KY },
+ { QLocale::Language::Korean, DECUMA_LANG_KO },
+ { QLocale::Language::Latvian, DECUMA_LANG_LV },
+ { QLocale::Language::Lithuanian, DECUMA_LANG_LT },
+ { QLocale::Language::Macedonian, DECUMA_LANG_MK },
+ { QLocale::Language::Malay, DECUMA_LANG_MS },
+ { QLocale::Language::Malayalam, DECUMA_LANG_ML },
+ { QLocale::Language::Marathi, DECUMA_LANG_MR },
+ { QLocale::Language::Mongolian, DECUMA_LANG_MN },
+ { QLocale::Language::NorwegianBokmal, DECUMA_LANG_NO },
+ { QLocale::Language::Persian, DECUMA_LANG_FA },
+ { QLocale::Language::Polish, DECUMA_LANG_PL },
+ { QLocale::Language::Portuguese, DECUMA_LANG_PT },
+ { QLocale::Language::Punjabi, DECUMA_LANG_PA },
+ { QLocale::Language::Romanian, DECUMA_LANG_RO },
+ { QLocale::Language::Russian, DECUMA_LANG_RU },
+ { QLocale::Language::Serbian, DECUMA_LANG_SRCY },
+ { QLocale::Language::Sinhala, DECUMA_LANG_SI },
+ { QLocale::Language::Slovak, DECUMA_LANG_SK },
+ { QLocale::Language::Slovenian, DECUMA_LANG_SL },
+ { QLocale::Language::SouthernSotho, DECUMA_LANG_ST },
+ { QLocale::Language::Spanish, DECUMA_LANG_ES },
+ { QLocale::Language::Swahili, DECUMA_LANG_SW },
+ { QLocale::Language::Swedish, DECUMA_LANG_SV },
+ { QLocale::Language::Tajik, DECUMA_LANG_TG },
+ { QLocale::Language::Tamil, DECUMA_LANG_TA },
+ { QLocale::Language::Telugu, DECUMA_LANG_TE },
+ { QLocale::Language::Thai, DECUMA_LANG_TH },
+ { QLocale::Language::Turkish, DECUMA_LANG_TR },
+ { QLocale::Language::Ukrainian, DECUMA_LANG_UK },
+ { QLocale::Language::Urdu, DECUMA_LANG_UR },
+ { QLocale::Language::Uzbek, DECUMA_LANG_UZ },
+ { QLocale::Language::Vietnamese, DECUMA_LANG_VI },
+ // Last entry
+ { QLocale::Language::AnyLanguage, DECUMA_LANG_GSMDEFAULT }
+ };
+
+ const int localeLanguage = locale.language();
+ const LanguageMap *languageMapIterator = languageMap;
+ for (; languageMapIterator->localeLanguage != QLocale::Language::AnyLanguage &&
+ languageMapIterator->localeLanguage != localeLanguage; languageMapIterator++) {}
+
+ DECUMA_UINT32 language = languageMapIterator->decumaLanguage;
+ if (language == DECUMA_LANG_PRC) {
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting)
+ language = DECUMA_LANG_EN;
+ else if (locale.script() == QLocale::TraditionalChineseScript)
+ language = DECUMA_LANG_HK; // Common language for the traditional script
+ } else if (language == DECUMA_LANG_JP) {
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting)
+ language = DECUMA_LANG_EN;
+ } else if (language == DECUMA_LANG_KO) {
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting)
+ language = DECUMA_LANG_EN;
+ } else if (language == DECUMA_LANG_SRCY) {
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::Cyrillic)
+ language = DECUMA_LANG_SRLA;
+ } else if (language == DECUMA_LANG_AR || language == DECUMA_LANG_FA) {
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::Arabic && inputMode != QVirtualKeyboardInputEngine::InputMode::Numeric)
+ language = DECUMA_LANG_EN;
+ } else if (language == DECUMA_LANG_IW) {
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::Hebrew)
+ language = DECUMA_LANG_EN;
+ } else if (language == DECUMA_LANG_TH) {
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::Thai)
+ language = DECUMA_LANG_EN;
+ }
+
+ return language;
+ }
+
+ void updateRecognitionMode(DECUMA_UINT32 language, const QLocale &locale,
+ QVirtualKeyboardInputEngine::InputMode inputMode)
+ {
+ Q_Q(T9WriteInputMethod);
+ Q_UNUSED(language);
+ Q_UNUSED(locale);
+
+ // Select recognition mode
+ // Note: MCR mode is preferred, as it does not require recognition
+ // timer and provides better user experience.
+ sessionSettings.recognitionMode = mcrMode;
+
+ // T9 Write Alphabetic v8.0.0 supports UCR mode for specific languages
+ if (!cjk) {
+ switch (inputMode) {
+ case QVirtualKeyboardInputEngine::InputMode::Latin:
+ sessionSettings.recognitionMode = ucrMode;
+ break;
+ case QVirtualKeyboardInputEngine::InputMode::Arabic:
+ sessionSettings.recognitionMode = ucrMode;
+ break;
+ case QVirtualKeyboardInputEngine::InputMode::Cyrillic:
+ sessionSettings.recognitionMode = ucrMode;
+ break;
+ case QVirtualKeyboardInputEngine::InputMode::Hebrew:
+ case QVirtualKeyboardInputEngine::InputMode::Thai:
+ sessionSettings.recognitionMode = ucrMode;
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Use scrMode with hidden text or with no predictive mode
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
+ const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhHiddenText) || inputMethodHints.testFlag(Qt::ImhNoPredictiveText))
+ sessionSettings.recognitionMode = scrMode;
+ }
+ }
+
+ bool updateSymbolCategories(DECUMA_UINT32 language, const QLocale &locale,
+ QVirtualKeyboardInputEngine::InputMode inputMode)
+ {
+ // Handle CJK in separate method
+ if (cjk)
+ return updateSymbolCategoriesCjk(language, locale, inputMode);
+
+ symbolCategories.clear();
+
+ // Choose the symbol categories by input mode, script and input method hints
+ bool leftToRightGestures = true;
+ Q_Q(T9WriteInputMethod);
+ const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ switch (inputMode) {
+ case QVirtualKeyboardInputEngine::InputMode::Latin:
+ if (inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly)) {
+ symbolCategories.append(DECUMA_CATEGORY_EMAIL);
+ } else if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly)) {
+ symbolCategories.append(DECUMA_CATEGORY_URL);
+ } else {
+ if (language == DECUMA_LANG_EN || language == DECUMA_LANG_NL ||
+ language == DECUMA_LANG_MS || language == DECUMA_LANG_IN)
+ symbolCategories.append(DECUMA_CATEGORY_ANSI);
+ else
+ symbolCategories.append(DECUMA_CATEGORY_ISO8859_1);
+ symbolCategories.append(DECUMA_CATEGORY_DIGIT);
+ symbolCategories.append(DECUMA_CATEGORY_BASIC_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
+ if (language == DECUMA_LANG_ES)
+ symbolCategories.append(DECUMA_CATEGORY_SPANISH_PUNCTUATIONS);
+ else if (language == DECUMA_LANG_VI)
+ symbolCategories.append(DECUMA_CATEGORY_VIETNAMESE_SUPPLEMENTS);
+ }
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Numeric:
+ if (language == DECUMA_LANG_AR || language == DECUMA_LANG_FA) {
+ symbolCategories.append(DECUMA_CATEGORY_ARABIC_NUM_MODE);
+ symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES);
+ leftToRightGestures = false;
+ break;
+ }
+ symbolCategories.append(DECUMA_CATEGORY_DIGIT);
+ if (!inputMethodHints.testFlag(Qt::ImhDigitsOnly))
+ symbolCategories.append(DECUMA_CATEGORY_NUM_SUP);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Dialable:
+ symbolCategories.append(DECUMA_CATEGORY_PHONE_NUMBER);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Greek:
+ symbolCategories.append(DECUMA_CATEGORY_GREEK);
+ symbolCategories.append(DECUMA_CATEGORY_QUEST_EXCL_MARK_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_PERIOD_COMMA_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_COLON_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
+ symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Cyrillic:
+ symbolCategories.append(DECUMA_CATEGORY_CYRILLIC);
+ symbolCategories.append(DECUMA_CATEGORY_QUEST_EXCL_MARK_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_PERIOD_COMMA_PUNCTUATIONS);
+ // Ukrainian needs contraction mark, but not Russian or Bulgarian
+ if (language == DECUMA_LANG_UK)
+ symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Arabic:
+ symbolCategories.append(DECUMA_CATEGORY_ARABIC_ISOLATED_LETTER_MODE);
+ symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES);
+ leftToRightGestures = false;
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Hebrew:
+ symbolCategories.append(DECUMA_CATEGORY_HEBREW_GL_HEBREW_CURSIVE_MODE);
+ symbolCategories.append(DECUMA_CATEGORY_HEBREW_GL_HEBREW_LETTERSYMBOLS);
+ symbolCategories.append(DECUMA_CATEGORY_HEBREW_SHEQEL);
+ symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES);
+ leftToRightGestures = false;
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Thai:
+ symbolCategories.append(DECUMA_CATEGORY_THAI_BASE);
+ symbolCategories.append(DECUMA_CATEGORY_THAI_NON_BASE);
+ break;
+
+ default:
+ qCCritical(lcT9Write) << "Invalid input mode" << inputMode;
+ return false;
+ }
+
+ if (leftToRightGestures) {
+ symbolCategories.append(DECUMA_CATEGORY_BACKSPACE_STROKE);
+ symbolCategories.append(DECUMA_CATEGORY_RETURN_STROKE);
+ symbolCategories.append(DECUMA_CATEGORY_WHITESPACE_STROKE);
+ }
+
+ return true;
+ }
+
+ bool updateSymbolCategoriesCjk(DECUMA_UINT32 language, const QLocale &locale,
+ QVirtualKeyboardInputEngine::InputMode inputMode)
+ {
+ Q_ASSERT(cjk);
+
+ symbolCategories.clear();
+
+ switch (inputMode) {
+ case QVirtualKeyboardInputEngine::InputMode::Latin:
+ symbolCategories.append(DECUMA_CATEGORY_ANSI);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
+ symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Numeric:
+ symbolCategories.append(DECUMA_CATEGORY_DIGIT);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
+ symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Dialable:
+ symbolCategories.append(DECUMA_CATEGORY_DIGIT);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting:
+ switch (locale.script()) {
+ case QLocale::SimplifiedChineseScript:
+ symbolCategories.append(DECUMA_CATEGORY_GB2312_A);
+ symbolCategories.append(DECUMA_CATEGORY_GB2312_B_CHARS_ONLY);
+ symbolCategories.append(DECUMA_CATEGORY_GBK_3);
+ symbolCategories.append(DECUMA_CATEGORY_GBK_4);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
+#ifdef HAVE_XT9
+ if (xt9Ime) {
+ symbolCategories.append(DECUMA_CATEGORY_ANSI);
+ }
+#endif
+ break;
+
+ case QLocale::TraditionalChineseScript:
+ symbolCategories.append(DECUMA_CATEGORY_BIGFIVE);
+ if (language == DECUMA_LANG_HK)
+ symbolCategories.append(DECUMA_CATEGORY_HKSCS_CHARS_ONLY);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
+ break;
+
+ default:
+ qCCritical(lcT9Write) << "Invalid locale" << locale << "for" << engineModeToString(engineMode);
+ return false;
+ }
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting:
+ symbolCategories.append(DECUMA_CATEGORY_JIS_LEVEL_1);
+ symbolCategories.append(DECUMA_CATEGORY_JIS_LEVEL_2);
+ symbolCategories.append(DECUMA_CATEGORY_HIRAGANA);
+ symbolCategories.append(DECUMA_CATEGORY_KATAKANA);
+ symbolCategories.append(DECUMA_CATEGORY_HIRAGANASMALL);
+ symbolCategories.append(DECUMA_CATEGORY_KATAKANASMALL);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
+#ifdef HAVE_XT9
+ if (xt9Ime) {
+ symbolCategories.append(DECUMA_CATEGORY_ANSI);
+ }
+#endif
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting:
+ symbolCategories.append(DECUMA_CATEGORY_HANGUL_1001_A);
+ symbolCategories.append(DECUMA_CATEGORY_HANGUL_1001_B);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
+ symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
+ symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
+ break;
+
+ default:
+ return false;
+ }
+
+ return true;
+ }
+
+ void updateDictionary(DECUMA_UINT32 language, const QLocale &locale, bool languageChanged)
+ {
+ Q_Q(T9WriteInputMethod);
+
+ /* The dictionary is loaded in the background thread. Once the loading is
+ complete the dictionary will be attached to the current session. The
+ attachment happens in the worker thread context, thus the direct
+ connection for the signal handler and the mutex protecting the
+ converted dictionary for concurrent access.
+ The loading operation is blocking for the main thread only if the
+ user starts handwriting input before the operation is complete.
+ */
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+
+ // Detach previous dictionary if the language is being changed
+ // or the recognizer mode is single-character mode
+ const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ if ((languageChanged || inputMethodHints.testFlag(Qt::ImhNoPredictiveText) || sessionSettings.recognitionMode == scrMode) && attachedDictionary) {
+ detachDictionary(attachedDictionary);
+ attachedDictionary.reset();
+ }
+
+ // Check if a dictionary needs to be loaded
+ if (languageChanged || !loadedDictionary) {
+ loadedDictionary.reset();
+
+ DECUMA_SRC_DICTIONARY_INFO dictionaryInfo;
+ memset(&dictionaryInfo, 0, sizeof(dictionaryInfo));
+
+ QList<QLocale> decumaLocales;
+ decumaLocales.append(locale);
+
+ // CJK: No dictionary for latin input
+ if (cjk && language == DECUMA_LANG_EN)
+ decumaLocales.clear();
+
+ dictionaryFileName.clear();
+ QLocale decumaLocale;
+ for (const QLocale &tryLocale : decumaLocales) {
+ dictionaryFileName = findDictionary(tryLocale, dictionaryInfo.srcType);
+ if (!dictionaryFileName.isEmpty()) {
+ decumaLocale = tryLocale;
+ break;
+ }
+ }
+ if (!dictionaryFileName.isEmpty()) {
+ if (dictionaryTask.isNull() || dictionaryTask->dictionaryFileName != dictionaryFileName) {
+ qCDebug(lcT9Write) << " -> load dictionary:" << dictionaryFileName;
+
+ bool convertDictionary = true;
+#if defined(HAVE_CERENCE_HWR_CJK)
+ // Chinese dictionary cannot be converted (PHD)
+ if (dictionaryInfo.srcType == decumaPortableHWRDictionary && decumaLocale.language() == QLocale::Chinese)
+ convertDictionary = false;
+#endif
+
+ QSharedPointer<T9WriteAbstractSource> sourceDictionary(new T9WriteFileSource(dictionaryInfo, dictionaryFileName));
+
+ QSharedPointer<T9WriteDictionary> newDictionary(new T9WriteDictionary(sourceDictionary, decumaSession, memFuncs, cjk));
+ dictionaryTask.reset(new T9WriteDictionaryTask(newDictionary, convertDictionary));
+
+ QObjectPrivate::connect(dictionaryTask.data(), &T9WriteDictionaryTask::completed,
+ this, &T9WriteInputMethodPrivate::dictionaryLoadCompleted, Qt::DirectConnection);
+ worker->addTask(dictionaryTask);
+ }
+ }
+ }
+
+ // Attach existing dictionary, if available
+ if (sessionSettings.recognitionMode != scrMode && !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) &&
+ loadedDictionary && !attachedDictionary) {
+ if (attachDictionary(loadedDictionary))
+ attachedDictionary = loadedDictionary;
+ }
+ }
+
+ QByteArray getContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo,
+ const QVariantMap &traceScreenInfo) const
+ {
+ QCryptographicHash hash(QCryptographicHash::Md5);
+
+ hash.addData(QByteArrayView(reinterpret_cast<const char *>(&patternRecognitionMode), sizeof(patternRecognitionMode)));
+
+ QByteArray mapData;
+ QDataStream ds(&mapData, QIODevice::WriteOnly);
+ ds << traceCaptureDeviceInfo;
+ ds << traceScreenInfo;
+ hash.addData(mapData);
+
+ return hash.result();
+ }
+
+ void setContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo,
+ const QVariantMap &traceScreenInfo,
+ const QByteArray &context)
+ {
+ Q_UNUSED(patternRecognitionMode);
+ Q_UNUSED(traceScreenInfo);
+ if (context == currentContext)
+ return;
+ currentContext = context;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::setContext():" << QLatin1String((context.toHex()));
+
+ // Finish recognition, but preserve current input
+ Q_Q(T9WriteInputMethod);
+ QString preeditText = q->inputContext()->preeditText();
+ bool preserveCurrentInput = !preeditText.isEmpty();
+ T9WriteCaseFormatter oldCaseFormatter(caseFormatter);
+ finishRecognition(!preserveCurrentInput);
+
+ if (preserveCurrentInput) {
+ caseFormatter = oldCaseFormatter;
+ stringStart = preeditText;
+ wordCandidates.append(T9WriteWordCandidate(preeditText));
+ activeWordIndex = 0;
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ }
+
+ const int dpi = traceCaptureDeviceInfo.value(QLatin1String("dpi"), 96).toInt();
+ static const int INSTANT_GESTURE_WIDTH_THRESHOLD_MM = 25;
+ gestureWidthThreshold = static_cast<DECUMA_UINT32>(INSTANT_GESTURE_WIDTH_THRESHOLD_MM / 25.4 * dpi);
+
+ gestureRecognizer.setDpi(dpi);
+
+ sessionSettings.baseline = 0;
+ sessionSettings.helpline = 0;
+ sessionSettings.topline = 0;
+ sessionSettings.supportLineSet = baselineAndHelpline;
+ sessionSettings.UIInputGuide = none;
+
+ DECUMA_STATUS status = DECUMA_API(ChangeSessionSettings)(decumaSession, &sessionSettings);
+ Q_ASSERT(status == decumaNoError);
+ }
+
+ QVirtualKeyboardTrace *traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+ {
+ if (!worker)
+ return nullptr;
+
+ // The result id follows the trace id so that the (previous)
+ // results completed during the handwriting can be rejected.
+ resultId = traceId;
+
+ stopResultTimer();
+
+ // Dictionary must be completed before the arc addition can begin
+ worker->waitForAllTasksOfType<T9WriteDictionaryTask>();
+ dictionaryTask.reset();
+
+ // Cancel the current recognition task
+ worker->removeAllTasks<T9WriteRecognitionResultsTask>();
+ worker->removeAllTasks<T9WriteRecognitionTask>();
+ if (recognitionTask) {
+ recognitionTask->cancelRecognition();
+ recognitionTask.reset();
+ }
+
+ // Check for hard limit on the size the trace list
+ if (traceList.size() >= traceListHardLimit) {
+ worker->waitForAllTasksOfType<T9WriteAddArcTask>();
+ while (traceListHardLimit < traceList.size())
+ delete traceList.takeFirst();
+ }
+
+#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ if (!unipenTrace)
+ unipenTrace.reset(new UnipenTrace(traceCaptureDeviceInfo, traceScreenInfo));
+#endif
+
+ QByteArray context = getContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
+ if (context != currentContext) {
+ worker->waitForAllTasks();
+ setContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo, context);
+ }
+
+ DECUMA_STATUS status;
+
+ if (!arcAdditionStarted) {
+ worker->waitForAllTasks();
+
+ DECUMA_RECOGNITION_SETTINGS recSettings;
+ memset(&recSettings, 0, sizeof(recSettings));
+
+ // Boost dictionary words by default
+ recSettings.boostLevel = attachedDictionary || attachedDynamicDictionaries.size() > 0 ? boostDictWords : noBoost;
+
+ // Disable dictionary boost in UCR mode for URL and E-mail input
+ // Otherwise it will completely mess input
+ Q_Q(T9WriteInputMethod);
+ const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ if (sessionSettings.recognitionMode == ucrMode && (inputMethodHints & (Qt::ImhUrlCharactersOnly | Qt::ImhEmailCharactersOnly)))
+ recSettings.boostLevel = noBoost;
+
+ recSettings.stringCompleteness = canBeContinued;
+ if (!stringStart.isEmpty())
+ recSettings.pStringStart = const_cast<DECUMA_UNICODE *>(stringStart.utf16());
+
+ status = DECUMA_API(BeginArcAddition)(decumaSession, &recSettings);
+ Q_ASSERT(status == decumaNoError);
+ arcAdditionStarted = true;
+ }
+
+ Q_Q(T9WriteInputMethod);
+ QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace(q);
+#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ trace->setChannels(QStringList(QLatin1String("t")));
+#endif
+ traceList.append(trace);
+
+ return trace;
+ }
+
+ void traceEnd(QVirtualKeyboardTrace *trace)
+ {
+ if (trace->isCanceled()) {
+ traceList.removeOne(trace);
+ delete trace;
+ } else {
+ if (cjk && countActiveTraces() == 0) {
+ // For some reason gestures don't seem to work in CJK mode
+ // Using our own gesture recognizer as fallback
+ if (handleGesture())
+ return;
+ }
+ worker->addTask(QSharedPointer<T9WriteAddArcTask>(new T9WriteAddArcTask(trace)));
+ }
+ if (!traceList.isEmpty()) {
+ Q_ASSERT(arcAdditionStarted);
+ if (countActiveTraces() == 0)
+ restartRecognition();
+ }
+ }
+
+ int countActiveTraces() const
+ {
+ int count = 0;
+ for (QVirtualKeyboardTrace *trace : std::as_const(traceList)) {
+ if (!trace->isFinal())
+ count++;
+ }
+ return count;
+ }
+
+ void clearTraces()
+ {
+ worker->waitForAllTasks();
+ qDeleteAll(traceList);
+ traceList.clear();
+ }
+
+ void noteSelected(int index)
+ {
+ if (index < 0 || index >= wordCandidates.size())
+ return;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::noteSelected():" << index;
+ const T9WriteWordCandidate &wordCandidate = wordCandidates[index];
+ switch (wordCandidate.origin) {
+ case T9WriteWordCandidate::Origin::T9Write:
+ DECUMA_API(NoteSelectedCandidate)(decumaSession, wordCandidate.resultIndex);
+ break;
+#ifdef HAVE_XT9
+ case T9WriteWordCandidate::Origin::XT9:
+ {
+ Xt9AwIme *xt9AwIme = static_cast<Xt9AwIme *>(xt9Ime.data());
+ if (xt9AwIme) {
+ xt9AwIme->noteWordDone(wordCandidate.symbs);
+ xt9AwIme->selectWord(wordCandidate.resultIndex, true);
+ }
+ break;
+ }
+#endif
+ default:
+ break;
+ }
+ }
+
+ void restartRecognition()
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::restartRecognition()";
+
+ worker->removeAllTasks<T9WriteRecognitionResultsTask>();
+ if (recognitionTask) {
+ recognitionTask->cancelRecognition();
+ recognitionTask.reset();
+ }
+
+ QSharedPointer<T9WriteRecognitionResult> recognitionResult(new T9WriteRecognitionResult(resultId, 9, 64));
+ recognitionTask.reset(new T9WriteRecognitionTask(recognitionResult));
+ worker->addTask(recognitionTask);
+
+ QSharedPointer<T9WriteRecognitionResultsTask> resultsTask(new T9WriteRecognitionResultsTask(recognitionResult));
+ QObjectPrivate::connect(resultsTask.data(), &T9WriteRecognitionResultsTask::resultsAvailable, this, &T9WriteInputMethodPrivate::setResultList, Qt::DirectConnection);
+ worker->addTask(resultsTask);
+
+ resetResultTimer(cjk ? Settings::instance()->hwrTimeoutForCjk() : Settings::instance()->hwrTimeoutForAlphabetic());
+ }
+
+ void waitForRecognitionResults()
+ {
+ if (!worker)
+ return;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::waitForRecognitionResults()";
+ worker->waitForAllTasks();
+ processResultCheckTimer();
+ }
+
+ bool finishRecognition(bool emitSelectionListChanged = true)
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::finishRecognition()";
+ if (!worker)
+ return false;
+
+ bool result = !traceList.isEmpty();
+
+ Q_ASSERT(decumaSession != nullptr);
+
+ stopResultTimer();
+
+ worker->removeAllTasks<T9WriteAddArcTask>();
+ worker->removeAllTasks<T9WriteRecognitionResultsTask>();
+ if (recognitionTask) {
+ recognitionTask->cancelRecognition();
+ recognitionTask.reset();
+ result = true;
+ }
+ worker->waitForAllTasks();
+
+ clearTraces();
+
+ if (arcAdditionStarted) {
+ DECUMA_API(EndArcAddition)(decumaSession);
+ arcAdditionStarted = false;
+ }
+
+ if (!wordCandidates.isEmpty()) {
+ wordCandidates.clear();
+ activeWordIndex = -1;
+ if (emitSelectionListChanged) {
+ Q_Q(T9WriteInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ }
+ result = true;
+ }
+
+ stringStart.clear();
+ scrResult.clear();
+ caseFormatter.clear();
+
+#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ unipenTrace.reset();
+#endif
+
+ return result;
+ }
+
+ bool select(int index = -1)
+ {
+ if (!worker)
+ return false;
+
+ if (sessionSettings.recognitionMode != scrMode && wordCandidates.isEmpty()) {
+ finishRecognition();
+ return false;
+ }
+ if (sessionSettings.recognitionMode == scrMode && scrResult.isEmpty()) {
+ finishRecognition();
+ return false;
+ }
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::select():" << index;
+
+ Q_Q(T9WriteInputMethod);
+ if (sessionSettings.recognitionMode != scrMode) {
+ index = index >= 0 ? index : activeWordIndex;
+ noteSelected(index);
+ QString finalWord = wordCandidates.at(index).symbs;
+ dlmAddWord(finalWord);
+
+#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ // Record trace
+ if (unipenTrace) {
+ if (finalWord.length() == 1) {
+ // In recording mode, the text case must match with the current text case
+ QChar ch(finalWord.at(0));
+ if (!ch.isLetter() || (ch.isUpper() == (textCase == QVirtualKeyboardInputEngine::TextCase::Upper))) {
+ QStringList homeLocations = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
+ if (!homeLocations.isEmpty()) {
+ unipenTrace->setDirectory(QStringLiteral("%1/%2").arg(homeLocations.at(0)).arg(QLatin1String("VIRTUAL_KEYBOARD_TRACES")));
+ unipenTrace->record(traceList);
+ unipenTrace->save(ch.unicode(), 100);
+ }
+ }
+ }
+ }
+#endif
+
+ finishRecognition();
+ QChar gesture = T9WriteInputMethodPrivate::mapSymbolToGesture(finalWord.right(1).at(0));
+ if (!gesture.isNull())
+ finalWord.chop(1);
+ q->inputContext()->commit(finalWord);
+ applyGesture(gesture);
+ } else if (sessionSettings.recognitionMode == scrMode) {
+ QString finalWord = scrResult;
+ finishRecognition();
+ q->inputContext()->inputEngine()->virtualKeyClick(static_cast<Qt::Key>(finalWord.at(0).unicode()), finalWord, Qt::NoModifier);
+ }
+
+ return true;
+ }
+
+ void resetResultTimer(int interval = 500)
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::resetResultTimer():" << interval;
+ Q_Q(T9WriteInputMethod);
+ stopResultTimer();
+ resultTimer = q->startTimer(interval);
+ }
+
+ void stopResultTimer()
+ {
+ if (resultTimer) {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::stopResultTimer()";
+ Q_Q(T9WriteInputMethod);
+ q->killTimer(resultTimer);
+ resultTimer = 0;
+ }
+ }
+
+ void dictionaryLoadCompleted(QSharedPointer<T9WriteAbstractDictionary> dictionary)
+ {
+ // Note: This method is called in worker thread context
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+
+ if (!dictionary)
+ return;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::dictionaryLoadCompleted():"
+ << dictionary->name() << dictionary->data() << dictionary->size();
+
+ Q_Q(T9WriteInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (ic && dictionary->name() == dictionaryFileName) {
+ loadedDictionary = dictionary;
+ if (sessionSettings.recognitionMode != scrMode &&
+ !ic->inputMethodHints().testFlag(Qt::ImhNoPredictiveText) &&
+ !attachedDictionary) {
+ if (attachDictionary(loadedDictionary))
+ attachedDictionary = loadedDictionary;
+ }
+ }
+ }
+
+ void recognitionError(int status)
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::recognitionError():" << status;
+ Q_Q(T9WriteInputMethod);
+ q->reset();
+ }
+
+ // Note: Called from T9WriteWorker thread!
+ void setResultList(const QVariantList &resultList)
+ {
+ {
+ const std::lock_guard<QRecursiveMutex> ListGuard(resultListLock);
+ this->resultList = resultList;
+ }
+
+ Q_Q(T9WriteInputMethod);
+ emit q->resultListChanged();
+ }
+
+ void processResultCheckTimer()
+ {
+ bool resultTimerWasRunning = resultTimer != 0;
+
+ processResult();
+
+ // Restart the result timer now if it stopped before the results were completed
+ if (!resultTimerWasRunning && (!scrResult.isEmpty() || !wordCandidates.isEmpty()))
+ resetResultTimer(0);
+ }
+
+ void processResult()
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult()";
+
+#ifdef SENSITIVE_DEBUG
+ if (lcT9Write().isDebugEnabled()) {
+ const std::lock_guard<QRecursiveMutex> resultListGuard(resultListLock);
+ for (int i = 0; i < resultList.size(); i++) {
+ QVariantMap result = resultList.at(i).toMap();
+ QString resultPrint = QStringLiteral("%1: ").arg(i + 1);
+ QString resultChars = result.value(QLatin1String("chars")).toString();
+ if (!resultChars.isEmpty())
+ resultPrint.append(resultChars);
+ if (result.contains(QLatin1String("gesture"))) {
+ if (!resultChars.isEmpty())
+ resultPrint.append(QLatin1String(", "));
+ QString gesture = result[QLatin1String("gesture")].toString();
+ resultPrint.append(QLatin1String("gesture ="));
+ for (const QChar &chr : gesture) {
+ resultPrint.append(QString::fromLatin1(" 0x%1").arg(chr.unicode(), 0, 16));
+ }
+ }
+ qCDebug(lcT9Write) << resultPrint.toUtf8().constData();
+ }
+ }
+#endif
+
+ Q_Q(T9WriteInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return;
+
+#ifdef HAVE_XT9
+ int xt9DefaultListIndex = 0;
+ QStringList xt9Candidates;
+#endif
+
+ QList<T9WriteWordCandidate> newWordCandidates;
+ int newActiveWordIndex = -1;
+ QString resultString;
+ QString gesture;
+ QVariantList symbolStrokes;
+ {
+ const std::lock_guard<QRecursiveMutex> resultListGuard(resultListLock);
+ if (resultList.isEmpty())
+ return;
+
+ if (resultList.first().toMap()[QLatin1String("resultId")] != resultId) {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult(): resultId mismatch" << resultList.first().toMap()[QLatin1String("resultId")] << "(" << resultId << ")";
+ resultList.clear();
+ return;
+ }
+ lastResultId = resultId;
+
+ for (int i = 0; i < resultList.size(); i++) {
+ QVariantMap result = resultList.at(i).toMap();
+ QString resultChars = result[QLatin1String("chars")].toString();
+ if (i == 0) {
+ if (ic->isShiftActive()) {
+ caseFormatter.ensureLength(1, textCase);
+ caseFormatter.ensureLength(resultChars.length(), QVirtualKeyboardInputEngine::TextCase::Lower);
+ } else {
+ caseFormatter.ensureLength(resultChars.length(), textCase);
+ }
+ }
+ if (!resultChars.isEmpty()) {
+ resultChars = caseFormatter.formatString(resultChars);
+ if (sessionSettings.recognitionMode != scrMode && !newWordCandidates.contains(T9WriteWordCandidate(resultChars))) {
+ newWordCandidates.append(T9WriteWordCandidate(resultChars, i, T9WriteWordCandidate::Origin::T9Write));
+ }
+ }
+ if (i == 0) {
+ resultString = resultChars;
+ if (result.contains(QLatin1String("gesture")))
+ gesture = result[QLatin1String("gesture")].toString();
+ if (sessionSettings.recognitionMode != scrMode && result.contains(QLatin1String("symbolStrokes")))
+ symbolStrokes = result[QLatin1String("symbolStrokes")].toList();
+ if (sessionSettings.recognitionMode == scrMode)
+ break;
+#ifdef HAVE_XT9
+ xt9Candidates = xt9BuildSelectionList(resultString, &xt9DefaultListIndex);
+#endif
+ } else {
+ // Add a gesture symbol to the secondary candidate
+ if (sessionSettings.recognitionMode != scrMode && result.contains(QLatin1String("gesture"))) {
+ QString gesture2 = result[QLatin1String("gesture")].toString();
+ if (gesture2.length() == 1) {
+ QChar symbol = T9WriteInputMethodPrivate::mapGestureToSymbol(gesture2.at(0).unicode());
+ if (!symbol.isNull()) {
+ // Check for duplicates
+ bool duplicateFound = false;
+ for (const T9WriteWordCandidate &wordCandidate : newWordCandidates) {
+ duplicateFound = wordCandidate.symbs.size() == 1 && wordCandidate.symbs.at(0) == symbol;
+ if (duplicateFound)
+ break;
+ }
+ if (!duplicateFound) {
+ if (!resultChars.isEmpty()) {
+ newWordCandidates.last().symbs.append(symbol);
+ } else {
+ newWordCandidates.append(T9WriteWordCandidate(symbol, i, T9WriteWordCandidate::Origin::T9Write));
+ }
+ }
+ }
+ }
+ }
+#ifdef HAVE_XT9
+ if (i >= 2 && !xt9Candidates.isEmpty())
+ break;
+#endif
+ }
+ }
+
+ resultList.clear();
+
+ if (!newWordCandidates.isEmpty())
+ newActiveWordIndex = 0;
+#ifdef HAVE_XT9
+ if (!xt9Candidates.isEmpty())
+ appendWordCandidates(newWordCandidates, newActiveWordIndex, resultString, xt9Candidates, xt9DefaultListIndex, T9WriteWordCandidate::Origin::XT9);
+#endif
+ }
+
+ bool wordCandidatesChanged = true;
+
+#ifndef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ // Delete trace history
+ // Note: We have to be sure there are no background tasks
+ // running since the QVirtualKeyboardTrace objects consumed there.
+ if (worker->numberOfPendingTasks() == 0) {
+
+ const QVirtualKeyboardInputEngine::InputMode inputMode = q->inputEngine()->inputMode();
+ if (sessionSettings.recognitionMode != scrMode &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
+ const int hwrTimeout = cjk ?
+ Settings::instance()->hwrTimeoutForCjk() :
+ Settings::instance()->hwrTimeoutForAlphabetic();
+ for (int traceIndex = 0; traceIndex < traceList.size();) {
+ QVirtualKeyboardTrace *trace = traceList.at(traceIndex);
+ if (trace->opacity() > 0) {
+ trace->startHideTimer(hwrTimeout);
+ ++traceIndex;
+ } else {
+ traceList.removeAt(traceIndex);
+ delete trace;
+ }
+ }
+ }
+
+ // Enforce hard limit for number of traces
+ if (traceList.size() >= traceListHardLimit) {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult(): Clearing traces (hard limit):" << traceList.size();
+ clearTraces();
+ }
+ }
+#endif
+
+ // Find a gesture at the end of the first result
+ if (!gesture.isEmpty()) {
+
+ DECUMA_UNICODE gestureSymbol = gesture.at(0).unicode();
+ if (!applyGesture(gestureSymbol)) {
+ ic->commit(ic->preeditText());
+ finishRecognition();
+ }
+
+ return;
+ }
+
+ if (sessionSettings.recognitionMode != scrMode) {
+ ignoreUpdate = true;
+ ic->setPreeditText(resultString);
+ ignoreUpdate = false;
+ } else {
+ scrResult = resultString;
+ }
+
+ if (wordCandidatesChanged) {
+ wordCandidates = newWordCandidates;
+ activeWordIndex = wordCandidates.isEmpty() ? -1 : newActiveWordIndex;
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ }
+
+ if (arcAdditionStarted && traceList.isEmpty() && worker->numberOfPendingTasks() == 0) {
+ DECUMA_API(EndArcAddition)(decumaSession);
+ arcAdditionStarted = false;
+ }
+ }
+
+ static QChar mapGestureToSymbol(const QChar &gesture)
+ {
+ switch (gesture.unicode()) {
+ case '\r':
+ return QChar(0x23CE);
+ case ' ':
+ return QChar(0x2423);
+ default:
+ return QChar();
+ }
+ }
+
+ static QChar mapSymbolToGesture(const QChar &symbol)
+ {
+ switch (symbol.unicode()) {
+ case 0x23CE:
+ return QLatin1Char('\r');
+ case 0x2423:
+ return QLatin1Char(' ');
+ default:
+ return QChar();
+ }
+ }
+
+ bool applyGesture(const QChar &gesture)
+ {
+ Q_Q(T9WriteInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ switch (gesture.unicode()) {
+ case '\b':
+ return ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
+ case '\r':
+ return ic->inputEngine()->virtualKeyClick(Qt::Key_Return, QLatin1String("\n"), Qt::NoModifier);
+ case ' ':
+ return ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
+ default:
+ return false;
+ }
+ }
+
+ bool handleGesture()
+ {
+ if (countActiveTraces() > 0)
+ return false;
+
+ QVariantMap gesture(gestureRecognizer.recognize(traceList.mid(traceList.size() - 1, 1)));
+ if (gesture.isEmpty())
+ return false;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::handleGesture():" << gesture;
+
+ if (gesture[QLatin1String("type")].toString() == QLatin1String("swipe")) {
+
+ static const int SWIPE_ANGLE_THRESHOLD = 15; // degrees +-
+
+ qreal swipeLength = gesture[QLatin1String("length")].toReal();
+ if (swipeLength >= gestureWidthThreshold) {
+
+ Q_Q(T9WriteInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return false;
+
+ qreal swipeAngle = gesture[QLatin1String("angle_degrees")].toReal();
+ int swipeTouchCount = gesture[QLatin1String("touch_count")].toInt();
+
+ // Swipe left
+ if (swipeAngle <= 180 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 180 - SWIPE_ANGLE_THRESHOLD) {
+ if (swipeTouchCount == 1) {
+ // Single swipe: backspace
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
+ return true;
+ }
+ return false;
+ }
+
+ // Swipe right
+ const QVirtualKeyboardInputEngine::InputMode inputMode = q->inputEngine()->inputMode();
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
+ if (swipeAngle <= SWIPE_ANGLE_THRESHOLD || swipeAngle >= 360 - SWIPE_ANGLE_THRESHOLD) {
+ if (swipeTouchCount == 1) {
+ // Single swipe: space
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ // Swipe up
+ if (swipeAngle <= 270 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 270 - SWIPE_ANGLE_THRESHOLD) {
+ if (swipeTouchCount == 1) {
+ // Single swipe: toggle input mode
+ select();
+ if (!(ic->inputMethodHints() & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly))) {
+ QList<int> inputModes = ic->inputEngine()->inputModes();
+ // Filter out duplicate numeric mode (in favor of Numeric)
+ int indexOfNumericInputMode = inputModes.indexOf(static_cast<const int>(QVirtualKeyboardInputEngine::InputMode::Numeric));
+ int indexOfDialableInputMode = inputModes.indexOf(static_cast<const int>(QVirtualKeyboardInputEngine::InputMode::Dialable));
+ if (indexOfNumericInputMode != -1 && indexOfDialableInputMode != -1)
+ inputModes.removeAt(inputMode != QVirtualKeyboardInputEngine::InputMode::Dialable ?
+ indexOfDialableInputMode :
+ indexOfNumericInputMode);
+ if (inputModes.size() > 1) {
+ int inputModeIndex = inputModes.indexOf(static_cast<const int>(inputMode)) + 1;
+ if (inputModeIndex >= inputModes.size())
+ inputModeIndex = 0;
+ ic->inputEngine()->setInputMode(static_cast<QVirtualKeyboardInputEngine::InputMode>(inputModes.at(inputModeIndex)));
+ }
+ }
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ bool isValidInputChar(const QChar &c) const
+ {
+ if (c.isLetterOrNumber())
+ return true;
+ if (isJoiner(c))
+ return true;
+ return false;
+ }
+
+ bool isJoiner(const QChar &c) const
+ {
+ if (c.isPunct() || c.isSymbol()) {
+ Q_Q(const T9WriteInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (ic) {
+ Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) || inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly))
+ return QString(QStringLiteral(":/?#[]@!$&'()*+,;=-_.%")).contains(c);
+ }
+ ushort unicode = c.unicode();
+ if (unicode == Qt::Key_Apostrophe || unicode == Qt::Key_Minus)
+ return true;
+ }
+ return false;
+ }
+
+ void onAvailableDynamicDictionariesChanged()
+ {
+ if (!worker)
+ return;
+
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+
+ const QStringList availableDictionaries = dictionaryManager->availableDictionaries();
+ for (const QString &dictionaryName : availableDictionaries) {
+
+ if (!dynamicDictionaries.contains(dictionaryName)) {
+
+ DECUMA_SRC_DICTIONARY_INFO sourceInfo;
+ sourceInfo.srcType = decumaTextList;
+ sourceInfo.bNoFrequencyRanking = 1;
+ sourceInfo.multiStepWordSeparator = 0;
+
+ QSharedPointer<T9WriteAbstractSource> sourceDictionary(
+ new T9WriteStringSource(
+ sourceInfo,
+ dictionaryManager->dictionary(dictionaryName)->contents(),
+ dictionaryName));
+
+ QSharedPointer<T9WriteDictionary> dynamicDictionary(
+ new T9WriteDictionary(
+ sourceDictionary,
+ decumaSession,
+ memFuncs,
+ cjk));
+
+ dynamicDictionaries[dictionaryName] = dynamicDictionary;
+
+ QSharedPointer<T9WriteDictionaryTask> dynamicDictionaryTask(
+ new T9WriteDictionaryTask(
+ dynamicDictionary,
+ true));
+
+ Q_Q(T9WriteInputMethod);
+ q->connect(dynamicDictionaryTask.data(),
+ &T9WriteDictionaryTask::completed,
+ [=](QSharedPointer<T9WriteAbstractDictionary> dynamicDictionary) {
+
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+
+ if (dynamicDictionary->data()) {
+ if (dictionaryManager->activeDictionaries().contains(dictionaryName) &&
+ !attachedDynamicDictionaries.contains(dictionaryName) &&
+ attachDictionary(dynamicDictionary))
+ attachedDynamicDictionaries[dictionaryName] = dynamicDictionary;
+ } else {
+ dynamicDictionaries.remove(dictionaryName);
+ }
+ });
+
+ worker->addTask(dynamicDictionaryTask);
+ }
+
+#ifdef HAVE_XT9
+ if (!xt9DynamicDictionaries.contains(dictionaryName)) {
+ if (xt9Ime) {
+ QVirtualKeyboardDictionary *dictionary = dictionaryManager->dictionary(dictionaryName);
+ const quint16 id = static_cast<quint16>(xt9DynamicDictionaryNextId.fetchAndAddRelaxed(1));
+ xt9DynamicDictionaries[dictionaryName] = id;
+
+ xt9Ime->updateIndex(id, dictionary->contents());
+
+ Q_Q(T9WriteInputMethod);
+ q->connect(dictionary, &QVirtualKeyboardDictionary::contentsChanged, q, [=]() {
+ xt9Ime->updateIndex(id, dictionary->contents());
+ if (xt9AttachedDynamicDictionaries.contains(dictionaryName))
+ xt9Ime->mountIndex(id);
+ });
+ }
+ }
+#endif
+ }
+ }
+
+ void onActiveDynamicDictionariesChanged()
+ {
+ if (!worker)
+ return;
+
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+
+ // Attach
+ const QStringList activeDictionaries = dictionaryManager->activeDictionaries();
+ for (const QString &dictionaryName : activeDictionaries) {
+
+ QSharedPointer<T9WriteAbstractDictionary> dynamicDictionary = dynamicDictionaries.value(dictionaryName);
+ if (dynamicDictionary && dynamicDictionary->data() &&
+ !attachedDynamicDictionaries.contains(dictionaryName) &&
+ dynamicDictionary->isCompleted() &&
+ attachDictionary(dynamicDictionary)) {
+ attachedDynamicDictionaries[dictionaryName] = dynamicDictionary;
+ }
+#ifdef HAVE_XT9
+ if (xt9Ime) {
+ if (!xt9AttachedDynamicDictionaries.contains(dictionaryName)) {
+ xt9AttachDictionary(dictionaryName);
+ }
+ }
+#endif
+ }
+
+ // Detach
+ const QStringList attachedDynamicDictionariesKeys = attachedDynamicDictionaries.keys();
+ for (const QString &dictionaryName : attachedDynamicDictionariesKeys) {
+ if (!activeDictionaries.contains(dictionaryName)) {
+ if (attachedDynamicDictionaries.contains(dictionaryName)) {
+ detachDictionary(attachedDynamicDictionaries[dictionaryName]);
+ attachedDynamicDictionaries.remove(dictionaryName);
+ }
+ }
+ }
+#ifdef HAVE_XT9
+ // Detach (XT9)
+ if (xt9Ime) {
+ const QStringList xt9AttachedDynamicDictionariesKeys = xt9AttachedDynamicDictionaries.keys();
+ for (const QString &dictionaryName : xt9AttachedDynamicDictionariesKeys) {
+ if (!activeDictionaries.contains(dictionaryName)) {
+ xt9DetachDictionary(dictionaryName);
+ }
+ }
+ }
+#endif
+ }
+
+ bool isDlmActive()
+ {
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+ return !loadedDlmDictionary.isNull();
+ }
+
+ QString dlmFileName() const
+ {
+ QString suffix;
+ switch (engineMode) {
+ case T9WriteInputMethod::EngineMode::Alphabetic:
+ case T9WriteInputMethod::EngineMode::Arabic:
+ case T9WriteInputMethod::EngineMode::Hebrew:
+ case T9WriteInputMethod::EngineMode::Thai:
+ suffix = QStringLiteral("aw");
+ break;
+ case T9WriteInputMethod::EngineMode::SimplifiedChinese:
+ case T9WriteInputMethod::EngineMode::TraditionalChinese:
+ case T9WriteInputMethod::EngineMode::HongKongChinese:
+ suffix = QStringLiteral("cp");
+ break;
+ case T9WriteInputMethod::EngineMode::Japanese:
+ suffix = QStringLiteral("j");
+ break;
+ case T9WriteInputMethod::EngineMode::Korean:
+ suffix = QStringLiteral("k");
+ break;
+ default:
+ break;
+ }
+ return QStringLiteral("cerence-hwr%1.dlm").arg(suffix);
+ }
+
+ void dlmActivate()
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::dlmActivate()";
+
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+ if (loadedDlmDictionary)
+ return;
+
+ DECUMA_SRC_DICTIONARY_INFO sourceInfo;
+ sourceInfo.srcType = decumaPortableHWRDictionary;
+ sourceInfo.bNoFrequencyRanking = 1;
+ sourceInfo.multiStepWordSeparator = 0;
+
+ QString dictionaryName(QStringLiteral("%1/%2").arg(Settings::instance()->userDataPath(), dlmFileName()));
+ QSharedPointer<T9WriteAbstractSource> sourceDictionary(
+ new T9WriteFileSource(
+ sourceInfo,
+ dictionaryName));
+
+ loadedDlmDictionary.reset(new T9WriteDynamicDictionary(
+ sourceDictionary,
+ CERENCE_HWR_DLM_MAX_WORDS,
+ memFuncs,
+ cjk));
+
+ QSharedPointer<T9WriteDictionaryTask> dynamicDictionaryTask(
+ new T9WriteDictionaryTask(
+ loadedDlmDictionary,
+ false));
+
+ Q_Q(T9WriteInputMethod);
+ q->connect(dynamicDictionaryTask.data(),
+ &T9WriteDictionaryTask::completed,
+ [=](QSharedPointer<T9WriteAbstractDictionary> dynamicDictionary) {
+
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+
+ if (!loadedDlmDictionary || dynamicDictionary != loadedDlmDictionary)
+ return;
+
+ if (dynamicDictionary->data()) {
+ if (attachedDlmDictionary != dynamicDictionary &&
+ attachDictionary(dynamicDictionary)) {
+ attachedDlmDictionary = dynamicDictionary;
+ }
+ } else {
+ dlmDeactivate();
+ }
+ });
+
+ worker->addTask(dynamicDictionaryTask);
+ }
+
+ void dlmDeactivate()
+ {
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+
+ if (loadedDlmDictionary) {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::dlmDeactivate()";
+ loadedDlmDictionary.reset();
+ }
+
+ if (attachedDlmDictionary) {
+ detachDictionary(attachedDlmDictionary);
+ attachedDlmDictionary.reset();
+ }
+ }
+
+ void dlmAddWord(const QString &word)
+ {
+ if (!isDlmActive() || !worker)
+ return;
+
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::dlmAddWord()";
+
+ QSharedPointer<T9WriteDlmWordTask> learnWordTask(new T9WriteDlmWordTask(loadedDlmDictionary, word, stringStart));
+ worker->addTask(learnWordTask);
+ }
+
+ bool dlmHasWord(const QString &word)
+ {
+ if (!isDlmActive() || !worker)
+ return false;
+
+ worker->waitForAllTasks();
+
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
+ T9WriteDynamicDictionary *dictionary = static_cast<T9WriteDynamicDictionary *>(loadedDlmDictionary.data());
+
+ return dictionary->hasWord(word);
+ }
+
+ void dlmRemoveWord(const QString &word)
+ {
+ qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::dlmRemoveWord()";
+
+ QSharedPointer<T9WriteDlmRemoveWordTask> removeWordTask(new T9WriteDlmRemoveWordTask(loadedDlmDictionary, word));
+ worker->addTask(removeWordTask);
+ }
+
+ T9WriteInputMethod *q_ptr;
+ static const DECUMA_MEM_FUNCTIONS memFuncs;
+ bool cjk;
+ T9WriteInputMethod::EngineMode engineMode;
+ QByteArray currentContext;
+ DECUMA_SESSION_SETTINGS sessionSettings;
+ DECUMA_UINT32 gestureWidthThreshold;
+ QStringList defaultHwrDbPaths;
+ QFile hwrDbFile;
+ QList<DECUMA_UINT32> languageCategories;
+ QList<DECUMA_UINT32> symbolCategories;
+ QScopedPointer<T9WriteWorker> worker;
+ QList<QVirtualKeyboardTrace *> traceList;
+ int traceListHardLimit;
+ QRecursiveMutex dictionaryLock;
+ QString dictionaryFileName;
+ QSharedPointer<T9WriteAbstractDictionary> loadedDictionary;
+ QSharedPointer<T9WriteAbstractDictionary> attachedDictionary;
+ QSharedPointer<Xt9LdbManager> ldbManager;
+ QSharedPointer<T9WriteDictionaryTask> dictionaryTask;
+ QMap<QString, QSharedPointer<T9WriteAbstractDictionary>> dynamicDictionaries;
+ QMap<QString, QSharedPointer<T9WriteAbstractDictionary>> attachedDynamicDictionaries;
+ QSharedPointer<T9WriteAbstractDictionary> loadedDlmDictionary;
+ QSharedPointer<T9WriteAbstractDictionary> attachedDlmDictionary;
+ QMetaObject::Connection availableDictionariesChangedConnection;
+ QMetaObject::Connection activeDictionariesChangedConnection;
+ QSharedPointer<T9WriteRecognitionTask> recognitionTask;
+ QRecursiveMutex resultListLock;
+ QVariantList resultList;
+ QMetaObject::Connection resultListChangedConnection;
+ int resultId;
+ int lastResultId;
+ int resultTimer;
+ QByteArray session;
+ DECUMA_SESSION *decumaSession;
+ QList<T9WriteWordCandidate> wordCandidates;
+ QString stringStart;
+ QString scrResult;
+ int activeWordIndex;
+ bool arcAdditionStarted;
+ bool ignoreUpdate;
+ QVirtualKeyboardInputEngine::TextCase textCase;
+ T9WriteCaseFormatter caseFormatter;
+ HandwritingGestureRecognizer gestureRecognizer;
+#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ QScopedPointer<UnipenTrace> unipenTrace;
+#endif
+#ifdef HAVE_XT9
+ QScopedPointer<Xt9Ime> xt9Ime;
+ QMap<QString, quint16> xt9DynamicDictionaries;
+ QMap<QString, quint16> xt9AttachedDynamicDictionaries;
+ QAtomicInt xt9DynamicDictionaryNextId;
+ QMetaObject::Connection defaultInputMethodDisabledChangedConnection;
+ QMetaObject::Connection defaultDictionaryDisabledChangedConnection;
+#endif
+ QMetaObject::Connection userDataResetConnection;
+};
+
+const DECUMA_MEM_FUNCTIONS T9WriteInputMethodPrivate::memFuncs = {
+ T9WriteInputMethodPrivate::decumaMalloc,
+ T9WriteInputMethodPrivate::decumaCalloc,
+ T9WriteInputMethodPrivate::decumaFree,
+ nullptr
+};
+
+/*!
+ \class QtVirtualKeyboard::T9WriteInputMethod
+ \internal
+*/
+
+T9WriteInputMethod::T9WriteInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(*new T9WriteInputMethodPrivate(this), parent)
+{
+}
+
+T9WriteInputMethod::~T9WriteInputMethod()
+{
+}
+
+void T9WriteInputMethod::clearInputMode()
+{
+ Q_D(T9WriteInputMethod);
+ d->exitEngine();
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> T9WriteInputMethod::inputModes(const QString &locale)
+{
+ Q_D(T9WriteInputMethod);
+ QList<QVirtualKeyboardInputEngine::InputMode> availableInputModes;
+ const Qt::InputMethodHints inputMethodHints(inputContext()->inputMethodHints());
+ const QLocale loc(locale);
+ T9WriteInputMethod::EngineMode mode = d->mapLocaleToEngineMode(loc);
+
+ // Add primary input mode
+ switch (mode) {
+#ifdef HAVE_CERENCE_HWR_ALPHABETIC
+ case T9WriteInputMethod::EngineMode::Alphabetic:
+ if (d->findHwrDb(T9WriteInputMethod::EngineMode::Alphabetic).isEmpty())
+ return availableInputModes;
+ if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly))) {
+ switch (loc.script()) {
+ case QLocale::GreekScript:
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Greek);
+ break;
+ case QLocale::CyrillicScript:
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Cyrillic);
+ break;
+ case QLocale::ThaiScript:
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Thai);
+ break;
+ default:
+ break;
+ }
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Latin);
+ }
+ break;
+ case T9WriteInputMethod::EngineMode::Arabic:
+ if (d->findHwrDb(T9WriteInputMethod::EngineMode::Arabic).isEmpty())
+ return availableInputModes;
+ if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Arabic);
+ break;
+ case T9WriteInputMethod::EngineMode::Hebrew:
+ if (d->findHwrDb(T9WriteInputMethod::EngineMode::Hebrew).isEmpty())
+ return availableInputModes;
+ if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Hebrew);
+ break;
+ case T9WriteInputMethod::EngineMode::Thai:
+ if (d->findHwrDb(T9WriteInputMethod::EngineMode::Thai).isEmpty())
+ return availableInputModes;
+ if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Thai);
+ break;
+#endif
+#ifdef HAVE_CERENCE_HWR_CJK
+ case T9WriteInputMethod::EngineMode::SimplifiedChinese:
+ case T9WriteInputMethod::EngineMode::TraditionalChinese:
+ case T9WriteInputMethod::EngineMode::HongKongChinese:
+ if (d->findHwrDb(mode).isEmpty())
+ return availableInputModes;
+ if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting);
+ break;
+ case T9WriteInputMethod::EngineMode::Japanese:
+ if (d->findHwrDb(T9WriteInputMethod::EngineMode::Japanese).isEmpty())
+ return availableInputModes;
+ if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting);
+ break;
+ case T9WriteInputMethod::EngineMode::Korean:
+ if (d->findHwrDb(T9WriteInputMethod::EngineMode::Korean).isEmpty())
+ return availableInputModes;
+ if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting);
+ break;
+#endif
+ default:
+ return availableInputModes;
+ }
+
+ // Add exclusive input modes
+ if (inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly) || inputMethodHints.testFlag(Qt::ImhDigitsOnly)) {
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Dialable);
+ } else if (inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly)) {
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
+ } else if (inputMethodHints.testFlag(Qt::ImhLatinOnly)) {
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Latin);
+ } else {
+ // Add other input modes
+ Q_ASSERT(!availableInputModes.isEmpty());
+ if (!availableInputModes.contains(QVirtualKeyboardInputEngine::InputMode::Latin))
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Latin);
+ availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
+ }
+
+ return availableInputModes;
+}
+
+bool T9WriteInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_D(T9WriteInputMethod);
+ d->select();
+ return d->setInputMode(QLocale(locale), inputMode);
+}
+
+bool T9WriteInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_D(T9WriteInputMethod);
+ d->textCase = textCase;
+ return true;
+}
+
+bool T9WriteInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(modifiers);
+ Q_D(T9WriteInputMethod);
+ switch (key) {
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Tab:
+ case Qt::Key_Space:
+ d->select();
+ update();
+ break;
+
+ case Qt::Key_Backspace:
+ {
+ QVirtualKeyboardInputContext *ic = inputContext();
+ QString preeditText = ic->preeditText();
+ if (preeditText.length() > 1) {
+ preeditText.chop(1);
+ ic->setPreeditText(preeditText);
+ d->caseFormatter.ensureLength(preeditText.length(), d->textCase);
+ T9WriteCaseFormatter caseFormatter(d->caseFormatter);
+ d->finishRecognition(false);
+ d->caseFormatter = caseFormatter;
+ d->stringStart = preeditText;
+ int xt9DefaultListIndex = 0;
+ d->activeWordIndex = 0;
+ d->appendWordCandidates(d->wordCandidates, d->activeWordIndex, d->stringStart, d->xt9BuildSelectionList(d->stringStart, &xt9DefaultListIndex), xt9DefaultListIndex, T9WriteWordCandidate::Origin::XT9);
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+ return true;
+ } else {
+ bool result = !preeditText.isEmpty();
+ if (result)
+ ic->clear();
+ else
+ result = !d->scrResult.isEmpty();
+ d->finishRecognition();
+ return result;
+ }
+ }
+
+ default:
+ if (d->sessionSettings.recognitionMode != scrMode && text.length() > 0) {
+ d->waitForRecognitionResults();
+ QVirtualKeyboardInputContext *ic = inputContext();
+ QString preeditText = ic->preeditText();
+ QChar c = text.at(0);
+ bool addToWord = d->isValidInputChar(c) && (!preeditText.isEmpty() || !d->isJoiner(c));
+ if (addToWord) {
+ preeditText.append(text);
+ ic->setPreeditText(preeditText);
+ d->caseFormatter.ensureLength(preeditText.length(), d->textCase);
+ T9WriteCaseFormatter caseFormatter(d->caseFormatter);
+ d->finishRecognition(false);
+ d->caseFormatter = caseFormatter;
+ d->stringStart = preeditText;
+ d->wordCandidates.append(preeditText);
+ d->activeWordIndex = 0;
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+ return true;
+ } else {
+ ic->commit();
+ d->finishRecognition();
+ }
+ break;
+ } else if (d->sessionSettings.recognitionMode == scrMode) {
+ d->finishRecognition();
+ }
+ }
+ return false;
+}
+
+void T9WriteInputMethod::reset()
+{
+ Q_D(T9WriteInputMethod);
+ d->finishRecognition();
+ d->setInputMode(QLocale(inputContext()->locale()), inputEngine()->inputMode());
+}
+
+void T9WriteInputMethod::update()
+{
+ Q_D(T9WriteInputMethod);
+ if (d->ignoreUpdate)
+ return;
+ d->select();
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> T9WriteInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int T9WriteInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type);
+ Q_D(T9WriteInputMethod);
+ return d->wordCandidates.size();
+}
+
+QVariant T9WriteInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ QVariant result;
+ Q_D(T9WriteInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->wordCandidates.at(index).symbs);
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ result.setValue(0);
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::Dictionary:
+ {
+ QVirtualKeyboardSelectionListModel::DictionaryType dictionaryType =
+ d->dlmHasWord(d->wordCandidates.at(index).symbs) ?
+ QVirtualKeyboardSelectionListModel::DictionaryType::User :
+ QVirtualKeyboardSelectionListModel::DictionaryType::Default;
+ result = QVariant(static_cast<int>(dictionaryType));
+ break;
+ }
+ case QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion:
+ result = QVariant(d->dlmHasWord(d->wordCandidates.at(index).symbs));
+ break;
+ default:
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ break;
+ }
+ return result;
+}
+
+void T9WriteInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type);
+ Q_D(T9WriteInputMethod);
+
+#ifdef HAVE_XT9
+ switch (d->engineMode) {
+ case T9WriteInputMethod::EngineMode::SimplifiedChinese:
+ if (inputEngine()->inputMode() != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting)
+ break;
+
+ [[fallthrough]]; case T9WriteInputMethod::EngineMode::Japanese:
+ if (d->wordCandidates[index].origin == T9WriteWordCandidate::Origin::T9Write) {
+ if (d->xt9AllSymbsArePinyin(d->wordCandidates[index].symbs)) {
+ int indexOfFirstXt9Candidate;
+ for (indexOfFirstXt9Candidate = 0; indexOfFirstXt9Candidate < d->wordCandidates.size(); ++indexOfFirstXt9Candidate) {
+ if (d->wordCandidates[indexOfFirstXt9Candidate].origin == T9WriteWordCandidate::Origin::XT9)
+ break;
+ }
+
+ while (indexOfFirstXt9Candidate < d->wordCandidates.size()) {
+ d->wordCandidates.removeAt(indexOfFirstXt9Candidate);
+ }
+
+ int xt9DefaultListIndex = 0;
+ d->appendWordCandidates(d->wordCandidates, d->activeWordIndex, d->wordCandidates[index].symbs, d->xt9BuildSelectionList(d->wordCandidates[index].symbs, &xt9DefaultListIndex), xt9DefaultListIndex, T9WriteWordCandidate::Origin::XT9);
+ d->activeWordIndex = index;
+
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+ return;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+#endif
+
+ d->select(index);
+}
+
+bool T9WriteInputMethod::selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type)
+ Q_D(T9WriteInputMethod);
+ if (index < 0 || index >= d->wordCandidates.size())
+ return false;
+ d->dlmRemoveWord(d->wordCandidates.at(index).symbs);
+ if (d->wordCandidates.size() > 1) {
+ d->wordCandidates.removeAt(index);
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+ } else {
+ inputContext()->clear();
+ reset();
+ }
+ return true;
+}
+
+QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> T9WriteInputMethod::patternRecognitionModes() const
+{
+ return QList<QVirtualKeyboardInputEngine::PatternRecognitionMode>()
+ << QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting;
+}
+
+QVirtualKeyboardTrace *T9WriteInputMethod::traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+{
+ Q_D(T9WriteInputMethod);
+ return d->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
+}
+
+bool T9WriteInputMethod::traceEnd(QVirtualKeyboardTrace *trace)
+{
+ Q_D(T9WriteInputMethod);
+ d->traceEnd(trace);
+ return true;
+}
+
+bool T9WriteInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
+{
+ Q_D(T9WriteInputMethod);
+
+ if (d->sessionSettings.recognitionMode == scrMode)
+ return false;
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (!ic)
+ return false;
+
+ const QVirtualKeyboardInputEngine::InputMode inputMode = inputEngine()->inputMode();
+ const int maxLength = (inputMode == QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting ||
+ inputMode == QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting ||
+ inputMode == QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) ? 16 : 32;
+ const QString surroundingText = ic->surroundingText();
+ int replaceFrom = 0;
+
+ if (cursorPosition > surroundingText.length())
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor)) {
+ for (int i = cursorPosition - 1; i >= 0 && d->stringStart.length() < maxLength; --i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ d->stringStart.insert(0, c);
+ --replaceFrom;
+ }
+
+ while (replaceFrom < 0 && d->isJoiner(d->stringStart.at(0))) {
+ d->stringStart.remove(0, 1);
+ ++replaceFrom;
+ }
+ }
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == 0) {
+ d->stringStart.clear();
+ return false;
+ }
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor)) {
+ for (int i = cursorPosition; i < surroundingText.length() && d->stringStart.length() < maxLength; ++i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ d->stringStart.append(c);
+ }
+
+ while (replaceFrom > -d->stringStart.length()) {
+ int lastPos = d->stringStart.length() - 1;
+ if (!d->isJoiner(d->stringStart.at(lastPos)))
+ break;
+ d->stringStart.remove(lastPos, 1);
+ }
+ }
+
+ if (d->stringStart.isEmpty())
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -d->stringStart.length() && d->stringStart.length() < maxLength) {
+ d->stringStart.clear();
+ return false;
+ }
+
+ if (d->isJoiner(d->stringStart.at(0))) {
+ d->stringStart.clear();
+ return false;
+ }
+
+ if (d->isJoiner(d->stringStart.at(d->stringStart.length() - 1))) {
+ d->stringStart.clear();
+ return false;
+ }
+
+ ic->setPreeditText(d->stringStart, QList<QInputMethodEvent::Attribute>(), replaceFrom, d->stringStart.length());
+ for (int i = 0; i < d->stringStart.length(); ++i)
+ d->caseFormatter.ensureLength(i + 1, d->stringStart.at(i).isUpper() ? QVirtualKeyboardInputEngine::TextCase::Upper : QVirtualKeyboardInputEngine::TextCase::Lower);
+ int xt9DefaultListIndex = 0;
+ d->activeWordIndex = 0;
+ d->appendWordCandidates(d->wordCandidates, d->activeWordIndex, d->stringStart, d->xt9BuildSelectionList(d->stringStart, &xt9DefaultListIndex), xt9DefaultListIndex, T9WriteWordCandidate::Origin::XT9);
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+
+ return true;
+}
+
+void T9WriteInputMethod::timerEvent(QTimerEvent *timerEvent)
+{
+ Q_D(T9WriteInputMethod);
+ int timerId = timerEvent->timerId();
+ qCDebug(lcT9Write) << "T9WriteInputMethod::timerEvent():" << timerId;
+ if (timerId == d->resultTimer) {
+ d->stopResultTimer();
+
+ // Ignore if the result is not yet available
+ if (d->resultId != d->lastResultId) {
+ qCDebug(lcT9Write) << "T9WriteInputMethod::timerEvent(): Result not yet available";
+ return;
+ }
+
+ if (d->sessionSettings.recognitionMode != scrMode) {
+#ifndef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
+ // Don't clear traces in UCR mode if dictionary is loaded.
+ // In UCR mode the whole purpose is to write the word with
+ // one or few strokes.
+ if (d->sessionSettings.recognitionMode == ucrMode) {
+ const std::lock_guard<QRecursiveMutex> dictionaryGuard(d->dictionaryLock);
+ if (d->attachedDictionary)
+ return;
+ }
+
+ const QVirtualKeyboardInputEngine::InputMode inputMode = inputEngine()->inputMode();
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
+ inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
+ d->clearTraces();
+ }
+#endif
+ } else {
+ d->select();
+ }
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/hwr/plugin/t9writeinputmethod_p.h b/src/plugins/cerence/hwr/plugin/t9writeinputmethod_p.h
new file mode 100644
index 00000000..b8abb8d1
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writeinputmethod_p.h
@@ -0,0 +1,86 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef T9WRITEINPUTMETHOD_P_H
+#define T9WRITEINPUTMETHOD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class T9WriteInputMethodPrivate;
+class T9WriteAbstractDictionary;
+
+class T9WriteInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(T9WriteInputMethod)
+ QML_NAMED_ELEMENT(HandwritingInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ enum class EngineMode {
+ Uninitialized,
+ Alphabetic,
+ Arabic,
+ Hebrew,
+ Thai,
+ SimplifiedChinese,
+ TraditionalChinese,
+ HongKongChinese,
+ Japanese,
+ Korean
+ };
+ Q_ENUM(EngineMode)
+
+ explicit T9WriteInputMethod(QObject *parent = nullptr);
+ ~T9WriteInputMethod();
+
+ void clearInputMode() override;
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale);
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode);
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase);
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
+
+ void reset();
+ void update();
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists();
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type);
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role);
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index);
+ bool selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index) override;
+
+ QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patternRecognitionModes() const;
+ QVirtualKeyboardTrace *traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
+ bool traceEnd(QVirtualKeyboardTrace *trace);
+
+ bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags);
+
+signals:
+ void resultListChanged();
+
+protected:
+ void timerEvent(QTimerEvent *timerEvent);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/cerence/hwr/plugin/t9writewordcandidate.cpp b/src/plugins/cerence/hwr/plugin/t9writewordcandidate.cpp
new file mode 100644
index 00000000..ebb35c07
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writewordcandidate.cpp
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "t9writewordcandidate_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+T9WriteWordCandidate::T9WriteWordCandidate(QString symbs, int resultIndex, T9WriteWordCandidate::Origin origin) :
+ symbs(symbs),
+ resultIndex(resultIndex),
+ origin(origin)
+{
+
+}
+
+bool operator==(const T9WriteWordCandidate &a, const T9WriteWordCandidate &b)
+{
+ return a.symbs == b.symbs;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/hwr/plugin/t9writewordcandidate_p.h b/src/plugins/cerence/hwr/plugin/t9writewordcandidate_p.h
new file mode 100644
index 00000000..72c8cf11
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writewordcandidate_p.h
@@ -0,0 +1,45 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef T9WRITEWORDCANDIDATE_H
+#define T9WRITEWORDCANDIDATE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QString>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class T9WriteWordCandidate
+{
+public:
+ enum class Origin {
+ None,
+ T9Write,
+ XT9
+ };
+
+ T9WriteWordCandidate(QString symbs, int resultIndex = -1, Origin origin = Origin::None);
+
+public:
+ QString symbs;
+ int resultIndex;
+ Origin origin;
+};
+
+bool operator==(const T9WriteWordCandidate &a, const T9WriteWordCandidate &b);
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // T9WRITEWORDCANDIDATE_H
diff --git a/src/plugins/cerence/hwr/plugin/t9writeworker.cpp b/src/plugins/cerence/hwr/plugin/t9writeworker.cpp
new file mode 100644
index 00000000..1a127c71
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writeworker.cpp
@@ -0,0 +1,472 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "t9writeworker_p.h"
+#include <QLoggingCategory>
+
+#include <QFile>
+#include <QElapsedTimer>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_DECLARE_LOGGING_CATEGORY(lcT9Write)
+
+/*!
+ \class QtVirtualKeyboard::T9WriteTask
+ \internal
+*/
+
+T9WriteTask::T9WriteTask(QObject *parent) :
+ QObject(parent),
+ decumaSession(nullptr),
+ runSema()
+{
+}
+
+void T9WriteTask::wait()
+{
+ runSema.acquire();
+ runSema.release();
+}
+
+/*!
+ \class QtVirtualKeyboard::T9WriteDictionaryTask
+ \internal
+*/
+
+T9WriteDictionaryTask::T9WriteDictionaryTask(QSharedPointer<T9WriteAbstractDictionary> dictionary,
+ bool convertDictionary) :
+ dictionary(dictionary),
+ convertDictionary(convertDictionary)
+{
+}
+
+void T9WriteDictionaryTask::run()
+{
+ qCDebug(lcT9Write) << "T9WriteDictionaryTask::run()";
+
+ QElapsedTimer perf;
+ perf.start();
+
+ bool result = false;
+ if (dictionary) {
+ result = dictionary->load();
+ if (result && convertDictionary)
+ result = dictionary->convert();
+ }
+
+ qCDebug(lcT9Write) << "T9WriteDictionaryTask::run(): time:" << perf.elapsed() << "ms";
+
+ if (result) {
+ dictionary->state++;
+ emit completed(dictionary);
+ }
+}
+
+T9WriteAddArcTask::T9WriteAddArcTask(QVirtualKeyboardTrace *trace) :
+ trace(trace)
+{
+}
+
+void T9WriteAddArcTask::run()
+{
+ QElapsedTimer perf;
+ perf.start();
+ DECUMA_UINT32 arcID = (DECUMA_UINT32)trace->traceId();
+ DECUMA_STATUS status = DECUMA_API(StartNewArc)(decumaSession, arcID);
+ Q_ASSERT(status == decumaNoError);
+ if (status != decumaNoError) {
+ qCWarning(lcT9Write) << "T9WriteAddArcTask::run(): Failed to start new arc, status:" << status;
+ return;
+ }
+
+ const QVariantList points = trace->points();
+ Q_ASSERT(!points.isEmpty());
+
+ for (const QVariant &p : points) {
+ const QPoint pt(p.toPointF().toPoint());
+ status = DECUMA_API(AddPoint)(decumaSession, (DECUMA_COORD)pt.x(),(DECUMA_COORD)pt.y(), arcID);
+ if (status != decumaNoError) {
+ qCWarning(lcT9Write) << "T9WriteAddArcTask::run(): Failed to add point, status:" << status;
+ DECUMA_API(CancelArc)(decumaSession, arcID);
+ return;
+ }
+ }
+
+ status = DECUMA_API(CommitArc)(decumaSession, arcID);
+ if (status != decumaNoError)
+ qCWarning(lcT9Write) << "T9WriteAddArcTask::run(): Failed to commit arc, status:" << status;
+ else
+ qCDebug(lcT9Write) << "T9WriteAddArcTask::run(): time:" << perf.elapsed() << "ms";
+}
+
+/*!
+ \class QtVirtualKeyboard::T9WriteRecognitionResult
+ \internal
+*/
+
+T9WriteRecognitionResult::T9WriteRecognitionResult(int id, int maxResults, int maxCharsPerWord) :
+ status(decumaNoError),
+ numResults(0),
+ instantGesture(0),
+ id(id),
+ maxResults(maxResults),
+ maxCharsPerWord(maxCharsPerWord)
+{
+ Q_ASSERT(maxResults > 0);
+ Q_ASSERT(maxCharsPerWord > 0);
+ results.resize(maxResults);
+ int bufferLength = (maxCharsPerWord + 1);
+ _chars.resize(maxResults * bufferLength);
+ _symbolChars.resize(maxResults * bufferLength);
+ _symbolStrokes.resize(maxResults * bufferLength);
+ for (int i = 0; i < maxResults; i++) {
+ DECUMA_HWR_RESULT &hwrResult = results[i];
+ hwrResult.pChars = &_chars[i * bufferLength];
+ hwrResult.pSymbolChars = &_symbolChars[i * bufferLength];
+ hwrResult.pSymbolStrokes = &_symbolStrokes[i * bufferLength];
+ }
+}
+
+/*!
+ \class QtVirtualKeyboard::T9WriteRecognitionTask
+ \internal
+*/
+
+T9WriteRecognitionTask::T9WriteRecognitionTask(QSharedPointer<T9WriteRecognitionResult> result) :
+ T9WriteTask(),
+ result(result),
+ stateCancelled(false)
+{
+}
+
+void T9WriteRecognitionTask::run()
+{
+ if (!decumaSession)
+ return;
+
+ perf.start();
+
+ while (true) {
+ DECUMA_BG_REC_STATE bgRecState = bgRecIdle;
+ DECUMA_STATUS status = DECUMA_API(GetBackgroundRecognitionState(decumaSession, &bgRecState));
+ if (status) {
+ qCDebug(lcT9Write) << "T9WriteRecognitionTask::run(): GetBackgroundRecognitionState failed, status:" << status;
+ break;
+ }
+
+ if (bgRecState != bgRecStarted) {
+ qCDebug(lcT9Write) << "T9WriteRecognitionTask::run(): state:" << bgRecState << "time:" << perf.elapsed() << "ms";
+ break;
+ }
+
+ if (checkCancelled())
+ return;
+
+ QThread::msleep(25);
+
+ if (checkCancelled())
+ return;
+ }
+
+ result->status = DECUMA_API(Recognize)(decumaSession, result->results.data(), result->results.size(), &result->numResults, result->maxCharsPerWord, nullptr, nullptr);
+ if (result->status != decumaNoError)
+ qCWarning(lcT9Write) << "T9WriteRecognitionTask::run(): Recognition failed, status:" << result->status;
+
+ if (checkCancelled())
+ return;
+
+ qCDebug(lcT9Write) << "T9WriteRecognitionTask::run(): time:" << perf.elapsed() << "ms";
+}
+
+bool T9WriteRecognitionTask::cancelRecognition()
+{
+ QMutexLocker stateGuard(&stateLock);
+ Q_UNUSED(stateGuard)
+ stateCancelled = true;
+ return true;
+}
+
+bool T9WriteRecognitionTask::checkCancelled()
+{
+ QMutexLocker stateGuard(&stateLock);
+ Q_UNUSED(stateGuard)
+ if (stateCancelled) {
+ result.reset();
+ qCDebug(lcT9Write) << "T9WriteRecognitionTask cancelled, time:" << perf.elapsed() << "ms";
+ return true;
+ }
+
+ return false;
+}
+
+int T9WriteRecognitionTask::resultId() const
+{
+ return result != nullptr ? result->id : -1;
+}
+
+/*!
+ \class QtVirtualKeyboard::T9WriteRecognitionResultsTask
+ \internal
+*/
+
+T9WriteRecognitionResultsTask::T9WriteRecognitionResultsTask(QSharedPointer<T9WriteRecognitionResult> result) :
+ T9WriteTask(),
+ result(result)
+{
+}
+
+void T9WriteRecognitionResultsTask::run()
+{
+ if (!result)
+ return;
+
+ if (result->status != decumaNoError) {
+ emit recognitionError(result->status);
+ return;
+ }
+
+ QVariantList resultList;
+ for (int i = 0; i < result->numResults; i++)
+ {
+ QVariantMap resultMap;
+ QString resultString;
+ QString gesture;
+ const DECUMA_HWR_RESULT &hwrResult = result->results.at(i);
+ resultString.reserve(hwrResult.nChars);
+ QVariantList symbolStrokes;
+ int charPos = 0;
+ for (int symbolIndex = 0; symbolIndex < hwrResult.nSymbols; symbolIndex++) {
+ int symbolLength = hwrResult.pSymbolChars[symbolIndex];
+ QString symbol(QString::fromUtf16(reinterpret_cast<const char16_t *>(&hwrResult.pChars[charPos]), symbolLength));
+ // Do not append gesture symbol to result string
+ 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]));
+ }
+
+ resultMap[QLatin1String("resultId")] = result->id;
+ resultMap[QLatin1String("chars")] = resultString;
+ resultMap[QLatin1String("symbolStrokes")] = symbolStrokes;
+ if (!gesture.isEmpty())
+ resultMap[QLatin1String("gesture")] = gesture;
+
+ resultList.append(resultMap);
+ }
+
+ if (resultList.isEmpty()) {
+ qCDebug(lcT9Write) << "T9WriteRecognitionResultsTask::run(): no results available";
+ return;
+ }
+
+ qCDebug(lcT9Write) << "T9WriteRecognitionResultsTask::run():" << resultList.size() << "results available";
+ emit resultsAvailable(resultList);
+}
+
+/*!
+ \class QtVirtualKeyboard::T9WriteLearnWordTask
+ \internal
+*/
+
+T9WriteDlmWordTask::T9WriteDlmWordTask(QSharedPointer<T9WriteAbstractDictionary> dlmDictionary, const QString &word, const QString &stringStart) :
+ T9WriteTask(),
+ dlmDictionary(dlmDictionary),
+ word(word),
+ stringStart(stringStart)
+{
+
+}
+
+void T9WriteDlmWordTask::run()
+{
+ DECUMA_RECOGNITION_SETTINGS recSettings;
+ memset(&recSettings, 0, sizeof(recSettings));
+ recSettings.boostLevel = boostDictWords;
+ recSettings.stringCompleteness = canBeContinued;
+ if (!stringStart.isEmpty())
+ recSettings.pStringStart = const_cast<DECUMA_UNICODE *>(stringStart.utf16());
+
+ DECUMA_UINT16 nDictionaries = 0;
+ DECUMA_STATUS status = DECUMA_API(GetNAttachedDictionaries)(decumaSession, &nDictionaries);
+ if (status)
+ return;
+
+ bool wordFound = false;
+ if (nDictionaries != 0) {
+ QVector<DECUMA_MATCH_RESULT> matchResults;
+ matchResults.resize(nDictionaries);
+ status = DECUMA_API(MatchWord)(decumaSession, word.utf16(),
+ static_cast<DECUMA_UINT16>(word.length()),
+ &recSettings, matchResults.data());
+ if (!status) {
+ for (const auto &matchResult : std::as_const(matchResults)) {
+ qCDebug(lcT9Write) << "T9WriteDlmWordTask::run(): MatchWord string type" << matchResult.stringType;
+ if (matchResult.stringType != notFromDictionary) {
+ wordFound = true;
+ break;
+ }
+ }
+ } else {
+ qCDebug(lcT9Write) << "T9WriteDlmWordTask::run(): MatchWord failed" << status;
+ return;
+ }
+ }
+
+ if (!wordFound) {
+ qCDebug(lcT9Write) << "T9WriteDlmWordTask::run(): DynamicDictionaryAddWord";
+ status = DECUMA_API(DynamicDictionaryAddWord)(
+ const_cast<DECUMA_DYNAMIC_DICTIONARY *>(
+ reinterpret_cast<const DECUMA_DYNAMIC_DICTIONARY *>(dlmDictionary->data())),
+ word.utf16());
+
+ if (!status) {
+ persist();
+ }
+ }
+}
+
+void T9WriteDlmWordTask::persist()
+{
+ T9WriteDynamicDictionary *dictionary = static_cast<T9WriteDynamicDictionary *>(dlmDictionary.data());
+
+ QElapsedTimer perf;
+ perf.start();
+
+ dictionary->save();
+
+ qCDebug(lcT9Write) << "T9WriteDlmWordTask::persist(): time:" << perf.elapsed() << "ms";
+}
+
+/*!
+ \class QtVirtualKeyboard::T9WriteDlmRemoveWordTask
+ \internal
+*/
+
+T9WriteDlmRemoveWordTask::T9WriteDlmRemoveWordTask(QSharedPointer<T9WriteAbstractDictionary> dlmDictionary, const QString &word) :
+ T9WriteDlmWordTask(dlmDictionary, word, QString())
+{
+
+}
+
+void T9WriteDlmRemoveWordTask::run()
+{
+ T9WriteDynamicDictionary *dictionary = static_cast<T9WriteDynamicDictionary *>(dlmDictionary.data());
+ if (dictionary->removeWord(word)) {
+ persist();
+ }
+}
+
+/*!
+ \class QtVirtualKeyboard::T9WriteWorker
+ \internal
+*/
+
+T9WriteWorker::T9WriteWorker(DECUMA_SESSION *decumaSession, const bool cjk, QObject *parent) :
+ QThread(parent),
+ taskSema(),
+ taskLock(),
+ decumaSession(decumaSession),
+ cjk(cjk)
+{
+ abort = false;
+}
+
+T9WriteWorker::~T9WriteWorker()
+{
+ abort = true;
+ taskSema.release();
+ wait();
+}
+
+void T9WriteWorker::addTask(QSharedPointer<T9WriteTask> task)
+{
+ if (task) {
+ QMutexLocker guard(&taskLock);
+ task->moveToThread(this);
+ taskList.append(task);
+ taskSema.release();
+ }
+}
+
+int T9WriteWorker::removeTask(QSharedPointer<T9WriteTask> task)
+{
+ int count = 0;
+ if (task) {
+ QMutexLocker guard(&taskLock);
+ const bool isRunning = taskList.indexOf(task) == 0;
+ if (isRunning) {
+ task->wait();
+ } else if (taskList.removeOne(task)) {
+ ++count;
+ task->runSema.release();
+ }
+ }
+ return count;
+}
+
+int T9WriteWorker::removeAllTasks()
+{
+ idleSema.acquire();
+ QMutexLocker guard(&taskLock);
+ int count = taskList.size();
+ for (QSharedPointer<T9WriteTask> task : taskList) {
+ task->runSema.release();
+ }
+ taskList.clear();
+ idleSema.release();
+ return count;
+}
+
+void T9WriteWorker::waitForAllTasks()
+{
+ while (isRunning()) {
+ idleSema.acquire();
+ QMutexLocker guard(&taskLock);
+ if (taskList.isEmpty()) {
+ idleSema.release();
+ break;
+ }
+ idleSema.release();
+ }
+}
+
+int T9WriteWorker::numberOfPendingTasks()
+{
+ QMutexLocker guard(&taskLock);
+ return taskList.size();
+}
+
+void T9WriteWorker::run()
+{
+ while (!abort) {
+ idleSema.release();
+ taskSema.acquire();
+ if (abort)
+ break;
+ idleSema.acquire();
+ QSharedPointer<T9WriteTask> currentTask;
+ {
+ QMutexLocker guard(&taskLock);
+ if (!taskList.isEmpty()) {
+ currentTask = taskList.front();
+ }
+ }
+ if (currentTask) {
+ currentTask->decumaSession = decumaSession;
+ currentTask->cjk = cjk;
+ currentTask->run();
+ currentTask->runSema.release();
+ QMutexLocker guard(&taskLock);
+ taskList.removeOne(currentTask);
+ }
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/hwr/plugin/t9writeworker_p.h b/src/plugins/cerence/hwr/plugin/t9writeworker_p.h
new file mode 100644
index 00000000..34c29afe
--- /dev/null
+++ b/src/plugins/cerence/hwr/plugin/t9writeworker_p.h
@@ -0,0 +1,230 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef T9WRITEWORKER_H
+#define T9WRITEWORKER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
+
+#include <QThread>
+#include <QSemaphore>
+#include <QMutex>
+#include <QStringList>
+#include <QSharedPointer>
+#include <QPointer>
+#include <QMap>
+#include <QList>
+#include <QElapsedTimer>
+
+#include "cerence_hwr_p.h"
+#include "t9writedictionary_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class T9WriteTask : public QObject
+{
+ Q_OBJECT
+public:
+ explicit T9WriteTask(QObject *parent = nullptr);
+
+ virtual void run() = 0;
+
+ void wait();
+
+ friend class T9WriteWorker;
+
+protected:
+ DECUMA_SESSION *decumaSession;
+ bool cjk;
+
+private:
+ QSemaphore runSema;
+};
+
+class T9WriteDictionaryTask : public T9WriteTask
+{
+ Q_OBJECT
+public:
+ explicit T9WriteDictionaryTask(QSharedPointer<T9WriteAbstractDictionary> dictionary,
+ bool convertDictionary);
+
+ void run();
+
+ QSharedPointer<T9WriteAbstractDictionary> dictionary;
+ QSharedPointer<T9WriteAbstractSource> source;
+ const QString dictionaryFileName;
+ bool convertDictionary;
+
+signals:
+ void completed(QSharedPointer<T9WriteAbstractDictionary> dictionary);
+};
+
+class T9WriteAddArcTask : public T9WriteTask
+{
+ Q_OBJECT
+public:
+ explicit T9WriteAddArcTask(QVirtualKeyboardTrace *trace);
+
+ void run();
+
+private:
+ QVirtualKeyboardTrace *trace;
+};
+
+class T9WriteRecognitionResult
+{
+ Q_DISABLE_COPY(T9WriteRecognitionResult)
+
+public:
+ explicit T9WriteRecognitionResult(int id, int maxResults, int maxCharsPerWord);
+
+ DECUMA_STATUS status;
+ QList<DECUMA_HWR_RESULT> results;
+ DECUMA_UINT16 numResults;
+ int instantGesture;
+ const int id;
+ const int maxResults;
+ const int maxCharsPerWord;
+
+private:
+ QList<DECUMA_UNICODE> _chars;
+ QList<DECUMA_INT16> _symbolChars;
+ QList<DECUMA_INT16> _symbolStrokes;
+};
+
+class T9WriteRecognitionTask : public T9WriteTask
+{
+ Q_OBJECT
+public:
+ explicit T9WriteRecognitionTask(QSharedPointer<T9WriteRecognitionResult> result);
+
+ void run();
+ bool cancelRecognition();
+ bool checkCancelled();
+ int resultId() const;
+
+private:
+ void waitForBackgroundRecognition();
+
+private:
+ QSharedPointer<T9WriteRecognitionResult> result;
+ QMutex stateLock;
+ bool stateCancelled;
+ QElapsedTimer perf;
+};
+
+class T9WriteRecognitionResultsTask : public T9WriteTask
+{
+ Q_OBJECT
+public:
+ explicit T9WriteRecognitionResultsTask(QSharedPointer<T9WriteRecognitionResult> result);
+
+ void run();
+
+signals:
+ void resultsAvailable(const QVariantList &resultList);
+ void recognitionError(int status);
+
+private:
+ QSharedPointer<T9WriteRecognitionResult> result;
+};
+
+class T9WriteDlmWordTask : public T9WriteTask
+{
+ Q_OBJECT
+public:
+ explicit T9WriteDlmWordTask(QSharedPointer<T9WriteAbstractDictionary> dlmDictionary, const QString &word, const QString &stringStart);
+
+ void run();
+
+protected:
+ void persist();
+
+protected:
+ QSharedPointer<T9WriteAbstractDictionary> dlmDictionary;
+ const QString word;
+ const QString stringStart;
+};
+
+class T9WriteDlmRemoveWordTask : public T9WriteDlmWordTask
+{
+ Q_OBJECT
+public:
+ explicit T9WriteDlmRemoveWordTask(QSharedPointer<T9WriteAbstractDictionary> dlmDictionary, const QString &word);
+
+ void run();
+};
+
+class T9WriteWorker : public QThread
+{
+ Q_OBJECT
+public:
+ explicit T9WriteWorker(DECUMA_SESSION *decumaSession, const bool cjk, QObject *parent = nullptr);
+ ~T9WriteWorker();
+
+ void addTask(QSharedPointer<T9WriteTask> task);
+ int removeTask(QSharedPointer<T9WriteTask> task);
+ int removeAllTasks();
+ void waitForAllTasks();
+ int numberOfPendingTasks();
+
+ template <class X>
+ int removeAllTasks() {
+ QMutexLocker guard(&taskLock);
+ int count = 0;
+ for (int i = 0; i < taskList.size();) {
+ QSharedPointer<X> task(taskList[i].objectCast<X>());
+ if (task) {
+ taskList.removeAt(i);
+ ++count;
+ } else {
+ ++i;
+ }
+ }
+ return count;
+ }
+
+ template <class X>
+ void waitForAllTasksOfType() {
+ QSharedPointer<X> task;
+ {
+ QMutexLocker guard(&taskLock);
+ for (int i = taskList.size() - 1; i >= 0; --i) {
+ task = taskList[i].objectCast<X>();
+ if (task)
+ break;
+ }
+ }
+ if (task)
+ task->wait();
+ }
+
+protected:
+ void run();
+
+private:
+ QList<QSharedPointer<T9WriteTask> > taskList;
+ QSemaphore idleSema;
+ QSemaphore taskSema;
+ QMutex taskLock;
+ DECUMA_SESSION *decumaSession;
+ QBasicAtomicInt abort;
+ const bool cjk;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // T9WRITEWORKER_H
diff --git a/src/plugins/cerence/unpack.py b/src/plugins/cerence/unpack.py
new file mode 100644
index 00000000..825d333e
--- /dev/null
+++ b/src/plugins/cerence/unpack.py
@@ -0,0 +1,386 @@
+#!/usr/bin/env python
+# Copyright (C) 2021 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import sys
+import zipfile
+import tempfile
+import shutil
+import fnmatch
+
+#
+# This utility script unpacks the Cerence SDK to appropriate directory
+# structure for Qt Virtual Keyboard.
+#
+# Usage: unpack.py <filename.zip> [<target dir>]
+#
+# - <filename.zip> The Cerence SDK zip.
+# - <target dir> Target directory to unpack files to. The
+# directory can be located out of tree.
+# The default directory is src/plugins/cerence/sdk.
+#
+# The script will overwrite existing files, so be careful.
+#
+
+#
+# Unpack rule list
+#
+# Each list entry is a dictionary consisting of target directory as
+# key and matching pattern as value. The dictionary can be defined in
+# the following ways:
+#
+# Note: The rules within the dictionary are executed in arbitrary order.
+# Add a new list entry if the order is significant.
+#
+# Format:
+# 1. { 'target dir 1': [ 'pattern1', 'pattern2', ... ], 'target dir 2': ... }
+# - Each pattern is matched against the zip file contents. The file is
+# copied to target dir if the pattern matches. Each pattern is handled
+# independent of each other.
+#
+# 2. { 'target dir 1': [ [ 'file group pattern', 'sub pattern1', ... ] ], 'target dir 2': ... }
+# - First the file group pattern is matched against the zip file contents.
+# Then all the sub patterns are matched in the sub directory specified by
+# the first match. If all the sub patterns match, then first match from
+# file group pattern and all the matching files from sub pattterns are copied.
+# The purpose of this option is to copy coupled files, e.g. DLL and LIB
+# files found in the same directory.
+#
+
+T9WRITE_DIR = 't9write/'
+T9WRITE_DATA_DIR = 't9write/data/'
+XT9_DIR = 'xt9/'
+XT9_DATA_DIR = 'xt9/data/'
+
+UNPACK_RULES = [
+
+##############################################################################
+#
+# T9 Write
+#
+##############################################################################
+
+{ # Header files
+T9WRITE_DIR + 'api': [
+ '*/decuma_hwr.h',
+ '*/decuma_hwr_cjk.h',
+ '*/decuma_hwr_types.h',
+ '*/decuma_point.h',
+ '*/decumaBasicTypes.h',
+ '*/decumaBasicTypesMinMax.h',
+ '*/decumaCharacterSetType.h',
+ '*/decumaCurve.h',
+ '*/decumaFunctionalSupport.h',
+ '*/decumaFunctionalSupportCheck.h',
+ '*/decumaLanguages.h',
+ '*/decumaLiteFunctionalSupport.h',
+ '*/decumaPlusFunctionalSupport.h',
+ '*/decumaRuntimeMallocData.h',
+ '*/decumaStatus.h',
+ '*/decumaStorageSpecifiers.h',
+ '*/decumaSymbolCategories.h',
+ '*/decumaUnicodeTypes.h',
+ '*/cerence_handwriting_alpha_version.h',
+ '*/cerence_handwriting_api_version.h',
+ '*/cerence_handwriting_cjk_version.h',
+ '*/xxchApiOem.h',
+ '*/xxchOem.h',
+],
+}, { # Data
+T9WRITE_DATA_DIR + 'arabic': [
+ '*/Arabic/*_le.bin',
+],
+T9WRITE_DATA_DIR + 'hebrew': [
+ '*/Hebrew/*_le.bin',
+],
+T9WRITE_DATA_DIR + 'thai': [
+ '*/*Thai*/*_le.bin',
+],
+T9WRITE_DATA_DIR + '': [
+ '*/*_le.bin',
+ '*/*.hdb',
+ '*/*.phd',
+],
+}, { # Libraries
+# T9 Write ARM Linux 32-bit
+T9WRITE_DIR + 'lib/linux/arm/static/alphabetic': [
+ '*T9Write_Alphabetic*/arm_linux*_32bit/*.a',
+ '*T9Write_Alphabetic*/arm_linux*_32bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/arm/shared/alphabetic': [
+ '*T9Write_Alphabetic*/arm_linux*_32bit/*.so',
+],
+T9WRITE_DIR + 'lib/linux/arm/static/cjk': [
+ '*T9Write_CJK*/arm_linux*_32bit/*.a',
+ '*T9Write_CJK*/arm_linux*_32bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/arm/shared/cjk': [
+ '*T9Write_CJK*/arm_linux*_32bit/*.so',
+],
+# T9 Write ARM Linux 64-bit
+T9WRITE_DIR + 'lib/linux/arm64/static/alphabetic': [
+ '*T9Write_Alphabetic*/arm_linux*_64bit/*.a',
+ '*T9Write_Alphabetic*/arm_linux*_64bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/arm64/shared/alphabetic': [
+ '*T9Write_Alphabetic*/arm_linux*_64bit/*.so',
+],
+T9WRITE_DIR + 'lib/linux/arm64/static/cjk': [
+ '*T9Write_CJK*/arm_linux*_64bit/*.a',
+ '*T9Write_CJK*/arm_linux*_64bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/arm64/shared/cjk': [
+ '*T9Write_CJK*/arm_linux*_64bit/*.so',
+],
+# T9 Write x86 Linux 32-bit
+T9WRITE_DIR + 'lib/linux/x86/static/alphabetic': [
+ '*T9Write_Alphabetic*/i86_linux*_32bit/*.a',
+ '*T9Write_Alphabetic*/i86_linux*_32bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/x86/shared/alphabetic': [
+ '*T9Write_Alphabetic*/i86_linux*_32bit/*.so',
+],
+T9WRITE_DIR + 'lib/linux/x86/static/cjk': [
+ '*T9Write_CJK*/i86_linux*_32bit/*.a',
+ '*T9Write_CJK*/i86_linux*_32bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/x86/shared/cjk': [
+ '*T9Write_CJK*/i86_linux*_32bit/*.so',
+],
+# T9 Write x86 Linux 64-bit
+T9WRITE_DIR + 'lib/linux/x86_64/static/alphabetic': [
+ '*T9Write_Alphabetic*/i86_linux*_64bit/*.a',
+ '*T9Write_Alphabetic*/i86_linux*_64bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/x86_64/shared/alphabetic': [
+ '*T9Write_Alphabetic*/i86_linux*_64bit/*.so',
+],
+T9WRITE_DIR + 'lib/linux/x86_64/static/cjk': [
+ '*T9Write_CJK*/i86_linux*_64bit/*.a',
+ '*T9Write_CJK*/i86_linux*_64bit/*.o',
+],
+T9WRITE_DIR + 'lib/linux/x86_64/shared/cjk': [
+ '*T9Write_CJK*/i86_linux*_64bit/*.so',
+],
+# T9 Write x86 Win32 32-bit
+T9WRITE_DIR + 'lib/win32/x86/static/alphabetic': [
+ '*T9Write_Alphabetic*/i86_win32_32bit/libt9write*.lib',
+],
+T9WRITE_DIR + 'lib/win32/x86/shared/alphabetic': [
+ [ '*T9Write_Alphabetic*/i86_win32_32bit/t9write*.dll', 't9write*.lib' ],
+],
+T9WRITE_DIR + 'lib/win32/x86/static/cjk': [
+ '*T9Write_CJK*/i86_win32_32bit/libt9write*.lib',
+],
+T9WRITE_DIR + 'lib/win32/x86/shared/cjk': [
+ [ '*T9Write_CJK*/i86_win32_32bit/t9write*.dll', 't9write*.lib' ],
+],
+# T9 Write x86 Win32 64-bit
+T9WRITE_DIR + 'lib/win32/amd64/static/alphabetic': [
+ '*T9Write_Alphabetic*/i86_win32_64bit/libt9write*.lib',
+],
+T9WRITE_DIR + 'lib/win32/amd64/shared/alphabetic': [
+ [ '*T9Write_Alphabetic*/i86_win32_64bit/t9write*.dll', 't9write*.lib' ],
+],
+T9WRITE_DIR + 'lib/win32/amd64/static/cjk': [
+ '*T9Write_CJK*/i86_win32_64bit/libt9write*.lib',
+],
+T9WRITE_DIR + 'lib/win32/amd64/shared/cjk': [
+ [ '*T9Write_CJK*/i86_win32_64bit/t9write*.dll', 't9write*.lib' ],
+],
+},
+
+##############################################################################
+#
+# XT9
+#
+##############################################################################
+
+{ # Header files
+XT9_DIR + 'api': [
+ '*/et9api.h',
+ '*/et9awapi.h',
+ '*/et9cpapi.h',
+ '*/et9kapi.h',
+ '*/et9kbdef.h',
+ '*/et9navapi.h',
+ '*/xxet9oem.h',
+],
+}, { # Libraries
+# XT9 ARM Linux 32-bit
+XT9_DIR + 'lib/linux/arm/static': [
+ '*/Xt9/*/arm_linux*_32bit/*.a',
+ '*/Xt9/*/arm_linux*_32bit/*.o',
+],
+XT9_DIR + 'lib/linux/arm/shared': [
+ '*/Xt9/*/arm_linux*_32bit/*.so',
+],
+# XT9 ARM Linux 64-bit
+XT9_DIR + 'lib/linux/arm64/static': [
+ '*/Xt9/*/arm_linux*_64bit/*.a',
+ '*/Xt9/*/arm_linux*_64bit/*.o',
+],
+XT9_DIR + 'lib/linux/arm64/shared': [
+ '*/Xt9/*/arm_linux*_64bit/*.so',
+],
+# XT9 x86 Linux 32-bit
+XT9_DIR + 'lib/linux/x86/static': [
+ '*/Xt9/*/i86_linux*_32bit/*.a',
+ '*/Xt9/*/i86_linux*_32bit/*.o',
+],
+XT9_DIR + 'lib/linux/x86/shared': [
+ '*/Xt9/*/i86_linux*_32bit/*.so',
+],
+# XT9 x86 Linux 64-bit
+XT9_DIR + 'lib/linux/x86_64/static': [
+ '*/Xt9/*/i86_linux*_64bit/*.a',
+ '*/Xt9/*/i86_linux*_64bit/*.o',
+],
+XT9_DIR + 'lib/linux/x86_64/shared': [
+ '*/Xt9/*/i86_linux*_64bit/*.so',
+],
+# XT9 x86 Win32 32-bit
+XT9_DIR + 'lib/win32/x86/static': [
+ '*/Xt9/*/i86_win32_32bit/libxt9*.lib',
+],
+XT9_DIR + 'lib/win32/x86/shared': [
+ [ '*/Xt9/*/i86_win32_32bit/xt9*.dll', 'xt9*.lib' ],
+],
+# XT9 x86 Win32 64-bit
+XT9_DIR + 'lib/win32/amd64/static': [
+ '*/Xt9/*/i86_win32_64bit/libxt9*.lib',
+],
+XT9_DIR + 'lib/win32/amd64/shared': [
+ [ '*/Xt9/*/i86_win32_64bit/xt9*.dll', 'xt9*.lib' ],
+],
+},
+
+##############################################################################
+#
+# XT9 Data
+#
+##############################################################################
+
+{
+XT9_DATA_DIR: [
+ '*/*.ldb',
+],
+},
+
+]
+
+#
+# Blacklist
+#
+# File matching rules for blacklisted items. Matched before UNPACK_RULES.
+#
+
+BLACKLIST_RULES = [
+'*__MACOSX*',
+'*/.DS_Store',
+]
+
+def blacklist(file_list):
+ result = []
+ for file_name in file_list:
+ match = False
+ for blacklist_rule in BLACKLIST_RULES:
+ match = fnmatch.fnmatch(file_name, blacklist_rule)
+ if match:
+ break
+ if not match:
+ result.append(file_name)
+ return result
+
+def unzip(zip_file, target_dir):
+ zip_list = []
+ if os.path.isdir(zip_file):
+ base_dir, sdk_dir = os.path.split(zip_file.replace('\\', '/').rstrip('/'))
+ base_dir_length = len(base_dir) + 1 if base_dir else 0
+ if not 'T9Write' in sdk_dir:
+ print("Error: The input directory name '" + sdk_dir + "' does not contain 'T9Write'.")
+ print("Please unzip the file to a directory named after the zip file and try again.")
+ return zip_list
+ for root, dirs, files in os.walk(zip_file):
+ for file_name in files:
+ sub_dir = root[base_dir_length:]
+ dst_dir = os.path.join(target_dir, sub_dir)
+ if not os.path.exists(dst_dir):
+ os.makedirs(dst_dir)
+ shutil.copy2(os.path.join(root, file_name), dst_dir)
+ os.chmod(os.path.join(dst_dir, file_name), 0o644)
+ zip_list.append(os.path.join(sub_dir, file_name).replace('\\', '/'))
+ return zip_list
+ with zipfile.ZipFile(zip_file, 'r') as z:
+ zip_list = sorted(blacklist(z.namelist()))
+ zip_basename = os.path.splitext(os.path.basename(zip_file))[0]
+ if zip_list and zip_basename in zip_list[0]:
+ zip_basename = ''
+ zip_list = [os.path.join(zip_basename, zip_name).replace('\\', '/') for zip_name in zip_list]
+ z.extractall(os.path.join(target_dir, zip_basename))
+ return zip_list
+
+def match_file_list(file_list, base_dir, fnpattern):
+ result_list = [file_name for file_name in file_list \
+ if fnmatch.fnmatch(file_name, fnpattern) and \
+ os.path.isfile(os.path.join(base_dir, file_name))]
+ for file_name in result_list:
+ file_list.remove(file_name)
+ return result_list
+
+def unpack(zip_list, zip_dir, out_dir):
+ if not zip_list:
+ return
+ for unpack_rules in UNPACK_RULES:
+ process_unpack_rules(zip_list, zip_dir, out_dir, unpack_rules)
+
+def process_unpack_rules(zip_list, zip_dir, out_dir, unpack_rules):
+ for (target_dir, match_rules) in unpack_rules.items():
+ for match_rule in match_rules:
+ # Match
+ match_rule_group = match_rule if isinstance(match_rule, list) else [match_rule]
+ match_group_candidates = [match_file_list(zip_list, zip_dir, match_rule_group[0])]
+ if len(match_rule_group) > 1:
+ while len(match_group_candidates[0]) > 0:
+ match_group0_candidate = match_group_candidates[0][0]
+ all_sub_groups_match = True
+ for sub_group_rule in match_rule_group[1:]:
+ fnpattern = os.path.join(os.path.dirname(match_group0_candidate), sub_group_rule).replace('\\', '/')
+ sub_group_candidates = match_file_list(zip_list, zip_dir, fnpattern)
+ if not sub_group_candidates:
+ all_sub_groups_match = False
+ break
+ match_group_candidates.append(sub_group_candidates)
+ if all_sub_groups_match:
+ match_group_candidates[0] = [match_group0_candidate]
+ break
+ else:
+ match_group_candidates = [match_group_candidates[0][1:]]
+
+ # Copy
+ if match_group_candidates:
+ for match_group_candidate in match_group_candidates:
+ for zip_name in match_group_candidate:
+ dst_dir = os.path.join(out_dir, target_dir)
+ if not os.path.exists(dst_dir):
+ os.makedirs(dst_dir)
+ src = os.path.join(zip_dir, zip_name).replace('\\', '/')
+ dst = os.path.join(dst_dir, os.path.basename(zip_name)).replace('\\', '/')
+ print(zip_name + ' -> ' + dst)
+ shutil.copy2(src, dst)
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print("Usage: %s <filename.zip> [<target dir>]" % os.path.basename(__file__))
+ exit()
+
+ out_dir = os.path.join(sys.path[0], 'sdk') if len(sys.argv) == 2 else sys.argv[2]
+ zip_dir = tempfile.mkdtemp()
+
+ try:
+ unpack(unzip(sys.argv[1], zip_dir), zip_dir, out_dir)
+ except Exception as e:
+ print(e)
+ finally:
+ shutil.rmtree(zip_dir)
diff --git a/src/plugins/cerence/xt9/CMakeLists.txt b/src/plugins/cerence/xt9/CMakeLists.txt
new file mode 100644
index 00000000..7f4bad45
--- /dev/null
+++ b/src/plugins/cerence/xt9/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(plugin)
+add_subdirectory(xt9common)
diff --git a/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/ja_JP/main.qml b/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/ja_JP/main.qml
new file mode 100644
index 00000000..155d801e
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/ja_JP/main.qml
@@ -0,0 +1,673 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; JapaneseInputMethod {}', parent, "japaneseInputMethod")
+ }
+ sourceComponent: {
+ switch (InputContext.inputEngine.inputMode) {
+ case InputEngine.Katakana:
+ return katakana9key
+ case InputEngine.Hiragana:
+ return hiragana9key
+ case InputEngine.FullwidthLatin:
+ return fullWidthQwerty
+ default:
+ return qwerty
+ }
+ }
+ Component {
+ id: hiragana9key
+ KeyboardLayout {
+ KeyboardRow {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ Key {
+ text: "~"
+ alternativeKeys: "~『』「」()〔〕〈〉《》【】"
+ highlighted: true
+ }
+ Key {
+ text: "@"
+ alternativeKeys: "@#$%^&*()=<>,.:;!?~"
+ highlighted: true
+ }
+ InputModeKey {}
+ SymbolModeKey {}
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 3
+ KeyboardRow {
+ FlickKey {
+ text: "あ"
+ alternativeKeys: "あいうえお"
+ }
+ FlickKey {
+ text: "か"
+ alternativeKeys: "かきくけこ"
+ }
+ FlickKey {
+ text: "さ"
+ alternativeKeys: "さしすせそ"
+ }
+ }
+ KeyboardRow {
+ FlickKey {
+ text: "た"
+ alternativeKeys: "たちつてと"
+ }
+ FlickKey {
+ text: "な"
+ alternativeKeys: "なにぬねの"
+ }
+ FlickKey {
+ text: "は"
+ alternativeKeys: "はひふへほ"
+ }
+ }
+ KeyboardRow {
+ FlickKey {
+ text: "ま"
+ alternativeKeys: "まみむめも"
+ }
+ FlickKey {
+ text: "や"
+ alternativeKeys: "や(ゆ)よ"
+ }
+ FlickKey {
+ text: "ら"
+ alternativeKeys: "らりるれろ"
+ }
+ }
+ KeyboardRow {
+ readonly property bool modifyKeyEnabled: InputContext.inputEngine.inputMethod !== null &&
+ InputContext.inputEngine.inputMethod.hasOwnProperty("modifyKeyEnabled") &&
+ InputContext.inputEngine.inputMethod.modifyKeyEnabled
+ FlickKey {
+ visible: parent.modifyKeyEnabled
+ text: "小"
+ alternativeKeys: "小\u3099\u309A"
+ }
+ Key {
+ visible: !parent.modifyKeyEnabled
+ key: Qt.Key_Comma
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ }
+ FlickKey {
+ text: "わ"
+ alternativeKeys: "わをんー〜"
+ }
+ FlickKey {
+ text: "。"
+ alternativeKeys: "。,!:?"
+ }
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ BackspaceKey {}
+ Key {
+ text: "\u3000"
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ EnterKey {}
+ }
+ }
+ }
+ }
+ Component {
+ id: katakana9key
+ KeyboardLayout {
+ KeyboardRow {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ Key {
+ text: "~"
+ alternativeKeys: "~『』「」()〔〕〈〉《》【】"
+ highlighted: true
+ }
+ Key {
+ text: "@"
+ alternativeKeys: "@#$%^&*()=<>,.:;!?~"
+ highlighted: true
+ }
+ InputModeKey {}
+ SymbolModeKey {}
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 3
+ KeyboardRow {
+ FlickKey {
+ text: "ア"
+ alternativeKeys: "アイウエオ"
+ }
+ FlickKey {
+ text: "カ"
+ alternativeKeys: "カキクケコ"
+ }
+ FlickKey {
+ text: "サ"
+ alternativeKeys: "サシスセソ"
+ }
+ }
+ KeyboardRow {
+ FlickKey {
+ text: "タ"
+ alternativeKeys: "タチツテト"
+ }
+ FlickKey {
+ text: "ナ"
+ alternativeKeys: "ナニヌネノ"
+ }
+ FlickKey {
+ text: "ハ"
+ alternativeKeys: "ハヒフヘホ"
+ }
+ }
+ KeyboardRow {
+ FlickKey {
+ text: "マ"
+ alternativeKeys: "マミムメモ"
+ }
+ FlickKey {
+ text: "ヤ"
+ alternativeKeys: "ヤ(ユ)ヨ"
+ }
+ FlickKey {
+ text: "ラ"
+ alternativeKeys: "ラリルレロ"
+ }
+ }
+ KeyboardRow {
+ readonly property bool modifyKeyEnabled: InputContext.inputEngine.inputMethod !== null &&
+ InputContext.inputEngine.inputMethod.hasOwnProperty("modifyKeyEnabled") &&
+ InputContext.inputEngine.inputMethod.modifyKeyEnabled
+ FlickKey {
+ visible: parent.modifyKeyEnabled
+ text: "小"
+ alternativeKeys: "小\u3099\u309A"
+ }
+ Key {
+ visible: !parent.modifyKeyEnabled
+ key: Qt.Key_Comma
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ }
+ FlickKey {
+ text: "ワ"
+ alternativeKeys: "ワヲンー〜"
+ }
+ FlickKey {
+ text: "。"
+ alternativeKeys: "。,!:?"
+ }
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ BackspaceKey {}
+ Key {
+ text: "\u3000"
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ EnterKey {}
+ }
+ }
+ }
+ }
+ Component {
+ id: qwerty
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ EnterKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: fullWidthQwerty
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "\uFF51"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "\uFF57"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "\uFF45"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "\uFF52"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "\uFF54"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "\uFF59"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "\uFF55"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "\uFF49"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "\uFF4F"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "\uFF50"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "\uFF41"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "\uFF53"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "\uFF44"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "\uFF46"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "\uFF47"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "\uFF48"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "\uFF4A"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "\uFF4B"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "\uFF4C"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "\uFF5A"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "\uFF58"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "\uFF43"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "\uFF56"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "\uFF42"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "\uFF4E"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "\uFF4D"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_CN/main.qml b/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_CN/main.qml
new file mode 100644
index 00000000..be10d434
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_CN/main.qml
@@ -0,0 +1,165 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; PinyinInputMethod {}', parent, "main.qml")
+ }
+ sharedLayouts: ['symbols']
+ smallTextVisible: true
+ inputMode: InputEngine.InputMode.Pinyin
+ KeyboardRow {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ Key {
+ text: "~"
+ alternativeKeys: "~『』「」()〔〕〈〉《》【】"
+ highlighted: true
+ }
+ Key {
+ text: "@"
+ alternativeKeys: "@#$%^&*()=<>,.:;!?~"
+ highlighted: true
+ }
+ FillerKey {}
+ SymbolModeKey {}
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 3
+ KeyboardRow {
+ Key {
+ enabled: InputContext.preeditText.length > 0
+ key: Qt.Key_Apostrophe
+ text: "'"
+ displayText: "词"
+ smallText: "1"
+ alternativeKeys: "'1"
+ }
+ Key {
+ key: Qt.Key_2
+ text: "a"
+ displayText: "ABC"
+ smallText: "2"
+ alternativeKeys: "abc2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "d"
+ displayText: "DEF"
+ smallText: "3"
+ alternativeKeys: "def3"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_4
+ text: "g"
+ displayText: "GHI"
+ smallText: "4"
+ alternativeKeys: "ghi4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "j"
+ displayText: "JKL"
+ smallText: "5"
+ alternativeKeys: "jkl5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "m"
+ displayText: "MNO"
+ smallText: "6"
+ alternativeKeys: "mno6"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_7
+ text: "p"
+ displayText: "PQRS"
+ smallText: "7"
+ alternativeKeys: "pqrs7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "t"
+ displayText: "TUV"
+ smallText: "8"
+ alternativeKeys: "tuv8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "w"
+ displayText: "WXYZ"
+ smallText: "9"
+ alternativeKeys: "wxyz9"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Comma
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ }
+ Key {
+ key: Qt.Key_0
+ text: ","
+ alternativeKeys: ",;0"
+ smallText: "0"
+ }
+ Key {
+ text: "。"
+ alternativeKeys: "。?!:"
+ }
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ BackspaceKey {}
+ Key {
+ text: "\u3000"
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ EnterKey {}
+ }
+ }
+}
diff --git a/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_TW/main.qml b/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_TW/main.qml
new file mode 100644
index 00000000..9754bdb5
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/9key_layouts/content/layouts/zh_TW/main.qml
@@ -0,0 +1,161 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; StrokeInputMethod {}', parent, "main.qml")
+ }
+ sharedLayouts: ['symbols']
+ smallTextVisible: true
+ inputMode: InputEngine.InputMode.Stroke
+ KeyboardRow {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.alignment: Qt.AlignHCenter
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ Key {
+ text: "~"
+ alternativeKeys: "~『』「」()〔〕〈〉《》【】"
+ highlighted: true
+ }
+ Key {
+ text: "@"
+ alternativeKeys: "@#$%^&*()=<>,.:;!?~"
+ highlighted: true
+ }
+ FillerKey {}
+ SymbolModeKey {}
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 3
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "\u0001"
+ displayText: "\u4E00"
+ smallText: "1"
+ alternativeKeys: "\u00011"
+ }
+ Key {
+ key: Qt.Key_2
+ text: "\u0002"
+ displayText: "\u4E28"
+ smallText: "2"
+ alternativeKeys: "\u00022"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "\u0003"
+ displayText: "\u4E3F"
+ smallText: "3"
+ alternativeKeys: "\u00033"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_4
+ text: "\u0004"
+ displayText: "\u4E36"
+ smallText: "4"
+ alternativeKeys: "\u00044"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "\u0005"
+ displayText: "\u4E5B"
+ smallText: "5"
+ alternativeKeys: "\u00055"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "\u0006"
+ displayText: "*"
+ smallText: "6"
+ alternativeKeys: "\u00066"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_7
+ text: ","
+ smallText: "7"
+ alternativeKeys: ",7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "!"
+ smallText: "8"
+ alternativeKeys: "!8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "?"
+ smallText: "9"
+ alternativeKeys: "?9"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Comma
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ }
+ Key {
+ key: Qt.Key_0
+ text: ";"
+ alternativeKeys: ";0"
+ smallText: "0"
+ }
+ Key {
+ text: "。"
+ alternativeKeys: "。:"
+ }
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 30
+ KeyboardRow {
+ FillerKey {}
+ }
+ }
+ KeyboardColumn {
+ Layout.fillWidth: false
+ Layout.fillHeight: true
+ Layout.preferredWidth: parent.height / 4 * 1
+ BackspaceKey {}
+ Key {
+ text: "\u3000"
+ displayText: "\u2423"
+ repeat: true
+ showPreview: false
+ key: Qt.Key_Space
+ highlighted: true
+ }
+ HideKeyboardKey {
+ visible: true
+ }
+ EnterKey {}
+ }
+ }
+}
diff --git a/src/plugins/cerence/xt9/plugin/CMakeLists.txt b/src/plugins/cerence/xt9/plugin/CMakeLists.txt
new file mode 100644
index 00000000..4494c68e
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/CMakeLists.txt
@@ -0,0 +1,172 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## QtVirtualKeyboardXt9Plugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(qtvkbcerencext9plugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Cerence.XT9"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbcerencext9plugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ xt9awinputmethod.cpp xt9awinputmethod_p.h
+ xt9awinputmethodprivate.cpp xt9awinputmethodprivate_p.h
+ xt9cpinputmethod.cpp xt9cpinputmethod_p.h
+ xt9cpinputmethodprivate.cpp xt9cpinputmethodprivate_p.h
+ xt9inputmethod.cpp xt9inputmethod_p.h
+ xt9inputmethodprivate.cpp xt9inputmethodprivate_p.h
+ xt9jinputmethod.cpp xt9jinputmethod_p.h
+ xt9jinputmethodprivate.cpp xt9jinputmethodprivate_p.h
+ xt9kinputmethod.cpp xt9kinputmethod_p.h
+ xt9kinputmethodprivate.cpp xt9kinputmethodprivate_p.h
+ xt9thaiinputmethod.cpp xt9thaiinputmethod_p.h
+ xt9thaiinputmethodprivate.cpp xt9thaiinputmethodprivate_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::BundledCerencecommon
+ Qt::BundledXt9Common
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboardPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+set(qmake_virtualkeyboard_xt9_layouts_resource_files)
+if (QT_FEATURE_vkb_lang_ja_JP)
+ list(APPEND qmake_virtualkeyboard_xt9_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ja_JP/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/symbols.qml"
+ "${VKB_LAYOUTS_BASE}/ja_JP/dialpad.fallback"
+ )
+endif()
+if (QT_FEATURE_vkb_lang_ko_KR)
+ list(APPEND qmake_virtualkeyboard_xt9_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ko_KR/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/ko_KR/main.qml"
+ "${VKB_LAYOUTS_BASE}/ko_KR/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/ko_KR/symbols.qml"
+ "${VKB_LAYOUTS_BASE}/ko_KR/dialpad.fallback"
+ )
+endif()
+if (QT_FEATURE_vkb_lang_th_TH)
+ list(APPEND qmake_virtualkeyboard_xt9_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/th_TH/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/th_TH/main.qml"
+ "${VKB_LAYOUTS_BASE}/th_TH/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/th_TH/symbols.qml"
+ "${VKB_LAYOUTS_BASE}/th_TH/dialpad.fallback"
+ )
+endif()
+if (QT_FEATURE_vkb_lang_zh_CN)
+ list(APPEND qmake_virtualkeyboard_xt9_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_CN/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_CN/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_CN/symbols.qml"
+ "${VKB_LAYOUTS_BASE}/zh_CN/dialpad.fallback"
+ )
+endif()
+if (NOT FEATURE_vkb_cerence_xt9_9key_layouts AND QT_FEATURE_vkb_lang_zh_CN)
+ list(APPEND qmake_virtualkeyboard_xt9_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_CN/main.qml"
+ )
+endif()
+if (QT_FEATURE_vkb_lang_zh_TW)
+ list(APPEND qmake_virtualkeyboard_xt9_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_TW/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_TW/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_TW/symbols.qml"
+ "${VKB_LAYOUTS_BASE}/zh_TW/dialpad.fallback"
+ )
+endif()
+
+qt_internal_add_resource(qtvkbcerencext9plugin "qmake_virtualkeyboard_xt9_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${VKB_LAYOUTS_BASE}"
+ FILES
+ ${qmake_virtualkeyboard_xt9_layouts_resource_files}
+)
+
+
+set(qmake_virtualkeyboard_xt9_custom_layouts_resource_files)
+if (QT_FEATURE_vkb_lang_ja_JP AND NOT FEATURE_vkb_cerence_xt9_9key_layouts)
+ list(APPEND qmake_virtualkeyboard_xt9_custom_layouts_resource_files
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/ja_JP/main.qml"
+ )
+endif()
+if (QT_FEATURE_vkb_lang_zh_HK)
+ list(APPEND qmake_virtualkeyboard_xt9_custom_layouts_resource_files
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/zh_HK/digits.fallback"
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/zh_HK/numbers.fallback"
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/zh_HK/symbols.qml"
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/zh_HK/main.qml"
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/zh_HK/dialpad.fallback"
+ )
+endif()
+
+qt_internal_add_resource(qtvkbcerencext9plugin "qmake_virtualkeyboard_xt9_custom_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${CMAKE_CURRENT_SOURCE_DIR}/content/layouts"
+ FILES
+ ${qmake_virtualkeyboard_xt9_custom_layouts_resource_files}
+)
+
+if (QT_FEATURE_vkb_lang_zh_TW AND NOT FEATURE_vkb_cerence_xt9_9key_layouts)
+ # Resources:
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/content/layouts/zh_HK/main.qml ${CMAKE_CURRENT_BINARY_DIR}/content/layouts/zh_TW/main.qml COPYONLY)
+ set(qmake_virtualkeyboard_xt9_cangjie_layouts_resource_files
+ "${CMAKE_CURRENT_BINARY_DIR}/content/layouts/zh_TW/main.qml"
+ )
+
+ qt_internal_add_resource(qtvkbcerencext9plugin "qmake_virtualkeyboard_xt9_cangjie_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${CMAKE_CURRENT_BINARY_DIR}/content/layouts"
+ FILES
+ ${qmake_virtualkeyboard_xt9_cangjie_layouts_resource_files}
+ )
+endif()
+
+if (FEATURE_vkb_cerence_xt9_9key_layouts)
+ if (QT_FEATURE_vkb_lang_zh_CN)
+ list(APPEND qmake_virtualkeyboard_xt9_9key_layouts_resource_files
+ "${CMAKE_CURRENT_SOURCE_DIR}/9key_layouts/content/layouts/zh_CN/main.qml"
+ )
+ endif()
+
+ if (QT_FEATURE_vkb_lang_zh_TW)
+ list(APPEND qmake_virtualkeyboard_xt9_9key_layouts_resource_files
+ "${CMAKE_CURRENT_SOURCE_DIR}/9key_layouts/content/layouts/zh_TW/main.qml"
+ )
+ endif()
+
+ if (QT_FEATURE_vkb_lang_ja_JP)
+ list(APPEND qmake_virtualkeyboard_xt9_9key_layouts_resource_files
+ "${CMAKE_CURRENT_SOURCE_DIR}/9key_layouts/content/layouts/ja_JP/main.qml"
+ )
+ endif()
+
+ qt_internal_add_resource(qtvkbcerencext9plugin "qmake_virtualkeyboard_xt9_9key_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${CMAKE_CURRENT_SOURCE_DIR}/9key_layouts/content/layouts"
+ FILES
+ ${qmake_virtualkeyboard_xt9_9key_layouts_resource_files}
+ )
+endif()
diff --git a/src/plugins/cerence/xt9/plugin/content/layouts/ja_JP/main.qml b/src/plugins/cerence/xt9/plugin/content/layouts/ja_JP/main.qml
new file mode 100644
index 00000000..b837d257
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/content/layouts/ja_JP/main.qml
@@ -0,0 +1,927 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; JapaneseInputMethod {}', parent, "main.qml")
+ }
+ sourceComponent: {
+ switch (InputContext.inputEngine.inputMode) {
+ case InputEngine.Katakana:
+ return katakana
+ case InputEngine.Hiragana:
+ return hiragana
+ case InputEngine.FullwidthLatin:
+ return fullWidthQwerty
+ default:
+ return qwerty
+ }
+ }
+ Component {
+ id: hiragana
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Layout.preferredHeight: 3
+ KeyboardColumn {
+ KeyboardRow {
+ smallTextVisible: true
+ Key {
+ text: "\u306C"
+ }
+ Key {
+ id: normalKey
+ text: "\u3075"
+ }
+ Key {
+ text: "\u3042"
+ alternativeKeys: "\u3042\u3041"
+ }
+ Key {
+ text: "\u3046"
+ alternativeKeys: "\u3046\u3045"
+ }
+ Key {
+ text: "\u3048"
+ alternativeKeys: "\u3048\u3047"
+ }
+ Key {
+ text: "\u304A"
+ alternativeKeys: "\u304A\u3049"
+ }
+ Key {
+ text: "\u3084"
+ alternativeKeys: "\u3084\u3083"
+ }
+ Key {
+ text: "\u3086"
+ alternativeKeys: "\u3086\u3085"
+ }
+ Key {
+ text: "\u3088"
+ alternativeKeys: "\u3088\u3087"
+ }
+ Key {
+ text: "\u308F"
+ alternativeKeys: "\u308F\u3092"
+ }
+ Key {
+ text: "\u307B"
+ }
+ Key {
+ text: "\u3078"
+ }
+ }
+ KeyboardRow {
+ smallTextVisible: true
+ Key {
+ text: "\u305F"
+ }
+ Key {
+ text: "\u3066"
+ }
+ Key {
+ text: "\u3044"
+ alternativeKeys: "\u3044\u3043"
+ }
+ Key {
+ text: "\u3059"
+ }
+ Key {
+ text: "\u304B"
+ }
+ Key {
+ text: "\u3093"
+ }
+ Key {
+ text: "\u306A"
+ }
+ Key {
+ text: "\u306B"
+ }
+ Key {
+ text: "\u3089"
+ }
+ Key {
+ text: "\u305B"
+ }
+ Key {
+ text: "\u3099"
+ }
+ Key {
+ text: "\u309A"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u3061"
+ }
+ Key {
+ text: "\u3068"
+ }
+ Key {
+ text: "\u3057"
+ }
+ Key {
+ text: "\u306F"
+ }
+ Key {
+ text: "\u304D"
+ }
+ Key {
+ text: "\u304F"
+ }
+ Key {
+ text: "\u307E"
+ }
+ Key {
+ text: "\u306E"
+ }
+ Key {
+ text: "\u308A"
+ }
+ Key {
+ text: "\u308C"
+ }
+ Key {
+ text: "\u3051"
+ }
+ Key {
+ text: "\u3080"
+ }
+ }
+ KeyboardRow {
+ smallTextVisible: true
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u3064"
+ alternativeKeys: "\u3064\u3063"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u3055"
+ }
+ Key {
+ text: "\u305D"
+ }
+ Key {
+ text: "\u3072"
+ }
+ Key {
+ text: "\u3053"
+ }
+ Key {
+ text: "\u307F"
+ }
+ Key {
+ text: "\u3082"
+ }
+ Key {
+ text: "\u306D"
+ }
+ Key {
+ text: "\u308B"
+ }
+ Key {
+ text: "\u3081"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u308D"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ InputModeKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ BackspaceKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: katakana
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Layout.preferredHeight: 3
+ KeyboardColumn {
+ KeyboardRow {
+ smallTextVisible: true
+ Key {
+ text: "\u30CC"
+ }
+ Key {
+ id: normalKey
+ text: "\u30D5"
+ }
+ Key {
+ text: "\u30A2"
+ alternativeKeys: "\u30A2\u30A1"
+ }
+ Key {
+ text: "\u30A6"
+ alternativeKeys: "\u30A6\u30A5"
+ }
+ Key {
+ text: "\u30A8"
+ alternativeKeys: "\u30A8\u30A7"
+ }
+ Key {
+ text: "\u30AA"
+ alternativeKeys: "\u30AA\u30A9"
+ }
+ Key {
+ text: "\u30E4"
+ alternativeKeys: "\u30E4\u30E3"
+ }
+ Key {
+ text: "\u30E6"
+ alternativeKeys: "\u30E6\u30E5"
+ }
+ Key {
+ text: "\u30E8"
+ alternativeKeys: "\u30E8\u30E7"
+ }
+ Key {
+ text: "\u30EF"
+ alternativeKeys: "\u30EF\u30F2"
+ }
+ Key {
+ text: "\u30DB"
+ }
+ Key {
+ text: "\u30D8"
+ }
+ }
+ KeyboardRow {
+ smallTextVisible: true
+ Key {
+ text: "\u30BF"
+ }
+ Key {
+ text: "\u30C6"
+ }
+ Key {
+ text: "\u30A4"
+ alternativeKeys: "\u30A4\u30A3"
+ }
+ Key {
+ text: "\u30B9"
+ }
+ Key {
+ text: "\u30AB"
+ }
+ Key {
+ text: "\u30F3"
+ }
+ Key {
+ text: "\u30CA"
+ }
+ Key {
+ text: "\u30CB"
+ }
+ Key {
+ text: "\u30E9"
+ }
+ Key {
+ text: "\u30BB"
+ }
+ Key {
+ text: "\u3099"
+ }
+ Key {
+ text: "\u309A"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "\u30C1"
+ }
+ Key {
+ text: "\u30C8"
+ }
+ Key {
+ text: "\u30B7"
+ }
+ Key {
+ text: "\u30CF"
+ }
+ Key {
+ text: "\u30AD"
+ }
+ Key {
+ text: "\u30AF"
+ }
+ Key {
+ text: "\u30DE"
+ }
+ Key {
+ text: "\u30CE"
+ }
+ Key {
+ text: "\u30EA"
+ }
+ Key {
+ text: "\u30EC"
+ }
+ Key {
+ text: "\u30B1"
+ }
+ Key {
+ text: "\u30E0"
+ }
+ }
+ KeyboardRow {
+ smallTextVisible: true
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u30C4"
+ alternativeKeys: "\u30C4\u30C3"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u30B5"
+ }
+ Key {
+ text: "\u30BD"
+ }
+ Key {
+ text: "\u30D2"
+ }
+ Key {
+ text: "\u30B3"
+ }
+ Key {
+ text: "\u30DF"
+ }
+ Key {
+ text: "\u30E2"
+ }
+ Key {
+ text: "\u30CD"
+ }
+ Key {
+ text: "\u30EB"
+ }
+ Key {
+ text: "\u30E1"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u30ED"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ InputModeKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ BackspaceKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: qwerty
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ Layout.preferredWidth: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: fullWidthQwerty
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_Q
+ text: "\uFF51"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_W
+ text: "\uFF57"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "\uFF45"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "\uFF52"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "\uFF54"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "\uFF59"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "\uFF55"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "\uFF49"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "\uFF4F"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "\uFF50"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ key: Qt.Key_A
+ text: "\uFF41"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ key: Qt.Key_S
+ text: "\uFF53"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "\uFF44"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "\uFF46"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "\uFF47"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "\uFF48"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "\uFF4A"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "\uFF4B"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ key: Qt.Key_L
+ text: "\uFF4C"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Z
+ text: "\uFF5A"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "\uFF58"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "\uFF43"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "\uFF56"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "\uFF42"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "\uFF4E"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "\uFF4D"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ InputModeKey {
+ enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ inputModeNameList: [
+ "半角", // InputEngine.InputMode.Latin
+ "", // InputEngine.InputMode.Numeric
+ "", // InputEngine.InputMode.Dialable
+ "", // InputEngine.InputMode.Pinyin
+ "", // InputEngine.InputMode.Cangjie
+ "", // InputEngine.InputMode.Zhuyin
+ "", // InputEngine.InputMode.Hangul
+ "あ", // InputEngine.InputMode.Hiragana
+ "カ", // InputEngine.InputMode.Katakana
+ "全角", // InputEngine.InputMode.FullwidthLatin
+ ]
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3001"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\u3002"
+ alternativeKeys: "\u3001\uFF01\u3002\uFF1F,.?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/dialpad.fallback b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/dialpad.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/dialpad.fallback
diff --git a/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/digits.fallback b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/digits.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/digits.fallback
diff --git a/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/main.qml b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/main.qml
new file mode 100644
index 00000000..e54efca9
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/main.qml
@@ -0,0 +1,168 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; CangjieInputMethod {}', parent, "main.qml")
+ }
+ sharedLayouts: ['symbols']
+ smallTextVisible: true
+ inputMode: InputEngine.InputMode.Cangjie
+ KeyboardRow {
+ Key {
+ text: "\u624B"
+ }
+ Key {
+ id: normalKey
+ text: "\u7530"
+ }
+ Key {
+ text: "\u6C34"
+ }
+ Key {
+ text: "\u53E3"
+ }
+ Key {
+ text: "\u5EFF"
+ }
+ Key {
+ text: "\u535C"
+ }
+ Key {
+ text: "\u5C71"
+ }
+ Key {
+ text: "\u6208"
+ }
+ Key {
+ text: "\u4EBA"
+ }
+ Key {
+ text: "\u5FC3"
+ }
+ }
+ KeyboardRow {
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ FillerKey {
+ }
+ Key {
+ text: "\u65E5"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ Key {
+ text: "\u5C38"
+ }
+ Key {
+ text: "\u6728"
+ }
+ Key {
+ text: "\u706B"
+ }
+ Key {
+ text: "\u571F"
+ }
+ Key {
+ text: "\u7AF9"
+ }
+ Key {
+ text: "\u5341"
+ }
+ Key {
+ text: "\u5927"
+ }
+ KeyboardRow {
+ Layout.preferredWidth: functionKeyWidth
+ Layout.fillWidth: false
+ Key {
+ text: "\u4E2D"
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ FillerKey {
+ }
+ }
+ }
+ KeyboardRow {
+ ShiftKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ text: "\u91CD"
+ }
+ Key {
+ text: "\u96E3"
+ }
+ Key {
+ text: "\u91D1"
+ }
+ Key {
+ text: "\u5973"
+ }
+ Key {
+ text: "\u6708"
+ }
+ Key {
+ text: "\u5F13"
+ }
+ Key {
+ text: "\u4E00"
+ }
+ BackspaceKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0C"
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ InputModeKey {
+ visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.InputMode.Zhuyin) !== -1
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "\uFF0E"
+ alternativeKeys: "\uFF1B\u3001\uFF0E\uFF1A\u3002?!"
+ smallText: "!?"
+ smallTextVisible: true
+ highlighted: true
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+}
diff --git a/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/numbers.fallback b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/numbers.fallback
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/numbers.fallback
diff --git a/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/symbols.qml b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/symbols.qml
new file mode 100644
index 00000000..3205ae53
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/content/layouts/zh_HK/symbols.qml
@@ -0,0 +1,476 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+KeyboardLayoutLoader {
+ function createInputMethod() {
+ return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; CangjieInputMethod {}', parent, "symbols.qml")
+ }
+ sharedLayouts: ['main']
+ property int page
+ readonly property int numPages: 3
+ sourceComponent: {
+ switch (page) {
+ case 2: return page3
+ case 1: return page2
+ default: return page1
+ }
+ }
+ Component {
+ id: page1
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "1"
+ }
+ Key {
+ id: normalKey
+ key: Qt.Key_2
+ text: "2"
+ }
+ Key {
+ key: Qt.Key_3
+ text: "3"
+ }
+ Key {
+ key: Qt.Key_4
+ text: "4"
+ }
+ Key {
+ key: Qt.Key_5
+ text: "5"
+ }
+ Key {
+ key: Qt.Key_6
+ text: "6"
+ }
+ Key {
+ key: Qt.Key_7
+ text: "7"
+ }
+ Key {
+ key: Qt.Key_8
+ text: "8"
+ }
+ Key {
+ key: Qt.Key_9
+ text: "9"
+ }
+ Key {
+ key: Qt.Key_0
+ text: "0"
+ }
+ }
+ KeyboardRow {
+ Key {
+ key: Qt.Key_1
+ text: "@"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "#"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "%"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "&"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "*"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "_"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "-"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "+"
+ }
+ Key {
+ key: Qt.Key_1
+ text: "("
+ }
+ Key {
+ key: Qt.Key_1
+ text: ")"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "“"
+ }
+ Key {
+ text: "”"
+ }
+ Key {
+ text: "、"
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "~"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "—"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page2
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "½"
+ alternativeKeys: "½¼¾"
+ }
+ Key {
+ id: normalKey
+ text: "'"
+ }
+ Key {
+ text: "/"
+ }
+ Key {
+ text: "\\"
+ }
+ Key {
+ text: "|"
+ }
+ Key {
+ text: "["
+ }
+ Key {
+ text: "]"
+ }
+ Key {
+ text: "{"
+ }
+ Key {
+ text: "}"
+ }
+ Key {
+ text: "·"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "<"
+ }
+ Key {
+ text: ">"
+ }
+ Key {
+ text: ","
+ }
+ Key {
+ text: "."
+ }
+ Key {
+ text: ":"
+ }
+ Key {
+ text: ";"
+ }
+ Key {
+ text: "!"
+ }
+ Key {
+ text: "?"
+ }
+ Key {
+ text: "="
+ }
+ Key {
+ text: "~"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "\""
+ }
+ Key {
+ text: "§"
+ }
+ Key {
+ text: "^"
+ }
+ Key {
+ text: "$"
+ }
+ Key {
+ text: "¥"
+ }
+ Key {
+ text: "€"
+ }
+ Key {
+ text: "£"
+ }
+ Key {
+ text: "¢"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "。"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+ Component {
+ id: page3
+ KeyboardLayout {
+ keyWeight: 160
+ readonly property real normalKeyWidth: normalKey.width
+ readonly property real functionKeyWidth: mapFromItem(normalKey, normalKey.width / 2, 0).x
+ KeyboardRow {
+ Key {
+ text: "\"
+ }
+ Key {
+ id: normalKey
+ text: "/"
+ }
+ Key {
+ text: "("
+ }
+ Key {
+ text: ")"
+ }
+ Key {
+ text: "〔"
+ }
+ Key {
+ text: "〕"
+ }
+ Key {
+ text: "〈"
+ }
+ Key {
+ text: "〉"
+ }
+ Key {
+ text: "《"
+ }
+ Key {
+ text: "》"
+ }
+ }
+ KeyboardRow {
+ Key {
+ text: "→"
+ }
+ Key {
+ text: "←"
+ }
+ Key {
+ text: "↑"
+ }
+ Key {
+ text: "↓"
+ }
+ Key {
+ text: "■"
+ }
+ Key {
+ text: "□"
+ }
+ Key {
+ text: "●"
+ }
+ Key {
+ text: "○"
+ }
+ Key {
+ text: "【"
+ }
+ Key {
+ text: "】"
+ }
+ }
+ KeyboardRow {
+ Key {
+ displayText: (page + 1) + "/" + numPages
+ functionKey: true
+ onClicked: page = (page + 1) % numPages
+ highlighted: true
+ }
+ Key {
+ text: "『"
+ }
+ Key {
+ text: "』"
+ }
+ Key {
+ text: "「"
+ }
+ Key {
+ text: "」"
+ }
+ Key {
+ text: "★"
+ }
+ Key {
+ text: "☆"
+ }
+ Key {
+ text: "◆"
+ }
+ Key {
+ text: "◇"
+ }
+ BackspaceKey {
+ }
+ }
+ KeyboardRow {
+ SymbolModeKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ displayText: "ABC"
+ }
+ ChangeLanguageKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ Key {
+ key: Qt.Key_Comma
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: ","
+ smallText: "\u2699"
+ smallTextVisible: keyboard.isFunctionPopupListAvailable()
+ highlighted: true
+ }
+ SpaceKey {
+ }
+ Key {
+ key: Qt.Key_Period
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ text: "…"
+ highlighted: true
+ }
+ HideKeyboardKey {
+ weight: normalKeyWidth
+ Layout.fillWidth: false
+ }
+ EnterKey {
+ weight: functionKeyWidth
+ Layout.fillWidth: false
+ }
+ }
+ }
+ }
+}
diff --git a/src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp
new file mode 100644
index 00000000..f0794be2
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9awinputmethod.cpp
@@ -0,0 +1,303 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9awinputmethod_p.h"
+#include "xt9awinputmethodprivate_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardobserver.h>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::Xt9AwInputMethod
+ \internal
+*/
+
+Xt9AwInputMethod::Xt9AwInputMethod(Xt9AwInputMethodPrivate &dd, QObject *parent) :
+ Xt9InputMethod(dd, parent)
+{
+}
+
+Xt9AwInputMethod::Xt9AwInputMethod(QObject *parent) :
+ Xt9InputMethod(*new Xt9AwInputMethodPrivate(this), parent)
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> Xt9AwInputMethod::inputModes(const QString &locale)
+{
+ QList<QVirtualKeyboardInputEngine::InputMode> result;
+ bool supportsLatinInputMode = true;
+ switch (QLocale(locale).script()) {
+ case QLocale::GreekScript:
+ result.append(QVirtualKeyboardInputEngine::InputMode::Greek);
+ break;
+ case QLocale::CyrillicScript:
+ if (locale == QLatin1String("uk_UA") || locale == QLatin1String("ru_RU") || locale == QLatin1String("bg_BG")) {
+ result.append(QVirtualKeyboardInputEngine::InputMode::Cyrillic);
+ supportsLatinInputMode = false;
+ }
+ break;
+ case QLocale::ArabicScript:
+ result.append(QVirtualKeyboardInputEngine::InputMode::Arabic);
+ break;
+ case QLocale::HebrewScript:
+ result.append(QVirtualKeyboardInputEngine::InputMode::Hebrew);
+ break;
+ default:
+ break;
+ }
+ if (supportsLatinInputMode)
+ result.append(QVirtualKeyboardInputEngine::InputMode::Latin);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
+ return result;
+}
+
+bool Xt9AwInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_D(Xt9AwInputMethod);
+
+ return d->init(QLocale(locale), inputMode);
+}
+
+bool Xt9AwInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase)
+ return true;
+}
+
+bool Xt9AwInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(modifiers)
+ Q_D(Xt9AwInputMethod);
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ const Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhHiddenText) || inputMethodHints.testFlag(Qt::ImhNoPredictiveText)) {
+ const Qt::KeyboardModifiers mods = (key == Qt::Key_Return) ? Qt::NoModifier : modifiers;
+ inputContext()->sendKeyClick(key, text, mods);
+ return true;
+ }
+
+ switch (key) {
+ case Qt::Key_Backspace: {
+ const int cursorPosition = ic->cursorPosition();
+ if (cursorPosition > 0 && !d->xt9Ime()->hasActiveInput() &&
+ reselect(cursorPosition, QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor))
+ return true;
+ return d->processBackspace();
+ }
+
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Tab:
+ case Qt::Key_Space: {
+ Xt9DeferredSelectionListUpdate deferredSelectionListUpdate(d);
+ if (d->xt9Ime()->hasActiveInput() && !d->selectionList.isEmpty() && d->defaultListIndex >= 0) {
+ if (key == Qt::Key_Space)
+ d->selectionList.replace(d->defaultListIndex, d->selectionList.at(d->defaultListIndex) + QLatin1String(" "));
+ d->selectionListSelectItem(d->defaultListIndex);
+ if (key == Qt::Key_Space) {
+ d->setAutoSpaceAllowed(false);
+ return true;
+ }
+ return false;
+ }
+
+ update();
+ if (key == Qt::Key_Space) {
+ ic->commit(QLatin1String(" "));
+ d->buildSelectionList();
+ return true;
+ }
+ break;
+ }
+
+ case Qt::Key_Shift:
+ break;
+
+ default:
+ if (text.length() > 0) {
+ const bool autoSpaceAllowed = d->xt9Ime()->hasActiveInput() || d->autoSpaceAllowed;
+ if (text.length() == 1) {
+ if (!d->processKeyBySymbol(text.at(0))) {
+ ic->sendKeyClick(key, text, modifiers);
+ d->setAutoSpaceAllowed(autoSpaceAllowed);
+ }
+ return true;
+ } else {
+ update();
+ d->setAutoSpaceAllowed(true);
+ if (autoSpaceAllowed && d->isAutoSpaceAllowed())
+ ic->commit(QLatin1String(" "));
+ ic->commit(text);
+ d->setAutoSpaceAllowed(autoSpaceAllowed);
+ d->buildSelectionList();
+ return true;
+ }
+ }
+ break;
+ }
+
+ return false;
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> Xt9AwInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int Xt9AwInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type)
+ Q_D(Xt9AwInputMethod);
+ return d->selectionList.size();
+}
+
+QVariant Xt9AwInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ Q_UNUSED(type)
+ QVariant result;
+ Q_D(Xt9AwInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->selectionList.at(index));
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ result.setValue(0);
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::Dictionary:
+ {
+ ET9AWWordInfo *wordInfo = nullptr;
+ XT9_API(ET9AWSelLstGetWord, &d->xt9Ime()->sLingInfo, &wordInfo, static_cast<ET9U8>(index));
+ if (wordInfo) {
+ QVirtualKeyboardSelectionListModel::DictionaryType dictionaryType = wordInfo->bWordSource == ET9AWORDSOURCE_CUSTOM ?
+ QVirtualKeyboardSelectionListModel::DictionaryType::User :
+ QVirtualKeyboardSelectionListModel::DictionaryType::Default;
+ result = QVariant(static_cast<int>(dictionaryType));
+ }
+ break;
+ }
+ case QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion:
+ {
+ ET9AWWordInfo *wordInfo = nullptr;
+ XT9_API(ET9AWSelLstGetWord, &d->xt9Ime()->sLingInfo, &wordInfo, static_cast<ET9U8>(index));
+ result = QVariant(wordInfo && wordInfo->bIsDeletable != 0);
+ break;
+ }
+ }
+ return result;
+}
+
+void Xt9AwInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type)
+ Q_D(Xt9AwInputMethod);
+
+ d->selectionListSelectItem(index);
+}
+
+bool Xt9AwInputMethod::selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_D(Xt9AwInputMethod);
+ Q_UNUSED(type)
+
+ if (index <= 0 || index >= d->selectionList.size())
+ return false;
+
+ QString word = d->selectionList.at(index);
+ d->removeFromDictionary(word);
+ d->buildSelectionList();
+
+ return true;
+}
+
+bool Xt9AwInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
+{
+ Q_D(Xt9AwInputMethod);
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (!ic)
+ return false;
+
+ QString word;
+ const QString surroundingText = ic->surroundingText();
+ int replaceFrom = 0;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor)) {
+ for (int i = cursorPosition - 1; i >= 0; --i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ word.insert(0, c);
+ --replaceFrom;
+ }
+
+ while (replaceFrom < 0 && d->isJoiner(word.at(0))) {
+ word.remove(0, 1);
+ ++replaceFrom;
+ }
+ }
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == 0)
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor)) {
+ for (int i = cursorPosition; i < surroundingText.length(); ++i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ word.append(c);
+ }
+
+ while (replaceFrom > -word.length()) {
+ int lastPos = word.length() - 1;
+ if (!d->isJoiner(word.at(lastPos)))
+ break;
+ word.remove(lastPos, 1);
+ }
+ }
+
+ if (word.isEmpty())
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -word.length())
+ return false;
+
+ if (d->isJoiner(word.at(0)))
+ return false;
+
+ if (d->isJoiner(word.at(word.length() - 1)))
+ return false;
+
+ if (!d->reselectWord(word))
+ return false;
+
+ ic->setPreeditText(word, QList<QInputMethodEvent::Attribute>(), replaceFrom, word.length());
+ d->setAutoSpaceAllowed(false);
+
+ return true;
+}
+
+void Xt9AwInputMethod::reset()
+{
+ Q_D(Xt9AwInputMethod);
+
+ d->reset();
+}
+
+void Xt9AwInputMethod::update()
+{
+ Q_D(Xt9AwInputMethod);
+
+ if (d->xt9Ime()->hasActiveInput()) {
+ d->learnWord(d->xt9Ime()->exactWord());
+ inputContext()->commit();
+ }
+
+ reset();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9awinputmethod_p.h b/src/plugins/cerence/xt9/plugin/xt9awinputmethod_p.h
new file mode 100644
index 00000000..a2eb521b
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9awinputmethod_p.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9AWINPUTMETHOD_P_H
+#define XT9AWINPUTMETHOD_P_H
+
+#include "xt9inputmethod_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9AwInputMethodPrivate;
+
+class Xt9AwInputMethod : public Xt9InputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(Xt9AwInputMethod)
+ QML_NAMED_ELEMENT(DefaultInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+protected:
+ Xt9AwInputMethod(Xt9AwInputMethodPrivate &dd, QObject *parent = nullptr);
+
+public:
+ explicit Xt9AwInputMethod(QObject *parent = nullptr);
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale);
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode);
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase);
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists();
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type);
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role);
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index);
+ bool selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index);
+
+ bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags);
+
+ void reset();
+ void update();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp b/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp
new file mode 100644
index 00000000..4bb3c691
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate.cpp
@@ -0,0 +1,147 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9awinputmethodprivate_p.h"
+#include "xt9awinputmethod_p.h"
+#include "xt9languagemap.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionarymanager.h>
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <et9api.h>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9AwInputMethodPrivate::Xt9AwInputMethodPrivate(Xt9InputMethod *q, Xt9Ime *xt9Ime, const QString &aDlmFileName) :
+ Xt9InputMethodPrivate(q, xt9Ime, aDlmFileName)
+{
+}
+
+Xt9AwInputMethodPrivate::Xt9AwInputMethodPrivate(Xt9AwInputMethod *q) :
+ Xt9InputMethodPrivate(q, new Xt9AwIme(this), QStringLiteral("xt9aw.dlm"))
+{
+}
+
+void Xt9AwInputMethodPrivate::uninit()
+{
+ Xt9InputMethodPrivate::uninit();
+
+ defaultDictionaryDisabledConnection = QMetaObject::Connection();
+}
+
+void Xt9AwInputMethodPrivate::bindToSettings()
+{
+ Xt9InputMethodPrivate::bindToSettings();
+
+ if (!defaultDictionaryDisabledConnection)
+ defaultDictionaryDisabledConnection = QObjectPrivate::connect(
+ Settings::instance(), &Settings::defaultDictionaryDisabledChanged,
+ this, &Xt9AwInputMethodPrivate::onDefaultDictionaryDisabledChanged);
+}
+
+void Xt9AwInputMethodPrivate::updateLdb()
+{
+ Xt9InputMethodPrivate::updateLdb();
+
+ xt9Ime()->setLdbEnabled(!Settings::instance()->isDefaultDictionaryDisabled());
+}
+
+void Xt9AwInputMethodPrivate::selectionListSelectItem(int index)
+{
+ Q_Q(Xt9AwInputMethod);
+ Xt9DeferredSelectionListUpdate deferredSelectionListUpdate(this);
+
+ if (index >= 0 && index < selectionList.size()) {
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ const QString &selectedWord = selectionList.at(index);
+
+ // Auto space after next word prediction
+ bool wordIsPunct = selectedWord.length() == 1 && selectedWord.at(0).isPunct();
+ QString exactWord = xt9Ime()->exactWord();
+ if (!wordIsPunct && exactWord.isEmpty() && isAutoSpaceAllowed())
+ ic->commit(QLatin1String(" "));
+
+ // Commit selected word
+ xt9Ime()->selectWord(index, true);
+ ic->commit(selectedWord);
+ }
+
+ reset();
+ setAutoSpaceAllowed(true);
+
+ // Next word prediction
+ buildSelectionList();
+}
+
+bool Xt9AwInputMethodPrivate::reselectWord(const QString &word)
+{
+ ET9STATUS eStatus;
+ ET9U8 totalWords;
+ ET9U8 defaultListIndex;
+ ET9BOOL selectedWasAutomatic;
+ ET9BOOL wasFoundInHistory;
+
+ xt9Ime()->cursorMoved();
+
+ eStatus = XT9_API(ET9AWReselectWord,
+ &xt9Ime()->sLingInfo,
+ &xt9Ime()->sKdbInfo,
+ static_cast<const ET9SYMB *>(word.utf16()),
+ static_cast<ET9U16>(word.length()),
+ ET9AWReselectMode_Edit_Retain_Default,
+ &totalWords,
+ &defaultListIndex,
+ &selectedWasAutomatic,
+ &wasFoundInHistory);
+
+ if (eStatus)
+ return false;
+
+ buildSelectionList();
+
+ return true;
+}
+
+void Xt9AwInputMethodPrivate::learnWord(const QString &word)
+{
+ xt9Ime()->noteWordDone(word);
+}
+
+bool Xt9AwInputMethodPrivate::removeFromDictionary(const QString &word)
+{
+ ET9STATUS eStatus = XT9_API(ET9AWDLMDeleteWord,
+ &xt9Ime()->sLingInfo,
+ static_cast<const ET9SYMB *>(word.utf16()),
+ static_cast<ET9U16>(word.length()));
+
+ return !eStatus;
+}
+
+bool Xt9AwInputMethodPrivate::isJoiner(const QChar &c) const
+{
+ if (Xt9InputMethodPrivate::isJoiner(c))
+ return true;
+
+ if (c.isPunct() || c.isSymbol()) {
+ ushort unicode = c.unicode();
+ if (unicode == Qt::Key_Apostrophe || unicode == Qt::Key_Minus)
+ return true;
+ }
+ return false;
+}
+
+ET9U32 Xt9AwInputMethodPrivate::inputModeToET9InputMode(QVirtualKeyboardInputEngine::InputMode aInputMode) const
+{
+ Q_UNUSED(aInputMode)
+ return ET9AWInputMode_Default;
+}
+
+void Xt9AwInputMethodPrivate::onDefaultDictionaryDisabledChanged()
+{
+ xt9Ime()->setLdbEnabled(!Settings::instance()->isDefaultDictionaryDisabled());
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate_p.h b/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate_p.h
new file mode 100644
index 00000000..d0036691
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9awinputmethodprivate_p.h
@@ -0,0 +1,56 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9AWINPUTMETHODPRIVATE_P_H
+#define XT9AWINPUTMETHODPRIVATE_P_H
+
+#include "xt9inputmethodprivate_p.h"
+#include "xt9awinputmethod_p.h"
+#include "xt9awime.h"
+#include <QMetaObject>
+#include <QByteArray>
+#include <QLocale>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9AwInputMethodPrivate : public Xt9InputMethodPrivate
+{
+public:
+ Q_DECLARE_PUBLIC(Xt9AwInputMethod)
+
+protected:
+ Xt9AwInputMethodPrivate(Xt9InputMethod *q_ptr, Xt9Ime *xt9Ime, const QString &aDlmFileName);
+
+public:
+ Xt9AwInputMethodPrivate(Xt9AwInputMethod *q_ptr);
+
+ inline Xt9AwIme *xt9Ime() const;
+
+ void uninit() override;
+ void bindToSettings() override;
+ void updateLdb() override;
+ void selectionListSelectItem(int index) override;
+
+ bool reselectWord(const QString &word);
+ void learnWord(const QString &word);
+ bool removeFromDictionary(const QString &word);
+
+ bool isJoiner(const QChar &c) const override;
+ ET9U32 inputModeToET9InputMode(QVirtualKeyboardInputEngine::InputMode aInputMode) const override;
+
+ void onDefaultDictionaryDisabledChanged();
+
+private:
+ QMetaObject::Connection defaultDictionaryDisabledConnection;
+};
+
+Xt9AwIme *Xt9AwInputMethodPrivate::xt9Ime() const
+{
+ return static_cast<Xt9AwIme *>(_xt9Ime.data());
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9AWINPUTMETHODPRIVATE_P_H
diff --git a/src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp
new file mode 100644
index 00000000..f8a59334
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9cpinputmethod.cpp
@@ -0,0 +1,165 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9cpinputmethod_p.h"
+#include "xt9cpinputmethodprivate_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardobserver.h>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::Xt9CpInputMethod
+ \internal
+*/
+
+Xt9CpInputMethod::Xt9CpInputMethod(QObject *parent) :
+ Xt9InputMethod(*new Xt9CpInputMethodPrivate(this), parent)
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> Xt9CpInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale)
+ QList<QVirtualKeyboardInputEngine::InputMode> result;
+ result.append(QVirtualKeyboardInputEngine::InputMode::Pinyin);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Cangjie);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Stroke);
+ return result;
+}
+
+bool Xt9CpInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_D(Xt9CpInputMethod);
+
+ return d->init(QLocale(locale), inputMode);
+}
+
+bool Xt9CpInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase)
+ return true;
+}
+
+bool Xt9CpInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(modifiers)
+ Q_D(Xt9CpInputMethod);
+
+ switch (key) {
+ case Qt::Key_Backspace:
+ return d->processBackspace();
+
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Tab:
+ case Qt::Key_Space:
+ if (d->xt9Ime()->hasActiveInput() && !d->selectionList.isEmpty() && d->defaultListIndex >= 0) {
+ selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->defaultListIndex);
+ return key == Qt::Key_Space;
+ }
+
+ update();
+ break;
+
+ case Qt::Key_Shift:
+ break;
+
+ case Qt::Key_Apostrophe:
+ d->cycleTones();
+ return true;
+
+ default:
+ if (text.length() > 0) {
+ if (text.length() == 1) {
+ QString symbs = (d->inputMode == QVirtualKeyboardInputEngine::InputMode::Cangjie) ?
+ d->xt9Ime()->getCangjieConverter()->convertFrom(text) : text;
+ if (!d->processKeyBySymbol(symbs.at(0))) {
+ inputContext()->sendKeyClick(key, text, modifiers);
+ }
+ } else {
+ update();
+ inputContext()->commit(text);
+ }
+ return true;
+ }
+ break;
+ }
+
+ return false;
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> Xt9CpInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int Xt9CpInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type)
+ Q_D(Xt9CpInputMethod);
+ return d->selectionList.size();
+}
+
+QVariant Xt9CpInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ QVariant result;
+ Q_D(Xt9CpInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->selectionList.at(index));
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ result.setValue(0);
+ break;
+ default:
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ break;
+ }
+ return result;
+}
+
+void Xt9CpInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type)
+ Q_D(Xt9CpInputMethod);
+
+ d->selectionListSelectItem(index);
+}
+
+void Xt9CpInputMethod::reset()
+{
+ Q_D(Xt9CpInputMethod);
+
+ d->reset();
+}
+
+void Xt9CpInputMethod::update()
+{
+ Q_D(Xt9CpInputMethod);
+
+ if (d->xt9Ime()->hasActiveInput() && !d->selectionList.isEmpty() && d->defaultListIndex >= 0) {
+ d->selectionListSelectItem(d->defaultListIndex);
+ }
+
+ inputContext()->clear();
+
+ d->reset();
+}
+
+CangjieInputMethod::CangjieInputMethod(QObject *parent) :
+ Xt9CpInputMethod(parent)
+{
+
+}
+
+StrokeInputMethod::StrokeInputMethod(QObject *parent) :
+ Xt9CpInputMethod(parent)
+{
+
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9cpinputmethod_p.h b/src/plugins/cerence/xt9/plugin/xt9cpinputmethod_p.h
new file mode 100644
index 00000000..6486c662
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9cpinputmethod_p.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9CPINPUTMETHOD_P_H
+#define XT9CPINPUTMETHOD_P_H
+
+#include "xt9inputmethod_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9CpInputMethodPrivate;
+
+class Xt9CpInputMethod : public Xt9InputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(Xt9CpInputMethod)
+ QML_NAMED_ELEMENT(PinyinInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit Xt9CpInputMethod(QObject *parent = nullptr);
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale);
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode);
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase);
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists();
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type);
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role);
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index);
+
+ void reset();
+ void update();
+};
+
+class CangjieInputMethod : public Xt9CpInputMethod
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(CangjieInputMethod)
+public:
+ explicit CangjieInputMethod(QObject *parent = nullptr);
+};
+
+class StrokeInputMethod : public Xt9CpInputMethod
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(StrokeInputMethod)
+public:
+ explicit StrokeInputMethod(QObject *parent = nullptr);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate.cpp b/src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate.cpp
new file mode 100644
index 00000000..f42c1981
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate.cpp
@@ -0,0 +1,134 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9cpinputmethodprivate_p.h"
+#include "xt9cpinputmethod_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardobserver.h>
+#include <et9api.h>
+#include "xt9languagemap.h"
+#include <QDateTime>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9CpInputMethodPrivate::Xt9CpInputMethodPrivate(Xt9CpInputMethod *q) :
+ Xt9InputMethodPrivate(q, new Xt9CpIme(this), QStringLiteral("xt9cp.dlm"))
+{
+}
+
+void Xt9CpInputMethodPrivate::cycleTones()
+{
+ if (!xt9Ime()->sWordSymbInfo.wNumSymbs)
+ return;
+
+ const ET9SYMB lastSymb = xt9Ime()->lastSymb();
+ ET9U8 tone = ET9CPSymToCPTone(lastSymb);
+
+ if (lastSymb == ET9CPSYLLABLEDELIMITER || tone) {
+ XT9_API(ET9ClearOneSymb, &xt9Ime()->sWordSymbInfo);
+
+ for (tone++; tone < 6; tone++) {
+ if (xt9Ime()->addTone(static_cast<ET9CPSYMB>(tone + ET9CPTONE1 - 1)))
+ break;
+ }
+
+ if (tone == 6) {
+ for (tone = 1; tone < 6; tone++) {
+ if (xt9Ime()->addTone(static_cast<ET9CPSYMB>(tone + ET9CPTONE1 - 1)))
+ break;
+ }
+ }
+
+ if (tone == 6) {
+ /* cycle back to delimiter */
+ XT9_API(ET9AddExplicitSymb, &xt9Ime()->sWordSymbInfo, ET9CPSYLLABLEDELIMITER, 0, ET9NOSHIFT, ET9_NO_ACTIVE_INDEX);
+ }
+ } else { /* first call, add delim */
+ XT9_API(ET9AddExplicitSymb, &xt9Ime()->sWordSymbInfo, ET9CPSYLLABLEDELIMITER, 0, ET9NOSHIFT, ET9_NO_ACTIVE_INDEX);
+ }
+
+ buildSelectionList();
+ updatePreeditText();
+}
+
+void Xt9CpInputMethodPrivate::updatePreeditText()
+{
+ QString spell = xt9Ime()->spell();
+ if (!spell.isEmpty()) {
+ Q_Q(Xt9InputMethod);
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::Cangjie)
+ spell = xt9Ime()->getCangjieConverter()->convertTo(spell);
+ q->inputContext()->setPreeditText(spell);
+ } else {
+ Xt9InputMethodPrivate::updatePreeditText();
+ }
+}
+
+void Xt9CpInputMethodPrivate::selectionListSelectItem(int index)
+{
+ Q_Q(Xt9CpInputMethod);
+ Xt9DeferredSelectionListUpdate deferredSelectionListUpdate(this);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+
+ ET9STATUS eStatus = xt9Ime()->selectWord(index);
+ if (eStatus == ET9STATUS_SELECTED_CHINESE_COMPONENT) {
+ processKeyBySymbol(selectionList.at(index).at(0));
+ } else {
+ ic->commit(selectionList.at(index));
+ if (eStatus == ET9STATUS_ALL_SYMB_SELECTED) {
+ reset();
+ } else {
+ updatePreeditText();
+ }
+ buildSelectionList();
+ }
+}
+
+bool Xt9CpInputMethodPrivate::isValidInputChar(const QChar &c) const
+{
+ const ushort ucs = c.unicode();
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::Stroke) {
+ return ET9CPIsStrokeSymbol(ucs) || ET9CPIsComponent(&xt9Ime()->sLingInfo, ucs);
+ }
+
+ return Xt9InputMethodPrivate::isValidInputChar(c);
+}
+
+void Xt9CpInputMethodPrivate::reset()
+{
+ xt9Ime()->commitSelection();
+
+ Xt9InputMethodPrivate::reset();
+}
+
+bool Xt9CpInputMethodPrivate::maybeInsertSpaceBeforeNextInputSymbol(QChar symbol) const
+{
+ Q_UNUSED(symbol)
+ return false;
+}
+
+ET9U32 Xt9CpInputMethodPrivate::inputModeToET9InputMode(QVirtualKeyboardInputEngine::InputMode aInputMode) const
+{
+ switch (aInputMode) {
+ case QVirtualKeyboardInputEngine::InputMode::Pinyin:
+ return ET9CPMODE_PINYIN;
+
+ case QVirtualKeyboardInputEngine::InputMode::Cangjie:
+ return ET9CPMODE_CANGJIE;
+
+ case QVirtualKeyboardInputEngine::InputMode::Zhuyin:
+ return ET9CPMODE_BPMF;
+
+ case QVirtualKeyboardInputEngine::InputMode::Stroke:
+ return ET9CPMODE_STROKE;
+
+ default:
+ return ET9CPMODE_PINYIN;
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate_p.h b/src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate_p.h
new file mode 100644
index 00000000..520d37c3
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9cpinputmethodprivate_p.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9CPINPUTMETHODPRIVATE_P_H
+#define XT9CPINPUTMETHODPRIVATE_P_H
+
+#include "xt9inputmethodprivate_p.h"
+#include "xt9cpinputmethod_p.h"
+#include "xt9cpime.h"
+#include <QMetaObject>
+#include <QByteArray>
+#include <QLocale>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9CpInputMethodPrivate : public Xt9InputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(Xt9CpInputMethod)
+public:
+ Xt9CpInputMethodPrivate(Xt9CpInputMethod *q_ptr);
+
+ inline Xt9CpIme *xt9Ime() const;
+
+ void cycleTones();
+ void updatePreeditText() override;
+ void selectionListSelectItem(int index) override;
+ bool isValidInputChar(const QChar &c) const override;
+ void reset() override;
+
+ bool maybeInsertSpaceBeforeNextInputSymbol(QChar symbol) const override;
+ ET9U32 inputModeToET9InputMode(QVirtualKeyboardInputEngine::InputMode aInputMode) const override;
+};
+
+Xt9CpIme *Xt9CpInputMethodPrivate::xt9Ime() const
+{
+ return static_cast<Xt9CpIme *>(_xt9Ime.data());
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9CPINPUTMETHODPRIVATE_P_H
diff --git a/src/plugins/cerence/xt9/plugin/xt9inputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9inputmethod.cpp
new file mode 100644
index 00000000..3211f292
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9inputmethod.cpp
@@ -0,0 +1,30 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9inputmethod_p.h"
+#include "xt9inputmethodprivate_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::Xt9InputMethod
+ \internal
+*/
+
+Xt9InputMethod::Xt9InputMethod(Xt9InputMethodPrivate &dd, QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(dd, parent)
+{
+ Q_D(Xt9InputMethod);
+ d->sysInit();
+}
+
+void Xt9InputMethod::clearInputMode()
+{
+ qCDebug(lcXT9) << "clearInputMode";
+ Q_D(Xt9InputMethod);
+ d->uninit();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9inputmethod_p.h b/src/plugins/cerence/xt9/plugin/xt9inputmethod_p.h
new file mode 100644
index 00000000..76635b2a
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9inputmethod_p.h
@@ -0,0 +1,28 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9INPUTMETHOD_P_H
+#define XT9INPUTMETHOD_P_H
+
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+#include "xt9inputmethodprivate_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9InputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(Xt9InputMethod)
+
+protected:
+ Xt9InputMethod(Xt9InputMethodPrivate &dd, QObject *parent = nullptr);
+
+public:
+ void clearInputMode() override;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/cerence/xt9/plugin/xt9inputmethodprivate.cpp b/src/plugins/cerence/xt9/plugin/xt9inputmethodprivate.cpp
new file mode 100644
index 00000000..2518bbe1
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9inputmethodprivate.cpp
@@ -0,0 +1,603 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9inputmethodprivate_p.h"
+#include "xt9inputmethod_p.h"
+#include "xt9languagemap.h"
+#include "xt9dbfile.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardobserver.h>
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionarymanager.h>
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionary.h>
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <QDateTime>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9InputMethodPrivate::Xt9InputMethodPrivate(Xt9InputMethod *q_ptr, Xt9Ime *xt9Ime, const QString &aDlmFileName) :
+ QVirtualKeyboardAbstractInputMethodPrivate(),
+ q_ptr(q_ptr),
+ _xt9Ime(xt9Ime),
+ inputMode(QVirtualKeyboardInputEngine::InputMode::Latin),
+ selectionListUpdateCount(0),
+ defaultListIndex(ET9_NO_ACTIVE_INDEX),
+ autoSpaceAllowed(false),
+ initDone(false),
+ dlmFileName(aDlmFileName)
+{
+#ifdef HAVE_XT9_RESOURCE
+ Q_INIT_RESOURCE(qmake_cerencecommondata_db);
+#endif
+}
+
+void Xt9InputMethodPrivate::sysInit()
+{
+ xt9Ime()->sysInit();
+ bindToSettings();
+ xt9Ime()->setWorkingDirectory(Settings::instance()->userDataPath());
+ xt9Ime()->removeAllIndexes();
+}
+
+bool Xt9InputMethodPrivate::init(QLocale aLocale, QVirtualKeyboardInputEngine::InputMode aInputMode)
+{
+ initDone = true;
+
+ xt9Ime()->setWorkingDirectory(Settings::instance()->userDataPath());
+
+ bindToDictionaryManager();
+ bindToSettings();
+ bindToKeyboard();
+
+ this->locale = aLocale;
+ this->inputMode = aInputMode;
+
+ updateLdb();
+ updateShiftState();
+ updateLayout();
+ updateDlm();
+ updateDynamicDictionaries();
+
+ return true;
+}
+
+void Xt9InputMethodPrivate::uninit()
+{
+ Q_Q(Xt9InputMethod);
+
+ initDone = false;
+
+ QObject::disconnect(availableDictionariesChangedConnection);
+ QObject::disconnect(activeDictionariesChangedConnection);
+ QObject::disconnect(userDataPathChangedConnection);
+ QObject::disconnect(userDataResetConnection);
+ QObject::disconnect(layoutChangedConnection);
+ QObject::disconnect(shiftActiveChangedConnection);
+ QObject::disconnect(capsLockActiveChangedConnection);
+ QObject::disconnect(inputMethodHintsChangedConnection);
+
+ dlmDeactivate();
+
+ removeAllDynamicDictionaries();
+
+ xt9Ime()->uninit();
+}
+
+void Xt9InputMethodPrivate::bindToDictionaryManager()
+{
+ if (!availableDictionariesChangedConnection)
+ availableDictionariesChangedConnection = QObjectPrivate::connect(QVirtualKeyboardDictionaryManager::instance(),
+ &QVirtualKeyboardDictionaryManager::availableDictionariesChanged,
+ this, &Xt9InputMethodPrivate::onAvailableDynamicDictionariesChanged);
+
+ if (!activeDictionariesChangedConnection)
+ activeDictionariesChangedConnection = QObjectPrivate::connect(QVirtualKeyboardDictionaryManager::instance(),
+ &QVirtualKeyboardDictionaryManager::activeDictionariesChanged,
+ this, &Xt9InputMethodPrivate::onActiveDynamicDictionariesChanged);
+}
+
+void Xt9InputMethodPrivate::bindToSettings()
+{
+ if (!userDataPathChangedConnection)
+ userDataPathChangedConnection = QObjectPrivate::connect(
+ Settings::instance(), &Settings::userDataPathChanged,
+ this, &Xt9InputMethodPrivate::onUserDataPathChanged);
+
+ if (!userDataResetConnection)
+ userDataResetConnection = QObjectPrivate::connect(
+ Settings::instance(), &Settings::userDataReset,
+ this, &Xt9InputMethodPrivate::onUserDataReset);
+}
+
+void Xt9InputMethodPrivate::bindToKeyboard()
+{
+ Q_Q(Xt9InputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return;
+
+ if (!layoutChangedConnection)
+ layoutChangedConnection = QObjectPrivate::connect(
+ ic->keyboardObserver(), &QVirtualKeyboardObserver::layoutChanged,
+ this, &Xt9InputMethodPrivate::updateLayout);
+
+ if (!shiftActiveChangedConnection)
+ shiftActiveChangedConnection = QObjectPrivate::connect(
+ ic, &QVirtualKeyboardInputContext::shiftActiveChanged,
+ this, &Xt9InputMethodPrivate::updateShiftState);
+
+ if (!capsLockActiveChangedConnection)
+ capsLockActiveChangedConnection = QObjectPrivate::connect(
+ ic, &QVirtualKeyboardInputContext::capsLockActiveChanged,
+ this, &Xt9InputMethodPrivate::updateShiftState);
+
+ if (!inputMethodHintsChangedConnection)
+ inputMethodHintsChangedConnection = QObjectPrivate::connect(
+ ic, &QVirtualKeyboardInputContext::inputMethodHintsChanged,
+ this, &Xt9InputMethodPrivate::updateDlm);
+}
+
+void Xt9InputMethodPrivate::dlmActivate()
+{
+ const QString userDataPath = Settings::instance()->userDataPath();
+ const QString dlmFile = QStringLiteral("%1/%2").arg(userDataPath).arg(dlmFileName);
+ if (dlm && dlm->fileName() != dlmFile)
+ dlmDeactivate();
+
+ if (!dlm) {
+ if (!userDataPath.isEmpty()) {
+ qCDebug(lcXT9) << "dlmActivate" << dlmFile;
+ dlm.reset(new Xt9DbFile(dlmFile));
+ void *data = dlm->rwData(xt9Ime()->dlmPreferredSize());
+ qint64 size = dlm->size();
+ if (data != nullptr && size > 0) {
+ if (!xt9Ime()->dlmInit(data, size)) {
+ qCWarning(lcXT9) << "Failed to init DLM file - " << dlmFile;
+ dlm.reset();
+ }
+ } else {
+ qCWarning(lcXT9) << "Failed to open DLM file - " << dlmFile;
+ dlm.reset();
+ }
+ }
+ }
+}
+
+void Xt9InputMethodPrivate::dlmDeactivate()
+{
+ if (dlm) {
+ qCDebug(lcXT9) << "dlmDeactivate";
+ xt9Ime()->dlmInit(nullptr, 0);
+ dlm.reset();
+ }
+}
+
+void Xt9InputMethodPrivate::updateLdb()
+{
+ ET9U32 dwFirstLdbNum = Xt9LanguageMap::languageId(locale);
+ ET9U32 eInputMode = inputModeToET9InputMode(inputMode);
+
+ xt9Ime()->ldbInit(dwFirstLdbNum, ET9PLIDNone, eInputMode);
+}
+
+void Xt9InputMethodPrivate::updateDlm()
+{
+ Q_Q(Xt9InputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (ic == nullptr)
+ return;
+
+ const Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ if (!inputMethodHints.testFlag(Qt::ImhHiddenText) && !inputMethodHints.testFlag(Qt::ImhSensitiveData))
+ dlmActivate();
+ else
+ dlmDeactivate();
+}
+
+void Xt9InputMethodPrivate::removeAllDynamicDictionaries()
+{
+ Q_Q(Xt9InputMethod);
+ xt9Ime()->removeAllIndexes();
+
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+ const QStringList availableDictionaries = dictionaryManager->availableDictionaries();
+ for (const QString &dictionaryName : availableDictionaries) {
+ QVirtualKeyboardDictionary *dictionary = dictionaryManager->dictionary(dictionaryName);
+ dictionary->disconnect(q); // lambdas
+ }
+
+ attachedDynamicDictionaries.clear();
+ dynamicDictionaries.clear();
+ dynamicDictionaryNextId = 0;
+}
+
+void Xt9InputMethodPrivate::updateDynamicDictionaries()
+{
+ onAvailableDynamicDictionariesChanged();
+ onActiveDynamicDictionariesChanged();
+}
+
+void Xt9InputMethodPrivate::updateShiftState()
+{
+ Q_Q(Xt9InputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (ic) {
+ if (ic->isCapsLockActive())
+ xt9Ime()->setCapsLock();
+ else if (ic->isShiftActive())
+ xt9Ime()->setShift();
+ else
+ xt9Ime()->setUnShift();
+ }
+}
+
+bool Xt9InputMethodPrivate::updateLayout()
+{
+ Q_Q(Xt9InputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (ic == nullptr)
+ return false;
+
+ QVariantMap vkbLayout = ic->keyboardObserver()->layout().toMap();
+ ET9U32 dwFirstLdbNum = Xt9LanguageMap::languageId(locale);
+ vkbLayout[Xt9KeyboardGenerator::PRIMARY_ID] = static_cast<int>(dwFirstLdbNum & ET9PLIDMASK);
+ vkbLayout[Xt9KeyboardGenerator::SECONDARY_ID] = static_cast<int>(ET9SKIDNone);
+
+ return xt9Ime()->kdbInit(vkbLayout);
+}
+
+void Xt9InputMethodPrivate::updatePreeditText()
+{
+ Q_Q(Xt9InputMethod);
+
+ QString exactWord = xt9Ime()->exactWord();
+ q->inputContext()->setPreeditText(exactWord);
+}
+
+void Xt9InputMethodPrivate::buildSelectionList()
+{
+ ET9STATUS eStatus = ET9STATUS_NONE;
+ buildSelectionList(eStatus);
+}
+
+void Xt9InputMethodPrivate::buildSelectionList(ET9STATUS &eStatus)
+{
+ ET9U16 gestureValue;
+ Xt9DeferredSelectionListUpdate deferredSelectionListUpdate(this);
+
+ eStatus = ET9STATUS_NONE;
+
+ if (xt9Ime()->exactWord().isEmpty()) {
+ // Check if next word prediction is not allowed
+ Q_Q(Xt9InputMethod);
+ const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhHiddenText) || inputMethodHints.testFlag(Qt::ImhNoPredictiveText)) {
+ selectionList.clear();
+ defaultListIndex = -1;
+ return;
+ }
+
+ // Ensure the buffer context is up-to-date for next word prediction
+ xt9Ime()->cursorMoved();
+ }
+
+ selectionList = xt9Ime()->buildSelectionList(&defaultListIndex, &gestureValue, eStatus);
+}
+
+void Xt9InputMethodPrivate::selectionListUpdate()
+{
+ Q_Q(Xt9InputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, defaultListIndex);
+}
+
+void Xt9InputMethodPrivate::updatePunctuationBreaking()
+{
+ Q_Q(Xt9InputMethod);
+ Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ bool enabled = !inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) &&
+ !inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly);
+
+ if (enabled)
+ XT9_API(ET9SetPunctuationBreaking, &xt9Ime()->sWordSymbInfo);
+ else
+ XT9_API(ET9ClearPunctuationBreaking, &xt9Ime()->sWordSymbInfo);
+}
+
+bool Xt9InputMethodPrivate::processBackspace()
+{
+ if (XT9_API(ET9ClearOneSymb, &xt9Ime()->sWordSymbInfo))
+ return false;
+
+ buildSelectionList();
+ updatePreeditText();
+
+ return true;
+}
+
+bool Xt9InputMethodPrivate::processKeyBySymbol(const QChar &symbol)
+{
+ QString exactWord = xt9Ime()->exactWord();
+ bool addToWord = isValidInputChar(symbol) && (!exactWord.isEmpty() || !isJoiner(symbol));
+ if (!addToWord) {
+ Q_Q(Xt9InputMethod);
+ q->update();
+ return false;
+ }
+
+ if (maybeInsertSpaceBeforeNextInputSymbol(symbol)) {
+ Q_Q(Xt9InputMethod);
+ q->update();
+ q->inputContext()->commit(QLatin1String(" "));
+ }
+
+ if (exactWord.isEmpty()) {
+ updatePunctuationBreaking();
+ updateShiftState();
+ xt9Ime()->cursorMoved();
+ }
+
+ ET9STATUS eStatus;
+ ET9SYMB functionKey = 0;
+ const ET9U8 currIndexInList = defaultListIndex < 0 ?
+ ET9_NO_ACTIVE_INDEX : static_cast<ET9U8>(defaultListIndex);
+ const ET9BOOL bInitialSymCheck = 1;
+ ET9U32 dwTimeMS = static_cast<ET9U32>(QDateTime::currentMSecsSinceEpoch());
+
+ eStatus = XT9_API(ET9KDB_ProcessKeyBySymbol,
+ &xt9Ime()->sKdbInfo,
+ symbol.unicode(),
+ dwTimeMS,
+ currIndexInList,
+ &functionKey,
+ bInitialSymCheck);
+
+ const bool noKey = eStatus == ET9STATUS_NO_KEY;
+ if (noKey) {
+ const ET9INPUTSHIFTSTATE eShiftState = ET9SHIFT_STATE(&xt9Ime()->sWordSymbInfo);
+ eStatus = XT9_API(ET9AddExplicitSymb, &xt9Ime()->sWordSymbInfo, symbol.unicode(), dwTimeMS, eShiftState, 0);
+ } else if (eStatus == ET9STATUS_FULL) {
+ /*
+ Reject input when buffer is full. If we would return false,
+ the input would be added as an explicit symbol to text editor,
+ which is not what is wanted.
+ */
+ return true;
+ } else if (eStatus) {
+ return false;
+ }
+
+ Xt9DeferredSelectionListUpdate deferredSelectionListUpdate(this);
+ buildSelectionList(eStatus);
+ if (eStatus == ET9STATUS_INVALID_INPUT) {
+ /*
+ The symbol rejected as an invalid input:
+ 1. Remove the symbol and rebuild selection list
+ 2. Select the default candidate from selection list and finalize input (update)
+ 3. Start new input with the symbol
+ */
+
+ XT9_API(ET9ClearOneSymb, &xt9Ime()->sWordSymbInfo);
+ buildSelectionList(eStatus);
+
+ Q_Q(Xt9InputMethod);
+ q->update();
+
+ dwTimeMS = static_cast<ET9U32>(QDateTime::currentMSecsSinceEpoch());
+ if (noKey) {
+ const ET9INPUTSHIFTSTATE eShiftState = ET9SHIFT_STATE(&xt9Ime()->sWordSymbInfo);
+ XT9_API(ET9AddExplicitSymb,
+ &xt9Ime()->sWordSymbInfo,
+ symbol.unicode(),
+ dwTimeMS,
+ eShiftState, 0);
+ } else {
+ XT9_API(ET9KDB_ProcessKeyBySymbol,
+ &xt9Ime()->sKdbInfo,
+ symbol.unicode(),
+ dwTimeMS,
+ ET9_NO_ACTIVE_INDEX,
+ &functionKey,
+ bInitialSymCheck);
+ }
+ buildSelectionList();
+ }
+ updatePreeditText();
+
+ return true;
+}
+
+bool Xt9InputMethodPrivate::maybeInsertSpaceBeforeNextInputSymbol(QChar symbol) const
+{
+ Q_UNUSED(symbol)
+
+ QString exactWord = xt9Ime()->exactWord();
+ if (exactWord.isEmpty()) {
+ Q_Q(const Xt9InputMethod);
+
+ if (QVirtualKeyboardInputContext *ic = q->inputContext()) {
+ const QString surroundingText = ic->surroundingText();
+ const int cursorPosition = ic->cursorPosition();
+
+ if (!surroundingText.isEmpty() && cursorPosition == surroundingText.length()) {
+ QChar lastChar = surroundingText.at(cursorPosition - 1);
+
+ if (!lastChar.isSpace() && lastChar != QChar(Qt::Key_Minus) && isAutoSpaceAllowed())
+ return symbol.isLetterOrNumber();
+ }
+ }
+ }
+
+ return false;
+}
+
+void Xt9InputMethodPrivate::setAutoSpaceAllowed(bool value)
+{
+ if (autoSpaceAllowed == value)
+ return;
+
+ autoSpaceAllowed = value;
+ qCDebug(lcXT9) << "setAutoSpaceAllowed():" << value;
+}
+
+bool Xt9InputMethodPrivate::isAutoSpaceAllowed() const
+{
+ Q_Q(const Xt9InputMethod);
+ if (!autoSpaceAllowed)
+ return false;
+ if (q->inputEngine()->inputMode() == QVirtualKeyboardInputEngine::InputMode::Numeric)
+ return false;
+ Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ return !inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) &&
+ !inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly);
+}
+
+bool Xt9InputMethodPrivate::isValidInputChar(const QChar &c) const
+{
+ if (c.isLetterOrNumber())
+ return true;
+ if (isJoiner(c))
+ return true;
+ if (c.isMark())
+ return true;
+ return false;
+}
+
+bool Xt9InputMethodPrivate::isJoiner(const QChar &c) const
+{
+ if (c.isPunct() || c.isSymbol()) {
+ Q_Q(const Xt9InputMethod);
+ if (QVirtualKeyboardInputContext *ic = q->inputContext()) {
+ Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) || inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly))
+ return QStringView(u":/?#[]@!$&'()*+,;=-_.%").contains(c);
+ }
+ }
+ return false;
+}
+
+void Xt9InputMethodPrivate::setShiftState(bool shift, bool caps)
+{
+ if (caps)
+ xt9Ime()->setCapsLock();
+ else if (shift)
+ xt9Ime()->setShift();
+ else
+ xt9Ime()->setUnShift();
+}
+
+void Xt9InputMethodPrivate::reset()
+{
+ xt9Ime()->clearInput();
+
+ if (!selectionList.isEmpty() || defaultListIndex != -1) {
+ Xt9DeferredSelectionListUpdate deferredSelectionListUpdate(this);
+
+ selectionList.clear();
+ defaultListIndex = -1;
+ }
+
+ setAutoSpaceAllowed(false);
+}
+
+void Xt9InputMethodPrivate::onAvailableDynamicDictionariesChanged()
+{
+ Q_Q(Xt9InputMethod);
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+
+ const QStringList availableDictionaries = dictionaryManager->availableDictionaries();
+ for (const QString &dictionaryName : availableDictionaries) {
+ if (!dynamicDictionaries.contains(dictionaryName)) {
+
+ QVirtualKeyboardDictionary *dictionary = dictionaryManager->dictionary(dictionaryName);
+ const quint16 id = static_cast<quint16>(dynamicDictionaryNextId.fetchAndAddRelaxed(1));
+ dynamicDictionaries[dictionaryName] = id;
+
+ xt9Ime()->updateIndex(id, dictionary->contents());
+
+ q->connect(dictionary, &QVirtualKeyboardDictionary::contentsChanged, q, [=]() {
+ xt9Ime()->updateIndex(id, dictionary->contents());
+ if (attachedDynamicDictionaries.contains(dictionaryName))
+ xt9Ime()->mountIndex(id);
+ });
+ }
+ }
+}
+
+void Xt9InputMethodPrivate::onActiveDynamicDictionariesChanged()
+{
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+
+ // Attach
+ const QStringList activeDictionaries = dictionaryManager->activeDictionaries();
+ for (const QString &dictionaryName : activeDictionaries) {
+ if (!attachedDynamicDictionaries.contains(dictionaryName)) {
+ const quint16 id = dynamicDictionaries.value(dictionaryName);
+ xt9Ime()->mountIndex(id);
+ attachedDynamicDictionaries[dictionaryName] = id;
+ }
+ }
+
+ // Detach
+ for (const QString &dictionaryName : attachedDynamicDictionaries.keys()) {
+ if (!activeDictionaries.contains(dictionaryName)) {
+ const quint16 id = attachedDynamicDictionaries[dictionaryName];
+ xt9Ime()->unmountIndex(id);
+ attachedDynamicDictionaries.remove(dictionaryName);
+ }
+ }
+}
+
+void Xt9InputMethodPrivate::onUserDataPathChanged()
+{
+ updateDlm();
+ xt9Ime()->setWorkingDirectory(Settings::instance()->userDataPath());
+}
+
+void Xt9InputMethodPrivate::onUserDataReset()
+{
+ dlmDeactivate();
+ removeAllDynamicDictionaries();
+}
+
+ET9STATUS Xt9InputMethodPrivate::request(ET9_Request *const pRequest)
+{
+ Q_Q(Xt9InputMethod);
+
+ switch (pRequest->eType) {
+ case ET9_REQ_AutoCap:
+ break;
+
+ case ET9_REQ_AutoAccept:
+ selectionListSelectItem(defaultListIndex);
+ break;
+
+ case ET9_REQ_BufferContext:
+ {
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ break;
+
+ const ET9U32 dwContextLen = static_cast<ET9U32>(ic->cursorPosition());
+ const ET9U32 dwStartIndex =
+ dwContextLen <= pRequest->data.sBufferContextInfo.dwMaxBufLen ?
+ 0 : dwContextLen - pRequest->data.sBufferContextInfo.dwMaxBufLen;
+
+ pRequest->data.sBufferContextInfo.dwBufLen = dwContextLen - dwStartIndex;
+ const QString surroundingText = ic->surroundingText();
+
+ memcpy(pRequest->data.sBufferContextInfo.psBuf, surroundingText.utf16() + dwStartIndex,
+ pRequest->data.sBufferContextInfo.dwBufLen * sizeof(ET9SYMB));
+
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return ET9STATUS_NONE;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9inputmethodprivate_p.h b/src/plugins/cerence/xt9/plugin/xt9inputmethodprivate_p.h
new file mode 100644
index 00000000..9020ebd7
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9inputmethodprivate_p.h
@@ -0,0 +1,119 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9INPUTMETHODPRIVATE_P_H
+#define XT9INPUTMETHODPRIVATE_P_H
+
+#include <QtGlobal>
+#include <et9api.h>
+#include <QStringList>
+#include "xt9callbacks.h"
+#include "xt9ime.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardabstractinputmethod_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9InputMethod;
+
+class Xt9InputMethodPrivate : public QVirtualKeyboardAbstractInputMethodPrivate, public Xt9RequestCallback
+{
+public:
+ Q_DECLARE_PUBLIC(Xt9InputMethod)
+
+ Xt9InputMethodPrivate(Xt9InputMethod *q_ptr, Xt9Ime *xt9Ime, const QString &aDlmFileName);
+
+ inline Xt9Ime *xt9Ime() const;
+ void sysInit();
+ bool init(QLocale aLocale, QVirtualKeyboardInputEngine::InputMode aInputMode);
+ virtual void uninit();
+ void bindToDictionaryManager();
+ virtual void bindToSettings();
+ void bindToKeyboard();
+ void dlmActivate();
+ void dlmDeactivate();
+ virtual void updateLdb();
+ void updateDlm();
+ void removeAllDynamicDictionaries();
+ void updateDynamicDictionaries();
+ void updateShiftState();
+ bool updateLayout();
+ virtual void updatePreeditText();
+ void buildSelectionList();
+ void buildSelectionList(ET9STATUS &eStatus);
+ void selectionListUpdate();
+ virtual void selectionListSelectItem(int index) = 0;
+ void updatePunctuationBreaking();
+ bool processBackspace();
+ bool processKeyBySymbol(const QChar &symbol);
+ virtual bool maybeInsertSpaceBeforeNextInputSymbol(QChar symbol) const;
+ void setAutoSpaceAllowed(bool value);
+ virtual bool isAutoSpaceAllowed() const;
+ virtual bool isValidInputChar(const QChar &c) const;
+ virtual bool isJoiner(const QChar &c) const;
+ void setShiftState(bool shift, bool caps);
+ virtual void reset();
+ void onAvailableDynamicDictionariesChanged();
+ void onActiveDynamicDictionariesChanged();
+ void onUserDataPathChanged();
+ void onUserDataReset();
+
+ virtual ET9U32 inputModeToET9InputMode(QVirtualKeyboardInputEngine::InputMode aInputMode) const = 0;
+ ET9STATUS request(ET9_Request *const pRequest) override;
+
+public:
+ Xt9InputMethod *q_ptr;
+ QScopedPointer<Xt9Ime> _xt9Ime;
+ QMetaObject::Connection availableDictionariesChangedConnection;
+ QMetaObject::Connection activeDictionariesChangedConnection;
+ QMetaObject::Connection userDataPathChangedConnection;
+ QMetaObject::Connection userDataResetConnection;
+ QMetaObject::Connection layoutChangedConnection;
+ QMetaObject::Connection shiftActiveChangedConnection;
+ QMetaObject::Connection capsLockActiveChangedConnection;
+ QMetaObject::Connection inputMethodHintsChangedConnection;
+ QLocale locale;
+ QVirtualKeyboardInputEngine::InputMode inputMode;
+ QStringList selectionList;
+ QAtomicInt selectionListUpdateCount;
+ int defaultListIndex;
+ bool autoSpaceAllowed;
+ bool initDone;
+ const QString dlmFileName;
+ QSharedPointer<Xt9DbFile> dlm;
+ QMap<QString, quint16> dynamicDictionaries;
+ QMap<QString, quint16> attachedDynamicDictionaries;
+ QAtomicInt dynamicDictionaryNextId;
+};
+
+Xt9Ime *Xt9InputMethodPrivate::xt9Ime() const
+{
+ return _xt9Ime.data();
+}
+
+class Xt9DeferredSelectionListUpdate
+{
+ Q_DISABLE_COPY(Xt9DeferredSelectionListUpdate)
+public:
+ inline explicit Xt9DeferredSelectionListUpdate(Xt9InputMethodPrivate *d) :
+ d(d)
+ {
+ d->selectionListUpdateCount.ref();
+ }
+
+ inline ~Xt9DeferredSelectionListUpdate()
+ {
+ if (!d->selectionListUpdateCount.deref()) {
+ d->selectionListUpdate();
+ }
+ }
+
+private:
+ Xt9InputMethodPrivate *d;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9INPUTMETHODPRIVATE_P_H
diff --git a/src/plugins/cerence/xt9/plugin/xt9jinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9jinputmethod.cpp
new file mode 100644
index 00000000..6f94f214
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9jinputmethod.cpp
@@ -0,0 +1,104 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9jinputmethod_p.h"
+#include "xt9jinputmethodprivate_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::Xt9JInputMethod
+ \internal
+*/
+
+Xt9JInputMethod::Xt9JInputMethod(QObject *parent) :
+ Xt9AwInputMethod(*new Xt9JInputMethodPrivate(this), parent)
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> Xt9JInputMethod::inputModes(const QString &locale)
+{
+ QList<QVirtualKeyboardInputEngine::InputMode> result;
+ result.append(QVirtualKeyboardInputEngine::InputMode::Hiragana);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Katakana);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Romaji);
+ return result;
+}
+
+bool Xt9JInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ return Xt9AwInputMethod::setInputMode(locale, inputMode);
+}
+
+bool Xt9JInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_D(Xt9JInputMethod);
+
+ switch (key) {
+ case Qt::Key_Right:
+ case Qt::Key_Left:
+ {
+ ET9U16 wCurrLen;
+ ET9STATUS eStatus = XT9_API(ET9GetSegmentationLength, &d->xt9Ime()->sWordSymbInfo, &wCurrLen);
+ if (eStatus == ET9STATUS_INVALID_MODE) {
+ if (key == Qt::Key_Right) {
+
+ } else if (!XT9_API(ET9SetSegmentationLength, &d->xt9Ime()->sWordSymbInfo, wCurrLen)) {
+ d->selectionListUpdate();
+ return true;
+ }
+ } else if (!eStatus) {
+ if (key == Qt::Key_Left) {
+ --wCurrLen;
+ } else {
+ ++wCurrLen;
+ }
+
+ if (!XT9_API(ET9SetSegmentationLength, &d->xt9Ime()->sWordSymbInfo, wCurrLen)) {
+ d->selectionListUpdate();
+ return true;
+ }
+ }
+ break;
+ }
+
+ case 0x5C0F:
+ case 0x3099:
+ case 0x309A:
+ {
+ ET9MODIFIER eModifier;
+ switch (key) {
+ case 0x3099:
+ eModifier = ET9MODIFIER_JPNDAKUTEN_HANDAKUTEN;
+ break;
+ case 0x309A:
+ eModifier = ET9MODIFIER_JPNHANDAKUTEN;
+ break;
+ default:
+ eModifier = ET9MODIFIER_JPNALL;
+ break;
+ }
+ if (!XT9_API(ET9KDB_ModifyCurrentKey, &d->xt9Ime()->sKdbInfo, eModifier)) {
+ d->buildSelectionList();
+ d->updatePreeditText();
+ return true;
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return Xt9AwInputMethod::keyEvent(key, d->xt9Ime()->codeConverter->convertTo(text), modifiers);
+}
+
+bool Xt9JInputMethod::isModifyKeyEnabled() const
+{
+ Q_D(const Xt9JInputMethod);
+ return d->isModifyKeyEnabled;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9jinputmethod_p.h b/src/plugins/cerence/xt9/plugin/xt9jinputmethod_p.h
new file mode 100644
index 00000000..0c4e37c1
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9jinputmethod_p.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9JINPUTMETHOD_P_H
+#define XT9JINPUTMETHOD_P_H
+
+#include "xt9awinputmethod_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9JInputMethodPrivate;
+
+class Xt9JInputMethod : public Xt9AwInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(Xt9JInputMethod)
+ Q_PROPERTY(bool modifyKeyEnabled READ isModifyKeyEnabled NOTIFY modifyKeyEnabledChanged)
+ QML_NAMED_ELEMENT(JapaneseInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit Xt9JInputMethod(QObject *parent = nullptr);
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+
+ bool isModifyKeyEnabled() const;
+
+signals:
+ void modifyKeyEnabledChanged();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate.cpp b/src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate.cpp
new file mode 100644
index 00000000..fb27002b
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate.cpp
@@ -0,0 +1,116 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9jinputmethodprivate_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QTextFormat>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9JInputMethodPrivate::Xt9JInputMethodPrivate(Xt9JInputMethod *q) :
+ Xt9AwInputMethodPrivate(q, new Xt9JIme(this), QStringLiteral("xt9j.dlm")),
+ isModifyKeyEnabled(false)
+{
+}
+
+void Xt9JInputMethodPrivate::updateLdb()
+{
+ Xt9AwInputMethodPrivate::updateLdb();
+ XT9_API(ET9AWSetMultiWordInputProperties, &xt9Ime()->sLingInfo, ET9AW_MWI_SegmentMode_Manual, 1);
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::Katakana) {
+ static const ET9AW_UtilityWord eList[] = {
+ ET9AW_UtilityWord_Katakana_FW,
+ ET9AW_UtilityWord_Hiragana_FW,
+ ET9AW_UtilityWord_Romaji_IC_HW,
+ ET9AW_UtilityWord_Romaji_LC_HW,
+ ET9AW_UtilityWord_Romaji_UC_HW
+ };
+ XT9_API(ET9AWSetUtilityWords, &xt9Ime()->sLingInfo, eList, sizeof(eList) / sizeof(ET9AW_UtilityWord), 2);
+ } else if (inputMode == QVirtualKeyboardInputEngine::InputMode::Hiragana) {
+ static const ET9AW_UtilityWord eList[] = {
+ ET9AW_UtilityWord_Hiragana_FW,
+ ET9AW_UtilityWord_Katakana_FW,
+ ET9AW_UtilityWord_Romaji_IC_HW,
+ ET9AW_UtilityWord_Romaji_LC_HW,
+ ET9AW_UtilityWord_Romaji_UC_HW
+ };
+ XT9_API(ET9AWSetUtilityWords, &xt9Ime()->sLingInfo, eList, sizeof(eList) / sizeof(ET9AW_UtilityWord), 2);
+ } else if (inputMode == QVirtualKeyboardInputEngine::InputMode::Latin) {
+ static const ET9AW_UtilityWord eList[] = {
+ ET9AW_UtilityWord_Romaji_IC_HW,
+ ET9AW_UtilityWord_Hiragana_FW,
+ ET9AW_UtilityWord_Katakana_FW,
+ ET9AW_UtilityWord_Romaji_LC_HW,
+ ET9AW_UtilityWord_Romaji_UC_HW
+ };
+ XT9_API(ET9AWSetUtilityWords, &xt9Ime()->sLingInfo, eList, sizeof(eList) / sizeof(ET9AW_UtilityWord), 2);
+ } else if (inputMode == QVirtualKeyboardInputEngine::InputMode::FullwidthLatin) {
+ static const ET9AW_UtilityWord eList[] = {
+ ET9AW_UtilityWord_Romaji_IC_FW,
+ ET9AW_UtilityWord_Hiragana_FW,
+ ET9AW_UtilityWord_Katakana_FW,
+ ET9AW_UtilityWord_Romaji_LC_HW,
+ ET9AW_UtilityWord_Romaji_UC_HW
+ };
+ XT9_API(ET9AWSetUtilityWords, &xt9Ime()->sLingInfo, eList, sizeof(eList) / sizeof(ET9AW_UtilityWord), 2);
+ }
+}
+
+void Xt9JInputMethodPrivate::updatePreeditText()
+{
+ Q_Q(Xt9JInputMethod);
+
+ QString exactWord = xt9Ime()->exactWord();
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::Katakana) {
+ exactWord = xt9Ime()->codeConverter->convertFrom(exactWord);
+ }
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ QTextCharFormat textFormat;
+ textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, exactWord.length(), textFormat));
+
+ ET9U16 wCurrLen;
+ if (!XT9_API(ET9GetSegmentationLength, &xt9Ime()->sWordSymbInfo, &wCurrLen)) {
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, wCurrLen, 1, QVariant()));
+ }
+
+ setModifyKeyEnabled(!exactWord.isEmpty());
+
+ q->inputContext()->setPreeditText(exactWord, attributes);
+}
+
+ET9U32 Xt9JInputMethodPrivate::inputModeToET9InputMode(QVirtualKeyboardInputEngine::InputMode aInputMode) const
+{
+ switch (aInputMode) {
+ case QVirtualKeyboardInputEngine::InputMode::Latin:
+ return ET9AWInputMode_Transliteration;
+
+ case QVirtualKeyboardInputEngine::InputMode::Romaji:
+ return ET9AWInputMode_RomajiConversion;
+
+ default:
+ break;
+ }
+
+ return ET9AWInputMode_Conversion;
+}
+
+void Xt9JInputMethodPrivate::reset()
+{
+ Xt9AwInputMethodPrivate::reset();
+ setModifyKeyEnabled(false);
+}
+
+void Xt9JInputMethodPrivate::setModifyKeyEnabled(bool value)
+{
+ if (isModifyKeyEnabled != value) {
+ isModifyKeyEnabled = value;
+ Q_Q(Xt9JInputMethod);
+ emit q->modifyKeyEnabledChanged();
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate_p.h b/src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate_p.h
new file mode 100644
index 00000000..c5f2a39c
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9jinputmethodprivate_p.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9JINPUTMETHODPRIVATE_P_H
+#define XT9JINPUTMETHODPRIVATE_P_H
+
+#include "xt9awinputmethodprivate_p.h"
+#include "xt9jinputmethod_p.h"
+#include "xt9jime.h"
+#include <QMetaObject>
+#include <QByteArray>
+#include <QLocale>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9JInputMethodPrivate : public Xt9AwInputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(Xt9JInputMethod)
+public:
+ Xt9JInputMethodPrivate(Xt9JInputMethod *q_ptr);
+
+ inline Xt9JIme *xt9Ime() const;
+
+ void updateLdb() override;
+ void updatePreeditText() override;
+ ET9U32 inputModeToET9InputMode(QVirtualKeyboardInputEngine::InputMode aInputMode) const override;
+ void reset() override;
+
+ void setModifyKeyEnabled(bool value);
+
+ bool isModifyKeyEnabled;
+};
+
+Xt9JIme *Xt9JInputMethodPrivate::xt9Ime() const
+{
+ return static_cast<Xt9JIme *>(_xt9Ime.data());
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9JINPUTMETHODPRIVATE_P_H
diff --git a/src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp
new file mode 100644
index 00000000..956df3cf
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9kinputmethod.cpp
@@ -0,0 +1,44 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kinputmethod_p.h"
+#include "xt9kinputmethodprivate_p.h"
+#include <QVirtualKeyboardInputContext>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::Xt9KInputMethod
+ \internal
+*/
+
+Xt9KInputMethod::Xt9KInputMethod(QObject *parent) :
+ Xt9AwInputMethod(*new Xt9KInputMethodPrivate(this), parent)
+{
+}
+
+bool Xt9KInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_D(Xt9KInputMethod);
+ return Xt9AwInputMethod::keyEvent(key, d->xt9Ime()->codeConverter->convertTo(text), modifiers);
+}
+
+void Xt9KInputMethod::update()
+{
+ Q_D(Xt9KInputMethod);
+
+ if (d->xt9Ime()->hasActiveInput()) {
+ if (d->selectionList.size() > 0) {
+ d->learnWord(d->selectionList.at(0));
+ d->setAutoSpaceAllowed(false);
+ d->selectionListSelectItem(0);
+ } else {
+ inputContext()->commit();
+ reset();
+ }
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9kinputmethod_p.h b/src/plugins/cerence/xt9/plugin/xt9kinputmethod_p.h
new file mode 100644
index 00000000..e952163d
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9kinputmethod_p.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KINPUTMETHOD_P_H
+#define XT9KINPUTMETHOD_P_H
+
+#include "xt9awinputmethod_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KInputMethodPrivate;
+
+class Xt9KInputMethod : public Xt9AwInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(Xt9KInputMethod)
+ QML_NAMED_ELEMENT(HangulInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit Xt9KInputMethod(QObject *parent = nullptr);
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+
+ void update() override;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate.cpp b/src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate.cpp
new file mode 100644
index 00000000..a471a1fa
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate.cpp
@@ -0,0 +1,28 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kinputmethodprivate_p.h"
+#include <QVirtualKeyboardInputContext>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9KInputMethodPrivate::Xt9KInputMethodPrivate(Xt9KInputMethod *q) :
+ Xt9AwInputMethodPrivate(q, new Xt9KIme(this), QStringLiteral("xt9k.dlm"))
+{
+}
+
+void Xt9KInputMethodPrivate::updatePreeditText()
+{
+ ET9KHangulWord hangul;
+ ET9STATUS eStatus = XT9_API(ET9KBuildHangul, &xt9Ime()->sLingInfo, &hangul);
+ if (!eStatus && hangul.wLen) {
+ Q_Q(Xt9KInputMethod);
+ q->inputContext()->setPreeditText(QString::fromUtf16(reinterpret_cast<const char16_t*>(hangul.sString), hangul.wLen));
+ } else {
+ Xt9AwInputMethodPrivate::updatePreeditText();
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate_p.h b/src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate_p.h
new file mode 100644
index 00000000..73efb971
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9kinputmethodprivate_p.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KINPUTMETHODPRIVATE_P_H
+#define XT9KINPUTMETHODPRIVATE_P_H
+
+#include "xt9awinputmethodprivate_p.h"
+#include "xt9kinputmethod_p.h"
+#include "xt9kime.h"
+#include <QMetaObject>
+#include <QByteArray>
+#include <QLocale>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KInputMethodPrivate : public Xt9AwInputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(Xt9KInputMethod)
+public:
+ Xt9KInputMethodPrivate(Xt9KInputMethod *q_ptr);
+
+ inline Xt9KIme *xt9Ime() const;
+
+ void updatePreeditText();
+};
+
+Xt9KIme *Xt9KInputMethodPrivate::xt9Ime() const
+{
+ return static_cast<Xt9KIme *>(_xt9Ime.data());
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KINPUTMETHODPRIVATE_P_H
diff --git a/src/plugins/cerence/xt9/plugin/xt9thaiinputmethod.cpp b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethod.cpp
new file mode 100644
index 00000000..ed8d4abd
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethod.cpp
@@ -0,0 +1,32 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9thaiinputmethod_p.h"
+#include "xt9thaiinputmethodprivate_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::Xt9ThaiInputMethod
+ \internal
+*/
+
+Xt9ThaiInputMethod::Xt9ThaiInputMethod(QObject *parent) :
+ Xt9AwInputMethod(*new Xt9ThaiInputMethodPrivate(this), parent)
+{
+}
+
+bool Xt9ThaiInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ const bool isMark = text.length() == 2 && text.at(0) == QLatin1Char(' ');
+ if (isMark) {
+ const QString mark(text.right(1));
+ return Xt9AwInputMethod::keyEvent(static_cast<Qt::Key>(mark.at(0).unicode()),
+ mark, modifiers);
+ }
+ return Xt9AwInputMethod::keyEvent(key, text, modifiers);
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9thaiinputmethod_p.h b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethod_p.h
new file mode 100644
index 00000000..b7665cb1
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethod_p.h
@@ -0,0 +1,30 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9THAIINPUTMETHOD_P_H
+#define XT9THAIINPUTMETHOD_P_H
+
+#include "xt9awinputmethod_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9ThaiInputMethodPrivate;
+
+class Xt9ThaiInputMethod : public Xt9AwInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(Xt9ThaiInputMethod)
+ QML_NAMED_ELEMENT(ThaiInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit Xt9ThaiInputMethod(QObject *parent = nullptr);
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate.cpp b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate.cpp
new file mode 100644
index 00000000..a8e1240a
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9thaiinputmethodprivate_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9ThaiInputMethodPrivate::Xt9ThaiInputMethodPrivate(Xt9ThaiInputMethod *q) :
+ Xt9AwInputMethodPrivate(q, new Xt9AwIme(this), QStringLiteral("xt9aw.dlm"))
+{
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate_p.h b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate_p.h
new file mode 100644
index 00000000..8f68d563
--- /dev/null
+++ b/src/plugins/cerence/xt9/plugin/xt9thaiinputmethodprivate_p.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9THAIINPUTMETHODPRIVATE_P_H
+#define XT9THAIINPUTMETHODPRIVATE_P_H
+
+#include "xt9awinputmethodprivate_p.h"
+#include "xt9thaiinputmethod_p.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9ThaiInputMethodPrivate : public Xt9AwInputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(Xt9ThaiInputMethod)
+public:
+ Xt9ThaiInputMethodPrivate(Xt9ThaiInputMethod *q_ptr);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KINPUTMETHODPRIVATE_P_H
diff --git a/src/plugins/cerence/xt9/xt9common/CMakeLists.txt b/src/plugins/cerence/xt9/xt9common/CMakeLists.txt
new file mode 100644
index 00000000..08a6b1d6
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/CMakeLists.txt
@@ -0,0 +1,144 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from xt9common.pro.
+
+#####################################################################
+## BundledXt9Common Generic Library:
+#####################################################################
+
+qt_internal_add_3rdparty_library(BundledXt9Common
+ QMAKE_LIB_NAME xt9common
+ STATIC
+ SOURCES
+ xt9awime.cpp xt9awime.h
+ xt9callbacks.h
+ xt9cpime.cpp xt9cpime.h
+ xt9ime.cpp xt9ime.h
+ xt9jime.cpp xt9jime.h
+ xt9kdb.cpp xt9kdb.h
+ xt9kdbarea.cpp xt9kdbarea.h
+ xt9kdbelement.cpp xt9kdbelement.h
+ xt9kdbkey.cpp xt9kdbkey.h
+ xt9kdblayout.cpp xt9kdblayout.h
+ xt9keyboardgenerator.cpp xt9keyboardgenerator.h
+ xt9kime.cpp xt9kime.h
+ xt9languagemap.cpp xt9languagemap.h
+ PUBLIC_INCLUDE_DIRECTORIES
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ LIBRARIES
+ Qt::BundledCerencecommon
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::VirtualKeyboard
+ Cerence::XT9
+)
+
+## Scopes:
+#####################################################################
+
+if(NOT FEATURE_vkb_cerence_static)
+ qt_copy_or_install(
+ FILES "${CERENCE_XT9_BINARIES}"
+ DESTINATION "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
+ )
+endif()
+
+#### Keys ignored in scope 3:.:../..:../../cerence.pri:CERENCE_SDK_ROOT_ISEMPTY:
+# EXT_CERENCE_SDK_ROOT = "$$(CERENCE_SDK_ROOT)"
+
+#### Keys ignored in scope 4:.:../..:../../cerence.pri:NOT EXT_CERENCE_SDK_ROOT_ISEMPTY:
+# CERENCE_SDK_ROOT = "$$EXT_CERENCE_SDK_ROOT"
+
+#### Keys ignored in scope 6:.:../..:../../cerence.pri:CERENCE_SDK_ROOT_ISEMPTY:
+# CERENCE_SDK_ROOT = "$$PWD/sdk"
+
+#### Keys ignored in scope 9:.:../..:../../cerence.pri:QT_ARCH___equals___arm:
+# CERENCE_SHARED_LIB_PATH = "lib/linux/arm/shared"
+# CERENCE_STATIC_LIB_PATH = "lib/linux/arm/static"
+
+#### Keys ignored in scope 11:.:../..:../../cerence.pri:QT_ARCH___equals___arm64:
+# CERENCE_SHARED_LIB_PATH = "lib/linux/arm64/shared"
+# CERENCE_STATIC_LIB_PATH = "lib/linux/arm64/static"
+
+#### Keys ignored in scope 13:.:../..:../../cerence.pri:QT_ARCH___equals___x86_64:
+# CERENCE_SHARED_LIB_PATH = "lib/linux/x86_64/shared"
+# CERENCE_STATIC_LIB_PATH = "lib/linux/x86_64/static"
+
+#### Keys ignored in scope 15:.:../..:../../cerence.pri:QT_ARCH___equals___x86 OR QT_ARCH___equals___i386:
+# CERENCE_SHARED_LIB_PATH = "lib/linux/x86/shared"
+# CERENCE_STATIC_LIB_PATH = "lib/linux/x86/static"
+
+#### Keys ignored in scope 18:.:../..:../../cerence.pri:QT_ARCH___equals___x86_64:
+# CERENCE_SHARED_LIB_PATH = "lib/win32/x86_64/shared"
+# CERENCE_STATIC_LIB_PATH = "lib/win32/x86_64/static"
+
+#### Keys ignored in scope 19:.:../..:../../cerence.pri:else:
+# CERENCE_SHARED_LIB_PATH = "lib/win32/x86/shared"
+# CERENCE_STATIC_LIB_PATH = "lib/win32/x86/static"
+
+#### Keys ignored in scope 21:.:../..:../../cerence.pri:WIN32:
+# result = "$$1/*.obj"
+
+#### Keys ignored in scope 22:.:../..:../../cerence.pri:result_ISEMPTY:
+# result = "$$1/*.lib"
+
+#### Keys ignored in scope 23:.:../..:../../cerence.pri:else:
+# result = "$$1/*.o"
+
+#### Keys ignored in scope 24:.:../..:../../cerence.pri:result_ISEMPTY:
+# result = "$$1/*.a"
+
+#### Keys ignored in scope 26:.:../..:../../cerence.pri:WIN32:
+# result = "$$1/*.lib"
+
+#### Keys ignored in scope 27:.:../..:../../cerence.pri:else:
+# result = "$$1/*.so"
+
+#### Keys ignored in scope 29:.:../..:../../cerence.pri:WIN32:
+# result = "$$1/*.dll"
+
+#### Keys ignored in scope 30:.:../..:../../cerence.pri:else:
+# result = "$$1/*.so"
+
+#### Keys ignored in scope 31:.:../..:../../cerence.pri:EXISTS _ss_CERENCE_HWR_INCLUDEPATH/decuma_hwr.h:
+# CERENCE_HWR_ALPHABETIC_FOUND = "1"
+
+#### Keys ignored in scope 32:.:../..:../../cerence.pri:EXISTS _ss_CERENCE_HWR_INCLUDEPATH/decuma_hwr_cjk.h:
+# CERENCE_HWR_CJK_FOUND = "1"
+
+#### Keys ignored in scope 35:.:../..:../../cerence.pri:NOT cerence-hwr-static:
+# CERENCE_HWR_ALPHABETIC_LIBS = "$$findSharedLibrary($$CERENCE_SDK_ROOT/t9write/$$CERENCE_SHARED_LIB_PATH/alphabetic)"
+
+#### Keys ignored in scope 36:.:../..:../../cerence.pri:NOT CERENCE_HWR_ALPHABETIC_LIBS_ISEMPTY:
+# CERENCE_HWR_ALPHABETIC_BINS = "$$findSharedBinary($$CERENCE_SDK_ROOT/t9write/$$CERENCE_SHARED_LIB_PATH/alphabetic)"
+
+#### Keys ignored in scope 37:.:../..:../../cerence.pri:else:
+# CERENCE_HWR_ALPHABETIC_LIBS = "$$findStaticLibrary($$CERENCE_SDK_ROOT/t9write/$$CERENCE_STATIC_LIB_PATH/alphabetic)"
+
+#### Keys ignored in scope 39:.:../..:../../cerence.pri:NOT cerence-hwr-static:
+# CERENCE_HWR_CJK_LIBS = "$$findSharedLibrary($$CERENCE_SDK_ROOT/t9write/$$CERENCE_SHARED_LIB_PATH/cjk)"
+
+#### Keys ignored in scope 40:.:../..:../../cerence.pri:NOT CERENCE_HWR_CJK_LIBS_ISEMPTY:
+# CERENCE_HWR_CJK_BINS = "$$findSharedBinary($$CERENCE_SDK_ROOT/t9write/$$CERENCE_SHARED_LIB_PATH/cjk)"
+
+#### Keys ignored in scope 41:.:../..:../../cerence.pri:else:
+# CERENCE_HWR_CJK_LIBS = "$$findStaticLibrary($$CERENCE_SDK_ROOT/t9write/$$CERENCE_STATIC_LIB_PATH/cjk)"
+
+#### Keys ignored in scope 42:.:../..:../../cerence.pri:(CERENCE_HWR_ALPHABETIC_FOUND EQUAL 1) AND NOT CERENCE_HWR_ALPHABETIC_LIBS_ISEMPTY:
+# CERENCE_HWR_FOUND = "1"
+
+#### Keys ignored in scope 43:.:../..:../../cerence.pri:(CERENCE_HWR_CJK_FOUND EQUAL 1) AND NOT CERENCE_HWR_CJK_LIBS_ISEMPTY:
+# CERENCE_HWR_FOUND = "1"
+
+#### Keys ignored in scope 44:.:../..:../../cerence.pri:EXISTS _ss_XT9_INCLUDEPATH/et9api.h:
+# XT9_FOUND = "1"
+
+#### Keys ignored in scope 46:.:../..:../../cerence.pri:NOT QT_FEATURE_xt9_static:
+# XT9_LIBS = "$$findSharedLibrary($$CERENCE_SDK_ROOT/xt9/$$CERENCE_SHARED_LIB_PATH)"
+
+#### Keys ignored in scope 47:.:../..:../../cerence.pri:NOT XT9_LIBS_ISEMPTY:
+# XT9_BINS = "$$findSharedBinary($$CERENCE_SDK_ROOT/xt9/$$CERENCE_SHARED_LIB_PATH)"
+
+#### Keys ignored in scope 48:.:../..:../../cerence.pri:else:
+# XT9_LIBS = "$$findStaticLibrary($$CERENCE_SDK_ROOT/xt9/$$CERENCE_STATIC_LIB_PATH)"
diff --git a/src/plugins/cerence/xt9/xt9common/xt9awime.cpp b/src/plugins/cerence/xt9/xt9common/xt9awime.cpp
new file mode 100644
index 00000000..3beeb05f
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9awime.cpp
@@ -0,0 +1,112 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9awime.h"
+#include "xt9languagemap.h"
+#include "xt9dbfile.h"
+#include <QStandardPaths>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9AwIme::Xt9AwIme(Xt9RequestCallback *requestCallback, Xt9KeyboardGenerator::CodeConverter *codeConverter) :
+ Xt9Ime(requestCallback, codeConverter)
+{
+}
+
+void Xt9AwIme::sysInit()
+{
+ Xt9Ime::sysInit();
+ memset(&sLingInfo, 0, sizeof(sLingInfo));
+ memset(&sLingCmnInfo, 0, sizeof(sLingCmnInfo));
+ XT9_API(ET9AWSysInit, &sLingInfo, &sLingCmnInfo, &sWordSymbInfo, 1, this);
+}
+
+bool Xt9AwIme::ldbInit(ET9U32 dwFirstLdbNum, ET9U32 dwSecondLdbNum, ET9U32 eInputMode)
+{
+ ET9STATUS eStatus;
+
+ eStatus = XT9_API(ET9AWEnableDBs, &sLingInfo, ET9ALLDBMASK);
+
+ XT9_API(ET9AWLdbInit, &sLingInfo, &ET9AWLdbReadData);
+ eStatus = XT9_API(ET9AWLdbSetLanguage, &sLingInfo, dwFirstLdbNum, dwSecondLdbNum, 1, static_cast<ET9AWInputMode>(eInputMode));
+
+ //XT9_API(ET9AWClearNextWordPrediction, &sLingInfo);
+ XT9_API(ET9AWClearAutoAppendInList, &sLingInfo);
+
+ return !eStatus;
+}
+
+void Xt9AwIme::setLdbEnabled(bool enabled)
+{
+ XT9_API(ET9AWEnableDBs, &sLingInfo, ET9ALLDBMASK);
+
+ if (!enabled)
+ XT9_API(ET9AWDisableDBs, &sLingInfo, ET9STATELDBENABLEDMASK);
+}
+
+qint64 Xt9AwIme::dlmPreferredSize() const
+{
+ return ET9AWDLM_SIZE_NORMAL;
+}
+
+bool Xt9AwIme::dlmInit(void *data, qint64 size)
+{
+ ET9STATUS eStatus;
+
+ eStatus = XT9_API(ET9AWDLMInit, &sLingInfo, static_cast<_ET9DLM_info *>(data), static_cast<ET9U32>(size), nullptr);
+
+ return !eStatus;
+}
+
+QStringList Xt9AwIme::buildSelectionList(int *defaultListIndex, ET9U16 *gestureValue, ET9STATUS &eStatus)
+{
+ ET9U8 totalWords;
+ ET9U8 listIndex;
+
+ eStatus = XT9_API(ET9AWSelLstBuild, &sLingInfo, &totalWords, &listIndex, gestureValue);
+
+ if (defaultListIndex)
+ *defaultListIndex = listIndex == ET9_NO_ACTIVE_INDEX || exactWord().isEmpty() ? -1 : static_cast<int>(listIndex);
+
+ if (eStatus)
+ return QStringList();
+
+ QStringList list;
+ for (ET9U8 i = 0; i < totalWords; ++i) {
+ ET9AWWordInfo *wordInfo = nullptr;
+ eStatus = ET9AWSelLstGetWord(&sLingInfo, &wordInfo, i);
+ if (eStatus || !wordInfo)
+ return QStringList();
+
+ const QString word = QString::fromUtf16(reinterpret_cast<const char16_t *>(wordInfo->sWord), wordInfo->wWordLen);
+
+ list.append(word);
+ }
+
+ return list;
+}
+
+void Xt9AwIme::selectWord(int index, bool isUserExplicitChoice)
+{
+ if (index < 0)
+ return;
+
+ qCDebug(lcXT9) << "selectWord" << index;
+
+ XT9_API(ET9AWSelLstSelWord, &sLingInfo, static_cast<ET9U8>(index), isUserExplicitChoice);
+}
+
+void Xt9AwIme::noteWordDone(const QString &word)
+{
+ XT9_API(ET9AWNoteWordDone, &sLingInfo, word.utf16(), static_cast<ET9U32>(word.length()), 0);
+}
+
+ET9STATUS Xt9AwIme::ET9AWLdbReadData(ET9AWLingInfo *pLingInfo, ET9U8 *ET9FARDATA *ppbSrc, ET9U32 *pdwSizeInBytes)
+{
+ return reinterpret_cast<Xt9AwIme *>(pLingInfo->pPublicExtension)->ldbReadData(pLingInfo->pLingCmnInfo->dwLdbNum, ppbSrc, pdwSizeInBytes);
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9awime.h b/src/plugins/cerence/xt9/xt9common/xt9awime.h
new file mode 100644
index 00000000..e65e0ba1
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9awime.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9AWIME_H
+#define XT9AWIME_H
+
+#include "xt9ime.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9AwIme : public Xt9Ime
+{
+public:
+ Xt9AwIme(Xt9RequestCallback *requestCallback, Xt9KeyboardGenerator::CodeConverter *codeConverter = nullptr);
+
+ void sysInit() override;
+ bool ldbInit(ET9U32 dwFirstLdbNum, ET9U32 dwSecondLdbNum = ET9PLIDNone, ET9U32 eInputMode = 0) override;
+ void setLdbEnabled(bool enabled);
+ qint64 dlmPreferredSize() const override;
+ bool dlmInit(void *data, qint64 size) override;
+
+ QStringList buildSelectionList(int *defaultListIndex, ET9U16 *gestureValue, ET9STATUS &eStatus) override;
+ void selectWord(int index, bool isUserExplicitChoice);
+
+ void noteWordDone(const QString &word);
+
+private:
+ static ET9STATUS ET9AWLdbReadData(ET9AWLingInfo *pLingInfo, ET9U8 *ET9FARDATA *ppbSrc, ET9U32 *pdwSizeInBytes);
+
+public:
+ ET9AWLingInfo sLingInfo;
+ ET9AWLingCmnInfo sLingCmnInfo;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9AWIME_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9callbacks.h b/src/plugins/cerence/xt9/xt9common/xt9callbacks.h
new file mode 100644
index 00000000..1cb75973
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9callbacks.h
@@ -0,0 +1,21 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9CPALLBACKS_H
+#define XT9CPALLBACKS_H
+
+#include <et9api.h>
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9RequestCallback {
+public:
+ virtual ET9STATUS request(ET9_Request *const pRequest) = 0;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9CPALLBACKS_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9cpime.cpp b/src/plugins/cerence/xt9/xt9common/xt9cpime.cpp
new file mode 100644
index 00000000..5dff7495
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9cpime.cpp
@@ -0,0 +1,284 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9cpime.h"
+#include "xt9languagemap.h"
+#include "xt9dbfile.h"
+#include "xt9callbacks.h"
+#include <QStandardPaths>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+static const ET9SYMB CANGJIE_MAP[] = {
+ 0x65E5, 0x6708, 0x91D1, 0x6728, 0x6C34, 0x706B, 0x571F, 0x7AF9, 0x6208,
+ 0x5341, 0x5927, 0x4E2D, 0x4E00, 0x5F13, 0x4EBA, 0x5FC3, 0x624B, 0x53E3,
+ 0x5C38, 0x5EFF, 0x5C71, 0x5973, 0x7530, 0x96E3, 0x535C };
+static const size_t CANGJIE_MAP_SIZE = sizeof(CANGJIE_MAP) / sizeof(ET9SYMB);
+static const ET9SYMB CANGJIE_WILDCARD_SYMB = 0x91CD;
+
+static ET9SYMB GetCangjieMappingSymb(ET9SYMB symb)
+{
+ if (symb == CANGJIE_WILDCARD_SYMB)
+ return ET9CPCANGJIEWILDCARD;
+
+ for (size_t i = 0; i < CANGJIE_MAP_SIZE; i++) {
+ if (CANGJIE_MAP[i] == symb)
+ return static_cast<ET9SYMB>(i + 'a');
+ }
+
+ return symb;
+}
+
+static ET9SYMB GetCangjieSymb(ET9SYMB symb)
+{
+ if (symb == ET9CPCANGJIEWILDCARD)
+ return CANGJIE_WILDCARD_SYMB;
+
+ if (ET9CPIsCangJieLowerSymbol(symb))
+ return CANGJIE_MAP[symb - 'a'];
+
+ if (ET9CPIsCangJieUpperSymbol(symb))
+ return CANGJIE_MAP[symb - 'A'];
+
+ return symb;
+}
+
+class CangjieConverter : public Xt9KeyboardGenerator::CodeConverter {
+public:
+ QString convertTo(const QString &codes) const override
+ {
+ QVector<ushort> cangjieBuf(codes.size());
+ for (int i = 0; i < codes.size(); ++i) {
+ cangjieBuf[i] = GetCangjieSymb(codes.at(i).unicode());
+ }
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(cangjieBuf.constData()), cangjieBuf.size());
+ }
+
+ QString convertFrom(const QString &codes) const override
+ {
+ QVector<ushort> cangjieBuf(codes.size());
+ for (int i = 0; i < codes.size(); ++i) {
+ cangjieBuf[i] = GetCangjieMappingSymb(codes.at(i).unicode());
+ }
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(cangjieBuf.constData()), cangjieBuf.size());
+ }
+};
+
+Q_GLOBAL_STATIC(CangjieConverter, cangjieConverter)
+
+Xt9CpIme::Xt9CpIme(Xt9RequestCallback *requestCallback) :
+ Xt9Ime(requestCallback)
+{
+}
+
+Xt9KeyboardGenerator::CodeConverter *Xt9CpIme::getCangjieConverter()
+{
+ return cangjieConverter;
+}
+
+void Xt9CpIme::sysInit()
+{
+ Xt9Ime::sysInit();
+ memset(&sLingInfo, 0, sizeof(sLingInfo));
+ XT9_API(ET9CPSysInit, &sLingInfo, &sWordSymbInfo, this);
+}
+
+bool Xt9CpIme::ldbInit(ET9U32 dwFirstLdbNum, ET9U32 dwSecondLdbNum, ET9U32 eInputMode)
+{
+ ET9STATUS eStatus;
+ Q_UNUSED(dwSecondLdbNum)
+
+ eStatus = XT9_API(ET9CPLdbInit, &sLingInfo, dwFirstLdbNum, &ET9CPLdbReadData);
+ if (!eStatus) {
+ XT9_API(ET9CPSetInputMode, &sLingInfo, static_cast<ET9CPMode>(eInputMode));
+ XT9_API(ET9CPClearComponent, &sLingInfo);
+ XT9_API(ET9CPSetBilingual, &sLingInfo);
+ }
+
+ return !eStatus;
+}
+
+qint64 Xt9CpIme::dlmPreferredSize() const
+{
+ return ET9CPDLM_SIZE_NORMAL;
+}
+
+bool Xt9CpIme::dlmInit(void *data, qint64 size)
+{
+ ET9STATUS eStatus;
+
+ eStatus = XT9_API(ET9CPDLMInit, &sLingInfo, static_cast<ET9CPDLM_info *>(data), static_cast<ET9U32>(size), nullptr);
+
+ return !eStatus;
+}
+
+QString Xt9CpIme::exactWord(int *wordCompLen)
+{
+ QString exactWord = Xt9Ime::exactWord(wordCompLen);
+
+ ET9CPPhrase phrase;
+ ET9CPSpell spell;
+ ET9U8 selSymbCount = 0;
+ if (!XT9_API(ET9CPGetSelection, &sLingInfo, &phrase, &spell, &selSymbCount) && selSymbCount)
+ exactWord.remove(0, static_cast<int>(selSymbCount));
+
+ replaceSpecialSymbol(exactWord);
+
+ return exactWord;
+}
+
+void Xt9CpIme::replaceSpecialSymbol(QString &exactWord) const
+{
+ for (int i = 0; i < exactWord.length(); ++i) {
+ ET9SYMB symb = exactWord.at(i).unicode();
+ if (ET9CPSymToCPTone(symb)) {
+ exactWord.replace(i, 1, QChar(symb - ET9CPTONE1 + '1'));
+ } else if (ET9CPIsStrokeSymbol(symb)) {
+ int strokeIndex = symb - ET9CPSTROKE1;
+ static const ushort STROKE_TABLE[ET9CPSTROKEWILDCARD - ET9CPSTROKE1 + 1] = {
+ 0x4E00,
+ 0x4E28,
+ 0x4E3F,
+ 0x4E36,
+ 0x4E5B,
+ '*'
+ };
+ exactWord.replace(i, 1, QChar(STROKE_TABLE[strokeIndex]));
+ }
+ }
+}
+
+QString Xt9CpIme::spell()
+{
+ ET9STATUS eStatus;
+ ET9CPSpell spell;
+
+ eStatus = XT9_API(ET9CPGetSpell, &sLingInfo, &spell);
+ if (eStatus == ET9STATUS_NEED_SELLIST_BUILD) {
+ ET9U16 gestureValue;
+ eStatus = XT9_API(ET9CPBuildSelectionList, &sLingInfo, &gestureValue);
+ if (eStatus)
+ return QString();
+
+ eStatus = XT9_API(ET9CPGetSpell, &sLingInfo, &spell);
+ if (eStatus)
+ return QString();
+ } else if (eStatus) {
+ return QString();
+ }
+
+ QString result = QString::fromUtf16(reinterpret_cast<const char16_t *>(spell.pSymbs), spell.bLen);
+
+ replaceSpecialSymbol(result);
+
+ return result;
+}
+
+QStringList Xt9CpIme::buildSelectionList(int *defaultListIndex, ET9U16 *gestureValue, ET9STATUS &eStatus)
+{
+ ET9U16 totalWords;
+
+ eStatus = XT9_API(ET9CPBuildSelectionList, &sLingInfo, gestureValue);
+
+ if (defaultListIndex)
+ *defaultListIndex = -1;
+
+ if (eStatus)
+ return QStringList();
+
+ eStatus = XT9_API(ET9CPGetPhraseCount, &sLingInfo, &totalWords);
+
+ if (defaultListIndex && totalWords > 0 && !exactWord().isEmpty())
+ *defaultListIndex = 0;
+
+ QStringList list;
+ for (ET9U16 i = 0; i < totalWords; ++i) {
+ ET9CPPhrase phrase;
+ ET9CPSpell spell;
+ ET9CPPhraseSource phraseSource;
+ eStatus = ET9CPGetPhrase(&sLingInfo, i, &phrase, &spell, &phraseSource);
+ if (eStatus)
+ return QStringList();
+
+ const QString word = QString::fromUtf16(reinterpret_cast<const char16_t *>(phrase.pSymbs), phrase.bLen);
+
+ list.append(word);
+ }
+
+ return list;
+}
+
+ET9STATUS Xt9CpIme::selectWord(int index)
+{
+ ET9CPPhrase phrase;
+ ET9CPSpell spell;
+ ET9CPPhraseSource phraseSource;
+ ET9STATUS eStatus;
+
+ qCDebug(lcXT9) << "selectWord" << index;
+
+ eStatus = XT9_API(ET9CPGetPhrase, &sLingInfo, static_cast<ET9U16>(index), &phrase, &spell, &phraseSource);
+ if (!eStatus) {
+ eStatus = XT9_API(ET9CPSelectPhrase, &sLingInfo, static_cast<ET9U16>(index), &spell);
+ }
+
+ return eStatus;
+}
+
+void Xt9CpIme::cursorMoved()
+{
+ const ET9U32 maxBufLen = 456;
+ ET9SYMB buffer[maxBufLen];
+ ET9_Request request;
+
+ request.eType = ET9_REQ_BufferContext;
+ request.data.sBufferContextInfo.psBuf = buffer;
+ request.data.sBufferContextInfo.dwMaxBufLen = maxBufLen;
+ request.data.sBufferContextInfo.dwBufLen = static_cast<ET9U32>(-1);
+
+ _requestCallback->request(&request);
+
+ if (request.data.sBufferContextInfo.dwBufLen != static_cast<ET9U32>(-1))
+ ET9CPSetContext(&sLingInfo, request.data.sBufferContextInfo.psBuf, request.data.sBufferContextInfo.dwBufLen);
+ else
+ ET9CPSetContext(&sLingInfo, request.data.sBufferContextInfo.psBuf, 0);
+}
+
+void Xt9CpIme::commitSelection()
+{
+ XT9_API(ET9CPCommitSelection, &sLingInfo);
+}
+
+ET9SYMB Xt9CpIme::lastSymb()
+{
+ const QString word = Xt9Ime::exactWord();
+ const int wordLength = word.length();
+ return wordLength > 0 ? word.at(wordLength - 1).unicode() : 0;
+}
+
+bool Xt9CpIme::addTone(ET9CPSYMB symb)
+{
+ ET9STATUS eStatus;
+
+ eStatus = XT9_API(ET9AddExplicitSymb, sLingInfo.Base.pWordSymbInfo, symb, 0, ET9NOSHIFT, ET9_NO_ACTIVE_INDEX);
+ if (eStatus)
+ return false;
+
+ eStatus = XT9_API(ET9CPBuildSelectionList, &sLingInfo, nullptr);
+ if (eStatus) {
+ XT9_API(ET9ClearOneSymb, sLingInfo.Base.pWordSymbInfo);
+ return false;
+ }
+
+ return true;
+}
+
+ET9STATUS Xt9CpIme::ET9CPLdbReadData(ET9CPLingInfo *pLingInfo, ET9U8 *ET9FARDATA *ppbSrc, ET9U32 *pdwSizeInBytes)
+{
+ return reinterpret_cast<Xt9CpIme *>(pLingInfo->pPublicExtension)->ldbReadData(pLingInfo->dwLdbNum, ppbSrc, pdwSizeInBytes);
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9cpime.h b/src/plugins/cerence/xt9/xt9common/xt9cpime.h
new file mode 100644
index 00000000..09be859f
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9cpime.h
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9CPIME_H
+#define XT9CPIME_H
+
+#include "xt9ime.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9CpIme : public Xt9Ime
+{
+public:
+ Xt9CpIme(Xt9RequestCallback *requestCallback);
+
+ static Xt9KeyboardGenerator::CodeConverter *getCangjieConverter();
+
+ void sysInit() override;
+ bool ldbInit(ET9U32 dwFirstLdbNum, ET9U32 dwSecondLdbNum = ET9PLIDNone, ET9U32 eInputMode = 0) override;
+ qint64 dlmPreferredSize() const override;
+ bool dlmInit(void *data, qint64 size) override;
+
+ QString exactWord(int *wordCompLen = nullptr) override;
+ void replaceSpecialSymbol(QString &exactWord) const;
+ QString spell();
+ QStringList buildSelectionList(int *defaultListIndex, ET9U16 *gestureValue, ET9STATUS &eStatus) override;
+ ET9STATUS selectWord(int index);
+
+ void cursorMoved() override;
+
+ void commitSelection();
+
+ ET9SYMB lastSymb();
+ bool addTone(ET9CPSYMB symb);
+
+private:
+ static ET9STATUS ET9CPLdbReadData(ET9CPLingInfo *pLingInfo, ET9U8 *ET9FARDATA *ppbSrc, ET9U32 *pdwSizeInBytes);
+
+public:
+ ET9CPLingInfo sLingInfo;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9CPIME_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9ime.cpp b/src/plugins/cerence/xt9/xt9common/xt9ime.cpp
new file mode 100644
index 00000000..aac647b1
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9ime.cpp
@@ -0,0 +1,304 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9ime.h"
+#include "xt9callbacks.h"
+#include "xt9languagemap.h"
+#include "xt9dbfile.h"
+#include <QStandardPaths>
+#include <QDir>
+#include <QLoggingCategory>
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionarymanager.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(lcXT9, "qt.virtualkeyboard.xt9")
+
+Xt9Ime::Xt9Ime(Xt9RequestCallback *requestCallback, Xt9KeyboardGenerator::CodeConverter *codeConverter) :
+ _requestCallback(requestCallback),
+ codeConverter(codeConverter)
+{
+}
+
+void Xt9Ime::sysInit()
+{
+ if (!ldbManager)
+ ldbManager.reset(new Xt9LdbManager());
+ memset(&sWordSymbInfo, 0, sizeof(sWordSymbInfo));
+ memset(&sKdbInfo, 0, sizeof(sKdbInfo));
+ memset(&sSearchEngine, 0, sizeof(sSearchEngine));
+ XT9_API(ET9WordSymbInit, &sWordSymbInfo, 1, ET9Request, this);
+ XT9_API(ET9NAV_Init, &sSearchEngine, &sWordSymbInfo);
+}
+
+bool Xt9Ime::kdbInit(const QVariantMap &vkbLayout)
+{
+ ET9STATUS eStatus;
+
+ keyboardGenerator.reset(new Xt9KeyboardGenerator(vkbLayout, codeConverter));
+
+ const ET9U32 dwFirstKdbNum = static_cast<ET9U32>(vkbLayout[Xt9KeyboardGenerator::PRIMARY_ID].toInt());
+
+ eStatus = XT9_API(ET9KDB_Init,
+ &sKdbInfo,
+ &sWordSymbInfo,
+ dwFirstKdbNum,
+ 0,
+ &ET9KDBLoad,
+ &ET9KDBRequest,
+ this);
+
+ return !eStatus;
+}
+
+void Xt9Ime::uninit()
+{
+ clearInput();
+ keyboardGenerator.reset();
+ ldbManager->closeAll();
+ sysInit();
+}
+
+QString Xt9Ime::exactWord(int *wordCompLen)
+{
+ ET9SimpleWord simpleWord;
+ ET9STATUS eStatus;
+
+ eStatus = XT9_API(ET9GetExactWord, &sWordSymbInfo, &simpleWord);
+ if (eStatus) {
+ if (wordCompLen)
+ *wordCompLen = 0;
+ return QString();
+ }
+
+ if (wordCompLen)
+ *wordCompLen = simpleWord.wCompLen;
+
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(simpleWord.sString), simpleWord.wLen);
+}
+
+bool Xt9Ime::hasActiveInput() const
+{
+ return ET9HasActiveInput(&sWordSymbInfo);
+}
+
+QStringList Xt9Ime::buildSelectionList(int *defaultListIndex, unsigned short *gestureValue)
+{
+ ET9STATUS eStatus = ET9STATUS_NONE;
+ return buildSelectionList(defaultListIndex, gestureValue, eStatus);
+}
+
+void Xt9Ime::cursorMoved()
+{
+ XT9_API(ET9CursorMoved, &sWordSymbInfo, 1);
+}
+
+void Xt9Ime::clearInput()
+{
+ XT9_API(ET9ClearAllSymbs, &sWordSymbInfo);
+}
+
+void Xt9Ime::setCapsLock()
+{
+ XT9_API(ET9SetCapsLock, &sWordSymbInfo);
+}
+
+void Xt9Ime::setShift()
+{
+ XT9_API(ET9SetShift, &sWordSymbInfo);
+}
+
+void Xt9Ime::setUnShift()
+{
+ XT9_API(ET9SetUnShift, &sWordSymbInfo);
+}
+
+void Xt9Ime::setWorkingDirectory(const QString &workingDirectory)
+{
+ QString dir = workingDirectory;
+ if (!workingDirectory.isEmpty() && !dir.endsWith(QLatin1Char('/')))
+ dir.append(QLatin1Char('/'));
+ dir = QDir::toNativeSeparators(dir);
+ XT9_API(ET9NAVCore_SetWorkingDirectory, &sSearchEngine, dir.toUtf8().constData());
+}
+
+bool Xt9Ime::indexExists(quint16 id)
+{
+ ET9BOOL exists = 0;
+
+ XT9_API(ET9NAVCore_IndexExists, &sSearchEngine, id, &exists);
+
+ return exists != 0;
+}
+
+bool Xt9Ime::createIndex(quint16 id, quint32 contentInfo)
+{
+ ET9STATUS eStatus;
+ ET9NAVTypeInfo sTypeInfo;
+
+ if (indexExists(id)) {
+ removeIndex(id);
+ }
+
+ eStatus = XT9_API(ET9NAVTypeInfo_Init, &sTypeInfo, id, ET9NAVNO_RECORD_KEY_LENGTH, 0, ET9NAVSTORE_DISPLAY_STR_IN_INDEX);
+ if (!eStatus) {
+ eStatus = XT9_API(ET9NAVCore_CreateIndex, &sSearchEngine, id, &sTypeInfo, 1, contentInfo, 0);
+ }
+
+ return !eStatus;
+}
+
+bool Xt9Ime::insertRecord(quint16 id, const QString &phrase, const QString &tokens)
+{
+ ET9STATUS eStatus;
+ ET9NAVRecord sRecord;
+
+ eStatus = XT9_API(ET9NAVRecord_Init_NoKey, &sSearchEngine, &sRecord, id);
+ if (!eStatus) {
+ if (tokens.length() > 0) {
+ eStatus = XT9_API(ET9NAVRecord_AddField_Conversion, &sRecord,
+ static_cast<const ET9SYMB *>(tokens.utf16()),
+ static_cast<quint16>(tokens.length()),
+ static_cast<const ET9SYMB *>(phrase.utf16()),
+ static_cast<quint16>(phrase.length()),
+ ET9NAVMATCHLOGIC_ANY);
+ } else {
+ eStatus = XT9_API(ET9NAVRecord_AddField_16BIT, &sRecord,
+ static_cast<const ET9SYMB *>(phrase.utf16()),
+ static_cast<quint16>(phrase.length()),
+ ET9NAVMATCHLOGIC_ANY);
+ }
+
+ if (!eStatus) {
+ eStatus = XT9_API(ET9NAVCore_InsertRecord, &sSearchEngine, &sRecord);
+ }
+ }
+
+ return !eStatus;
+}
+
+void Xt9Ime::finalizeIndex(quint16 id)
+{
+ XT9_API(ET9NAVCore_FinalizeIndex, &sSearchEngine, id);
+}
+
+void Xt9Ime::updateIndex(quint16 id, const QStringList &wordList)
+{
+ createIndex(id);
+ for (const QString &word : wordList) {
+ insertRecord(id, word);
+ }
+ finalizeIndex(id);
+}
+
+void Xt9Ime::removeIndex(quint16 id)
+{
+ XT9_API(ET9NAVCore_RemoveIndex, &sSearchEngine, id);
+}
+
+void Xt9Ime::removeAllIndexes()
+{
+ XT9_API(ET9NAVCore_RemoveAllIndexes, &sSearchEngine);
+}
+
+void Xt9Ime::mountIndex(quint16 id)
+{
+ XT9_API(ET9NAVCore_MountIndex, &sSearchEngine, id, ET9NAVMountProperty_ReadOnlyNoValidation);
+}
+
+void Xt9Ime::unmountIndex(quint16 id)
+{
+ XT9_API(ET9NAVCore_UnmountIndex, &sSearchEngine, id);
+}
+
+ET9STATUS Xt9Ime::ldbReadData(ET9U32 dwLdbNum, ET9U8 *ET9FARDATA *ppbSrc, ET9U32 *pdwSizeInBytes)
+{
+ const QLocale locale = Xt9LanguageMap::locale(dwLdbNum);
+ if (locale.language() == QLocale::AnyLanguage) {
+ return ET9STATUS_READ_DB_FAIL;
+ }
+
+ const void *data;
+ qint64 size;
+ if (!ldbManager->loadDictionary(locale, data, size)) {
+ return ET9STATUS_READ_DB_FAIL;
+ }
+
+ *ppbSrc = static_cast<ET9U8 *>(const_cast<void *>(data));
+ *pdwSizeInBytes = static_cast<ET9U32>(size);
+
+ return ET9STATUS_NONE;
+}
+
+ET9STATUS Xt9Ime::ET9Request(ET9WordSymbInfo *const pWordSymbInfo, ET9_Request *const pRequest)
+{
+ return reinterpret_cast<Xt9Ime *>(pWordSymbInfo->pPublicExtension)->request(pRequest);
+}
+
+ET9STATUS Xt9Ime::request(ET9_Request *const pRequest)
+{
+#ifdef XT9_DEBUG
+ qCDebug(lcXT9) << "ET9Request, type =" << pRequest->eType;
+#endif
+ return _requestCallback->request(pRequest);
+}
+
+ET9STATUS Xt9Ime::ET9KDBLoad(ET9KDBInfo *const pKdbInfo, const ET9U32 dwKdbNum, const ET9U16 wPageNum)
+{
+ return reinterpret_cast<Xt9Ime *>(pKdbInfo->pPublicExtension)->kdbLoad(dwKdbNum, wPageNum);
+}
+
+ET9STATUS Xt9Ime::kdbLoad(const ET9U32 dwKdbNum, const ET9U16 wPageNum)
+{
+ Q_UNUSED(dwKdbNum)
+
+ ET9STATUS eStatus;
+ ET9UINT nErrorLine = 0;
+
+ if (keyboardGenerator->vkbLayout.isEmpty()) {
+ qCWarning(lcXT9) << "Keyboard layout is not set.";
+ return ET9STATUS_READ_DB_FAIL;
+ }
+
+ QByteArray xmlData = keyboardGenerator->createXmlLayout();
+ if (xmlData.isEmpty()) {
+ qCWarning(lcXT9) << "Failed to create xml layout.";
+ return ET9STATUS_READ_DB_FAIL;
+ }
+
+ eStatus = XT9_API(ET9KDB_Load_XmlKDB,
+ &sKdbInfo,
+ static_cast<ET9U16>(qRound(keyboardGenerator->layoutWidth)),
+ static_cast<ET9U16>(qRound(keyboardGenerator->layoutHeight)),
+ wPageNum,
+ reinterpret_cast<const ET9U8 *>(xmlData.constData()),
+ static_cast<ET9U32>(xmlData.size()),
+ nullptr,
+ nullptr,
+ &nErrorLine);
+
+ if (eStatus) {
+ qCWarning(lcXT9).nospace() << "Failed to load xml layout, status: " << eStatus << ", line: " << nErrorLine;
+ qCWarning(lcXT9).nospace().noquote() << xmlData.constData();
+ }
+
+ return eStatus;
+}
+
+ET9STATUS Xt9Ime::ET9KDBRequest(ET9KDBInfo *const pKDBInfo, ET9WordSymbInfo *const pWordSymbInfo, ET9KDB_Request *const pET9KDB_Request)
+{
+ Q_UNUSED(pWordSymbInfo)
+ return reinterpret_cast<Xt9Ime *>(pKDBInfo->pPublicExtension)->kdbRequest(pET9KDB_Request);
+}
+
+ET9STATUS Xt9Ime::kdbRequest(ET9KDB_Request *const pET9KDB_Request)
+{
+#ifdef XT9_DEBUG
+ qCDebug(lcXT9) << "ET9KDB_Request, type =" << pET9KDB_Request->eType;
+#endif
+ return ET9STATUS_NONE;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9ime.h b/src/plugins/cerence/xt9/xt9common/xt9ime.h
new file mode 100644
index 00000000..c86fc719
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9ime.h
@@ -0,0 +1,108 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9IME_H
+#define XT9IME_H
+
+#include <QtGlobal>
+#include <QVariantMap>
+#include <QLoggingCategory>
+#include <et9api.h>
+#include "xt9keyboardgenerator.h"
+#include "xt9ldbmanager.h"
+#include "xt9dbfile.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_DECLARE_LOGGING_CATEGORY(lcXT9)
+
+#ifdef XT9_DEBUG
+inline ET9STATUS xt9_log(ET9STATUS eStatus, const char *funcName) {
+ if (eStatus)
+ qCWarning(lcXT9) << funcName << "->" << eStatus;
+ else
+ qCDebug(lcXT9) << funcName;
+ return eStatus;
+}
+inline ET9STATUS xt9_nolog(ET9STATUS eStatus, const char *funcName) {
+ if (eStatus)
+ qCWarning(lcXT9) << funcName << "->" << eStatus;
+ return eStatus;
+}
+#else
+#define xt9_log(func, funcName) func
+#define xt9_nolog(func, funcName) func
+#endif
+
+#define XT9_API(FUNC_NAME, ...) \
+ xt9_log(FUNC_NAME(__VA_ARGS__), "" # FUNC_NAME)
+#define XT9_VAPI(FUNC_NAME, ...) \
+ xt9_nolog(FUNC_NAME(__VA_ARGS__), "" # FUNC_NAME)
+
+class Xt9RequestCallback;
+
+class Xt9Ime
+{
+public:
+ Xt9Ime(Xt9RequestCallback *requestCallback, Xt9KeyboardGenerator::CodeConverter *codeConverter = nullptr);
+ virtual ~Xt9Ime() {}
+
+ virtual void sysInit();
+ virtual bool ldbInit(ET9U32 dwFirstLdbNum, ET9U32 dwSecondLdbNum = ET9PLIDNone, ET9U32 eInputMode = 0) = 0;
+ virtual qint64 dlmPreferredSize() const = 0;
+ virtual bool dlmInit(void *data, qint64 size) = 0;
+ bool kdbInit(const QVariantMap &vkbLayout);
+
+ virtual void uninit();
+
+ virtual QString exactWord(int *wordCompLen = nullptr);
+ bool hasActiveInput() const;
+ virtual QStringList buildSelectionList(int *defaultListIndex, ET9U16 *gestureValue);
+ virtual QStringList buildSelectionList(int *defaultListIndex, ET9U16 *gestureValue, ET9STATUS &eStatus) = 0;
+ virtual void cursorMoved();
+ void clearInput();
+ void setCapsLock();
+ void setShift();
+ void setUnShift();
+
+ void setWorkingDirectory(const QString &workingDirectory);
+ bool indexExists(quint16 id);
+ bool createIndex(quint16 id, quint32 contentInfo = ET9_ContentInfo_None);
+ bool insertRecord(quint16 id, const QString &phrase, const QString &tokens = QString());
+ void finalizeIndex(quint16 id);
+ void updateIndex(quint16 id, const QStringList &wordList);
+ void removeIndex(quint16 id);
+ void removeAllIndexes();
+ void mountIndex(quint16 id);
+ void unmountIndex(quint16 id);
+
+protected:
+ ET9STATUS ldbReadData(ET9U32 dwLdbNum, ET9U8 *ET9FARDATA *ppbSrc, ET9U32 *pdwSizeInBytes);
+
+private:
+ static ET9STATUS ET9Request(ET9WordSymbInfo *const pWordSymbInfo, ET9_Request *const pRequest);
+ ET9STATUS request(ET9_Request *const pRequest);
+
+ static ET9STATUS ET9KDBLoad(ET9KDBInfo *const pKdbInfo, const ET9U32 dwKdbNum, const ET9U16 wPageNum);
+ ET9STATUS kdbLoad(const ET9U32 dwKdbNum, const ET9U16 wPageNum);
+
+ static ET9STATUS ET9KDBRequest(ET9KDBInfo *const pKDBInfo, ET9WordSymbInfo *const pWordSymbInfo, ET9KDB_Request *const pET9KDB_Request);
+ ET9STATUS kdbRequest(ET9KDB_Request *const pET9KDB_Request);
+
+public:
+ ET9WordSymbInfo sWordSymbInfo;
+ ET9KDBInfo sKdbInfo;
+ ET9NAVInfo sSearchEngine;
+ Xt9RequestCallback *const _requestCallback;
+ const Xt9KeyboardGenerator::CodeConverter *codeConverter;
+ QSharedPointer<Xt9LdbManager> ldbManager;
+
+protected:
+ QScopedPointer<Xt9KeyboardGenerator> keyboardGenerator;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9IME_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9jime.cpp b/src/plugins/cerence/xt9/xt9common/xt9jime.cpp
new file mode 100644
index 00000000..aef47329
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9jime.cpp
@@ -0,0 +1,42 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9jime.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class KanaConverter : public Xt9KeyboardGenerator::CodeConverter {
+public:
+ QString convertTo(const QString &codes) const override
+ {
+ QString buf(codes);
+ for (int i = 0; i < buf.length(); ++i) {
+ const ushort uc = buf.at(i).unicode();
+ if ((uc >= 0x30a1 && uc <= 0x30f6) || uc == 0x30fd || uc == 0x30fe)
+ buf.replace(i, 1, QChar(uc - 0x0060));
+ }
+ return buf;
+ }
+
+ QString convertFrom(const QString &codes) const override
+ {
+ QString buf(codes);
+ for (int i = 0; i < buf.length(); ++i) {
+ const ushort uc = buf.at(i).unicode();
+ if ((uc >= 0x30a1 && uc <= 0x30f6) || uc == 0x30fd || uc == 0x30fe)
+ buf.replace(i, 1, QChar(uc + 0x0060));
+ }
+ return buf;
+ }
+};
+
+Q_GLOBAL_STATIC(KanaConverter, kanaConverter)
+
+Xt9JIme::Xt9JIme(Xt9RequestCallback *requestCallback) :
+ Xt9AwIme(requestCallback, kanaConverter)
+{
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9jime.h b/src/plugins/cerence/xt9/xt9common/xt9jime.h
new file mode 100644
index 00000000..57ed9168
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9jime.h
@@ -0,0 +1,21 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9JIME_H
+#define XT9JIME_H
+
+#include "xt9awime.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9JIme : public Xt9AwIme
+{
+public:
+ Xt9JIme(Xt9RequestCallback *requestCallback);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9JIME_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdb.cpp b/src/plugins/cerence/xt9/xt9common/xt9kdb.cpp
new file mode 100644
index 00000000..d9a3b05e
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdb.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kdb.h"
+#include <QXmlStreamWriter>
+#include <QBuffer>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+QByteArray Xt9Kdb::generate(const Xt9KdbLayout &layout, bool prettyPrint)
+{
+ QByteArray result;
+ QXmlStreamWriter writer(&result);
+
+ writer.setAutoFormatting(prettyPrint);
+ writer.writeStartDocument();
+ layout.serialize(writer);
+ writer.writeEndDocument();
+
+ return result;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdb.h b/src/plugins/cerence/xt9/xt9common/xt9kdb.h
new file mode 100644
index 00000000..54762d1b
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdb.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KDB_H
+#define XT9KDB_H
+
+#include "xt9kdblayout.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9Kdb
+{
+ Q_DISABLE_COPY(Xt9Kdb)
+
+public:
+ static QByteArray generate(const Xt9KdbLayout &layout, bool prettyPrint = false);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KDBGENERATOR_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdbarea.cpp b/src/plugins/cerence/xt9/xt9common/xt9kdbarea.cpp
new file mode 100644
index 00000000..a0157c4c
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdbarea.cpp
@@ -0,0 +1,21 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kdbarea.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+void Xt9KdbArea::serialize(QXmlStreamWriter &writer) const
+{
+ writer.writeStartElement(QStringLiteral("area"));
+ if (!conditionValue.isEmpty())
+ writer.writeAttribute(QStringLiteral("conditionValue"), conditionValue);
+ for (const Xt9KdbKey &key : keys) {
+ key.serialize(writer);
+ }
+ writer.writeEndElement();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdbarea.h b/src/plugins/cerence/xt9/xt9common/xt9kdbarea.h
new file mode 100644
index 00000000..552c37ad
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdbarea.h
@@ -0,0 +1,25 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KDBAREA_H
+#define XT9KDBAREA_H
+
+#include "xt9kdbelement.h"
+#include "xt9kdbkey.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KdbArea : public Xt9KdbElement
+{
+public:
+ void serialize(QXmlStreamWriter &writer) const;
+
+ QString conditionValue;
+ QList<Xt9KdbKey> keys;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KDBAREA_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdbelement.cpp b/src/plugins/cerence/xt9/xt9common/xt9kdbelement.cpp
new file mode 100644
index 00000000..2d46ada3
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdbelement.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kdbelement.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9KdbElement::~Xt9KdbElement()
+{
+
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdbelement.h b/src/plugins/cerence/xt9/xt9common/xt9kdbelement.h
new file mode 100644
index 00000000..229e4213
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdbelement.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KDBELEMENT_H
+#define XT9KDBELEMENT_H
+
+#include <QXmlStreamWriter>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KdbElement
+{
+public:
+ virtual ~Xt9KdbElement();
+
+ virtual void serialize(QXmlStreamWriter &writer) const = 0;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KDBELEMENT_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdbkey.cpp b/src/plugins/cerence/xt9/xt9common/xt9kdbkey.cpp
new file mode 100644
index 00000000..617154b9
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdbkey.cpp
@@ -0,0 +1,100 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kdbkey.h"
+#include <QMetaEnum>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+static const QString DP_VALUE = QStringLiteral("%1dp");
+static const QString PC_VALUE = QStringLiteral("%1%");
+const QString HEX_VALUE = QStringLiteral("0x%1");
+
+static bool isPrintable(const QString &str)
+{
+ for (const QChar &chr : str) {
+ if (!QChar::isPrint(chr.unicode()))
+ return false;
+ }
+ return true;
+}
+
+Xt9KdbKey::Xt9KdbKey() :
+ type(Type::nonRegional),
+ name(Name::NONE)
+{
+
+}
+
+void Xt9KdbKey::serialize(QXmlStreamWriter &writer) const
+{
+ /* WORKAROUND:
+ *
+ * This workaround generates a key for each alternate key. This ensures that
+ * ET9KDB_ProcessKeyBySymbol finds the key and that ET9KDB_ModifyCurrentKey
+ * works.
+ */
+ if (hackWriteDistinctKeysForAllCodes && !codes.isEmpty()) {
+ Xt9KdbKey tmpKey;
+ tmpKey = *this;
+ tmpKey.hackWriteDistinctKeysForAllCodes = false;
+ tmpKey.codes.clear();
+ tmpKey.codesShifted.clear();
+ if (!absolute.isEmpty()) {
+ tmpKey.absolute.adjust(0, 0, (tmpKey.absolute.width() / (codes.size() + 1)) - tmpKey.absolute.width(), 0);
+ } else if (!relative.isEmpty()) {
+ tmpKey.relative.adjust(0, 0, (tmpKey.relative.width() / (codes.size() + 1)) - tmpKey.relative.width(), 0);
+ }
+ tmpKey.serialize(writer);
+ if (!absolute.isEmpty()) {
+ tmpKey.absolute.adjust(tmpKey.absolute.width(), 0, tmpKey.absolute.width(), 0);
+ } else if (!relative.isEmpty()) {
+ tmpKey.relative.adjust(tmpKey.relative.width(), 0, tmpKey.relative.width(), 0);
+ }
+ for (const QChar &code : codes) {
+ tmpKey.label = code;
+ if (!labelShifted.isEmpty())
+ tmpKey.labelShifted = code.toUpper();
+ tmpKey.serialize(writer);
+ if (!absolute.isEmpty()) {
+ tmpKey.absolute.adjust(tmpKey.absolute.width(), 0, tmpKey.absolute.width(), 0);
+ } else if (!relative.isEmpty()) {
+ tmpKey.relative.adjust(tmpKey.relative.width(), 0, tmpKey.relative.width(), 0);
+ }
+ }
+ return;
+ }
+ /* WORKAROUND END */
+ if (!absolute.isEmpty()) {
+ writer.writeStartElement(QStringLiteral("key"));
+ writer.writeAttribute(QStringLiteral("keyLeft"), DP_VALUE.arg(absolute.left()));
+ writer.writeAttribute(QStringLiteral("keyTop"), DP_VALUE.arg(absolute.top()));
+ writer.writeAttribute(QStringLiteral("keyWidth"), DP_VALUE.arg(absolute.width()));
+ writer.writeAttribute(QStringLiteral("keyHeight"), DP_VALUE.arg(absolute.height()));
+ } else if (!relative.isEmpty()) {
+ writer.writeStartElement(QStringLiteral("key"));
+ writer.writeAttribute(QStringLiteral("keyLeft"), PC_VALUE.arg(relative.left() * 100.));
+ writer.writeAttribute(QStringLiteral("keyTop"), PC_VALUE.arg(relative.top() * 100.));
+ writer.writeAttribute(QStringLiteral("keyWidth"), PC_VALUE.arg(relative.width() * 100.));
+ writer.writeAttribute(QStringLiteral("keyHeight"), PC_VALUE.arg(relative.height() * 100.));
+ } else {
+ // No geometry, skip
+ return;
+ }
+ writer.writeAttribute(QStringLiteral("keyType"), QMetaEnum::fromType<Xt9KdbKey::Type>().key(static_cast<int>(type)));
+ if (name != Name::NONE)
+ writer.writeAttribute(QStringLiteral("keyName"), QMetaEnum::fromType<Xt9KdbKey::Name>().key(static_cast<int>(name)));
+ if (!label.isEmpty())
+ writer.writeAttribute(QStringLiteral("keyLabel"), isPrintable(label) ? label : joinCodeList(label));
+ if (!labelShifted.isEmpty())
+ writer.writeAttribute(QStringLiteral("keyLabelShifted"), isPrintable(labelShifted) ? labelShifted : joinCodeList(labelShifted));
+ if (!codes.isEmpty())
+ writer.writeAttribute(QStringLiteral("keyCodes"), joinCodeList(codes));
+ if (!codesShifted.isEmpty())
+ writer.writeAttribute(QStringLiteral("keyCodesShifted"), joinCodeList(codesShifted));
+ writer.writeEndElement();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdbkey.h b/src/plugins/cerence/xt9/xt9common/xt9kdbkey.h
new file mode 100644
index 00000000..bd8e9a83
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdbkey.h
@@ -0,0 +1,87 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KDBKEY_H
+#define XT9KDBKEY_H
+
+#include "xt9kdbelement.h"
+#include <QRect>
+#include <QRectF>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KdbKey : public Xt9KdbElement
+{
+ Q_GADGET
+
+public:
+ enum class Type {
+ regional,
+ nonRegional,
+ smartPunct,
+ string,
+ function
+ };
+ Q_ENUM(Type)
+
+ // The names must match with et9kbdef.h.
+ // The enum value must not be assigned.
+ enum class Name {
+ NONE,
+ ET9KEY_BACK,
+ ET9KEY_TAB,
+ ET9KEY_NEW_LINE,
+ ET9KEY_SPACE,
+ ET9KEY_LEFT,
+ ET9KEY_UP,
+ ET9KEY_RIGHT,
+ ET9KEY_DOWN,
+ ET9KEY_SHIFT,
+ ET9KEY_LANGUAGE,
+ };
+ Q_ENUM(Name)
+
+ Xt9KdbKey();
+
+ void serialize(QXmlStreamWriter &writer) const;
+
+ QRect absolute;
+ QRectF relative;
+ Type type;
+ Name name;
+ QString label;
+ QString labelShifted;
+ QString codes;
+ QString codesShifted;
+ bool hackWriteDistinctKeysForAllCodes;
+
+private:
+ template<typename T>
+ static QString joinCodeList(const T &codes);
+};
+
+template<typename T>
+QString Xt9KdbKey::joinCodeList(const T &codes)
+{
+ static const QString HEX_VALUE = QStringLiteral("0x%1");
+
+ QString result;
+ bool first = true;
+
+ for (const QChar &code : codes) {
+ if (first)
+ first = false;
+ else
+ result.append(QLatin1Char(','));
+
+ result.append(HEX_VALUE.arg(code.unicode(), 0, 16));
+ }
+
+ return result;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KDBKEY_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdblayout.cpp b/src/plugins/cerence/xt9/xt9common/xt9kdblayout.cpp
new file mode 100644
index 00000000..454b096e
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdblayout.cpp
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kdblayout.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Xt9KdbLayout::Xt9KdbLayout() :
+ primaryId(0),
+ secondaryId(0),
+ defaultLayoutWidth(0),
+ defaultLayoutHeight(0),
+ supportsExact(false),
+ smartTouchActive(false)
+{
+
+}
+
+void Xt9KdbLayout::serialize(QXmlStreamWriter &writer) const
+{
+ writer.writeStartElement(QStringLiteral("keyboard"));
+ writer.writeAttribute(QStringLiteral("primaryId"), QString::number(primaryId));
+ writer.writeAttribute(QStringLiteral("secondaryId"), QString::number(secondaryId));
+ if (defaultLayoutWidth > 0 && defaultLayoutHeight > 0) {
+ writer.writeAttribute(QStringLiteral("defaultLayoutWidth"), QString::number(defaultLayoutWidth));
+ writer.writeAttribute(QStringLiteral("defaultLayoutHeight"), QString::number(defaultLayoutHeight + 1));
+ }
+ if (supportsExact)
+ writer.writeAttribute(QStringLiteral("supportsExact"), QString(QStringLiteral("%1")).arg(supportsExact));
+ if (smartTouchActive)
+ writer.writeAttribute(QStringLiteral("smartTouchActive"), QString(QStringLiteral("%1")).arg(smartTouchActive));
+ for (const Xt9KdbArea &area : areas) {
+ area.serialize(writer);
+ }
+ writer.writeEndElement();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kdblayout.h b/src/plugins/cerence/xt9/xt9common/xt9kdblayout.h
new file mode 100644
index 00000000..1dc18053
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kdblayout.h
@@ -0,0 +1,31 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KDBLAYOUT_H
+#define XT9KDBLAYOUT_H
+
+#include "xt9kdbarea.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KdbLayout : public Xt9KdbElement
+{
+public:
+ Xt9KdbLayout();
+
+ void serialize(QXmlStreamWriter &writer) const;
+
+ int primaryId;
+ int secondaryId;
+ int defaultLayoutWidth;
+ int defaultLayoutHeight;
+ bool supportsExact;
+ bool smartTouchActive;
+ QList<Xt9KdbArea> areas;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KDBLAYOUT_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.cpp b/src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.cpp
new file mode 100644
index 00000000..830b1d2b
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.cpp
@@ -0,0 +1,141 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9keyboardgenerator.h"
+#include "xt9kdblayout.h"
+#include "xt9kdb.h"
+#include <QtVirtualKeyboard/qvirtualkeyboard_namespace.h>
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+const QString Xt9KeyboardGenerator::PRIMARY_ID = QStringLiteral("primaryId");
+const QString Xt9KeyboardGenerator::SECONDARY_ID = QStringLiteral("secondaryId");
+const QString Xt9KeyboardGenerator::WIDTH = QStringLiteral("width");
+const QString Xt9KeyboardGenerator::HEIGHT = QStringLiteral("height");
+const QString Xt9KeyboardGenerator::KEY = QStringLiteral("key");
+const QString Xt9KeyboardGenerator::KEYS = QStringLiteral("keys");
+const QString Xt9KeyboardGenerator::KEY_TYPE = QStringLiteral("keyType");
+const QString Xt9KeyboardGenerator::TOP = QStringLiteral("top");
+const QString Xt9KeyboardGenerator::LEFT = QStringLiteral("left");
+const QString Xt9KeyboardGenerator::TEXT = QStringLiteral("text");
+const QString Xt9KeyboardGenerator::ALT_KEYS = QStringLiteral("altKeys");
+const int Xt9KeyboardGenerator::EMOTICON_KEY = 0xE000;
+
+Xt9KeyboardGenerator::Xt9KeyboardGenerator(const QVariantMap &vkbLayout, const CodeConverter *keyConverter) :
+ vkbLayout(vkbLayout),
+ layoutWidth(vkbLayout[WIDTH].toDouble()),
+ layoutHeight(vkbLayout[HEIGHT].toDouble()),
+ codeConverter(keyConverter)
+{
+
+}
+
+QByteArray Xt9KeyboardGenerator::createXmlLayout() const
+{
+ if (layoutWidth <= 0 || layoutHeight <= 0)
+ return QByteArray();
+
+ Xt9KdbLayout kdbLayout;
+ kdbLayout.primaryId = vkbLayout[PRIMARY_ID].toInt();
+ kdbLayout.secondaryId = vkbLayout[SECONDARY_ID].toInt();
+ kdbLayout.defaultLayoutWidth = qRound(layoutWidth);
+ kdbLayout.defaultLayoutHeight = qRound(layoutHeight);
+
+ Xt9KdbArea xt9Area;
+ if (convertFromVkb(xt9Area))
+ kdbLayout.areas.append(xt9Area);
+
+ return Xt9Kdb::generate(kdbLayout, true);
+}
+
+bool Xt9KeyboardGenerator::convertFromVkb(Xt9KdbArea &xt9Area) const
+{
+ QVariantList vkbKeys = vkbLayout[KEYS].toList();
+
+ for (const QVariant &i : vkbKeys) {
+ Xt9KdbKey xt9Key;
+ if (convertFromVkb(xt9Key, i.toMap()))
+ xt9Area.keys.append(xt9Key);
+ }
+
+ return true;
+}
+
+bool Xt9KeyboardGenerator::convertFromVkb(Xt9KdbKey &xt9Key, const QVariantMap &vkbKey) const
+{
+ const KeyType vkbKeyType = static_cast<KeyType>(vkbKey[KEY_TYPE].toInt());
+
+ switch (vkbKeyType) {
+ case KeyType::BackspaceKey:
+ xt9Key.type = Xt9KdbKey::Type::function;
+ xt9Key.name = Xt9KdbKey::Name::ET9KEY_BACK;
+ break;
+
+ case KeyType::EnterKey:
+ xt9Key.type = Xt9KdbKey::Type::function;
+ xt9Key.name = Xt9KdbKey::Name::ET9KEY_NEW_LINE;
+ break;
+
+ case KeyType::Key:
+ case KeyType::FlickKey:
+ xt9Key.hackWriteDistinctKeysForAllCodes = (vkbKeyType == KeyType::FlickKey);
+ switch (vkbKey[KEY].toInt()) {
+ case Qt::Key_Space:
+ xt9Key.type = Xt9KdbKey::Type::function;
+ xt9Key.name = Xt9KdbKey::Name::ET9KEY_SPACE;
+ break;
+
+ case EMOTICON_KEY:
+ xt9Key.type = Xt9KdbKey::Type::string;
+ break;
+
+ default:
+ xt9Key.type = Xt9KdbKey::Type::nonRegional;
+ break;
+ }
+ break;
+
+ case KeyType::SpaceKey:
+ xt9Key.type = Xt9KdbKey::Type::function;
+ xt9Key.name = Xt9KdbKey::Name::ET9KEY_SPACE;
+ break;
+
+ default:
+ return false;
+ }
+
+ xt9Key.relative.setLeft(vkbKey[LEFT].toDouble() / layoutWidth);
+ xt9Key.relative.setTop(vkbKey[TOP].toDouble() / layoutHeight);
+ xt9Key.relative.setWidth(vkbKey[WIDTH].toDouble() / layoutWidth);
+ xt9Key.relative.setHeight(vkbKey[HEIGHT].toDouble() / layoutHeight);
+
+ switch (xt9Key.type) {
+ case Xt9KdbKey::Type::regional:
+ case Xt9KdbKey::Type::nonRegional:
+ case Xt9KdbKey::Type::string:
+ xt9Key.label = vkbKey[TEXT].toString().toUpper();
+ if (xt9Key.label.isEmpty())
+ return false;
+ xt9Key.codes = vkbKey[ALT_KEYS].toString();
+ if (codeConverter) {
+ xt9Key.label = codeConverter->convertTo(xt9Key.label);
+ xt9Key.codes = codeConverter->convertTo(xt9Key.codes);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+Xt9KeyboardGenerator::CodeConverter::~CodeConverter()
+{
+
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.h b/src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.h
new file mode 100644
index 00000000..537e9745
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9keyboardgenerator.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KEYBOARDGENERATOR_H
+#define XT9KEYBOARDGENERATOR_H
+
+#include <QVariantMap>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KdbArea;
+class Xt9KdbKey;
+
+class Xt9KeyboardGenerator
+{
+public:
+ class CodeConverter;
+
+ Xt9KeyboardGenerator(const QVariantMap &vkbLayout, const CodeConverter *codeConverter = nullptr);
+
+ QByteArray createXmlLayout() const;
+
+ static const QString PRIMARY_ID;
+ static const QString SECONDARY_ID;
+ static const QString WIDTH;
+ static const QString HEIGHT;
+ static const QString KEY;
+ static const QString KEYS;
+ static const QString KEY_TYPE;
+ static const QString TOP;
+ static const QString LEFT;
+ static const QString TEXT;
+ static const QString ALT_KEYS;
+ static const int EMOTICON_KEY;
+
+ class CodeConverter {
+ public:
+ virtual ~CodeConverter();
+ virtual QString convertTo(const QString &codes) const = 0;
+ virtual QString convertFrom(const QString &codes) const = 0;
+ };
+
+private:
+ bool convertFromVkb(Xt9KdbArea &xt9Area) const;
+ bool convertFromVkb(Xt9KdbKey &xt9Key, const QVariantMap &vkbKey) const;
+
+public:
+ const QVariantMap vkbLayout;
+ const double layoutWidth;
+ const double layoutHeight;
+ const CodeConverter *codeConverter;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KEYBOARDGENERATOR_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kime.cpp b/src/plugins/cerence/xt9/xt9common/xt9kime.cpp
new file mode 100644
index 00000000..76173728
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kime.cpp
@@ -0,0 +1,48 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9kime.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class JamoConverter : public Xt9KeyboardGenerator::CodeConverter {
+public:
+ QString convertTo(const QString &codes) const override
+ {
+ QVector<ushort> jamoBuf(codes.size());
+ memcpy(jamoBuf.data(), codes.utf16(), static_cast<size_t>(jamoBuf.size()) * sizeof(ushort));
+ XT9_VAPI(ET9KCompatibilityJamoToJamo, jamoBuf.data(), static_cast<ET9U32>(jamoBuf.size()));
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(jamoBuf.constData()), jamoBuf.size());
+ }
+
+ QString convertFrom(const QString &codes) const override
+ {
+ QVector<ushort> jamoBuf(codes.size());
+ memcpy(jamoBuf.data(), codes.utf16(), static_cast<size_t>(jamoBuf.size()) * sizeof(ushort));
+ XT9_VAPI(ET9KJamoToCompatibilityJamo, jamoBuf.data(), static_cast<ET9U32>(jamoBuf.size()));
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(jamoBuf.constData()), jamoBuf.size());
+ }
+};
+
+Q_GLOBAL_STATIC(JamoConverter, jamoConverter)
+
+Xt9KIme::Xt9KIme(Xt9RequestCallback *requestCallback) :
+ Xt9AwIme(requestCallback, jamoConverter)
+{
+}
+
+void Xt9KIme::sysInit()
+{
+ Xt9AwIme::sysInit();
+ memset(&sKLingCmn, 0, sizeof(sKLingCmn));
+ XT9_API(ET9KSysActivate, &sLingInfo, &sKLingCmn, 1);
+}
+
+QString Xt9KIme::exactWord(int *wordCompLen)
+{
+ return jamoConverter->convertFrom(Xt9AwIme::exactWord(wordCompLen));
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9kime.h b/src/plugins/cerence/xt9/xt9common/xt9kime.h
new file mode 100644
index 00000000..50578e81
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9kime.h
@@ -0,0 +1,27 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9KIME_H
+#define XT9KIME_H
+
+#include "xt9awime.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9KIme : public Xt9AwIme
+{
+public:
+ Xt9KIme(Xt9RequestCallback *requestCallback);
+
+ void sysInit() override;
+ QString exactWord(int *wordCompLen = nullptr) override;
+
+public:
+ ET9KLingCmnInfo sKLingCmn;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9KIME_H
diff --git a/src/plugins/cerence/xt9/xt9common/xt9languagemap.cpp b/src/plugins/cerence/xt9/xt9common/xt9languagemap.cpp
new file mode 100644
index 00000000..e53b562d
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9languagemap.cpp
@@ -0,0 +1,224 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "xt9languagemap.h"
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+const Xt9LanguageMap::SimpleLanguageMapEntry Xt9LanguageMap::SIMPLE_LANGUAGE_MAP[] = {
+ { ET9PLIDAbkhazian, QLocale::Language::Abkhazian },
+ { ET9PLIDAfar, QLocale::Language::Afar },
+ { ET9PLIDAfrikaans, QLocale::Language::Afrikaans },
+ { ET9PLIDAlbanian, QLocale::Language::Albanian },
+ { ET9PLIDAmharic, QLocale::Language::Amharic },
+ { ET9PLIDArabic, QLocale::Language::Arabic },
+ { ET9PLIDArmenian, QLocale::Language::Armenian },
+ { ET9PLIDAssamese, QLocale::Language::Assamese },
+ { ET9PLIDAymara, QLocale::Language::Aymara },
+ { ET9PLIDAzerbaijani, QLocale::Language::Azerbaijani },
+ { ET9PLIDBashkir, QLocale::Language::Bashkir },
+ { ET9PLIDBasque, QLocale::Language::Basque },
+ { ET9PLIDBelarusian, QLocale::Language::Belarusian },
+ { ET9PLIDBengali, QLocale::Language::Bengali },
+ { ET9PLIDBislama, QLocale::Language::Bislama },
+ { ET9PLIDBosnian, QLocale::Language::Bosnian },
+ { ET9PLIDBreton, QLocale::Language::Breton },
+ { ET9PLIDBulgarian, QLocale::Language::Bulgarian },
+ { ET9PLIDBurmese, QLocale::Language::Burmese },
+ { ET9PLIDCatalan, QLocale::Language::Catalan },
+ { ET9PLIDChineseSimplified, QLocale::Language::Chinese },
+ { ET9PLIDCorsican, QLocale::Language::Corsican },
+ { ET9PLIDCroatian, QLocale::Language::Croatian },
+ { ET9PLIDCzech, QLocale::Language::Czech },
+ { ET9PLIDDanish, QLocale::Language::Danish },
+ { ET9PLIDDutch, QLocale::Language::Dutch },
+ { ET9PLIDEnglish, QLocale::Language::English },
+ { ET9PLIDEsperanto, QLocale::Language::Esperanto },
+ { ET9PLIDEstonian, QLocale::Language::Estonian },
+ { ET9PLIDFilipino, QLocale::Language::Filipino },
+ { ET9PLIDFinnish, QLocale::Language::Finnish },
+ { ET9PLIDFrench, QLocale::Language::French },
+ { ET9PLIDGalician, QLocale::Language::Galician },
+ { ET9PLIDGeorgian, QLocale::Language::Georgian },
+ { ET9PLIDGerman, QLocale::Language::German },
+ { ET9PLIDGerman, QLocale::Language::LowGerman },
+ { ET9PLIDGerman, QLocale::Language::SwissGerman },
+ { ET9PLIDGreek, QLocale::Language::Greek },
+ { ET9PLIDGreenlandic, QLocale::Language::Greenlandic },
+ { ET9PLIDGuarani, QLocale::Language::Guarani },
+ { ET9PLIDGujarati, QLocale::Language::Gujarati },
+ { ET9PLIDHausa, QLocale::Language::Hausa },
+ { ET9PLIDHawaiian, QLocale::Language::Hawaiian },
+ { ET9PLIDHebrew, QLocale::Language::Hebrew },
+ { ET9PLIDHindi, QLocale::Language::Hindi },
+ { ET9PLIDHungarian, QLocale::Language::Hungarian },
+ { ET9PLIDIcelandic, QLocale::Language::Icelandic },
+ { ET9PLIDIgbo, QLocale::Language::Igbo },
+ { ET9PLIDIndonesian, QLocale::Language::Indonesian },
+ { ET9PLIDInterlingua, QLocale::Language::Interlingua },
+ { ET9PLIDInterlingue, QLocale::Language::Interlingue },
+ { ET9PLIDInuktitut, QLocale::Language::Inuktitut },
+ { ET9PLIDInupiak, QLocale::Language::Inupiak },
+ { ET9PLIDIrish, QLocale::Language::Irish },
+ { ET9PLIDItalian, QLocale::Language::Italian },
+ { ET9PLIDJapanese, QLocale::Language::Japanese },
+ { ET9PLIDJavanese, QLocale::Language::Javanese },
+ { ET9PLIDKannada, QLocale::Language::Kannada },
+ { ET9PLIDKashmiri, QLocale::Language::Kashmiri },
+ { ET9PLIDKazakh, QLocale::Language::Kazakh },
+ { ET9PLIDKhmer, QLocale::Language::Khmer },
+ { ET9PLIDKirghiz, QLocale::Language::Kirghiz },
+ { ET9PLIDKonkani, QLocale::Language::Konkani },
+ { ET9PLIDKorean, QLocale::Language::Korean },
+ { ET9PLIDKurdish, QLocale::Language::Kurdish },
+ { ET9PLIDLao, QLocale::Language::Lao },
+ { ET9PLIDLatin, QLocale::Language::Latin },
+ { ET9PLIDLatvian, QLocale::Language::Latvian },
+ { ET9PLIDLingala, QLocale::Language::Lingala },
+ { ET9PLIDLithuanian, QLocale::Language::Lithuanian },
+ { ET9PLIDMacedonian, QLocale::Language::Macedonian },
+ { ET9PLIDMalagasy, QLocale::Language::Malagasy },
+ { ET9PLIDMalay, QLocale::Language::Malay },
+ { ET9PLIDMalayalam, QLocale::Language::Malayalam },
+ { ET9PLIDMaltese, QLocale::Language::Maltese },
+ { ET9PLIDMaori, QLocale::Language::Maori },
+ { ET9PLIDMarathi, QLocale::Language::Marathi },
+ { ET9PLIDMongolian, QLocale::Language::Mongolian },
+ { ET9PLIDNepali, QLocale::Language::Nepali },
+ { ET9PLIDNorwegian, QLocale::Language::NorwegianBokmal },
+ { ET9PLIDNorwegian, QLocale::Language::NorwegianNynorsk },
+ { ET9PLIDOccitan, QLocale::Language::Occitan },
+ { ET9PLIDOriya, QLocale::Language::Oriya },
+ { ET9PLIDOromo, QLocale::Language::Oromo },
+ { ET9PLIDPashto, QLocale::Language::Pashto },
+ { ET9PLIDPersian, QLocale::Language::Persian },
+ { ET9PLIDPolish, QLocale::Language::Polish },
+ { ET9PLIDPortuguese, QLocale::Language::Portuguese },
+ { ET9PLIDPunjabi, QLocale::Language::Punjabi },
+ { ET9PLIDQuechua, QLocale::Language::Quechua },
+ { ET9PLIDRomanian, QLocale::Language::Romanian },
+ { ET9PLIDRussian, QLocale::Language::Russian },
+ { ET9PLIDSami, QLocale::Language::NorthernSami },
+ { ET9PLIDSamoan, QLocale::Language::Samoan },
+ { ET9PLIDSangho, QLocale::Language::Sango },
+ { ET9PLIDSanskrit, QLocale::Language::Sanskrit },
+ { ET9PLIDSerbian, QLocale::Language::Serbian },
+ { ET9PLIDSesotho, QLocale::Language::NorthernSotho },
+ { ET9PLIDSesotho, QLocale::Language::SouthernSotho },
+ { ET9PLIDShona, QLocale::Language::Shona },
+ { ET9PLIDSindhi, QLocale::Language::Sindhi },
+ { ET9PLIDSinhala, QLocale::Language::Sinhala },
+ { ET9PLIDSiswati, QLocale::Language::Swati },
+ { ET9PLIDSlovak, QLocale::Language::Slovak },
+ { ET9PLIDSlovenian, QLocale::Language::Slovenian },
+ { ET9PLIDSomali, QLocale::Language::Somali },
+ { ET9PLIDSpanish, QLocale::Language::Spanish },
+ { ET9PLIDSundanese, QLocale::Language::Sundanese },
+ { ET9PLIDSwahili, QLocale::Language::Swahili },
+ { ET9PLIDSwedish, QLocale::Language::Swedish },
+ { ET9PLIDTajik, QLocale::Language::Tajik },
+ { ET9PLIDTamil, QLocale::Language::Tamil },
+ { ET9PLIDTatar, QLocale::Language::Tatar },
+ { ET9PLIDTelugu, QLocale::Language::Telugu },
+ { ET9PLIDThai, QLocale::Language::Thai },
+ { ET9PLIDTibetan, QLocale::Language::Tibetan },
+ { ET9PLIDTigrinya, QLocale::Language::Tigrinya },
+ { ET9PLIDTonga, QLocale::Language::Tongan },
+ { ET9PLIDTsonga, QLocale::Language::Tsonga },
+ { ET9PLIDTswana, QLocale::Language::Tswana },
+ { ET9PLIDTurkish, QLocale::Language::Turkish },
+ { ET9PLIDTurkmen, QLocale::Language::Turkmen },
+ { ET9PLIDUkrainian, QLocale::Language::Ukrainian },
+ { ET9PLIDUrdu, QLocale::Language::Urdu },
+ { ET9PLIDUzbek, QLocale::Language::Uzbek },
+ { ET9PLIDVenda, QLocale::Language::Venda },
+ { ET9PLIDVietnamese, QLocale::Language::Vietnamese },
+ { ET9PLIDVolapuk, QLocale::Language::Volapuk },
+ { ET9PLIDWelsh, QLocale::Language::Welsh },
+ { ET9PLIDWolof, QLocale::Language::Wolof },
+ { ET9PLIDXhosa, QLocale::Language::Xhosa },
+ { ET9PLIDYiddish, QLocale::Language::Yiddish },
+ { ET9PLIDYoruba, QLocale::Language::Yoruba },
+ { ET9PLIDZhuang, QLocale::Language::Zhuang },
+ { ET9PLIDZulu, QLocale::Language::Zulu },
+ // End-of-map
+ { ET9PLIDNone, QLocale::Language::AnyLanguage }
+};
+
+const struct Xt9LanguageMap::LanguageMapEntry Xt9LanguageMap::LANGUAGE_MAP[] = {
+ { ET9LIDEnglish_UK, QLocale(QLocale::English, QLocale::UnitedKingdom) },
+ { ET9LIDEnglish_Australia, QLocale(QLocale::English, QLocale::Australia) },
+ { ET9LIDEnglish_India, QLocale(QLocale::English, QLocale::India) },
+ { ET9LIDEnglish_US, QLocale(QLocale::English, QLocale::UnitedStates) },
+ { ET9PLIDEnglish|ET9SLIDDEFAULT, QLocale(QLocale::English, QLocale::UnitedKingdom) },
+ { ET9LIDSpanish_LatinAmerican, QLocale(QLocale::Spanish, QLocale::LatinAmerica) },
+ { ET9PLIDSpanish|ET9SLIDDEFAULT, QLocale(QLocale::Spanish, QLocale::Spain) },
+ { ET9LIDFrench_Canada, QLocale(QLocale::French, QLocale::Canada) },
+ { ET9LIDFrench_Switzerland, QLocale(QLocale::French, QLocale::Switzerland) },
+ { ET9PLIDFrench|ET9SLIDDEFAULT, QLocale(QLocale::French, QLocale::France) },
+ { ET9LIDItalian_Switzerland, QLocale(QLocale::Italian, QLocale::Switzerland) },
+ { ET9LIDDutch_Belgium, QLocale(QLocale::Dutch, QLocale::Belgium) },
+ { ET9PLIDPortuguese|ET9SLIDDEFAULT, QLocale(QLocale::Portuguese, QLocale::Portugal) },
+ { ET9LIDPortuguese_Brazil, QLocale(QLocale::Portuguese, QLocale::Brazil) },
+ { ET9PLIDChineseSimplified, QLocale(QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China) },
+ { ET9PLIDChineseTraditional, QLocale(QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Taiwan) },
+ { ET9PLIDChineseHongkong, QLocale(QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::HongKong) },
+ { ET9PLIDChineseSingapore, QLocale(QLocale::Chinese, QLocale::TraditionalHanScript, QLocale::Singapore) },
+ { ET9LIDJapanese_Hiragana, QLocale(QLocale::Japanese) },
+ // End-of-map
+ { 0, QLocale(QLocale::AnyLanguage) },
+};
+
+ET9U32 Xt9LanguageMap::languageId(const QLocale &locale)
+{
+ const QLocale::Language localeLanguage = locale.language();
+ const QLocale::Territory localeTerritory = locale.territory();
+
+ for (int i = 0; LANGUAGE_MAP[i].languageId != 0; ++i) {
+ const QLocale &item = LANGUAGE_MAP[i].locale;
+ if (item.language() == localeLanguage && item.territory() == localeTerritory)
+ return LANGUAGE_MAP[i].languageId;
+ }
+
+ const SimpleLanguageMapEntry *simpleLanguageMapIterator = SIMPLE_LANGUAGE_MAP;
+ for (; simpleLanguageMapIterator->localeLanguage != QLocale::Language::AnyLanguage;
+ simpleLanguageMapIterator++) {
+ if (simpleLanguageMapIterator->localeLanguage == localeLanguage)
+ return simpleLanguageMapIterator->languageId;
+ }
+
+ return ET9PLIDNone;
+}
+
+QLocale Xt9LanguageMap::locale(ET9U32 languageId)
+{
+ for (int i = 0; LANGUAGE_MAP[i].languageId != 0; ++i) {
+ if (LANGUAGE_MAP[i].languageId == languageId)
+ return LANGUAGE_MAP[i].locale;
+ }
+
+ if (!(languageId & ET9SLIDMASK) &&
+ (languageId < ET9PLIDChineseTraditional || languageId > ET9PLIDChineseSingapore)) {
+
+ languageId |= ET9SLIDDEFAULT;
+
+ for (int i = 0; LANGUAGE_MAP[i].languageId != 0; ++i) {
+ if (LANGUAGE_MAP[i].languageId == languageId)
+ return LANGUAGE_MAP[i].locale;
+ }
+ }
+
+ const ET9U32 plid = languageId & ET9PLIDMASK;
+ const SimpleLanguageMapEntry *simpleLanguageMapIterator = SIMPLE_LANGUAGE_MAP;
+ for (; simpleLanguageMapIterator->localeLanguage != QLocale::Language::AnyLanguage;
+ simpleLanguageMapIterator++) {
+ if (simpleLanguageMapIterator->languageId == plid)
+ return QLocale(simpleLanguageMapIterator->localeLanguage);
+ }
+
+ return QLocale(QLocale::AnyLanguage);
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/cerence/xt9/xt9common/xt9languagemap.h b/src/plugins/cerence/xt9/xt9common/xt9languagemap.h
new file mode 100644
index 00000000..ed14a0fe
--- /dev/null
+++ b/src/plugins/cerence/xt9/xt9common/xt9languagemap.h
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef XT9LANGUAGEMAP_H
+#define XT9LANGUAGEMAP_H
+
+#include <QLocale>
+#include <et9api.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Xt9LanguageMap
+{
+private:
+ Xt9LanguageMap();
+
+public:
+ static ET9U32 languageId(const QLocale &locale);
+ static QLocale locale(ET9U32 languageId);
+
+private:
+ struct SimpleLanguageMapEntry {
+ ET9U32 languageId;
+ QLocale::Language localeLanguage;
+ };
+
+ struct LanguageMapEntry {
+ ET9U32 languageId;
+ QLocale locale;
+ };
+
+ static const SimpleLanguageMapEntry SIMPLE_LANGUAGE_MAP[];
+ static const struct LanguageMapEntry LANGUAGE_MAP[];
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // XT9LANGUAGEMAP_H
diff --git a/src/plugins/example/CMakeLists.txt b/src/plugins/example/CMakeLists.txt
new file mode 100644
index 00000000..a8976f9b
--- /dev/null
+++ b/src/plugins/example/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_subdirectory(hwr)
+list(APPEND example_imports QtQuick.VirtualKeyboard.Plugins.Example.HWR/auto)
+
+qt_internal_add_qml_module(qtvkbexampleplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Example"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbexampleplugin
+ IMPORTS
+ ${example_imports}
+ NO_GENERATE_CPP_EXPORTS
+)
diff --git a/src/plugins/example/hwr/CMakeLists.txt b/src/plugins/example/hwr/CMakeLists.txt
new file mode 100644
index 00000000..61f64101
--- /dev/null
+++ b/src/plugins/example/hwr/CMakeLists.txt
@@ -0,0 +1,284 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_qml_module(qtvkbexamplehwrplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Example.HWR"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbexamplehwrplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ examplehwrinputmethod.cpp examplehwrinputmethod_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboardPrivate
+ NO_GENERATE_CPP_EXPORTS
+)
+
+set(qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fallback/handwriting.qml"
+)
+
+if (QT_FEATURE_vkb_lang_en_GB)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/en_GB/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_en_US)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/en_US/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ar_AR)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ar_AR/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_bg_BG)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/bg_BG/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_cs_CZ)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/cs_CZ/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_da_DK)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/da_DK/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_de_DE)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/de_DE/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_el_GR)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/el_GR/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_es_ES)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/es_ES/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_es_MX)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/es_MX/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_et_EE)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/et_EE/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fa_FA)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fa_FA/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fi_FI)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fi_FI/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fr_FR)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fr_FR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_fr_CA)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/fr_CA/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_he_IL)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/he_IL/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_hr_HR)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/hr_HR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_hu_HU)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/hu_HU/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_id_ID)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/id_ID/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_it_IT)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/it_IT/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ms_MY)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ms_MY/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_nb_NO)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/nb_NO/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_nl_NL)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/nl_NL/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_pl_PL)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/pl_PL/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_pt_BR)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/pt_BR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_pt_PT)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/pt_PT/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ro_RO)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ro_RO/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ru_RU)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ru_RU/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sk_SK)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sk_SK/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sl_SI)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sl_SI/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sq_AL)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sq_AL/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sr_SP)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sr_SP/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_sv_SE)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/sv_SE/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_th_TH)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/th_TH/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_tr_TR)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/tr_TR/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_uk_UA)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/uk_UA/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_vi_VN)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/vi_VN/handwriting.fallback"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ja_JP)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ja_JP/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_ko_KR)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ko_KR/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_zh_CN)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_CN/handwriting.qml"
+ )
+endif()
+
+if (QT_FEATURE_vkb_lang_zh_TW)
+ list(APPEND qt_virtualkeyboard_example_hwr_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_TW/handwriting.qml"
+ )
+endif()
+
+qt_internal_add_resource(qtvkbexamplehwrplugin "qt_virtualkeyboard_example_hwr_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${VKB_LAYOUTS_BASE}"
+ FILES
+ ${qt_virtualkeyboard_example_hwr_layouts_resource_files}
+)
diff --git a/src/plugins/example/hwr/examplehwrinputmethod.cpp b/src/plugins/example/hwr/examplehwrinputmethod.cpp
new file mode 100644
index 00000000..58d1d2c8
--- /dev/null
+++ b/src/plugins/example/hwr/examplehwrinputmethod.cpp
@@ -0,0 +1,632 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "examplehwrinputmethod_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
+#include <QtVirtualKeyboard/private/handwritinggesturerecognizer_p.h>
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardabstractinputmethod_p.h>
+#include <QCryptographicHash>
+#include <QRandomGenerator>
+#include <QLoggingCategory>
+#include <QLocale>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(lcExampleHwr, "qt.virtualkeyboard.example.hwr")
+
+class ExampleHwrInputMethodPrivate : public QVirtualKeyboardAbstractInputMethodPrivate
+{
+public:
+ Q_DECLARE_PUBLIC(ExampleHwrInputMethod)
+
+ ExampleHwrInputMethodPrivate(ExampleHwrInputMethod *q_ptr) :
+ QVirtualKeyboardAbstractInputMethodPrivate(),
+ q_ptr(q_ptr)
+ {
+ }
+
+ bool setInputMode(const QLocale &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+ {
+ Q_UNUSED(locale);
+ finishRecognition();
+ this->inputMode = inputMode;
+ return true;
+ }
+
+ QByteArray getContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo,
+ const QVariantMap &traceScreenInfo) const
+ {
+ QCryptographicHash hash(QCryptographicHash::Md5);
+
+ hash.addData(QByteArrayView(reinterpret_cast<const char *>(&patternRecognitionMode), sizeof(patternRecognitionMode)));
+
+ QByteArray mapData;
+ QDataStream ds(&mapData, QIODevice::WriteOnly);
+ ds << traceCaptureDeviceInfo;
+ ds << traceScreenInfo;
+ hash.addData(mapData);
+
+ return hash.result();
+ }
+
+ void setContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo,
+ const QVariantMap &traceScreenInfo,
+ const QByteArray &context)
+ {
+ Q_UNUSED(patternRecognitionMode);
+ Q_UNUSED(traceScreenInfo);
+ if (context == currentContext)
+ return;
+ currentContext = context;
+
+ qCDebug(lcExampleHwr) << "setContext:" << QLatin1String((context.toHex()));
+
+ // Finish recognition, but preserve current input
+ const int dpi = traceCaptureDeviceInfo.value(QLatin1String("dpi"), 96).toInt();
+ static const int INSTANT_GESTURE_WIDTH_THRESHOLD_MM = 25;
+ gestureWidthThreshold = qRound(INSTANT_GESTURE_WIDTH_THRESHOLD_MM / 25.4 * dpi);
+
+ gestureRecognizer.setDpi(dpi);
+ }
+
+ QVirtualKeyboardTrace *traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+ {
+ // The result id follows the trace id so that the (previous)
+ // results completed during the handwriting can be rejected.
+ resultId = traceId;
+
+ QByteArray context = getContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
+ if (context != currentContext) {
+ setContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo, context);
+ }
+
+ Q_Q(ExampleHwrInputMethod);
+ QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace(q);
+ traceList.append(trace);
+
+ return trace;
+ }
+
+ void traceEnd(QVirtualKeyboardTrace *trace)
+ {
+ if (trace->isCanceled()) {
+ traceList.removeOne(trace);
+ delete trace;
+ } else if (handleGesture()) {
+ finishRecognition();
+ return;
+ }
+ if (!traceList.isEmpty()) {
+ if (countActiveTraces() == 0)
+ restartRecognition();
+ }
+ }
+
+ int countActiveTraces() const
+ {
+ int count = 0;
+ for (QVirtualKeyboardTrace *trace : std::as_const(traceList)) {
+ if (!trace->isFinal())
+ count++;
+ }
+ return count;
+ }
+
+ void clearTraces()
+ {
+ qDeleteAll(traceList);
+ traceList.clear();
+ }
+
+ bool applyGesture(const QChar &gesture)
+ {
+ Q_Q(ExampleHwrInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ switch (gesture.unicode()) {
+ case '\b':
+ return ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
+ case '\r':
+ return ic->inputEngine()->virtualKeyClick(Qt::Key_Return, QLatin1String("\n"), Qt::NoModifier);
+ case ' ':
+ return ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
+ default:
+ return false;
+ }
+ }
+
+ bool handleGesture()
+ {
+ if (countActiveTraces() > 0)
+ return false;
+
+ QVariantMap gesture(gestureRecognizer.recognize(traceList.mid(traceList.size() - 1, 1)));
+ if (gesture.isEmpty())
+ return false;
+
+ qCDebug(lcExampleHwr) << "handleGesture:" << gesture;
+
+ if (gesture[QLatin1String("type")].toString() == QLatin1String("swipe")) {
+
+ static const int SWIPE_ANGLE_THRESHOLD = 15; // degrees +-
+
+ qreal swipeLength = gesture[QLatin1String("length")].toReal();
+ if (swipeLength >= gestureWidthThreshold) {
+
+ Q_Q(ExampleHwrInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return false;
+
+ qreal swipeAngle = gesture[QLatin1String("angle_degrees")].toReal();
+ int swipeTouchCount = gesture[QLatin1String("touch_count")].toInt();
+
+ // Swipe left
+ if (swipeAngle <= 180 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 180 - SWIPE_ANGLE_THRESHOLD) {
+ if (swipeTouchCount == 1) {
+ // Single swipe: backspace
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
+ return true;
+ }
+ return false;
+ }
+
+ // Swipe right
+ if (swipeAngle <= SWIPE_ANGLE_THRESHOLD || swipeAngle >= 360 - SWIPE_ANGLE_THRESHOLD) {
+ if (swipeTouchCount == 1) {
+ // Single swipe: space
+ ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
+ return true;
+ }
+ return false;
+ }
+
+ // Swipe up
+ if (swipeAngle <= 270 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 270 - SWIPE_ANGLE_THRESHOLD) {
+ if (swipeTouchCount == 1) {
+ // Single swipe: toggle input mode
+ select();
+ if (!(ic->inputMethodHints() & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly))) {
+ QList<int> inputModes = ic->inputEngine()->inputModes();
+ // Filter out duplicate numeric mode (in favor of Numeric)
+ int indexOfNumericInputMode = inputModes.indexOf(static_cast<int>(QVirtualKeyboardInputEngine::InputMode::Numeric));
+ int indexOfDialableInputMode = inputModes.indexOf(static_cast<int>(QVirtualKeyboardInputEngine::InputMode::Dialable));
+ if (indexOfNumericInputMode != -1 && indexOfDialableInputMode != -1)
+ inputModes.removeAt(inputMode != QVirtualKeyboardInputEngine::InputMode::Dialable ?
+ indexOfDialableInputMode :
+ indexOfNumericInputMode);
+ if (inputModes.size() > 1) {
+ int inputModeIndex = inputModes.indexOf(static_cast<int>(inputMode)) + 1;
+ if (inputModeIndex >= inputModes.size())
+ inputModeIndex = 0;
+ ic->inputEngine()->setInputMode(static_cast<QVirtualKeyboardInputEngine::InputMode>(inputModes.at(inputModeIndex)));
+ }
+ }
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ bool isValidInputChar(const QChar &c) const
+ {
+ if (c.isLetterOrNumber())
+ return true;
+ if (isJoiner(c))
+ return true;
+ return false;
+ }
+
+ bool isJoiner(const QChar &c) const
+ {
+ if (c.isPunct() || c.isSymbol()) {
+ Q_Q(const ExampleHwrInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (ic) {
+ Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) || inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly))
+ return QString(QStringLiteral(":/?#[]@!$&'()*+,;=-_.%")).contains(c);
+ }
+ ushort unicode = c.unicode();
+ if (unicode == Qt::Key_Apostrophe || unicode == Qt::Key_Minus)
+ return true;
+ }
+ return false;
+ }
+
+ void restartRecognition()
+ {
+ qCDebug(lcExampleHwr) << "restartRecognition";
+
+ resetResultTimer(Settings::instance()->hwrTimeoutForAlphabetic());
+ }
+
+ bool finishRecognition(bool emitSelectionListChanged = true)
+ {
+ qCDebug(lcExampleHwr) << "finishRecognition";
+ bool result = !traceList.isEmpty();
+
+ stopResultTimer();
+ clearTraces();
+
+ if (!wordCandidates.isEmpty()) {
+ wordCandidates.clear();
+ activeWordIndex = -1;
+ if (emitSelectionListChanged) {
+ Q_Q(ExampleHwrInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ }
+ result = true;
+ }
+
+ return result;
+ }
+
+ void select(int index = -1)
+ {
+ Q_Q(ExampleHwrInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return;
+
+ if (!wordCandidates.isEmpty())
+ ic->commit(wordCandidates.at(index != -1 ? index : 0));
+
+ finishRecognition();
+ }
+
+ void processResult()
+ {
+ qCDebug(lcExampleHwr) << "processResult";
+
+ Q_Q(ExampleHwrInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return;
+
+ QStringList newWordCandidates;
+ QString word = !wordCandidates.isEmpty() ? wordCandidates.at(0) : QString();
+ switch (inputMode) {
+ case QVirtualKeyboardInputEngine::InputMode::Latin:
+ appendRandomChar(word);
+ break;
+ case QVirtualKeyboardInputEngine::InputMode::Numeric:
+ case QVirtualKeyboardInputEngine::InputMode::Dialable:
+ appendRandomDigit(word);
+ break;
+ default:
+ break;
+ }
+ newWordCandidates.append(word);
+ activeWordIndex = 0;
+ wordCandidates = newWordCandidates;
+ qCDebug(lcExampleHwr) << "wordCandidates" << wordCandidates;
+ ic->setPreeditText(word);
+
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ }
+
+ static void appendRandomChar(QString& word)
+ {
+ word.append(QChar('a' + QRandomGenerator::global()->bounded(26)));
+ }
+
+ static void appendRandomDigit(QString& word)
+ {
+ word.append(QChar('0' + QRandomGenerator::global()->bounded(10)));
+ }
+
+ void resetResultTimer(int interval = 500)
+ {
+ qCDebug(lcExampleHwr) << "resetResultTimer:" << interval;
+ Q_Q(ExampleHwrInputMethod);
+ stopResultTimer();
+ resultTimer = q->startTimer(interval);
+ }
+
+ void stopResultTimer()
+ {
+ if (resultTimer) {
+ qCDebug(lcExampleHwr) << "stopResultTimer";
+ Q_Q(ExampleHwrInputMethod);
+ q->killTimer(resultTimer);
+ resultTimer = 0;
+ }
+ }
+
+ ExampleHwrInputMethod *q_ptr = nullptr;
+ QVirtualKeyboardInputEngine::InputMode inputMode = QVirtualKeyboardInputEngine::InputMode::Latin;
+ QByteArray currentContext;
+ int gestureWidthThreshold = 0;
+ int resultId = 0;
+ int lastResultId = 0;
+ int resultTimer = 0;
+ QList<QVirtualKeyboardTrace *> traceList;
+ HandwritingGestureRecognizer gestureRecognizer;
+ QStringList wordCandidates;
+ int activeWordIndex = -1;
+};
+
+/*!
+ \class QtVirtualKeyboard::ExampleHwrInputMethod
+ \internal
+*/
+
+ExampleHwrInputMethod::ExampleHwrInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(*new ExampleHwrInputMethodPrivate(this), parent)
+{
+}
+
+ExampleHwrInputMethod::~ExampleHwrInputMethod()
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> ExampleHwrInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale);
+ QList<QVirtualKeyboardInputEngine::InputMode> availableInputModes = {
+ QVirtualKeyboardInputEngine::InputMode::Latin,
+ QVirtualKeyboardInputEngine::InputMode::Numeric,
+ };
+ return availableInputModes;
+}
+
+bool ExampleHwrInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_D(ExampleHwrInputMethod);
+ d->select();
+ return d->setInputMode(QLocale(locale), inputMode);
+}
+
+bool ExampleHwrInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase);
+ return true;
+}
+
+bool ExampleHwrInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(modifiers);
+ Q_D(ExampleHwrInputMethod);
+ switch (key) {
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Tab:
+ case Qt::Key_Space:
+ d->select();
+ update();
+ break;
+
+ case Qt::Key_Backspace:
+ {
+ QVirtualKeyboardInputContext *ic = inputContext();
+ QString preeditText = ic->preeditText();
+ if (preeditText.length() > 1) {
+ preeditText.chop(1);
+ ic->setPreeditText(preeditText);
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+ return true;
+ } else {
+ bool result = !preeditText.isEmpty();
+ if (result)
+ ic->clear();
+ d->finishRecognition();
+ return result;
+ }
+ }
+
+ default:
+ if (text.length() > 0) {
+ QVirtualKeyboardInputContext *ic = inputContext();
+ QString preeditText = ic->preeditText();
+ QChar c = text.at(0);
+ bool addToWord = d->isValidInputChar(c) && (!preeditText.isEmpty() || !d->isJoiner(c));
+ if (addToWord) {
+ preeditText.append(text);
+ ic->setPreeditText(preeditText);
+ d->finishRecognition(false);
+ d->wordCandidates.append(preeditText);
+ d->activeWordIndex = 0;
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+ return true;
+ } else {
+ ic->commit();
+ d->finishRecognition();
+ }
+ break;
+ }
+ }
+ return false;
+}
+
+void ExampleHwrInputMethod::reset()
+{
+ Q_D(ExampleHwrInputMethod);
+ qCDebug(lcExampleHwr) << "reset";
+ d->finishRecognition();
+}
+
+void ExampleHwrInputMethod::update()
+{
+ Q_D(ExampleHwrInputMethod);
+ qCDebug(lcExampleHwr) << "update";
+ d->select();
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> ExampleHwrInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int ExampleHwrInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type);
+ Q_D(ExampleHwrInputMethod);
+ return d->wordCandidates.size();
+}
+
+QVariant ExampleHwrInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ QVariant result;
+ Q_D(ExampleHwrInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->wordCandidates.at(index));
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ result.setValue(0);
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::Dictionary:
+ {
+ QVirtualKeyboardSelectionListModel::DictionaryType dictionaryType =
+ QVirtualKeyboardSelectionListModel::DictionaryType::Default;
+ result = QVariant(static_cast<int>(dictionaryType));
+ break;
+ }
+ case QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion:
+ result = QVariant(false);
+ break;
+ default:
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ break;
+ }
+ return result;
+}
+
+void ExampleHwrInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type);
+ Q_D(ExampleHwrInputMethod);
+ d->select(index);
+}
+
+QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> ExampleHwrInputMethod::patternRecognitionModes() const
+{
+ return QList<QVirtualKeyboardInputEngine::PatternRecognitionMode>()
+ << QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting;
+}
+
+QVirtualKeyboardTrace *ExampleHwrInputMethod::traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
+{
+ Q_D(ExampleHwrInputMethod);
+ return d->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
+}
+
+bool ExampleHwrInputMethod::traceEnd(QVirtualKeyboardTrace *trace)
+{
+ Q_D(ExampleHwrInputMethod);
+ d->traceEnd(trace);
+ return true;
+}
+
+bool ExampleHwrInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
+{
+ Q_D(ExampleHwrInputMethod);
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (!ic)
+ return false;
+
+ const int maxLength = 32;
+ const QString surroundingText = ic->surroundingText();
+ int replaceFrom = 0;
+ QString stringStart;
+
+ if (cursorPosition > surroundingText.length())
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor)) {
+ for (int i = cursorPosition - 1; i >= 0 && stringStart.length() < maxLength; --i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ stringStart.insert(0, c);
+ --replaceFrom;
+ }
+
+ while (replaceFrom < 0 && d->isJoiner(stringStart.at(0))) {
+ stringStart.remove(0, 1);
+ ++replaceFrom;
+ }
+ }
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == 0) {
+ stringStart.clear();
+ return false;
+ }
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor)) {
+ for (int i = cursorPosition; i < surroundingText.length() && stringStart.length() < maxLength; ++i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ stringStart.append(c);
+ }
+
+ while (replaceFrom > -stringStart.length()) {
+ int lastPos = stringStart.length() - 1;
+ if (!d->isJoiner(stringStart.at(lastPos)))
+ break;
+ stringStart.remove(lastPos, 1);
+ }
+ }
+
+ if (stringStart.isEmpty())
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -stringStart.length() && stringStart.length() < maxLength) {
+ stringStart.clear();
+ return false;
+ }
+
+ if (d->isJoiner(stringStart.at(0))) {
+ stringStart.clear();
+ return false;
+ }
+
+ if (d->isJoiner(stringStart.at(stringStart.length() - 1))) {
+ stringStart.clear();
+ return false;
+ }
+
+ ic->setPreeditText(stringStart, QList<QInputMethodEvent::Attribute>(), replaceFrom, stringStart.length());
+ d->activeWordIndex = 0;
+ d->wordCandidates = {stringStart};
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
+
+ return true;
+}
+
+void ExampleHwrInputMethod::timerEvent(QTimerEvent *timerEvent)
+{
+ Q_D(ExampleHwrInputMethod);
+ int timerId = timerEvent->timerId();
+ qCDebug(lcExampleHwr) << "timerEvent():" << timerId;
+ if (timerId == d->resultTimer) {
+ if (!d->countActiveTraces()) {
+ d->stopResultTimer();
+ d->processResult();
+ d->clearTraces();
+ }
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/example/hwr/examplehwrinputmethod_p.h b/src/plugins/example/hwr/examplehwrinputmethod_p.h
new file mode 100644
index 00000000..3bb47c3f
--- /dev/null
+++ b/src/plugins/example/hwr/examplehwrinputmethod_p.h
@@ -0,0 +1,65 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef EXAMPLEHWRINPUTMETHOD_P_H
+#define EXAMPLEHWRINPUTMETHOD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class ExampleHwrInputMethodPrivate;
+
+class ExampleHwrInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(ExampleHwrInputMethod)
+ QML_NAMED_ELEMENT(HandwritingInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit ExampleHwrInputMethod(QObject *parent = nullptr);
+ ~ExampleHwrInputMethod();
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+
+ void reset() override;
+ void update() override;
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role) override;
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
+
+ QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patternRecognitionModes() const override;
+ QVirtualKeyboardTrace *traceBegin(
+ int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
+ const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo) override;
+ bool traceEnd(QVirtualKeyboardTrace *trace) override;
+
+ bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags) override;
+
+protected:
+ void timerEvent(QTimerEvent *timerEvent) override;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/hangul/.prev_CMakeLists.txt b/src/plugins/hangul/.prev_CMakeLists.txt
deleted file mode 100644
index 91684b36..00000000
--- a/src/plugins/hangul/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Generated from hangul.pro.
-
-#####################################################################
-## QtVirtualKeyboardHangulPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardHangulPlugin
- OUTPUT_NAME qtvirtualkeyboard_hangul
- TYPE virtualkeyboard
- SOURCES
- hangul.cpp hangul_p.h
- hangulinputmethod.cpp hangulinputmethod_p.h
- hangulplugin.cpp hangulplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
-)
-
-# Resources:
-set(qmake_virtualkeyboard_hangul_layouts_resource_files
- "virtualkeyboard/content/layouts/ko_KR/dialpad.fallback"
- "virtualkeyboard/content/layouts/ko_KR/digits.fallback"
- "virtualkeyboard/content/layouts/ko_KR/main.qml"
- "virtualkeyboard/content/layouts/ko_KR/numbers.fallback"
- "virtualkeyboard/content/layouts/ko_KR/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardHangulPlugin "qmake_virtualkeyboard_hangul_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_hangul_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:hangul.pro:<TRUE>:
-# OTHER_FILES = "hangul.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:hangul.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Hangul (Qt $$QT_VERSION)"
diff --git a/src/plugins/hangul/CMakeLists.txt b/src/plugins/hangul/CMakeLists.txt
index bec19898..41e4ee47 100644
--- a/src/plugins/hangul/CMakeLists.txt
+++ b/src/plugins/hangul/CMakeLists.txt
@@ -1,53 +1,48 @@
-# Generated from hangul.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QtVirtualKeyboardHangulPlugin Plugin:
#####################################################################
-qt_internal_add_plugin(QtVirtualKeyboardHangulPlugin
- OUTPUT_NAME qtvirtualkeyboard_hangul
- TYPE virtualkeyboard
+qt_internal_add_qml_module(qtvkbhangulplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Hangul"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbhangulplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
SOURCES
hangul.cpp hangul_p.h
hangulinputmethod.cpp hangulinputmethod_p.h
- hangulplugin.cpp hangulplugin.h
DEFINES
QT_ASCII_CAST_WARNINGS
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_FROM_BYTEARRAY
QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::Qml
Qt::VirtualKeyboard
+ NO_GENERATE_CPP_EXPORTS
)
# Resources:
set(qmake_virtualkeyboard_hangul_layouts_resource_files
- "virtualkeyboard/content/layouts/ko_KR/dialpad.fallback"
- "virtualkeyboard/content/layouts/ko_KR/digits.fallback"
- "virtualkeyboard/content/layouts/ko_KR/main.qml"
- "virtualkeyboard/content/layouts/ko_KR/numbers.fallback"
- "virtualkeyboard/content/layouts/ko_KR/symbols.qml"
+ "${VKB_LAYOUTS_BASE}/ko_KR/dialpad.fallback"
+ "${VKB_LAYOUTS_BASE}/ko_KR/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/ko_KR/main.qml"
+ "${VKB_LAYOUTS_BASE}/ko_KR/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/ko_KR/symbols.qml"
)
-qt_add_resource(QtVirtualKeyboardHangulPlugin "qmake_virtualkeyboard_hangul_layouts"
+qt_internal_add_resource(qtvkbhangulplugin "qmake_virtualkeyboard_hangul_layouts"
PREFIX
- "${VKB_LAYOUTS_PREFIX}" #special case
+ "${VKB_LAYOUTS_PREFIX}"
BASE
- "${VKB_LAYOUTS_BASE}" #special case
+ "${VKB_LAYOUTS_BASE}"
FILES
${qmake_virtualkeyboard_hangul_layouts_resource_files}
)
-
-
-#### Keys ignored in scope 1:.:.:hangul.pro:<TRUE>:
-# OTHER_FILES = "hangul.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:hangul.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Hangul (Qt $$QT_VERSION)"
diff --git a/src/plugins/hangul/hangul.cpp b/src/plugins/hangul/hangul.cpp
index f29fb3a3..60f352ec 100644
--- a/src/plugins/hangul/hangul.cpp
+++ b/src/plugins/hangul/hangul.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "hangul_p.h"
@@ -63,7 +37,7 @@ const int Hangul::SCount = Hangul::LCount * Hangul::NCount; // 11172
QString Hangul::decompose(const QString &source)
{
QString result;
- const int len = source.length();
+ const int len = source.size();
for (int i = 0; i < len; i++) {
QChar ch = source.at(i);
int SIndex = (int)ch.unicode() - SBase;
@@ -106,7 +80,7 @@ QString Hangul::decompose(const QString &source)
QString Hangul::compose(const QString &source)
{
- const int len = source.length();
+ const int len = source.size();
if (len == 0)
return QString();
@@ -138,7 +112,7 @@ QString Hangul::compose(const QString &source)
TIndex = finals.indexOf(unicode);
if (TIndex != -1) {
last = QChar((int)lastUnicode + TIndex);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
@@ -163,7 +137,7 @@ QString Hangul::compose(const QString &source)
HangulMedialIndex VIndexD = it.value();
int VDiff = (int)VIndexD - (int)VIndexA;
last = QChar((int)lastUnicode + VDiff * TCount);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
}
@@ -188,7 +162,7 @@ QString Hangul::compose(const QString &source)
// Remove the previous final jamo from the syllable,
// making the current syllable of form LV
last = QChar((int)lastUnicode - TIndex);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
// Make new syllable of form LV
last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
@@ -209,7 +183,7 @@ QString Hangul::compose(const QString &source)
HangulFinalIndex TIndexA, TIndexB;
unpackDoubleFinal(key, TIndexA, TIndexB);
last = QChar((int)lastUnicode - TIndex + (int)TIndexA);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
// Add new syllable by combining the initial jamo
// and the current vowel
@@ -238,7 +212,7 @@ QString Hangul::compose(const QString &source)
HangulFinalIndex TIndexD = it.value();
int TDiff = (int)TIndexD - (int)TIndexA;
last = QChar((int)lastUnicode + TDiff);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
}
@@ -257,7 +231,7 @@ QString Hangul::compose(const QString &source)
int VIndex = (int)unicode - VBase;
if (VIndex >= 0 && VIndex < VCount) {
last = QChar(SBase + (LIndex * VCount + VIndex) * TCount);
- result.replace(result.length() - 1, 1, last);
+ result.replace(result.size() - 1, 1, last);
continue;
}
}
diff --git a/src/plugins/hangul/hangul.json b/src/plugins/hangul/hangul.json
deleted file mode 100644
index f7008a87..00000000
--- a/src/plugins/hangul/hangul.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "hangul",
- "Provider": "Qt Hangul Extension",
- "InputMethod": "HangulInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/hangul/hangul.pro b/src/plugins/hangul/hangul.pro
deleted file mode 100644
index f2540ab2..00000000
--- a/src/plugins/hangul/hangul.pro
+++ /dev/null
@@ -1,45 +0,0 @@
-TARGET = qtvirtualkeyboard_hangul
-QT += qml virtualkeyboard
-
-include(../../shared.pri)
-
-HEADERS += \
- hangul_p.h \
- hangulplugin.h \
- hangulinputmethod_p.h
-SOURCES += \
- hangul.cpp \
- hangulplugin.cpp \
- hangulinputmethod.cpp
-OTHER_FILES += \
- hangul.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-LAYOUT_FILES += \
- $$LAYOUTS_BASE/content/layouts/ko_KR/dialpad.fallback \
- $$LAYOUTS_BASE/content/layouts/ko_KR/digits.fallback \
- $$LAYOUTS_BASE/content/layouts/ko_KR/main.qml \
- $$LAYOUTS_BASE/content/layouts/ko_KR/numbers.fallback \
- $$LAYOUTS_BASE/content/layouts/ko_KR/symbols.qml
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-virtualkeyboard_hangul_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_hangul_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_hangul_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_hangul_layouts
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Hangul (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardHangulPlugin
-load(qt_plugin)
diff --git a/src/plugins/hangul/hangul_p.h b/src/plugins/hangul/hangul_p.h
index 4f8c70c9..3dfe7095 100644
--- a/src/plugins/hangul/hangul_p.h
+++ b/src/plugins/hangul/hangul_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef HANGUL_P_H
#define HANGUL_P_H
diff --git a/src/plugins/hangul/hangulinputmethod.cpp b/src/plugins/hangul/hangulinputmethod.cpp
index dd50f20b..eaadbcfa 100644
--- a/src/plugins/hangul/hangulinputmethod.cpp
+++ b/src/plugins/hangul/hangulinputmethod.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "hangulinputmethod_p.h"
#include "hangul_p.h"
@@ -77,8 +51,8 @@ bool HangulInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardM
if (key == Qt::Key_Backspace) {
int contextLength = cursorPosition > 1 ? 2 : 1;
QString hangul = Hangul::decompose(ic->surroundingText().mid(cursorPosition - contextLength, contextLength));
- int length = hangul.length();
- if (hangul.length() > 1) {
+ int length = hangul.size();
+ if (hangul.size() > 1) {
ic->commit(Hangul::compose(hangul.left(length - 1)), -contextLength, contextLength);
accept = true;
}
diff --git a/src/plugins/hangul/hangulinputmethod_p.h b/src/plugins/hangul/hangulinputmethod_p.h
index 212e6b2b..7421232c 100644
--- a/src/plugins/hangul/hangulinputmethod_p.h
+++ b/src/plugins/hangul/hangulinputmethod_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef HANGULINPUTMETHOD_P_H
#define HANGULINPUTMETHOD_P_H
@@ -52,6 +26,9 @@ class HangulInputMethod : public QVirtualKeyboardAbstractInputMethod
{
Q_OBJECT
Q_DECLARE_PRIVATE(HangulInputMethod)
+ QML_ELEMENT
+ QML_ADDED_IN_VERSION(2, 0)
+
public:
explicit HangulInputMethod(QObject *parent = nullptr);
~HangulInputMethod();
diff --git a/src/plugins/hangul/hangulplugin.cpp b/src/plugins/hangul/hangulplugin.cpp
deleted file mode 100644
index a1438ed8..00000000
--- a/src/plugins/hangul/hangulplugin.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "hangulplugin.h"
-#include "hangulinputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardHangulPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<HangulInputMethod>(uri, 1, 3, "HangulInputMethod");
- qmlRegisterType<HangulInputMethod>(uri, 2, 0, "HangulInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/hangul/hangulplugin.h b/src/plugins/hangul/hangulplugin.h
deleted file mode 100644
index 84ab3e1e..00000000
--- a/src/plugins/hangul/hangulplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HANGULPLUGIN_H
-#define HANGULPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardHangulPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "hangul.json")
-public:
- void registerTypes(const char *uri) const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/hunspell/3rdparty/hunspell/CMakeLists.txt b/src/plugins/hunspell/3rdparty/hunspell/CMakeLists.txt
new file mode 100644
index 00000000..73eb12ee
--- /dev/null
+++ b/src/plugins/hunspell/3rdparty/hunspell/CMakeLists.txt
@@ -0,0 +1,41 @@
+#####################################################################
+## BundledHunspell Generic Library:
+#####################################################################
+
+qt_internal_add_3rdparty_library(BundledHunspell
+ QMAKE_LIB_NAME hunspell
+ STATIC
+ SOURCES
+ ${CMAKE_CURRENT_BINARY_DIR}/hunspell/config.h
+ hunspell/src/hunspell/affentry.cxx hunspell/src/hunspell/affentry.hxx
+ hunspell/src/hunspell/affixmgr.cxx hunspell/src/hunspell/affixmgr.hxx
+ hunspell/src/hunspell/atypes.hxx
+ hunspell/src/hunspell/baseaffix.hxx
+ hunspell/src/hunspell/csutil.cxx hunspell/src/hunspell/csutil.hxx
+ hunspell/src/hunspell/filemgr.cxx hunspell/src/hunspell/filemgr.hxx
+ hunspell/src/hunspell/hashmgr.cxx hunspell/src/hunspell/hashmgr.hxx
+ hunspell/src/hunspell/htypes.hxx
+ hunspell/src/hunspell/hunspell.cxx hunspell/src/hunspell/hunspell.h hunspell/src/hunspell/hunspell.hxx
+ hunspell/src/hunspell/hunvisapi.h
+ hunspell/src/hunspell/hunzip.cxx hunspell/src/hunspell/hunzip.hxx
+ hunspell/src/hunspell/langnum.hxx
+ hunspell/src/hunspell/phonet.cxx hunspell/src/hunspell/phonet.hxx
+ hunspell/src/hunspell/replist.cxx hunspell/src/hunspell/replist.hxx
+ hunspell/src/hunspell/suggestmgr.cxx hunspell/src/hunspell/suggestmgr.hxx
+ hunspell/src/hunspell/w_char.hxx
+ PUBLIC_DEFINES
+ HUNSPELL_STATIC
+ PUBLIC_INCLUDE_DIRECTORIES
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/hunspell/src>
+)
+qt_disable_warnings(BundledHunspell)
+
+file(READ hunspell/ChangeLog HUNSPELL_VERSION LIMIT 10)
+string(STRIP ${HUNSPELL_VERSION} HUNSPELL_VERSION)
+configure_file(config.h.cmake.in hunspell/config.h)
+
+qt_internal_extend_target(BundledHunspell CONDITION CMAKE_BUILD_TYPE STREQUAL Debug
+ DEFINES
+ HUNSPELL_WARNING_ON
+)
diff --git a/src/plugins/hunspell/3rdparty/hunspell/config.h.cmake.in b/src/plugins/hunspell/3rdparty/hunspell/config.h.cmake.in
new file mode 100644
index 00000000..c9503097
--- /dev/null
+++ b/src/plugins/hunspell/3rdparty/hunspell/config.h.cmake.in
@@ -0,0 +1,2 @@
+/* Version number of package */
+#define VERSION "@HUNSPELL_VERSION@"
diff --git a/src/plugins/hunspell/3rdparty/hunspell/hunspell.pro b/src/plugins/hunspell/3rdparty/hunspell/hunspell.pro
deleted file mode 100644
index bd5eccb3..00000000
--- a/src/plugins/hunspell/3rdparty/hunspell/hunspell.pro
+++ /dev/null
@@ -1,52 +0,0 @@
-TARGET = qthunspell
-
-CONFIG += static
-CONFIG += precompile_header warn_off
-CONFIG(debug, debug|release) {
- DEFINES += HUNSPELL_WARNING_ON
-}
-
-config_file = "/* Version number of package */" "$${LITERAL_HASH}define VERSION \"$$VERSION\""
-write_file($$PWD/config.h, config_file)
-
-MODULE_DEFINES += HUNSPELL_STATIC
-MODULE_INCLUDEPATH = $$PWD/src
-
-SOURCES += \
- src/hunspell/affentry.cxx \
- src/hunspell/affixmgr.cxx \
- src/hunspell/csutil.cxx \
- src/hunspell/filemgr.cxx \
- src/hunspell/hashmgr.cxx \
- src/hunspell/hunspell.cxx \
- src/hunspell/hunzip.cxx \
- src/hunspell/phonet.cxx \
- src/hunspell/replist.cxx \
- src/hunspell/suggestmgr.cxx
-
-HEADERS += \
- config.h \
- src/hunspell/affentry.hxx \
- src/hunspell/affixmgr.hxx \
- src/hunspell/atypes.hxx \
- src/hunspell/baseaffix.hxx \
- src/hunspell/csutil.hxx \
- src/hunspell/filemgr.hxx \
- src/hunspell/hashmgr.hxx \
- src/hunspell/htypes.hxx \
- src/hunspell/hunspell.h \
- src/hunspell/hunspell.hxx \
- src/hunspell/hunvisapi.h \
- src/hunspell/hunzip.hxx \
- src/hunspell/langnum.hxx \
- src/hunspell/phonet.hxx \
- src/hunspell/replist.hxx \
- src/hunspell/suggestmgr.hxx \
- src/hunspell/w_char.hxx
-
-OTHER_FILES +=\
- src/hunspell/license.hunspell \
- src/hunspell/license.myspell \
- src/hunspell/utf_info.cxx
-
-load(qt_helper_lib)
diff --git a/src/plugins/hunspell/CMakeLists.txt b/src/plugins/hunspell/CMakeLists.txt
index 3ebc3efa..5f4d9015 100644
--- a/src/plugins/hunspell/CMakeLists.txt
+++ b/src/plugins/hunspell/CMakeLists.txt
@@ -1,7 +1,7 @@
-# Generated from hunspell.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-add_subdirectory(hunspellinputmethod)
-add_subdirectory(plugin)
if(QT_FEATURE_3rdparty_hunspell)
add_subdirectory(3rdparty/hunspell)
endif()
+add_subdirectory(module)
diff --git a/src/plugins/hunspell/hunspell.pro b/src/plugins/hunspell/hunspell.pro
deleted file mode 100644
index a34a56e7..00000000
--- a/src/plugins/hunspell/hunspell.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TEMPLATE = subdirs
-
-QT_FOR_CONFIG += virtualkeyboard-private
-
-SUBDIRS += \
- hunspellinputmethod \
- plugin
-
-qtConfig(3rdparty-hunspell) {
- SUBDIRS += 3rdparty/hunspell
- hunspellinputmethod.depends += 3rdparty/hunspell
-}
-
-plugin.depends += hunspellinputmethod
diff --git a/src/plugins/hunspell/hunspellinputmethod/.prev_CMakeLists.txt b/src/plugins/hunspell/hunspellinputmethod/.prev_CMakeLists.txt
deleted file mode 100644
index b3c22b73..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Generated from hunspellinputmethod.pro.
-
-#####################################################################
-## HunspellInputMethod Module:
-#####################################################################
-
-qt_add_module(HunspellInputMethod
- INTERNAL_MODULE
- SOURCES
- hunspellinputmethod.cpp hunspellinputmethod_p.cpp hunspellinputmethod_p.h
- hunspellinputmethod_p_p.h
- hunspellworker.cpp hunspellworker_p.h
- qhunspellinputmethod_global.h
- DEFINES
- QHUNSPELLINPUTMETHOD_LIBRARY
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::VirtualKeyboardPrivate
-)
-
-#### Keys ignored in scope 1:.:.:hunspellinputmethod.pro:<TRUE>:
-# MODULE = "hunspellinputmethod"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(HunspellInputMethod CONDITION QT_FEATURE_system_hunspell
- PUBLIC_LIBRARIES
- Hunspell::Hunspell
-)
-
-#### Keys ignored in scope 4:.:.:hunspellinputmethod.pro:QT_FEATURE_3rdparty_hunspell:
-# PKGCONFIG = "hunspell"
diff --git a/src/plugins/hunspell/hunspellinputmethod/CMakeLists.txt b/src/plugins/hunspell/hunspellinputmethod/CMakeLists.txt
deleted file mode 100644
index a525ae35..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Generated from hunspellinputmethod.pro.
-
-#####################################################################
-## HunspellInputMethod Module:
-#####################################################################
-
-qt_add_module(HunspellInputMethod
- INTERNAL_MODULE
- SOURCES
- hunspellinputmethod.cpp hunspellinputmethod_p.cpp hunspellinputmethod_p.h
- hunspellinputmethod_p_p.h
- hunspellworker.cpp hunspellworker_p.h
- qhunspellinputmethod_global.h
- DEFINES
- QHUNSPELLINPUTMETHOD_LIBRARY
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::VirtualKeyboardPrivate
-)
-
-#### Keys ignored in scope 1:.:.:hunspellinputmethod.pro:<TRUE>:
-# MODULE = "hunspellinputmethod"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(HunspellInputMethod CONDITION QT_FEATURE_system_hunspell
- PUBLIC_LIBRARIES
- Hunspell::Hunspell
-)
-
-# special case begin
-extend_target(HunspellInputMethod CONDITION NOT FEATURE_system_hunspell AND QT_FEATURE_3rdparty_hunspell
- PUBLIC_LIBRARIES
- BundledHunspell
-)
-# special case end
-
-#### Keys ignored in scope 4:.:.:hunspellinputmethod.pro:QT_FEATURE_3rdparty_hunspell:
-# PKGCONFIG = "hunspell"
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp
deleted file mode 100644
index 3c17003c..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.cpp
+++ /dev/null
@@ -1,412 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtHunspellInputMethod/private/hunspellinputmethod_p_p.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#include <QLoggingCategory>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_LOGGING_CATEGORY(lcHunspell, "qt.virtualkeyboard.hunspell")
-
-/*!
- \class QtVirtualKeyboard::HunspellInputMethod
- \internal
-*/
-
-HunspellInputMethod::HunspellInputMethod(HunspellInputMethodPrivate *d_ptr, QObject *parent) :
- QVirtualKeyboardAbstractInputMethod(parent),
- d_ptr(d_ptr)
-{
-}
-
-HunspellInputMethod::HunspellInputMethod(QObject *parent) :
- QVirtualKeyboardAbstractInputMethod(parent),
- d_ptr(new HunspellInputMethodPrivate(this))
-{
-}
-
-HunspellInputMethod::~HunspellInputMethod()
-{
-}
-
-QList<QVirtualKeyboardInputEngine::InputMode> HunspellInputMethod::inputModes(const QString &locale)
-{
- QList<QVirtualKeyboardInputEngine::InputMode> result;
- switch (QLocale(locale).script()) {
- case QLocale::GreekScript:
- result.append(QVirtualKeyboardInputEngine::InputMode::Greek);
- break;
- case QLocale::CyrillicScript:
- result.append(QVirtualKeyboardInputEngine::InputMode::Cyrillic);
- break;
- case QLocale::ArabicScript:
- result.append(QVirtualKeyboardInputEngine::InputMode::Arabic);
- break;
- case QLocale::HebrewScript:
- result.append(QVirtualKeyboardInputEngine::InputMode::Hebrew);
- break;
- default:
- break;
- }
- result.append(QVirtualKeyboardInputEngine::InputMode::Latin);
- result.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
- return result;
-}
-
-bool HunspellInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
-{
- Q_UNUSED(inputMode);
- Q_D(HunspellInputMethod);
- return d->createHunspell(locale);
-}
-
-bool HunspellInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase);
- return true;
-}
-
-bool HunspellInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_D(HunspellInputMethod);
- QVirtualKeyboardInputContext *ic = inputContext();
- Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
- bool accept = false;
- switch (key) {
- case Qt::Key_Enter:
- case Qt::Key_Return:
- case Qt::Key_Tab:
- case Qt::Key_Space:
- update();
- break;
- case Qt::Key_Backspace:
- {
- QString word = d->wordCandidates.wordAt(0);
- if (!word.isEmpty()) {
- word.remove(word.length() - 1, 1);
- ic->setPreeditText(word);
- if (!word.isEmpty()) {
- d->wordCandidates.updateWord(0, word);
- if (d->updateSuggestions()) {
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
- }
- } else {
- d->reset();
- }
- accept = true;
- }
- break;
- }
- default:
- if (inputMethodHints.testFlag(Qt::ImhNoPredictiveText))
- break;
- if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded) {
- update();
- break;
- }
- if (text.length() > 0) {
- QChar c = text.at(0);
- QString word = d->wordCandidates.wordAt(0);
- bool addToWord = d->isValidInputChar(c) && (!word.isEmpty() || !d->isJoiner(c));
- if (addToWord) {
- QString newText = text;
- /* Automatic space insertion. */
- if (word.isEmpty()) {
- QString surroundingText = ic->surroundingText();
- int cursorPosition = ic->cursorPosition();
- /* Rules for automatic space insertion:
- - Surrounding text is not empty
- - Cursor is at the end of the line
- - No space before the cursor
- - No spefic characters before the cursor; minus and apostrophe
- */
- if (!surroundingText.isEmpty() && cursorPosition == surroundingText.length()) {
- QChar lastChar = surroundingText.at(cursorPosition - 1);
- if (!lastChar.isSpace() &&
- lastChar != Qt::Key_Minus &&
- d->isAutoSpaceAllowed()) {
- // auto-insertion of space might trigger auto-capitalization
- bool wasShiftActive = ic->isShiftActive();
- ic->commit(QLatin1String(" "));
- if (ic->isShiftActive() && !wasShiftActive)
- newText = newText.toUpper();
- }
- }
- }
- /* Ignore possible call to update() function when sending initial
- pre-edit text. The update is triggered if the text editor has
- a selection which the pre-edit text will replace.
- */
- d->ignoreUpdate = word.isEmpty();
- word.append(newText);
- d->wordCandidates.updateWord(0, word);
- ic->setPreeditText(word);
- d->ignoreUpdate = false;
- if (d->updateSuggestions()) {
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
- }
- accept = true;
- } else if (text.length() > 1) {
- bool addSpace = !word.isEmpty() || d->autoSpaceAllowed;
- update();
- d->autoSpaceAllowed = true;
- if (addSpace && d->isAutoSpaceAllowed())
- ic->commit(QLatin1String(" "));
- ic->commit(text);
- d->autoSpaceAllowed = addSpace;
- accept = true;
- } else {
- update();
- inputContext()->sendKeyClick(key, text, modifiers);
- d->autoSpaceAllowed = true;
- accept = true;
- }
- }
- break;
- }
- return accept;
-}
-
-QList<QVirtualKeyboardSelectionListModel::Type> HunspellInputMethod::selectionLists()
-{
- Q_D(const HunspellInputMethod);
- QVirtualKeyboardInputContext *ic = inputContext();
- if (!ic)
- return QList<QVirtualKeyboardSelectionListModel::Type>();
- Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
- if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded || inputMethodHints.testFlag(Qt::ImhNoPredictiveText) || inputMethodHints.testFlag(Qt::ImhHiddenText))
- return QList<QVirtualKeyboardSelectionListModel::Type>();
- return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
-}
-
-int HunspellInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
-{
- Q_UNUSED(type);
- Q_D(HunspellInputMethod);
- return d->wordCandidates.size();
-}
-
-QVariant HunspellInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
-{
- QVariant result;
- Q_D(HunspellInputMethod);
- switch (role) {
- case QVirtualKeyboardSelectionListModel::Role::Display:
- result = QVariant(d->wordCandidates.wordAt(index));
- break;
- case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
- {
- const QString wordCandidate(d->wordCandidates.wordAt(index));
- const QString word(d->wordCandidates.wordAt(0));
- int wordCompletionLength = wordCandidate.length() - word.length();
- result.setValue((wordCompletionLength > 0 && wordCandidate.startsWith(word)) ? wordCompletionLength : 0);
- break;
- }
- case QVirtualKeyboardSelectionListModel::Role::Dictionary:
- {
- const QString wordCandidate(d->wordCandidates.wordAt(index));
- QVirtualKeyboardSelectionListModel::DictionaryType dictionaryType =
- d->userDictionaryWords && d->userDictionaryWords->contains(wordCandidate) ?
- QVirtualKeyboardSelectionListModel::DictionaryType::User : QVirtualKeyboardSelectionListModel::DictionaryType::Default;
- result = QVariant(static_cast<int>(dictionaryType));
- break;
- }
- case QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion:
- result.setValue(index > 0 && d->wordCandidates.wordFlagsAt(index).testFlag(HunspellWordList::SpellCheckOk));
- break;
- default:
- result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void HunspellInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
-{
- Q_UNUSED(type);
- Q_D(HunspellInputMethod);
- d->wordCandidates.setIndex(index);
- d->addToDictionary();
- QString finalWord = d->wordCandidates.wordAt(index);
- reset();
- inputContext()->commit(finalWord);
- d->autoSpaceAllowed = true;
-}
-
-bool HunspellInputMethod::selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index)
-{
- Q_D(HunspellInputMethod);
- Q_UNUSED(type);
-
- if (index <= 0 || index >= d->wordCandidates.size())
- return false;
-
- QString word = d->wordCandidates.wordAt(index);
- d->removeFromDictionary(word);
-
- return true;
-}
-
-bool HunspellInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
-{
- Q_D(HunspellInputMethod);
- QString word(d->wordCandidates.wordAt(0));
- Q_ASSERT(word.isEmpty());
-
- if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded)
- return false;
-
- QVirtualKeyboardInputContext *ic = inputContext();
- if (!ic)
- return false;
-
- const QString surroundingText = ic->surroundingText();
- int replaceFrom = 0;
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor)) {
- for (int i = cursorPosition - 1; i >= 0; --i) {
- QChar c = surroundingText.at(i);
- if (!d->isValidInputChar(c))
- break;
- word.insert(0, c);
- --replaceFrom;
- }
-
- while (replaceFrom < 0 && d->isJoiner(word.at(0))) {
- word.remove(0, 1);
- ++replaceFrom;
- }
- }
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == 0)
- return false;
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor)) {
- for (int i = cursorPosition; i < surroundingText.length(); ++i) {
- QChar c = surroundingText.at(i);
- if (!d->isValidInputChar(c))
- break;
- word.append(c);
- }
-
- while (replaceFrom > -word.length()) {
- int lastPos = word.length() - 1;
- if (!d->isJoiner(word.at(lastPos)))
- break;
- word.remove(lastPos, 1);
- }
- }
-
- if (word.isEmpty())
- return false;
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -word.length())
- return false;
-
- if (d->isJoiner(word.at(0)))
- return false;
-
- if (d->isJoiner(word.at(word.length() - 1)))
- return false;
-
- d->wordCandidates.updateWord(0, word);
- ic->setPreeditText(word, QList<QInputMethodEvent::Attribute>(), replaceFrom, word.length());
-
- d->autoSpaceAllowed = false;
- if (d->updateSuggestions()) {
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
- }
-
- return true;
-}
-
-void HunspellInputMethod::reset()
-{
- Q_D(HunspellInputMethod);
- d->reset();
-}
-
-void HunspellInputMethod::update()
-{
- Q_D(HunspellInputMethod);
- if (d->ignoreUpdate)
- return;
-
- QString finalWord;
- if (!d->wordCandidates.isEmpty()) {
- d->addToDictionary();
- finalWord = d->wordCandidates.wordAt(d->wordCandidates.index());
- }
- d->reset();
- inputContext()->commit(finalWord);
- d->autoSpaceAllowed = false;
-}
-
-void HunspellInputMethod::updateSuggestions(const QSharedPointer<HunspellWordList> &wordList, int tag)
-{
- Q_D(HunspellInputMethod);
- if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded) {
- qCDebug(lcHunspell) << "updateSuggestions: skip (dictionary not loaded)";
- update();
- return;
- }
- if (d->wordCandidatesUpdateTag != tag) {
- qCDebug(lcHunspell) << "updateSuggestions: skip tag" << tag << "current" << d->wordCandidatesUpdateTag;
- return;
- }
- QString word(d->wordCandidates.wordAt(0));
- d->wordCandidates = *wordList;
- if (d->wordCandidates.wordAt(0).compare(word) != 0)
- d->wordCandidates.updateWord(0, word);
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
-}
-
-void HunspellInputMethod::dictionaryLoadCompleted(bool success)
-{
- Q_D(HunspellInputMethod);
- QVirtualKeyboardInputContext *ic = inputContext();
- if (!ic)
- return;
-
- QList<QVirtualKeyboardSelectionListModel::Type> oldSelectionLists = selectionLists();
- d->dictionaryState = success ? HunspellInputMethodPrivate::DictionaryReady :
- HunspellInputMethodPrivate::DictionaryNotLoaded;
- QList<QVirtualKeyboardSelectionListModel::Type> newSelectionLists = selectionLists();
- if (oldSelectionLists != newSelectionLists)
- emit selectionListsChanged();
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.pro b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.pro
deleted file mode 100644
index 9948b01f..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod.pro
+++ /dev/null
@@ -1,28 +0,0 @@
-TARGET = QtHunspellInputMethod
-MODULE = hunspellinputmethod
-
-CONFIG += internal_module
-QT += virtualkeyboard-private
-
-DEFINES += QHUNSPELLINPUTMETHOD_LIBRARY
-
-SOURCES += \
- hunspellinputmethod.cpp \
- hunspellinputmethod_p.cpp \
- hunspellworker.cpp
-HEADERS += \
- hunspellinputmethod_p.h \
- hunspellinputmethod_p_p.h \
- hunspellworker_p.h \
- qhunspellinputmethod_global.h
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-qtConfig(system-hunspell):QMAKE_USE += hunspell
-else:qtConfig(3rdparty-hunspell): PKGCONFIG += hunspell
-
-load(qt_module)
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp
deleted file mode 100644
index 5835fa3e..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtHunspellInputMethod/private/hunspellinputmethod_p_p.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#include <hunspell/hunspell.h>
-#include <QStringList>
-#include <QDir>
-#include <QtCore/QLibraryInfo>
-#include <QStandardPaths>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-const int HunspellInputMethodPrivate::userDictionaryMaxSize = 100;
-
-/*!
- \class QtVirtualKeyboard::HunspellInputMethodPrivate
- \internal
-*/
-
-HunspellInputMethodPrivate::HunspellInputMethodPrivate(HunspellInputMethod *q_ptr) :
- q_ptr(q_ptr),
- hunspellWorker(new HunspellWorker()),
- locale(),
- wordCompletionPoint(2),
- ignoreUpdate(false),
- autoSpaceAllowed(false),
- dictionaryState(DictionaryNotLoaded),
- userDictionaryWords(new HunspellWordList(userDictionaryMaxSize)),
- blacklistedWords(new HunspellWordList(userDictionaryMaxSize)),
- wordCandidatesUpdateTag(0)
-{
- if (hunspellWorker)
- hunspellWorker->start();
-}
-
-HunspellInputMethodPrivate::~HunspellInputMethodPrivate()
-{
-}
-
-bool HunspellInputMethodPrivate::createHunspell(const QString &locale)
-{
- Q_Q(HunspellInputMethod);
- if (!hunspellWorker)
- return false;
- if (this->locale != locale) {
- clearSuggestionsRelatedTasks();
- hunspellWorker->waitForAllTasks();
- QString hunspellDataPath(qEnvironmentVariable("QT_VIRTUALKEYBOARD_HUNSPELL_DATA_PATH"));
- const QString pathListSep(
-#if defined(Q_OS_WIN32)
- QStringLiteral(";")
-#else
- QStringLiteral(":")
-#endif
- );
- QStringList searchPaths(hunspellDataPath.split(pathListSep, Qt::SkipEmptyParts));
- const QStringList defaultPaths = QStringList()
- << QDir(QLibraryInfo::location(QLibraryInfo::DataPath) + QStringLiteral("/qtvirtualkeyboard/hunspell")).absolutePath()
-#if !defined(Q_OS_WIN32)
- << QStringLiteral("/usr/share/hunspell")
- << QStringLiteral("/usr/share/myspell/dicts")
-#endif
- ;
- for (const QString &defaultPath : defaultPaths) {
- if (!searchPaths.contains(defaultPath))
- searchPaths.append(defaultPath);
- }
- QSharedPointer<HunspellLoadDictionaryTask> loadDictionaryTask(new HunspellLoadDictionaryTask(locale, searchPaths));
- QObject::connect(loadDictionaryTask.data(), &HunspellLoadDictionaryTask::completed, q, &HunspellInputMethod::dictionaryLoadCompleted);
- dictionaryState = HunspellInputMethodPrivate::DictionaryLoading;
- emit q->selectionListsChanged();
- hunspellWorker->addTask(loadDictionaryTask);
- this->locale = locale;
-
- loadCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
- addToHunspell(userDictionaryWords);
- loadCustomDictionary(blacklistedWords, QLatin1String("blacklist"));
- removeFromHunspell(blacklistedWords);
- }
- return true;
-}
-
-void HunspellInputMethodPrivate::reset()
-{
- if (clearSuggestions(true)) {
- Q_Q(HunspellInputMethod);
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, wordCandidates.index());
- }
- autoSpaceAllowed = false;
-}
-
-bool HunspellInputMethodPrivate::updateSuggestions()
-{
- bool wordCandidateListChanged = false;
- QString word = wordCandidates.wordAt(0);
- if (!word.isEmpty() && dictionaryState != HunspellInputMethodPrivate::DictionaryNotLoaded) {
- wordCandidateListChanged = true;
- if (word.length() >= wordCompletionPoint) {
- if (hunspellWorker) {
- QSharedPointer<HunspellWordList> wordList(new HunspellWordList(wordCandidates));
-
- // Clear obsolete tasks from the worker queue
- clearSuggestionsRelatedTasks();
-
- // Build suggestions
- QSharedPointer<HunspellBuildSuggestionsTask> buildSuggestionsTask(new HunspellBuildSuggestionsTask());
- buildSuggestionsTask->wordList = wordList;
- buildSuggestionsTask->autoCorrect = false;
- hunspellWorker->addTask(buildSuggestionsTask);
-
- // Filter out blacklisted word (sometimes Hunspell suggests,
- // e.g. with different text case)
- QSharedPointer<HunspellFilterWordTask> filterWordTask(new HunspellFilterWordTask());
- filterWordTask->wordList = wordList;
- filterWordTask->filterList = blacklistedWords;
- hunspellWorker->addTask(filterWordTask);
-
- // Boost words from user dictionary
- QSharedPointer<HunspellBoostWordTask> boostWordTask(new HunspellBoostWordTask());
- boostWordTask->wordList = wordList;
- boostWordTask->boostList = userDictionaryWords;
- hunspellWorker->addTask(boostWordTask);
-
- // Update word candidate list
- QSharedPointer<HunspellUpdateSuggestionsTask> updateSuggestionsTask(new HunspellUpdateSuggestionsTask());
- updateSuggestionsTask->wordList = wordList;
- updateSuggestionsTask->tag = ++wordCandidatesUpdateTag;
- Q_Q(HunspellInputMethod);
- QObject::connect(updateSuggestionsTask.data(), &HunspellUpdateSuggestionsTask::updateSuggestions, q, &HunspellInputMethod::updateSuggestions);
- hunspellWorker->addTask(updateSuggestionsTask);
- }
- }
- } else {
- wordCandidateListChanged = clearSuggestions();
- }
- return wordCandidateListChanged;
-}
-
-bool HunspellInputMethodPrivate::clearSuggestions(bool clearInputWord)
-{
- clearSuggestionsRelatedTasks();
- return clearInputWord ? wordCandidates.clear() : wordCandidates.clearSuggestions();
-}
-
-void HunspellInputMethodPrivate::clearSuggestionsRelatedTasks()
-{
- if (hunspellWorker) {
- hunspellWorker->removeAllTasksOfType<HunspellBuildSuggestionsTask>();
- hunspellWorker->removeAllTasksOfType<HunspellFilterWordTask>();
- hunspellWorker->removeAllTasksOfType<HunspellBoostWordTask>();
- hunspellWorker->removeAllTasksOfType<HunspellUpdateSuggestionsTask>();
- }
-}
-
-bool HunspellInputMethodPrivate::isAutoSpaceAllowed() const
-{
- Q_Q(const HunspellInputMethod);
- if (!autoSpaceAllowed)
- return false;
- if (q->inputEngine()->inputMode() == QVirtualKeyboardInputEngine::InputMode::Numeric)
- return false;
- QVirtualKeyboardInputContext *ic = q->inputContext();
- if (!ic)
- return false;
- Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
- return !inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) &&
- !inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly);
-}
-
-bool HunspellInputMethodPrivate::isValidInputChar(const QChar &c) const
-{
- if (c.isLetterOrNumber())
- return true;
- if (isJoiner(c))
- return true;
- if (c.isMark())
- return true;
- return false;
-}
-
-bool HunspellInputMethodPrivate::isJoiner(const QChar &c) const
-{
- if (c.isPunct() || c.isSymbol()) {
- Q_Q(const HunspellInputMethod);
- QVirtualKeyboardInputContext *ic = q->inputContext();
- if (ic) {
- Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
- if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) || inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly))
- return QString(QStringLiteral(":/?#[]@!$&'()*+,;=-_.%")).contains(c);
- }
- ushort unicode = c.unicode();
- if (unicode == Qt::Key_Apostrophe || unicode == Qt::Key_Minus)
- return true;
- }
- return false;
-}
-
-QString HunspellInputMethodPrivate::customDictionaryLocation(const QString &dictionaryType) const
-{
- if (dictionaryType.isEmpty() || locale.isEmpty())
- return QString();
-
- QString location = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
- if (location.isEmpty())
- return QString();
-
- return QStringLiteral("%1/qtvirtualkeyboard/hunspell/%2-%3.txt")
- .arg(location)
- .arg(dictionaryType)
- .arg(locale);
-}
-
-void HunspellInputMethodPrivate::loadCustomDictionary(const QSharedPointer<HunspellWordList> &wordList,
- const QString &dictionaryType) const
-{
- QSharedPointer<HunspellLoadWordListTask> loadWordsTask(new HunspellLoadWordListTask());
- loadWordsTask->filePath = customDictionaryLocation(dictionaryType);
- loadWordsTask->wordList = wordList;
- hunspellWorker->addTask(loadWordsTask);
-}
-
-void HunspellInputMethodPrivate::saveCustomDictionary(const QSharedPointer<HunspellWordList> &wordList,
- const QString &dictionaryType) const
-{
- QSharedPointer<HunspellSaveWordListTask> saveWordsTask(new HunspellSaveWordListTask());
- saveWordsTask->filePath = customDictionaryLocation(dictionaryType);
- saveWordsTask->wordList = wordList;
- hunspellWorker->addTask(saveWordsTask);
-}
-
-void HunspellInputMethodPrivate::addToHunspell(const QSharedPointer<HunspellWordList> &wordList) const
-{
- QSharedPointer<HunspellAddWordTask> addWordTask(new HunspellAddWordTask());
- addWordTask->wordList = wordList;
- hunspellWorker->addTask(addWordTask);
-}
-
-void HunspellInputMethodPrivate::removeFromHunspell(const QSharedPointer<HunspellWordList> &wordList) const
-{
- QSharedPointer<HunspellRemoveWordTask> removeWordTask(new HunspellRemoveWordTask());
- removeWordTask->wordList = wordList;
- hunspellWorker->addTask(removeWordTask);
-}
-
-void HunspellInputMethodPrivate::removeFromDictionary(const QString &word)
-{
- if (userDictionaryWords->removeWord(word) > 0) {
- saveCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
- } else if (!blacklistedWords->contains(word)) {
- blacklistedWords->appendWord(word);
- saveCustomDictionary(blacklistedWords, QLatin1String("blacklist"));
- }
-
- QSharedPointer<HunspellWordList> wordList(new HunspellWordList());
- wordList->appendWord(word);
- removeFromHunspell(wordList);
-
- updateSuggestions();
-}
-
-void HunspellInputMethodPrivate::addToDictionary()
-{
- Q_Q(HunspellInputMethod);
- // This feature is not allowed when dealing with sensitive information
- const Qt::InputMethodHints inputMethodHints(q->inputContext()->inputMethodHints());
- const bool userDictionaryEnabled =
- !inputMethodHints.testFlag(Qt::ImhHiddenText) &&
- !inputMethodHints.testFlag(Qt::ImhSensitiveData);
- if (!userDictionaryEnabled)
- return;
-
- if (wordCandidates.isEmpty())
- return;
-
- QString word;
- HunspellWordList::Flags wordFlags;
- const int activeWordIndex = wordCandidates.index();
- wordCandidates.wordAt(activeWordIndex, word, wordFlags);
- if (activeWordIndex == 0) {
- if (blacklistedWords->removeWord(word) > 0) {
- saveCustomDictionary(blacklistedWords, QLatin1String("blacklist"));
- } else if (word.length() > 1 && !wordFlags.testFlag(HunspellWordList::SpellCheckOk) && !userDictionaryWords->contains(word)) {
- userDictionaryWords->appendWord(word);
- saveCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
- } else {
- // Avoid adding words to Hunspell which are too short or passed spell check
- return;
- }
-
- QSharedPointer<HunspellWordList> wordList(new HunspellWordList());
- wordList->appendWord(word);
- addToHunspell(wordList);
- } else {
- // Check if found in the user dictionary and move as last in the list.
- // This way the list is always ordered by use.
- // If userDictionaryMaxSize is greater than zero the number of words in the
- // list will be limited to that amount. By pushing last used items to end of
- // list we can avoid (to certain extent) removing frequently used words.
- int userDictionaryIndex = userDictionaryWords->indexOfWord(word);
- if (userDictionaryIndex != -1) {
- userDictionaryWords->moveWord(userDictionaryIndex, userDictionaryWords->size() - 1);
- saveCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
- }
- }
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.h b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.h
deleted file mode 100644
index a0f53710..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HUNSPELLINPUTMETHOD_P_H
-#define HUNSPELLINPUTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-#include <QtHunspellInputMethod/qhunspellinputmethod_global.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class HunspellInputMethodPrivate;
-class HunspellWordList;
-
-class QHUNSPELLINPUTMETHOD_EXPORT HunspellInputMethod : public QVirtualKeyboardAbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(HunspellInputMethod)
-protected:
- HunspellInputMethod(HunspellInputMethodPrivate *d_ptr, QObject *parent);
-public:
- explicit HunspellInputMethod(QObject *parent = nullptr);
- ~HunspellInputMethod();
-
- QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
- bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
- bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
-
- QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
- int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
- QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
- QVirtualKeyboardSelectionListModel::Role role) override;
- void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
- bool selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index) override;
-
- bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags) override;
-
- void reset() override;
- void update() override;
-
-protected Q_SLOTS:
- void updateSuggestions(const QSharedPointer<HunspellWordList> &wordList, int tag);
- void dictionaryLoadCompleted(bool success);
-
-protected:
- QScopedPointer<HunspellInputMethodPrivate> d_ptr;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // HUNSPELLINPUTMETHOD_P_H
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p_p.h b/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p_p.h
deleted file mode 100644
index 2e604350..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/hunspellinputmethod_p_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HUNSPELLINPUTMETHOD_P_P_H
-#define HUNSPELLINPUTMETHOD_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtHunspellInputMethod/private/hunspellinputmethod_p.h>
-#include <QtHunspellInputMethod/private/hunspellworker_p.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class QHUNSPELLINPUTMETHOD_EXPORT HunspellInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(HunspellInputMethod)
-
-public:
- HunspellInputMethodPrivate(HunspellInputMethod *q_ptr);
- ~HunspellInputMethodPrivate();
-
- enum DictionaryState {
- DictionaryNotLoaded,
- DictionaryLoading,
- DictionaryReady
- };
-
- bool createHunspell(const QString &locale);
- void reset();
- bool updateSuggestions();
- bool clearSuggestions(bool clearInputWord = false);
- void clearSuggestionsRelatedTasks();
- bool isAutoSpaceAllowed() const;
- bool isValidInputChar(const QChar &c) const;
- bool isJoiner(const QChar &c) const;
- QString customDictionaryLocation(const QString &dictionaryType) const;
- void loadCustomDictionary(const QSharedPointer<HunspellWordList> &wordList, const QString &dictionaryType) const;
- void saveCustomDictionary(const QSharedPointer<HunspellWordList> &wordList, const QString &dictionaryType) const;
- void addToHunspell(const QSharedPointer<HunspellWordList> &wordList) const;
- void removeFromHunspell(const QSharedPointer<HunspellWordList> &wordList) const;
- void removeFromDictionary(const QString &word);
- void addToDictionary();
-
- HunspellInputMethod *q_ptr;
- QScopedPointer<HunspellWorker> hunspellWorker;
- QString locale;
- HunspellWordList wordCandidates;
- int wordCompletionPoint;
- bool ignoreUpdate;
- bool autoSpaceAllowed;
- DictionaryState dictionaryState;
- QSharedPointer<HunspellWordList> userDictionaryWords;
- QSharedPointer<HunspellWordList> blacklistedWords;
- int wordCandidatesUpdateTag;
- static const int userDictionaryMaxSize;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // HUNSPELLINPUTMETHOD_P_P_H
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellworker.cpp b/src/plugins/hunspell/hunspellinputmethod/hunspellworker.cpp
deleted file mode 100644
index e97e3415..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/hunspellworker.cpp
+++ /dev/null
@@ -1,772 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtHunspellInputMethod/private/hunspellworker_p.h>
-#include <QList>
-#include <QFileInfo>
-#include <QRegularExpression>
-#include <QElapsedTimer>
-#include <QFile>
-#include <QDir>
-#include <QtAlgorithms>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-HunspellWordList::HunspellWordList(int limit) :
- _index(0),
- _limit(limit)
-{
-}
-
-HunspellWordList::HunspellWordList(HunspellWordList &other)
-{
- *this = other;
-}
-
-HunspellWordList &HunspellWordList::operator=(HunspellWordList &other)
-{
- if (this != &other) {
- QMutexLocker guard(&_lock);
- QMutexLocker otherGuard(&other._lock);
- _list = other._list;
- _flags = other._flags;
- _index = other._index;
- _limit = other._limit;
- _searchIndex = other._searchIndex;
- }
- return *this;
-}
-
-int HunspellWordList::index() const
-{
- return _index < _list.size() ? _index : -1;
-}
-
-void HunspellWordList::setIndex(int index)
-{
- QMutexLocker guard(&_lock);
- _index = index;
-}
-
-bool HunspellWordList::clear()
-{
- QMutexLocker guard(&_lock);
- bool result = !_list.isEmpty();
- _list.clear();
- _flags.clear();
- _index = 0;
- _searchIndex.clear();
- return result;
-}
-
-bool HunspellWordList::clearSuggestions()
-{
- QMutexLocker guard(&_lock);
- if (_list.isEmpty())
- return false;
-
- _searchIndex.clear();
- if (_list.size() > 1) {
- QString word = _list.at(0);
- Flags flags = _flags.at(0);
- _list.clear();
- _flags.clear();
- if (!word.isEmpty()) {
- _index = 0;
- _list.append(word);
- _flags.append(flags);
- }
- return true;
- } else if (_list.at(0).isEmpty()) {
- _list.clear();
- _flags.clear();
- _index = 0;
- return true;
- }
- return false;
-}
-
-bool HunspellWordList::hasSuggestions() const
-{
- return _list.size() > 1;
-}
-
-int HunspellWordList::size() const
-{
- return _list.size();
-}
-
-int HunspellWordList::isEmpty() const
-{
- return _list.isEmpty() || _list.at(0).isEmpty();
-}
-
-bool HunspellWordList::contains(const QString &word)
-{
- QMutexLocker guard(&_lock);
-
- // Use index search when the search index is available.
- // This provides a lot faster search than QList::contains().
- // Search index is available when it has been rebuilt using
- // rebuildSearchIndex() method. Search index is automatically
- // cleared when the word list is modified.
- if (!_searchIndex.isEmpty()) {
- Q_ASSERT(_searchIndex.size() == _list.size());
-
- SearchContext searchContext(word, _list);
- return std::binary_search(_searchIndex.begin(), _searchIndex.end(), -1, [searchContext](const int &a, const int &b) {
- const QString &wordA = (a == -1) ? searchContext.word : searchContext.list[a];
- const QString &wordB = (b == -1) ? searchContext.word : searchContext.list[b];
- return wordA.compare(wordB, Qt::CaseInsensitive) < 0;
- });
- }
-
- return _list.contains(word, Qt::CaseInsensitive);
-}
-
-QString HunspellWordList::findWordCompletion(const QString &word)
-{
- QMutexLocker guard(&_lock);
-
- if (!_searchIndex.isEmpty()) {
- Q_ASSERT(_searchIndex.size() == _list.size());
-
- SearchContext searchContext(word, _list);
- auto match = std::lower_bound(_searchIndex.begin(), _searchIndex.end(), -1, [searchContext](const int &a, const int &b) {
- const QString &wordA = (a == -1) ? searchContext.word : searchContext.list[a];
- const QString &wordB = (b == -1) ? searchContext.word : searchContext.list[b];
- return wordA.compare(wordB, Qt::CaseInsensitive) < 0;
- });
-
- if (match == _searchIndex.end())
- return QString();
-
- if (!word.compare(_list[*match], Qt::CaseInsensitive)) {
- match++;
- if (match == _searchIndex.end())
- return QString();
- }
-
- return _list[*match].startsWith(word, Qt::CaseInsensitive) ? _list[*match] : QString();
- }
-
- QString bestMatch;
- for (int i = 0, count = _list.size(); i < count; ++i) {
- const QString &wordB(_list[i]);
- if (wordB.length() > bestMatch.length() &&
- word.length() < wordB.length() &&
- wordB.startsWith(word, Qt::CaseInsensitive))
- bestMatch = wordB;
- }
-
- return bestMatch;
-}
-
-int HunspellWordList::indexOfWord(const QString &word)
-{
- QMutexLocker guard(&_lock);
-
- if (!_searchIndex.isEmpty()) {
- Q_ASSERT(_searchIndex.size() == _list.size());
-
- SearchContext searchContext(word, _list);
- auto match = std::lower_bound(_searchIndex.begin(), _searchIndex.end(), -1, [searchContext](int a, int b) {
- const QString &wordA = (a == -1) ? searchContext.word : searchContext.list[a];
- const QString &wordB = (b == -1) ? searchContext.word : searchContext.list[b];
- return wordA.compare(wordB, Qt::CaseInsensitive) < 0;
- });
- return (match != _searchIndex.end()) ? *match : -1;
- }
-
- return _list.indexOf(word);
-}
-
-QString HunspellWordList::wordAt(int index)
-{
- QMutexLocker guard(&_lock);
-
- return index >= 0 && index < _list.size() ? _list.at(index) : QString();
-}
-
-void HunspellWordList::wordAt(int index, QString &word, Flags &flags)
-{
- QMutexLocker guard(&_lock);
- Q_ASSERT(index >= 0 && index < _list.size());
-
- word = _list.at(index);
- flags = _flags.at(index);
-}
-
-const HunspellWordList::Flags &HunspellWordList::wordFlagsAt(int index)
-{
- QMutexLocker guard(&_lock);
-
- return _flags[index];
-}
-
-void HunspellWordList::appendWord(const QString &word, const Flags &flags)
-{
- QMutexLocker guard(&_lock);
-
- _searchIndex.clear();
- if (_limit > 0) {
- while (_list.size() >= _limit) {
- _list.removeAt(0);
- _flags.removeAt(0);
- }
- }
- _list.append(word);
- _flags.append(flags);
-}
-
-void HunspellWordList::insertWord(int index, const QString &word, const Flags &flags)
-{
- QMutexLocker guard(&_lock);
- Q_ASSERT(_limit == 0);
-
- _searchIndex.clear();
- _list.insert(index, word);
- _flags.insert(index, flags);
-}
-
-void HunspellWordList::updateWord(int index, const QString &word, const Flags &flags)
-{
- Q_ASSERT(index >= 0);
- QMutexLocker guard(&_lock);
-
- if (index < _list.size()) {
- if (word != _list[index])
- _searchIndex.clear();
- _list[index] = word;
- _flags[index] = flags;
- } else {
- _searchIndex.clear();
- _list.append(word);
- _flags.append(flags);
- }
-}
-
-void HunspellWordList::moveWord(int from, int to)
-{
- QMutexLocker guard(&_lock);
-
- if (from < 0 || from >= _list.size())
- return;
- if (to < 0 || to >= _list.size())
- return;
- if (from == to)
- return;
-
- _searchIndex.clear();
- _list.move(from, to);
- _flags.move(from, to);
-}
-
-int HunspellWordList::removeWord(const QString &word)
-{
- QMutexLocker guard(&_lock);
- int removeCount = 0;
- for (int i = 0, count = _list.size(); i < count;) {
- if (!_list[i].compare(word, Qt::CaseInsensitive)) {
- _list.removeAt(i);
- _flags.removeAt(i);
- --count;
- ++removeCount;
- } else {
- ++i;
- }
- }
- if (removeCount > 0)
- _searchIndex.clear();
- return removeCount;
-}
-
-void HunspellWordList::removeWordAt(int index)
-{
- QMutexLocker guard(&_lock);
-
- _list.removeAt(index);
-}
-
-void HunspellWordList::rebuildSearchIndex()
-{
- QMutexLocker guard(&_lock);
- _searchIndex.clear();
-
- if (_list.isEmpty())
- return;
-
- _searchIndex.resize(_list.size());
- std::iota(_searchIndex.begin(), _searchIndex.end(), 0);
-
- const QStringList list(_list);
- std::sort(_searchIndex.begin(), _searchIndex.end(), [list](int a, int b) { return list[a].compare(list[b], Qt::CaseInsensitive) < 0; });
-}
-
-/*!
- \class QtVirtualKeyboard::HunspellTask
- \internal
-*/
-
-/*!
- \class QtVirtualKeyboard::HunspellWordList
- \internal
-*/
-
-/*!
- \class QtVirtualKeyboard::HunspellLoadDictionaryTask
- \internal
-*/
-
-HunspellLoadDictionaryTask::HunspellLoadDictionaryTask(const QString &locale, const QStringList &searchPaths) :
- HunspellTask(),
- hunspellPtr(nullptr),
- locale(locale),
- searchPaths(searchPaths)
-{
-}
-
-void HunspellLoadDictionaryTask::run()
-{
- Q_ASSERT(hunspellPtr != nullptr);
-
- qCDebug(lcHunspell) << "HunspellLoadDictionaryTask::run(): locale:" << locale;
-
- if (*hunspellPtr) {
- Hunspell_destroy(*hunspellPtr);
- *hunspellPtr = nullptr;
- }
-
- QString affPath;
- QString dicPath;
- for (const QString &searchPath : searchPaths) {
- affPath = QStringLiteral("%1/%2.aff").arg(searchPath, locale);
- if (QFileInfo::exists(affPath)) {
- dicPath = QStringLiteral("%1/%2.dic").arg(searchPath, locale);
- if (QFileInfo::exists(dicPath))
- break;
- dicPath.clear();
- }
- affPath.clear();
- }
-
- if (!affPath.isEmpty() && !dicPath.isEmpty()) {
- *hunspellPtr = Hunspell_create(affPath.toUtf8().constData(), dicPath.toUtf8().constData());
- if (*hunspellPtr) {
- /* Make sure the encoding used by the dictionary is supported
- by the QStringConverter.
- */
- if (!QStringConverter::encodingForName(Hunspell_get_dic_encoding(*hunspellPtr))) {
- qCWarning(lcHunspell) << "The Hunspell dictionary" << dicPath << "cannot be used because it uses an unknown text codec" << QLatin1String(Hunspell_get_dic_encoding(*hunspellPtr));
- Hunspell_destroy(*hunspellPtr);
- *hunspellPtr = nullptr;
- }
- }
- } else {
- qCWarning(lcHunspell) << "Hunspell dictionary is missing for" << locale << ". Search paths" << searchPaths;
- }
-
- emit completed(*hunspellPtr != nullptr);
-}
-
-/*!
- \class QtVirtualKeyboard::HunspellBuildSuggestionsTask
- \internal
-*/
-
-void HunspellBuildSuggestionsTask::run()
-{
- if (wordList->isEmpty())
- return;
-
- wordList->clearSuggestions();
- QString word = wordList->wordAt(0);
-
- /* Select text codec based on the dictionary encoding.
- Hunspell_get_dic_encoding() should always return at least
- "ISO8859-1", but you can never be too sure.
- */
- textDecoder = QStringDecoder(Hunspell_get_dic_encoding(hunspell));
- textEncoder = QStringEncoder(Hunspell_get_dic_encoding(hunspell));
- if (!textDecoder.isValid() || !textEncoder.isValid())
- return;
-
- char **slst = nullptr;
- int n = Hunspell_suggest(hunspell, &slst, QByteArray { textEncoder(word) }.constData());
- if (n > 0) {
- /* Collect word candidates from the Hunspell suggestions.
- Insert word completions in the beginning of the list.
- */
- const int firstWordCompletionIndex = wordList->size();
- int lastWordCompletionIndex = firstWordCompletionIndex;
- bool suggestCapitalization = false;
- for (int i = 0; i < n; i++) {
- QString wordCandidate(textDecoder(slst[i]));
- wordCandidate.replace(QChar(0x2019), QLatin1Char('\''));
- QString normalizedWordCandidate = removeAccentsAndDiacritics(wordCandidate);
- /* Prioritize word Capitalization */
- if (!wordCandidate.compare(word, Qt::CaseInsensitive)) {
- if (suggestCapitalization) {
- bool wordCandidateIsCapital = wordCandidate.at(0).isUpper();
- bool wordIsCapital = word.at(0).isUpper();
- if (wordCandidateIsCapital == wordIsCapital) {
- if (wordCandidateIsCapital)
- wordCandidate = wordCandidate.toLower();
- else
- wordCandidate[0] = wordCandidate.at(0).toUpper();
- }
- wordList->insertWord(1, wordCandidate);
- lastWordCompletionIndex++;
- suggestCapitalization = true;
- }
- /* Prioritize word completions, missing punctuation or missing accents */
- } else if ((normalizedWordCandidate.length() > word.length() &&
- normalizedWordCandidate.startsWith(word)) ||
- wordCandidate.contains(QLatin1Char('\''))) {
- wordList->insertWord(lastWordCompletionIndex++, wordCandidate);
- } else {
- wordList->appendWord(wordCandidate);
- }
- }
- /* Prioritize words with missing spaces next to word completions.
- */
- for (int i = lastWordCompletionIndex; i < wordList->size(); i++) {
- QString wordCandidate(wordList->wordAt(i));
- if (wordCandidate.contains(QLatin1String(" "))) {
- wordList->updateWord(i, wordCandidate, wordList->wordFlagsAt(i) | HunspellWordList::CompoundWord);
- if (i != lastWordCompletionIndex) {
- wordList->moveWord(i, lastWordCompletionIndex);
- }
- lastWordCompletionIndex++;
- }
- }
- /* Do spell checking and suggest the first candidate, if:
- - the word matches partly the suggested word; or
- - the quality of the suggested word is good enough.
-
- The quality is measured here using the Levenshtein Distance,
- which may be suboptimal for the purpose, but gives some clue
- how much the suggested word differs from the given word.
- */
- if (autoCorrect && wordList->size() > 1 && (!spellCheck(word) || suggestCapitalization)) {
- if (lastWordCompletionIndex > firstWordCompletionIndex || levenshteinDistance(word, wordList->wordAt(firstWordCompletionIndex)) < 3)
- wordList->setIndex(firstWordCompletionIndex);
- }
- }
- Hunspell_free_list(hunspell, &slst, n);
-
- for (int i = 0, count = wordList->size(); i < count; ++i) {
- HunspellWordList::Flags flags;
- wordList->wordAt(i, word, flags);
- if (flags.testFlag(HunspellWordList::CompoundWord))
- continue;
- if (Hunspell_spell(hunspell, QByteArray { textEncoder(word) }.constData()) != 0)
- wordList->updateWord(i, word, wordList->wordFlagsAt(i) | HunspellWordList::SpellCheckOk);
- }
-}
-
-bool HunspellBuildSuggestionsTask::spellCheck(const QString &word)
-{
- if (!hunspell)
- return false;
- if (word.contains(QRegularExpression(QLatin1String("[0-9]"))))
- return true;
- return Hunspell_spell(hunspell, QByteArray { textEncoder(word) }.constData()) != 0;
-}
-
-// source: http://en.wikipedia.org/wiki/Levenshtein_distance
-int HunspellBuildSuggestionsTask::levenshteinDistance(const QString &s, const QString &t)
-{
- if (s == t)
- return 0;
- if (s.length() == 0)
- return t.length();
- if (t.length() == 0)
- return s.length();
- QList<int> v0(t.length() + 1);
- QList<int> v1(t.length() + 1);
- for (int i = 0; i < v0.size(); i++)
- v0[i] = i;
- for (int i = 0; i < s.size(); i++) {
- v1[0] = i + 1;
- for (int j = 0; j < t.length(); j++) {
- int cost = (s[i].toLower() == t[j].toLower()) ? 0 : 1;
- v1[j + 1] = qMin(qMin(v1[j] + 1, v0[j + 1] + 1), v0[j] + cost);
- }
- for (int j = 0; j < v0.size(); j++)
- v0[j] = v1[j];
- }
- return v1[t.length()];
-}
-
-QString HunspellBuildSuggestionsTask::removeAccentsAndDiacritics(const QString& s)
-{
- QString normalized = s.normalized(QString::NormalizationForm_D);
- for (int i = 0; i < normalized.length();) {
- QChar::Category category = normalized[i].category();
- if (category <= QChar::Mark_Enclosing) {
- normalized.remove(i, 1);
- } else {
- i++;
- }
- }
- return normalized;
-}
-
-/*!
- \class QtVirtualKeyboard::HunspellUpdateSuggestionsTask
- \internal
-*/
-
-void HunspellUpdateSuggestionsTask::run()
-{
- emit updateSuggestions(wordList, tag);
-}
-
-void HunspellAddWordTask::run()
-{
- auto fromUtf16 = QStringEncoder(Hunspell_get_dic_encoding(hunspell));
- if (!fromUtf16.isValid())
- return;
-
- QString tmpWord;
- tmpWord.reserve(64);
- for (int i = 0, count = wordList->size(); i < count; ++i) {
- const QString word(wordList->wordAt(i));
- if (word.length() < 2)
- continue;
- Hunspell_add(hunspell, QByteArray { fromUtf16(word) }.constData());
- if (HunspellAddWordTask::alternativeForm(word, tmpWord))
- Hunspell_add(hunspell, QByteArray { fromUtf16(tmpWord) }.constData());
- }
-}
-
-bool HunspellAddWordTask::alternativeForm(const QString &word, QString &alternativeForm)
-{
- if (word.length() < 2)
- return false;
- if (!word.mid(1).isLower())
- return false;
-
- const QChar initial(word.at(0));
- const QChar newInitial = initial.isUpper() ? initial.toLower() : initial.toUpper();
- if (newInitial == initial)
- return false;
-
- alternativeForm.truncate(0);
- alternativeForm.append(word);
- alternativeForm[0] = newInitial;
-
- return true;
-}
-
-void HunspellRemoveWordTask::run()
-{
- auto fromUtf16 = QStringEncoder(Hunspell_get_dic_encoding(hunspell));
- if (!fromUtf16.isValid())
- return;
-
- QString tmpWord;
- tmpWord.reserve(64);
- for (int i = 0, count = wordList->size(); i < count; ++i) {
- const QString word(wordList->wordAt(i));
- if (word.isEmpty())
- continue;
- Hunspell_remove(hunspell, QByteArray { fromUtf16(word) }.constData());
- if (HunspellAddWordTask::alternativeForm(word, tmpWord))
- Hunspell_remove(hunspell, QByteArray { fromUtf16(tmpWord) }.constData());
- }
-}
-
-void HunspellLoadWordListTask::run()
-{
- wordList->clear();
-
- QFile inputFile(filePath);
- if (inputFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream inStream(&inputFile);
- QString word;
- word.reserve(64);
- while (inStream.readLineInto(&word)) {
- if (!word.isEmpty())
- wordList->appendWord(word);
- }
- inputFile.close();
- }
-}
-
-void HunspellSaveWordListTask::run()
-{
- QFile outputFile(filePath);
- if (!QFileInfo::exists(filePath))
- QDir().mkpath(QFileInfo(filePath).absoluteDir().path());
- if (outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
- QTextStream outStream(&outputFile);
- for (int i = 0, count = wordList->size(); i < count; ++i) {
- const QString word(wordList->wordAt(i));
- outStream << word.toUtf8() << '\n';
- }
- outputFile.close();
- }
-}
-
-void HunspellFilterWordTask::run()
-{
- if (filterList->isEmpty())
- return;
-
- filterList->rebuildSearchIndex();
-
- for (int i = startIndex, count = wordList->size(); i < count;) {
- if (filterList->contains(wordList->wordAt(i))) {
- wordList->removeWordAt(i);
- --count;
- } else {
- ++i;
- }
- }
-}
-
-void HunspellBoostWordTask::run()
-{
- if (boostList->isEmpty())
- return;
-
- boostList->rebuildSearchIndex();
-
- const QString word(wordList->wordAt(0));
- const QString wordCompletion(boostList->findWordCompletion(word));
- if (!wordCompletion.isEmpty()) {
- int from = wordList->indexOfWord(wordCompletion);
- if (from != 1) {
- int to;
- for (to = 1; to < wordList->size() && wordList->wordAt(to).startsWith(word); ++to)
- ;
- if (from != -1) {
- if (to < from)
- wordList->moveWord(from, to);
- } else {
- wordList->insertWord(to, wordCompletion, HunspellWordList::SpellCheckOk);
- }
- }
- }
-}
-
-/*!
- \class QtVirtualKeyboard::HunspellWorker
- \internal
-*/
-
-HunspellWorker::HunspellWorker(QObject *parent) :
- QThread(parent),
- idleSema(),
- taskSema(),
- taskLock(),
- hunspell(nullptr)
-{
- abort = false;
- qRegisterMetaType<QSharedPointer<HunspellWordList>>("QSharedPointer<HunspellWordList>");
-}
-
-HunspellWorker::~HunspellWorker()
-{
- abort = true;
- taskSema.release(1);
- wait();
-}
-
-void HunspellWorker::addTask(QSharedPointer<HunspellTask> task)
-{
- if (task) {
- QMutexLocker guard(&taskLock);
- taskList.append(task);
- taskSema.release();
- }
-}
-
-void HunspellWorker::removeAllTasks()
-{
- QMutexLocker guard(&taskLock);
- taskList.clear();
-}
-
-void HunspellWorker::waitForAllTasks()
-{
- qCDebug(lcHunspell) << "waitForAllTasks enter";
- while (isRunning()) {
- idleSema.acquire();
- QMutexLocker guard(&taskLock);
- if (taskList.isEmpty()) {
- idleSema.release();
- break;
- }
- idleSema.release();
- }
- qCDebug(lcHunspell) << "waitForAllTasks leave";
-}
-
-void HunspellWorker::run()
-{
- QElapsedTimer perf;
- while (!abort) {
- idleSema.release();
- taskSema.acquire();
- if (abort)
- break;
- idleSema.acquire();
- QSharedPointer<HunspellTask> currentTask;
- {
- QMutexLocker guard(&taskLock);
- if (!taskList.isEmpty()) {
- currentTask = taskList.front();
- taskList.pop_front();
- }
- }
- if (currentTask) {
- QSharedPointer<HunspellLoadDictionaryTask> loadDictionaryTask(currentTask.objectCast<HunspellLoadDictionaryTask>());
- if (loadDictionaryTask)
- loadDictionaryTask->hunspellPtr = &hunspell;
- else if (hunspell)
- currentTask->hunspell = hunspell;
- else
- continue;
- perf.start();
- currentTask->run();
- qCDebug(lcHunspell) << QString(QLatin1String(currentTask->metaObject()->className()) + QLatin1String("::run(): time:")).toLatin1().constData() << perf.elapsed() << "ms";
- }
- }
- if (hunspell) {
- Hunspell_destroy(hunspell);
- hunspell = nullptr;
- }
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/hunspellinputmethod/hunspellworker_p.h b/src/plugins/hunspell/hunspellinputmethod/hunspellworker_p.h
deleted file mode 100644
index de43a035..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/hunspellworker_p.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HUNSPELLWORKER_P_H
-#define HUNSPELLWORKER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QThread>
-#include <QSemaphore>
-#include <QMutex>
-#include <QStringList>
-#include <QSharedPointer>
-#include <QList>
-#include <QLoggingCategory>
-#include <QStringDecoder>
-#include <QStringEncoder>
-#include <hunspell/hunspell.h>
-#include <QtHunspellInputMethod/qhunspellinputmethod_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtVirtualKeyboard {
-
-Q_DECLARE_LOGGING_CATEGORY(lcHunspell)
-
-class QHUNSPELLINPUTMETHOD_EXPORT HunspellWordList
-{
-public:
- enum Flag
- {
- SpellCheckOk = 0x1,
- CompoundWord = 0x2
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- HunspellWordList(int limit = 0);
- HunspellWordList(HunspellWordList &other);
-
- HunspellWordList &operator=(HunspellWordList &other);
-
- int index() const;
- void setIndex(int index);
- bool clear();
- bool clearSuggestions();
- bool hasSuggestions() const;
- int size() const;
- int isEmpty() const;
- bool contains(const QString &word);
- QString findWordCompletion(const QString &word);
- int indexOfWord(const QString &word);
- QString wordAt(int index);
- void wordAt(int index, QString &word, Flags &flags);
- const Flags &wordFlagsAt(int index);
- void appendWord(const QString &word, const Flags &flags = Flags());
- void insertWord(int index, const QString &word, const Flags &flags = Flags());
- void updateWord(int index, const QString &word, const Flags &flags = Flags());
- void moveWord(int from, int to);
- int removeWord(const QString &word);
- void removeWordAt(int index);
- void rebuildSearchIndex();
-
-private:
- class SearchContext {
- public:
- SearchContext(const QString &word,
- const QStringList &list) :
- word(word),
- list(list)
- {}
- const QString &word;
- const QStringList &list;
- };
-
-private:
- QMutex _lock;
- QStringList _list;
- QList<Flags> _flags;
- QList<int> _searchIndex;
- int _index;
- int _limit;
-};
-
-class HunspellTask : public QObject
-{
- Q_OBJECT
-public:
- explicit HunspellTask(QObject *parent = nullptr) :
- QObject(parent),
- hunspell(nullptr)
- {}
-
- virtual void run() = 0;
-
- Hunhandle *hunspell;
-};
-
-class HunspellLoadDictionaryTask : public HunspellTask
-{
- Q_OBJECT
-public:
- explicit HunspellLoadDictionaryTask(const QString &locale, const QStringList &searchPaths);
-
- void run() override;
-
-signals:
- void completed(bool success);
-
-public:
- Hunhandle **hunspellPtr;
- const QString locale;
- const QStringList searchPaths;
-};
-
-class HunspellBuildSuggestionsTask : public HunspellTask
-{
- Q_OBJECT
-public:
- QSharedPointer<HunspellWordList> wordList;
- bool autoCorrect;
-
- void run() override;
- bool spellCheck(const QString &word);
- int levenshteinDistance(const QString &s, const QString &t);
- QString removeAccentsAndDiacritics(const QString& s);
-
-private:
- QStringDecoder textDecoder;
- QStringEncoder textEncoder;
-};
-
-class HunspellUpdateSuggestionsTask : public HunspellTask
-{
- Q_OBJECT
-public:
- QSharedPointer<HunspellWordList> wordList;
-
- void run() override;
-
-signals:
- void updateSuggestions(const QSharedPointer<HunspellWordList> &wordList, int tag);
-
-public:
- int tag;
-};
-
-class HunspellAddWordTask : public HunspellTask
-{
- Q_OBJECT
-public:
- QSharedPointer<HunspellWordList> wordList;
-
- void run() override;
-
- static bool alternativeForm(const QString &word, QString &alternativeForm);
-};
-
-class HunspellRemoveWordTask : public HunspellTask
-{
- Q_OBJECT
-public:
- QSharedPointer<HunspellWordList> wordList;
-
- void run() override;
-};
-
-class HunspellLoadWordListTask : public HunspellTask
-{
- Q_OBJECT
-public:
- QSharedPointer<HunspellWordList> wordList;
- QString filePath;
-
- void run() override;
-};
-
-class HunspellSaveWordListTask : public HunspellTask
-{
- Q_OBJECT
-public:
- QSharedPointer<HunspellWordList> wordList;
- QString filePath;
-
- void run() override;
-};
-
-class HunspellFilterWordTask : public HunspellTask
-{
- Q_OBJECT
-public:
- HunspellFilterWordTask() :
- HunspellTask(),
- startIndex(1)
- {}
-
- QSharedPointer<HunspellWordList> wordList;
- QSharedPointer<HunspellWordList> filterList;
- int startIndex;
-
- void run() override;
-};
-
-class HunspellBoostWordTask : public HunspellTask
-{
- Q_OBJECT
-public:
- HunspellBoostWordTask() :
- HunspellTask()
- {}
-
- QSharedPointer<HunspellWordList> wordList;
- QSharedPointer<HunspellWordList> boostList;
-
- void run() override;
-};
-
-class HunspellWorker : public QThread
-{
- Q_OBJECT
-public:
- explicit HunspellWorker(QObject *parent = nullptr);
- ~HunspellWorker();
-
- void addTask(QSharedPointer<HunspellTask> task);
- void removeAllTasks();
- void waitForAllTasks();
-
- template <class X>
- void removeAllTasksOfType() {
- QMutexLocker guard(&taskLock);
- for (int i = 0; i < taskList.size();) {
- QSharedPointer<X> task(taskList[i].objectCast<X>());
- if (task) {
- qCDebug(lcHunspell) << "Remove task" << QLatin1String(task->metaObject()->className());
- taskList.removeAt(i);
- } else {
- i++;
- }
- }
- }
-
-protected:
- void run() override;
-
-private:
- void createHunspell();
-
-private:
- friend class HunspellLoadDictionaryTask;
- QList<QSharedPointer<HunspellTask> > taskList;
- QSemaphore idleSema;
- QSemaphore taskSema;
- QMutex taskLock;
- Hunhandle *hunspell;
- QBasicAtomicInt abort;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QSharedPointer<QT_PREPEND_NAMESPACE(QtVirtualKeyboard)::HunspellWordList>);
-
-#endif // HUNSPELLWORKER_P_H
diff --git a/src/plugins/hunspell/hunspellinputmethod/qhunspellinputmethod_global.h b/src/plugins/hunspell/hunspellinputmethod/qhunspellinputmethod_global.h
deleted file mode 100644
index 9a548c92..00000000
--- a/src/plugins/hunspell/hunspellinputmethod/qhunspellinputmethod_global.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHUNSPELLINPUTMETHOD_GLOBAL_H
-#define QHUNSPELLINPUTMETHOD_GLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QHUNSPELLINPUTMETHOD_LIBRARY)
-# define QHUNSPELLINPUTMETHOD_EXPORT Q_DECL_EXPORT
-# else
-# define QHUNSPELLINPUTMETHOD_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define QHUNSPELLINPUTMETHOD_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/hunspell/module/CMakeLists.txt b/src/plugins/hunspell/module/CMakeLists.txt
new file mode 100644
index 00000000..b17ab545
--- /dev/null
+++ b/src/plugins/hunspell/module/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## QtQuickVirtualKeyboardHunspellPlugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(HunspellInputMethod
+ URI "QtQuick.VirtualKeyboard.Plugins.Hunspell"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbhunspellplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ hunspellinputmethod.cpp hunspellinputmethod_p.cpp hunspellinputmethod_p.h
+ hunspellinputmethod_p_p.h
+ hunspellworker.cpp hunspellworker_p.h
+ hunspellwordlist.cpp hunspellwordlist_p.h
+ qhunspellinputmethod_global.h
+ DEFINES
+ QHUNSPELLINPUTMETHOD_LIBRARY
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ PUBLIC_LIBRARIES
+ Qt::VirtualKeyboardPrivate
+)
+
+qt_internal_extend_target(HunspellInputMethod CONDITION QT_FEATURE_system_hunspell
+ LIBRARIES
+ Hunspell::Hunspell
+)
+
+qt_internal_extend_target(HunspellInputMethod CONDITION NOT QT_FEATURE_system_hunspell AND QT_FEATURE_3rdparty_hunspell
+ LIBRARIES
+ Qt::BundledHunspell
+)
+
+if(QT_FEATURE_3rdparty_hunspell)
+ qt_copy_or_install(
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/hunspell/data/"
+ DESTINATION "${VKB_INSTALL_DATA}/hunspell"
+ FILES_MATCHING
+ PATTERN "*.dic"
+ PATTERN "*.aff"
+ )
+endif()
diff --git a/src/plugins/hunspell/module/hunspellinputmethod.cpp b/src/plugins/hunspell/module/hunspellinputmethod.cpp
new file mode 100644
index 00000000..a066c927
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellinputmethod.cpp
@@ -0,0 +1,350 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "hunspellinputmethod_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(lcHunspell, "qt.virtualkeyboard.hunspell")
+
+/*!
+ \class QtVirtualKeyboard::HunspellInputMethod
+ \internal
+*/
+
+HunspellInputMethod::HunspellInputMethod(HunspellInputMethodPrivate &dd, QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(dd, parent)
+{
+}
+
+HunspellInputMethod::HunspellInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(*new HunspellInputMethodPrivate(this), parent)
+{
+}
+
+HunspellInputMethod::~HunspellInputMethod()
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> HunspellInputMethod::inputModes(const QString &locale)
+{
+ QList<QVirtualKeyboardInputEngine::InputMode> result;
+ switch (QLocale(locale).script()) {
+ case QLocale::GreekScript:
+ result.append(QVirtualKeyboardInputEngine::InputMode::Greek);
+ break;
+ case QLocale::CyrillicScript:
+ result.append(QVirtualKeyboardInputEngine::InputMode::Cyrillic);
+ break;
+ case QLocale::ArabicScript:
+ result.append(QVirtualKeyboardInputEngine::InputMode::Arabic);
+ break;
+ case QLocale::HebrewScript:
+ result.append(QVirtualKeyboardInputEngine::InputMode::Hebrew);
+ break;
+ default:
+ break;
+ }
+ result.append(QVirtualKeyboardInputEngine::InputMode::Latin);
+ result.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
+ return result;
+}
+
+bool HunspellInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(inputMode);
+ Q_D(HunspellInputMethod);
+ return d->createHunspell(locale);
+}
+
+bool HunspellInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase);
+ return true;
+}
+
+bool HunspellInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_D(HunspellInputMethod);
+ QVirtualKeyboardInputContext *ic = inputContext();
+ Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ bool accept = false;
+ switch (key) {
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Tab:
+ case Qt::Key_Space:
+ update();
+ break;
+ case Qt::Key_Backspace:
+ {
+ QString word = d->wordCandidates.wordAt(0);
+ if (!word.isEmpty()) {
+ word.remove(word.size() - 1, 1);
+ ic->setPreeditText(word);
+ if (!word.isEmpty()) {
+ d->wordCandidates.updateWord(0, word);
+ if (d->updateSuggestions()) {
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
+ }
+ } else {
+ d->reset();
+ }
+ accept = true;
+ }
+ break;
+ }
+ default:
+ if (inputMethodHints.testFlag(Qt::ImhNoPredictiveText))
+ break;
+ if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded) {
+ update();
+ break;
+ }
+ if (text.size() > 0) {
+ QChar c = text.at(0);
+ QString word = d->wordCandidates.wordAt(0);
+ bool addToWord = d->isValidInputChar(c) && (!word.isEmpty() || !d->isJoiner(c));
+ if (addToWord) {
+ QString newText = text;
+ /* Automatic space insertion. */
+ if (word.isEmpty()) {
+ QString surroundingText = ic->surroundingText();
+ int cursorPosition = ic->cursorPosition();
+ /* Rules for automatic space insertion:
+ - Surrounding text is not empty
+ - Cursor is at the end of the line
+ - No space before the cursor
+ - No spefic characters before the cursor; minus and apostrophe
+ */
+ if (!surroundingText.isEmpty() && cursorPosition == surroundingText.size()) {
+ QChar lastChar = surroundingText.at(cursorPosition - 1);
+ if (!lastChar.isSpace() &&
+ lastChar != QLatin1Char(Qt::Key_Minus) &&
+ d->isAutoSpaceAllowed()) {
+ // auto-insertion of space might trigger auto-capitalization
+ bool wasShiftActive = ic->isShiftActive();
+ ic->commit(QLatin1String(" "));
+ if (ic->isShiftActive() && !wasShiftActive)
+ newText = newText.toUpper();
+ }
+ }
+ }
+ /* Ignore possible call to update() function when sending initial
+ pre-edit text. The update is triggered if the text editor has
+ a selection which the pre-edit text will replace.
+ */
+ d->ignoreUpdate = word.isEmpty();
+ word.append(newText);
+ d->wordCandidates.updateWord(0, word);
+ ic->setPreeditText(word);
+ d->ignoreUpdate = false;
+ if (d->updateSuggestions()) {
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
+ }
+ accept = true;
+ } else if (text.size() > 1) {
+ bool addSpace = !word.isEmpty() || d->autoSpaceAllowed;
+ update();
+ d->autoSpaceAllowed = true;
+ if (addSpace && d->isAutoSpaceAllowed())
+ ic->commit(QLatin1String(" "));
+ ic->commit(text);
+ d->autoSpaceAllowed = addSpace;
+ accept = true;
+ } else {
+ update();
+ inputContext()->sendKeyClick(key, text, modifiers);
+ d->autoSpaceAllowed = true;
+ accept = true;
+ }
+ }
+ break;
+ }
+ return accept;
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> HunspellInputMethod::selectionLists()
+{
+ Q_D(const HunspellInputMethod);
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (!ic)
+ return QList<QVirtualKeyboardSelectionListModel::Type>();
+ Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded || inputMethodHints.testFlag(Qt::ImhNoPredictiveText) || inputMethodHints.testFlag(Qt::ImhHiddenText))
+ return QList<QVirtualKeyboardSelectionListModel::Type>();
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int HunspellInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type);
+ Q_D(HunspellInputMethod);
+ return d->wordCandidates.size();
+}
+
+QVariant HunspellInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ QVariant result;
+ Q_D(HunspellInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->wordCandidates.wordAt(index));
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ {
+ const QString wordCandidate(d->wordCandidates.wordAt(index));
+ const QString word(d->wordCandidates.wordAt(0));
+ int wordCompletionLength = wordCandidate.size() - word.size();
+ result.setValue((wordCompletionLength > 0 && wordCandidate.startsWith(word)) ? wordCompletionLength : 0);
+ break;
+ }
+ case QVirtualKeyboardSelectionListModel::Role::Dictionary:
+ {
+ const QString wordCandidate(d->wordCandidates.wordAt(index));
+ QVirtualKeyboardSelectionListModel::DictionaryType dictionaryType =
+ d->userDictionaryWords && d->userDictionaryWords->contains(wordCandidate) ?
+ QVirtualKeyboardSelectionListModel::DictionaryType::User : QVirtualKeyboardSelectionListModel::DictionaryType::Default;
+ result = QVariant(static_cast<int>(dictionaryType));
+ break;
+ }
+ case QVirtualKeyboardSelectionListModel::Role::CanRemoveSuggestion:
+ result.setValue(index > 0 && d->wordCandidates.wordFlagsAt(index).testFlag(HunspellWordList::SpellCheckOk));
+ break;
+ default:
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ break;
+ }
+ return result;
+}
+
+void HunspellInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type);
+ Q_D(HunspellInputMethod);
+ d->wordCandidates.setIndex(index);
+ d->addToDictionary();
+ QString finalWord = d->wordCandidates.wordAt(index);
+ reset();
+ inputContext()->commit(finalWord);
+ d->autoSpaceAllowed = true;
+}
+
+bool HunspellInputMethod::selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_D(HunspellInputMethod);
+ Q_UNUSED(type);
+
+ if (index <= 0 || index >= d->wordCandidates.size())
+ return false;
+
+ QString word = d->wordCandidates.wordAt(index);
+ d->removeFromDictionary(word);
+
+ return true;
+}
+
+bool HunspellInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
+{
+ Q_D(HunspellInputMethod);
+ QString word(d->wordCandidates.wordAt(0));
+ Q_ASSERT(word.isEmpty());
+
+ if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded)
+ return false;
+
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (!ic)
+ return false;
+
+ const QString surroundingText = ic->surroundingText();
+ int replaceFrom = 0;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor)) {
+ for (int i = cursorPosition - 1; i >= 0; --i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ word.insert(0, c);
+ --replaceFrom;
+ }
+
+ while (replaceFrom < 0 && d->isJoiner(word.at(0))) {
+ word.remove(0, 1);
+ ++replaceFrom;
+ }
+ }
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == 0)
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor)) {
+ for (int i = cursorPosition; i < surroundingText.size(); ++i) {
+ QChar c = surroundingText.at(i);
+ if (!d->isValidInputChar(c))
+ break;
+ word.append(c);
+ }
+
+ while (replaceFrom > -word.size()) {
+ int lastPos = word.size() - 1;
+ if (!d->isJoiner(word.at(lastPos)))
+ break;
+ word.remove(lastPos, 1);
+ }
+ }
+
+ if (word.isEmpty())
+ return false;
+
+ if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -word.size())
+ return false;
+
+ if (d->isJoiner(word.at(0)))
+ return false;
+
+ if (d->isJoiner(word.at(word.size() - 1)))
+ return false;
+
+ d->wordCandidates.updateWord(0, word);
+ ic->setPreeditText(word, QList<QInputMethodEvent::Attribute>(), replaceFrom, word.size());
+
+ d->autoSpaceAllowed = false;
+ if (d->updateSuggestions()) {
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->wordCandidates.index());
+ }
+
+ return true;
+}
+
+void HunspellInputMethod::reset()
+{
+ Q_D(HunspellInputMethod);
+ d->reset();
+}
+
+void HunspellInputMethod::update()
+{
+ Q_D(HunspellInputMethod);
+ if (d->ignoreUpdate)
+ return;
+
+ QString finalWord;
+ if (!d->wordCandidates.isEmpty()) {
+ d->addToDictionary();
+ finalWord = d->wordCandidates.wordAt(d->wordCandidates.index());
+ }
+ d->reset();
+ if (!finalWord.isEmpty())
+ inputContext()->commit(finalWord);
+ d->autoSpaceAllowed = false;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/module/hunspellinputmethod_p.cpp b/src/plugins/hunspell/module/hunspellinputmethod_p.cpp
new file mode 100644
index 00000000..393bbf88
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellinputmethod_p.cpp
@@ -0,0 +1,347 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "hunspellinputmethod_p_p.h"
+#include "hunspellinputmethod_p.h"
+#include "hunspellworker_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QStringList>
+#include <QDir>
+#include <QtCore/QLibraryInfo>
+#include <QStandardPaths>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+const int HunspellInputMethodPrivate::userDictionaryMaxSize = 100;
+
+/*!
+ \class QtVirtualKeyboard::HunspellInputMethodPrivate
+ \internal
+*/
+
+HunspellInputMethodPrivate::HunspellInputMethodPrivate(HunspellInputMethod *q_ptr) :
+ q_ptr(q_ptr),
+ hunspellWorker(new HunspellWorker()),
+ locale(),
+ wordCompletionPoint(2),
+ ignoreUpdate(false),
+ autoSpaceAllowed(false),
+ dictionaryState(DictionaryNotLoaded),
+ userDictionaryWords(new HunspellWordList(userDictionaryMaxSize)),
+ blacklistedWords(new HunspellWordList(userDictionaryMaxSize)),
+ wordCandidatesUpdateTag(0)
+{
+ if (hunspellWorker)
+ hunspellWorker->start();
+}
+
+HunspellInputMethodPrivate::~HunspellInputMethodPrivate()
+{
+}
+
+bool HunspellInputMethodPrivate::createHunspell(const QString &locale)
+{
+ Q_Q(HunspellInputMethod);
+ if (!hunspellWorker)
+ return false;
+ if (this->locale != locale) {
+ clearSuggestionsRelatedTasks();
+ hunspellWorker->waitForAllTasks();
+ QString hunspellDataPath(qEnvironmentVariable("QT_VIRTUALKEYBOARD_HUNSPELL_DATA_PATH"));
+ const QString pathListSep(
+#if defined(Q_OS_WIN32)
+ QStringLiteral(";")
+#else
+ QStringLiteral(":")
+#endif
+ );
+ QStringList searchPaths(hunspellDataPath.split(pathListSep, Qt::SkipEmptyParts));
+ const QStringList defaultPaths = QStringList()
+ << QDir(QLibraryInfo::path(QLibraryInfo::DataPath) + QStringLiteral("/qtvirtualkeyboard/hunspell")).absolutePath()
+#if !defined(Q_OS_WIN32)
+ << QStringLiteral("/usr/share/hunspell")
+ << QStringLiteral("/usr/share/myspell/dicts")
+#endif
+ ;
+ for (const QString &defaultPath : defaultPaths) {
+ if (!searchPaths.contains(defaultPath))
+ searchPaths.append(defaultPath);
+ }
+ QSharedPointer<HunspellLoadDictionaryTask> loadDictionaryTask(new HunspellLoadDictionaryTask(locale, searchPaths));
+ QObjectPrivate::connect(loadDictionaryTask.data(), &HunspellLoadDictionaryTask::completed, this, &HunspellInputMethodPrivate::dictionaryLoadCompleted);
+ dictionaryState = HunspellInputMethodPrivate::DictionaryLoading;
+ emit q->selectionListsChanged();
+ hunspellWorker->addTask(loadDictionaryTask);
+ this->locale = locale;
+
+ loadCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
+ addToHunspell(userDictionaryWords);
+ loadCustomDictionary(blacklistedWords, QLatin1String("blacklist"));
+ removeFromHunspell(blacklistedWords);
+ }
+ return true;
+}
+
+void HunspellInputMethodPrivate::reset()
+{
+ if (clearSuggestions(true)) {
+ Q_Q(HunspellInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, wordCandidates.index());
+ }
+ autoSpaceAllowed = false;
+}
+
+bool HunspellInputMethodPrivate::updateSuggestions()
+{
+ bool wordCandidateListChanged = false;
+ QString word = wordCandidates.wordAt(0);
+ if (!word.isEmpty() && dictionaryState != HunspellInputMethodPrivate::DictionaryNotLoaded) {
+ wordCandidateListChanged = true;
+ if (word.size() >= wordCompletionPoint) {
+ if (hunspellWorker) {
+ QSharedPointer<HunspellWordList> wordList(new HunspellWordList(wordCandidates));
+
+ // Clear obsolete tasks from the worker queue
+ clearSuggestionsRelatedTasks();
+
+ // Build suggestions
+ QSharedPointer<HunspellBuildSuggestionsTask> buildSuggestionsTask(new HunspellBuildSuggestionsTask());
+ buildSuggestionsTask->wordList = wordList;
+ buildSuggestionsTask->autoCorrect = false;
+ hunspellWorker->addTask(buildSuggestionsTask);
+
+ // Filter out blacklisted word (sometimes Hunspell suggests,
+ // e.g. with different text case)
+ QSharedPointer<HunspellFilterWordTask> filterWordTask(new HunspellFilterWordTask());
+ filterWordTask->wordList = wordList;
+ filterWordTask->filterList = blacklistedWords;
+ hunspellWorker->addTask(filterWordTask);
+
+ // Boost words from user dictionary
+ QSharedPointer<HunspellBoostWordTask> boostWordTask(new HunspellBoostWordTask());
+ boostWordTask->wordList = wordList;
+ boostWordTask->boostList = userDictionaryWords;
+ hunspellWorker->addTask(boostWordTask);
+
+ // Update word candidate list
+ QSharedPointer<HunspellUpdateSuggestionsTask> updateSuggestionsTask(new HunspellUpdateSuggestionsTask());
+ updateSuggestionsTask->wordList = wordList;
+ updateSuggestionsTask->tag = ++wordCandidatesUpdateTag;
+ QObjectPrivate::connect(updateSuggestionsTask.data(), &HunspellUpdateSuggestionsTask::updateSuggestions, this, &HunspellInputMethodPrivate::updateSuggestionsCompleted);
+ hunspellWorker->addTask(updateSuggestionsTask);
+ }
+ }
+ } else {
+ wordCandidateListChanged = clearSuggestions();
+ }
+ return wordCandidateListChanged;
+}
+
+bool HunspellInputMethodPrivate::clearSuggestions(bool clearInputWord)
+{
+ clearSuggestionsRelatedTasks();
+ return clearInputWord ? wordCandidates.clear() : wordCandidates.clearSuggestions();
+}
+
+void HunspellInputMethodPrivate::clearSuggestionsRelatedTasks()
+{
+ if (hunspellWorker) {
+ hunspellWorker->removeAllTasksOfType<HunspellBuildSuggestionsTask>();
+ hunspellWorker->removeAllTasksOfType<HunspellFilterWordTask>();
+ hunspellWorker->removeAllTasksOfType<HunspellBoostWordTask>();
+ hunspellWorker->removeAllTasksOfType<HunspellUpdateSuggestionsTask>();
+ }
+}
+
+bool HunspellInputMethodPrivate::isAutoSpaceAllowed() const
+{
+ Q_Q(const HunspellInputMethod);
+ if (!autoSpaceAllowed)
+ return false;
+ if (q->inputEngine()->inputMode() == QVirtualKeyboardInputEngine::InputMode::Numeric)
+ return false;
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return false;
+ Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ return !inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) &&
+ !inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly);
+}
+
+bool HunspellInputMethodPrivate::isValidInputChar(const QChar &c) const
+{
+ if (c.isLetterOrNumber())
+ return true;
+ if (isJoiner(c))
+ return true;
+ if (c.isMark())
+ return true;
+ return false;
+}
+
+bool HunspellInputMethodPrivate::isJoiner(const QChar &c) const
+{
+ if (c.isPunct() || c.isSymbol()) {
+ Q_Q(const HunspellInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (ic) {
+ Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) || inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly))
+ return QString(QStringLiteral(":/?#[]@!$&'()*+,;=-_.%")).contains(c);
+ }
+ ushort unicode = c.unicode();
+ if (unicode == Qt::Key_Apostrophe || unicode == Qt::Key_Minus)
+ return true;
+ }
+ return false;
+}
+
+QString HunspellInputMethodPrivate::customDictionaryLocation(const QString &dictionaryType) const
+{
+ if (dictionaryType.isEmpty() || locale.isEmpty())
+ return QString();
+
+ QString location = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
+ if (location.isEmpty())
+ return QString();
+
+ return QStringLiteral("%1/qtvirtualkeyboard/hunspell/%2-%3.txt")
+ .arg(location)
+ .arg(dictionaryType)
+ .arg(locale);
+}
+
+void HunspellInputMethodPrivate::loadCustomDictionary(const QSharedPointer<HunspellWordList> &wordList,
+ const QString &dictionaryType) const
+{
+ QSharedPointer<HunspellLoadWordListTask> loadWordsTask(new HunspellLoadWordListTask());
+ loadWordsTask->filePath = customDictionaryLocation(dictionaryType);
+ loadWordsTask->wordList = wordList;
+ hunspellWorker->addTask(loadWordsTask);
+}
+
+void HunspellInputMethodPrivate::saveCustomDictionary(const QSharedPointer<HunspellWordList> &wordList,
+ const QString &dictionaryType) const
+{
+ QSharedPointer<HunspellSaveWordListTask> saveWordsTask(new HunspellSaveWordListTask());
+ saveWordsTask->filePath = customDictionaryLocation(dictionaryType);
+ saveWordsTask->wordList = wordList;
+ hunspellWorker->addTask(saveWordsTask);
+}
+
+void HunspellInputMethodPrivate::addToHunspell(const QSharedPointer<HunspellWordList> &wordList) const
+{
+ QSharedPointer<HunspellAddWordTask> addWordTask(new HunspellAddWordTask());
+ addWordTask->wordList = wordList;
+ hunspellWorker->addTask(addWordTask);
+}
+
+void HunspellInputMethodPrivate::removeFromHunspell(const QSharedPointer<HunspellWordList> &wordList) const
+{
+ QSharedPointer<HunspellRemoveWordTask> removeWordTask(new HunspellRemoveWordTask());
+ removeWordTask->wordList = wordList;
+ hunspellWorker->addTask(removeWordTask);
+}
+
+void HunspellInputMethodPrivate::removeFromDictionary(const QString &word)
+{
+ if (userDictionaryWords->removeWord(word) > 0) {
+ saveCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
+ } else if (!blacklistedWords->contains(word)) {
+ blacklistedWords->appendWord(word);
+ saveCustomDictionary(blacklistedWords, QLatin1String("blacklist"));
+ }
+
+ QSharedPointer<HunspellWordList> wordList(new HunspellWordList());
+ wordList->appendWord(word);
+ removeFromHunspell(wordList);
+
+ updateSuggestions();
+}
+
+void HunspellInputMethodPrivate::addToDictionary()
+{
+ Q_Q(HunspellInputMethod);
+ // This feature is not allowed when dealing with sensitive information
+ const Qt::InputMethodHints inputMethodHints(q->inputContext()->inputMethodHints());
+ const bool userDictionaryEnabled =
+ !inputMethodHints.testFlag(Qt::ImhHiddenText) &&
+ !inputMethodHints.testFlag(Qt::ImhSensitiveData);
+ if (!userDictionaryEnabled)
+ return;
+
+ if (wordCandidates.isEmpty())
+ return;
+
+ QString word;
+ HunspellWordList::Flags wordFlags;
+ const int activeWordIndex = wordCandidates.index();
+ wordCandidates.wordAt(activeWordIndex, word, wordFlags);
+ if (activeWordIndex == 0) {
+ if (blacklistedWords->removeWord(word) > 0) {
+ saveCustomDictionary(blacklistedWords, QLatin1String("blacklist"));
+ } else if (word.size() > 1 && !wordFlags.testFlag(HunspellWordList::SpellCheckOk) && !userDictionaryWords->contains(word)) {
+ userDictionaryWords->appendWord(word);
+ saveCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
+ } else {
+ // Avoid adding words to Hunspell which are too short or passed spell check
+ return;
+ }
+
+ QSharedPointer<HunspellWordList> wordList(new HunspellWordList());
+ wordList->appendWord(word);
+ addToHunspell(wordList);
+ } else {
+ // Check if found in the user dictionary and move as last in the list.
+ // This way the list is always ordered by use.
+ // If userDictionaryMaxSize is greater than zero the number of words in the
+ // list will be limited to that amount. By pushing last used items to end of
+ // list we can avoid (to certain extent) removing frequently used words.
+ int userDictionaryIndex = userDictionaryWords->indexOfWord(word);
+ if (userDictionaryIndex != -1) {
+ userDictionaryWords->moveWord(userDictionaryIndex, userDictionaryWords->size() - 1);
+ saveCustomDictionary(userDictionaryWords, QLatin1String("userdictionary"));
+ }
+ }
+}
+
+void HunspellInputMethodPrivate::updateSuggestionsCompleted(const QSharedPointer<HunspellWordList> &wordList, int tag)
+{
+ if (dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded) {
+ qCDebug(lcHunspell) << "updateSuggestions: skip (dictionary not loaded)";
+ Q_Q(HunspellInputMethod);
+ q->update();
+ return;
+ }
+ if (wordCandidatesUpdateTag != tag) {
+ qCDebug(lcHunspell) << "updateSuggestions: skip tag" << tag << "current" << wordCandidatesUpdateTag;
+ return;
+ }
+ QString word(wordCandidates.wordAt(0));
+ wordCandidates = *wordList;
+ if (wordCandidates.wordAt(0).compare(word) != 0)
+ wordCandidates.updateWord(0, word);
+ Q_Q(HunspellInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, wordCandidates.index());
+}
+
+void HunspellInputMethodPrivate::dictionaryLoadCompleted(bool success)
+{
+ Q_Q(HunspellInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ if (!ic)
+ return;
+
+ QList<QVirtualKeyboardSelectionListModel::Type> oldSelectionLists = q->selectionLists();
+ dictionaryState = success ? HunspellInputMethodPrivate::DictionaryReady :
+ HunspellInputMethodPrivate::DictionaryNotLoaded;
+ QList<QVirtualKeyboardSelectionListModel::Type> newSelectionLists = q->selectionLists();
+ if (oldSelectionLists != newSelectionLists)
+ emit q->selectionListsChanged();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/module/hunspellinputmethod_p.h b/src/plugins/hunspell/module/hunspellinputmethod_p.h
new file mode 100644
index 00000000..fb90812a
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellinputmethod_p.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef HUNSPELLINPUTMETHOD_P_H
+#define HUNSPELLINPUTMETHOD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+#include <QtHunspellInputMethod/qhunspellinputmethod_global.h>
+#include <QtHunspellInputMethod/private/hunspellinputmethod_p_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class HunspellWordList;
+
+class Q_HUNSPELLINPUTMETHOD_EXPORT HunspellInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(HunspellInputMethod)
+ QML_NAMED_ELEMENT(DefaultInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+protected:
+ HunspellInputMethod(HunspellInputMethodPrivate &dd, QObject *parent);
+public:
+ explicit HunspellInputMethod(QObject *parent = nullptr);
+ ~HunspellInputMethod();
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
+ QVirtualKeyboardSelectionListModel::Role role) override;
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
+ bool selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index) override;
+
+ bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags) override;
+
+ void reset() override;
+ void update() override;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // HUNSPELLINPUTMETHOD_P_H
diff --git a/src/plugins/hunspell/module/hunspellinputmethod_p_p.h b/src/plugins/hunspell/module/hunspellinputmethod_p_p.h
new file mode 100644
index 00000000..bac0a8ed
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellinputmethod_p_p.h
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef HUNSPELLINPUTMETHOD_P_P_H
+#define HUNSPELLINPUTMETHOD_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtHunspellInputMethod/qhunspellinputmethod_global.h>
+#include <QtHunspellInputMethod/private/hunspellwordlist_p.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardabstractinputmethod_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class HunspellInputMethod;
+class HunspellWorker;
+
+class Q_HUNSPELLINPUTMETHOD_EXPORT HunspellInputMethodPrivate : public QVirtualKeyboardAbstractInputMethodPrivate
+{
+public:
+ Q_DECLARE_PUBLIC(HunspellInputMethod)
+
+ HunspellInputMethodPrivate(HunspellInputMethod *q_ptr);
+ ~HunspellInputMethodPrivate();
+
+ enum DictionaryState {
+ DictionaryNotLoaded,
+ DictionaryLoading,
+ DictionaryReady
+ };
+
+ bool createHunspell(const QString &locale);
+ void reset();
+ bool updateSuggestions();
+ bool clearSuggestions(bool clearInputWord = false);
+ void clearSuggestionsRelatedTasks();
+ bool isAutoSpaceAllowed() const;
+ bool isValidInputChar(const QChar &c) const;
+ bool isJoiner(const QChar &c) const;
+ QString customDictionaryLocation(const QString &dictionaryType) const;
+ void loadCustomDictionary(const QSharedPointer<HunspellWordList> &wordList, const QString &dictionaryType) const;
+ void saveCustomDictionary(const QSharedPointer<HunspellWordList> &wordList, const QString &dictionaryType) const;
+ void addToHunspell(const QSharedPointer<HunspellWordList> &wordList) const;
+ void removeFromHunspell(const QSharedPointer<HunspellWordList> &wordList) const;
+ void removeFromDictionary(const QString &word);
+ void addToDictionary();
+ void updateSuggestionsCompleted(const QSharedPointer<HunspellWordList> &wordList, int tag);
+ void dictionaryLoadCompleted(bool success);
+
+ HunspellInputMethod *q_ptr;
+ QScopedPointer<HunspellWorker> hunspellWorker;
+ QString locale;
+ HunspellWordList wordCandidates;
+ int wordCompletionPoint;
+ bool ignoreUpdate;
+ bool autoSpaceAllowed;
+ DictionaryState dictionaryState;
+ QSharedPointer<HunspellWordList> userDictionaryWords;
+ QSharedPointer<HunspellWordList> blacklistedWords;
+ int wordCandidatesUpdateTag;
+ static const int userDictionaryMaxSize;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // HUNSPELLINPUTMETHOD_P_P_H
diff --git a/src/plugins/hunspell/module/hunspellwordlist.cpp b/src/plugins/hunspell/module/hunspellwordlist.cpp
new file mode 100644
index 00000000..6c4a8df0
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellwordlist.cpp
@@ -0,0 +1,308 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "hunspellwordlist_p.h"
+#include <QtAlgorithms>
+#include <hunspell/hunspell.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::HunspellWordList
+ \internal
+*/
+
+HunspellWordList::HunspellWordList(int limit) :
+ _index(0),
+ _limit(limit)
+{
+}
+
+HunspellWordList::HunspellWordList(HunspellWordList &other)
+{
+ *this = other;
+}
+
+HunspellWordList &HunspellWordList::operator=(HunspellWordList &other)
+{
+ if (this != &other) {
+ QMutexLocker guard(&_lock);
+ QMutexLocker otherGuard(&other._lock);
+ _list = other._list;
+ _flags = other._flags;
+ _index = other._index;
+ _limit = other._limit;
+ _searchIndex = other._searchIndex;
+ }
+ return *this;
+}
+
+int HunspellWordList::index() const
+{
+ return _index < _list.size() ? _index : -1;
+}
+
+void HunspellWordList::setIndex(int index)
+{
+ QMutexLocker guard(&_lock);
+ _index = index;
+}
+
+bool HunspellWordList::clear()
+{
+ QMutexLocker guard(&_lock);
+ bool result = !_list.isEmpty();
+ _list.clear();
+ _flags.clear();
+ _index = 0;
+ _searchIndex.clear();
+ return result;
+}
+
+bool HunspellWordList::clearSuggestions()
+{
+ QMutexLocker guard(&_lock);
+ if (_list.isEmpty())
+ return false;
+
+ _searchIndex.clear();
+ if (_list.size() > 1) {
+ QString word = _list.at(0);
+ Flags flags = _flags.at(0);
+ _list.clear();
+ _flags.clear();
+ if (!word.isEmpty()) {
+ _index = 0;
+ _list.append(word);
+ _flags.append(flags);
+ }
+ return true;
+ } else if (_list.at(0).isEmpty()) {
+ _list.clear();
+ _flags.clear();
+ _index = 0;
+ return true;
+ }
+ return false;
+}
+
+bool HunspellWordList::hasSuggestions() const
+{
+ return _list.size() > 1;
+}
+
+int HunspellWordList::size() const
+{
+ return _list.size();
+}
+
+int HunspellWordList::isEmpty() const
+{
+ return _list.isEmpty() || _list.at(0).isEmpty();
+}
+
+bool HunspellWordList::contains(const QString &word)
+{
+ QMutexLocker guard(&_lock);
+
+ // Use index search when the search index is available.
+ // This provides a lot faster search than QList::contains().
+ // Search index is available when it has been rebuilt using
+ // rebuildSearchIndex() method. Search index is automatically
+ // cleared when the word list is modified.
+ if (!_searchIndex.isEmpty()) {
+ Q_ASSERT(_searchIndex.size() == _list.size());
+
+ SearchContext searchContext(word, _list);
+ return std::binary_search(_searchIndex.begin(), _searchIndex.end(), -1, [searchContext](const int &a, const int &b) {
+ const QString &wordA = (a == -1) ? searchContext.word : searchContext.list[a];
+ const QString &wordB = (b == -1) ? searchContext.word : searchContext.list[b];
+ return wordA.compare(wordB, Qt::CaseInsensitive) < 0;
+ });
+ }
+
+ return _list.contains(word, Qt::CaseInsensitive);
+}
+
+QString HunspellWordList::findWordCompletion(const QString &word)
+{
+ QMutexLocker guard(&_lock);
+
+ if (!_searchIndex.isEmpty()) {
+ Q_ASSERT(_searchIndex.size() == _list.size());
+
+ SearchContext searchContext(word, _list);
+ auto match = std::lower_bound(_searchIndex.begin(), _searchIndex.end(), -1, [searchContext](const int &a, const int &b) {
+ const QString &wordA = (a == -1) ? searchContext.word : searchContext.list[a];
+ const QString &wordB = (b == -1) ? searchContext.word : searchContext.list[b];
+ return wordA.compare(wordB, Qt::CaseInsensitive) < 0;
+ });
+
+ if (match == _searchIndex.end())
+ return QString();
+
+ if (!word.compare(_list[*match], Qt::CaseInsensitive)) {
+ match++;
+ if (match == _searchIndex.end())
+ return QString();
+ }
+
+ return _list[*match].startsWith(word, Qt::CaseInsensitive) ? _list[*match] : QString();
+ }
+
+ QString bestMatch;
+ for (int i = 0, count = _list.size(); i < count; ++i) {
+ const QString &wordB(_list[i]);
+ if (wordB.size() > bestMatch.size() &&
+ word.size() < wordB.size() &&
+ wordB.startsWith(word, Qt::CaseInsensitive))
+ bestMatch = wordB;
+ }
+
+ return bestMatch;
+}
+
+int HunspellWordList::indexOfWord(const QString &word)
+{
+ QMutexLocker guard(&_lock);
+
+ if (!_searchIndex.isEmpty()) {
+ Q_ASSERT(_searchIndex.size() == _list.size());
+
+ SearchContext searchContext(word, _list);
+ auto match = std::lower_bound(_searchIndex.begin(), _searchIndex.end(), -1, [searchContext](int a, int b) {
+ const QString &wordA = (a == -1) ? searchContext.word : searchContext.list[a];
+ const QString &wordB = (b == -1) ? searchContext.word : searchContext.list[b];
+ return wordA.compare(wordB, Qt::CaseInsensitive) < 0;
+ });
+ return (match != _searchIndex.end()) ? *match : -1;
+ }
+
+ return _list.indexOf(word);
+}
+
+QString HunspellWordList::wordAt(int index)
+{
+ QMutexLocker guard(&_lock);
+
+ return index >= 0 && index < _list.size() ? _list.at(index) : QString();
+}
+
+void HunspellWordList::wordAt(int index, QString &word, Flags &flags)
+{
+ QMutexLocker guard(&_lock);
+ Q_ASSERT(index >= 0 && index < _list.size());
+
+ word = _list.at(index);
+ flags = _flags.at(index);
+}
+
+const HunspellWordList::Flags &HunspellWordList::wordFlagsAt(int index)
+{
+ QMutexLocker guard(&_lock);
+
+ return _flags[index];
+}
+
+void HunspellWordList::appendWord(const QString &word, const Flags &flags)
+{
+ QMutexLocker guard(&_lock);
+
+ _searchIndex.clear();
+ if (_limit > 0) {
+ while (_list.size() >= _limit) {
+ _list.removeAt(0);
+ _flags.removeAt(0);
+ }
+ }
+ _list.append(word);
+ _flags.append(flags);
+}
+
+void HunspellWordList::insertWord(int index, const QString &word, const Flags &flags)
+{
+ QMutexLocker guard(&_lock);
+ Q_ASSERT(_limit == 0);
+
+ _searchIndex.clear();
+ _list.insert(index, word);
+ _flags.insert(index, flags);
+}
+
+void HunspellWordList::updateWord(int index, const QString &word, const Flags &flags)
+{
+ Q_ASSERT(index >= 0);
+ QMutexLocker guard(&_lock);
+
+ if (index < _list.size()) {
+ if (word != _list[index])
+ _searchIndex.clear();
+ _list[index] = word;
+ _flags[index] = flags;
+ } else {
+ _searchIndex.clear();
+ _list.append(word);
+ _flags.append(flags);
+ }
+}
+
+void HunspellWordList::moveWord(int from, int to)
+{
+ QMutexLocker guard(&_lock);
+
+ if (from < 0 || from >= _list.size())
+ return;
+ if (to < 0 || to >= _list.size())
+ return;
+ if (from == to)
+ return;
+
+ _searchIndex.clear();
+ _list.move(from, to);
+ _flags.move(from, to);
+}
+
+int HunspellWordList::removeWord(const QString &word)
+{
+ QMutexLocker guard(&_lock);
+ int removeCount = 0;
+ for (int i = 0, count = _list.size(); i < count;) {
+ if (!_list[i].compare(word, Qt::CaseInsensitive)) {
+ _list.removeAt(i);
+ _flags.removeAt(i);
+ --count;
+ ++removeCount;
+ } else {
+ ++i;
+ }
+ }
+ if (removeCount > 0)
+ _searchIndex.clear();
+ return removeCount;
+}
+
+void HunspellWordList::removeWordAt(int index)
+{
+ QMutexLocker guard(&_lock);
+
+ _list.removeAt(index);
+}
+
+void HunspellWordList::rebuildSearchIndex()
+{
+ QMutexLocker guard(&_lock);
+ _searchIndex.clear();
+
+ if (_list.isEmpty())
+ return;
+
+ _searchIndex.resize(_list.size());
+ std::iota(_searchIndex.begin(), _searchIndex.end(), 0);
+
+ const QStringList list(_list);
+ std::sort(_searchIndex.begin(), _searchIndex.end(), [list](int a, int b) { return list[a].compare(list[b], Qt::CaseInsensitive) < 0; });
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/module/hunspellwordlist_p.h b/src/plugins/hunspell/module/hunspellwordlist_p.h
new file mode 100644
index 00000000..c795dd27
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellwordlist_p.h
@@ -0,0 +1,86 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef HUNSPELLWORDLIST_P_H
+#define HUNSPELLWORDLIST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QMutex>
+#include <QStringList>
+#include <QtHunspellInputMethod/qhunspellinputmethod_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtVirtualKeyboard {
+
+class Q_HUNSPELLINPUTMETHOD_EXPORT HunspellWordList
+{
+public:
+ enum Flag
+ {
+ SpellCheckOk = 0x1,
+ CompoundWord = 0x2
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ HunspellWordList(int limit = 0);
+ HunspellWordList(HunspellWordList &other);
+
+ HunspellWordList &operator=(HunspellWordList &other);
+
+ int index() const;
+ void setIndex(int index);
+ bool clear();
+ bool clearSuggestions();
+ bool hasSuggestions() const;
+ int size() const;
+ int isEmpty() const;
+ bool contains(const QString &word);
+ QString findWordCompletion(const QString &word);
+ int indexOfWord(const QString &word);
+ QString wordAt(int index);
+ void wordAt(int index, QString &word, Flags &flags);
+ const Flags &wordFlagsAt(int index);
+ void appendWord(const QString &word, const Flags &flags = Flags());
+ void insertWord(int index, const QString &word, const Flags &flags = Flags());
+ void updateWord(int index, const QString &word, const Flags &flags = Flags());
+ void moveWord(int from, int to);
+ int removeWord(const QString &word);
+ void removeWordAt(int index);
+ void rebuildSearchIndex();
+
+private:
+ class SearchContext {
+ public:
+ SearchContext(const QString &word,
+ const QStringList &list) :
+ word(word),
+ list(list)
+ {}
+ const QString &word;
+ const QStringList &list;
+ };
+
+private:
+ QMutex _lock;
+ QStringList _list;
+ QList<Flags> _flags;
+ QList<int> _searchIndex;
+ int _index;
+ int _limit;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // HUNSPELLWORDLIST_P_H
diff --git a/src/plugins/hunspell/module/hunspellworker.cpp b/src/plugins/hunspell/module/hunspellworker.cpp
new file mode 100644
index 00000000..85a94888
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellworker.cpp
@@ -0,0 +1,450 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtHunspellInputMethod/private/hunspellworker_p.h>
+#include <QList>
+#include <QFileInfo>
+#include <QRegularExpression>
+#include <QElapsedTimer>
+#include <QFile>
+#include <QDir>
+#include <QtAlgorithms>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::HunspellTask
+ \internal
+*/
+
+/*!
+ \class QtVirtualKeyboard::HunspellLoadDictionaryTask
+ \internal
+*/
+
+HunspellLoadDictionaryTask::HunspellLoadDictionaryTask(const QString &locale, const QStringList &searchPaths) :
+ HunspellTask(),
+ hunspellPtr(nullptr),
+ locale(locale),
+ searchPaths(searchPaths)
+{
+}
+
+void HunspellLoadDictionaryTask::run()
+{
+ Q_ASSERT(hunspellPtr != nullptr);
+
+ qCDebug(lcHunspell) << "HunspellLoadDictionaryTask::run(): locale:" << locale;
+
+ if (*hunspellPtr) {
+ Hunspell_destroy(*hunspellPtr);
+ *hunspellPtr = nullptr;
+ }
+
+ QString affPath;
+ QString dicPath;
+ for (const QString &searchPath : searchPaths) {
+ affPath = QStringLiteral("%1/%2.aff").arg(searchPath, locale);
+ if (QFileInfo::exists(affPath)) {
+ dicPath = QStringLiteral("%1/%2.dic").arg(searchPath, locale);
+ if (QFileInfo::exists(dicPath))
+ break;
+ dicPath.clear();
+ }
+ affPath.clear();
+ }
+
+ if (!affPath.isEmpty() && !dicPath.isEmpty()) {
+ *hunspellPtr = Hunspell_create(affPath.toUtf8().constData(), dicPath.toUtf8().constData());
+ if (*hunspellPtr) {
+ /* Make sure the encoding used by the dictionary is supported
+ by the QStringConverter.
+ */
+ if (!QStringConverter::encodingForName(Hunspell_get_dic_encoding(*hunspellPtr))) {
+ qCWarning(lcHunspell) << "The Hunspell dictionary" << dicPath << "cannot be used because it uses an unknown text codec" << QLatin1String(Hunspell_get_dic_encoding(*hunspellPtr));
+ Hunspell_destroy(*hunspellPtr);
+ *hunspellPtr = nullptr;
+ }
+ }
+ } else {
+ qCWarning(lcHunspell).nospace() << "Hunspell dictionary is missing for " << locale << ". Search paths " << searchPaths;
+ }
+
+ emit completed(*hunspellPtr != nullptr);
+}
+
+/*!
+ \class QtVirtualKeyboard::HunspellBuildSuggestionsTask
+ \internal
+*/
+
+void HunspellBuildSuggestionsTask::run()
+{
+ if (wordList->isEmpty())
+ return;
+
+ wordList->clearSuggestions();
+ QString word = wordList->wordAt(0);
+
+ /* Select text codec based on the dictionary encoding.
+ Hunspell_get_dic_encoding() should always return at least
+ "ISO8859-1", but you can never be too sure.
+ */
+ textDecoder = QStringDecoder(Hunspell_get_dic_encoding(hunspell));
+ textEncoder = QStringEncoder(Hunspell_get_dic_encoding(hunspell));
+ if (!textDecoder.isValid() || !textEncoder.isValid())
+ return;
+
+ char **slst = nullptr;
+ int n = Hunspell_suggest(hunspell, &slst, QByteArray { textEncoder(word) }.constData());
+ if (n > 0) {
+ /* Collect word candidates from the Hunspell suggestions.
+ Insert word completions in the beginning of the list.
+ */
+ const int firstWordCompletionIndex = wordList->size();
+ int lastWordCompletionIndex = firstWordCompletionIndex;
+ bool suggestCapitalization = false;
+ for (int i = 0; i < n; i++) {
+ QString wordCandidate(textDecoder(slst[i]));
+ wordCandidate.replace(QChar(0x2019), QLatin1Char('\''));
+ QString normalizedWordCandidate = removeAccentsAndDiacritics(wordCandidate);
+ /* Prioritize word Capitalization */
+ if (!wordCandidate.compare(word, Qt::CaseInsensitive)) {
+ if (suggestCapitalization) {
+ bool wordCandidateIsCapital = wordCandidate.at(0).isUpper();
+ bool wordIsCapital = word.at(0).isUpper();
+ if (wordCandidateIsCapital == wordIsCapital) {
+ if (wordCandidateIsCapital)
+ wordCandidate = wordCandidate.toLower();
+ else
+ wordCandidate[0] = wordCandidate.at(0).toUpper();
+ }
+ wordList->insertWord(1, wordCandidate);
+ lastWordCompletionIndex++;
+ suggestCapitalization = true;
+ }
+ /* Prioritize word completions, missing punctuation or missing accents */
+ } else if ((normalizedWordCandidate.size() > word.size() &&
+ normalizedWordCandidate.startsWith(word)) ||
+ wordCandidate.contains(QLatin1Char('\''))) {
+ wordList->insertWord(lastWordCompletionIndex++, wordCandidate);
+ } else {
+ wordList->appendWord(wordCandidate);
+ }
+ }
+ /* Prioritize words with missing spaces next to word completions.
+ */
+ for (int i = lastWordCompletionIndex; i < wordList->size(); i++) {
+ QString wordCandidate(wordList->wordAt(i));
+ if (wordCandidate.contains(QLatin1String(" "))) {
+ wordList->updateWord(i, wordCandidate, wordList->wordFlagsAt(i) | HunspellWordList::CompoundWord);
+ if (i != lastWordCompletionIndex) {
+ wordList->moveWord(i, lastWordCompletionIndex);
+ }
+ lastWordCompletionIndex++;
+ }
+ }
+ /* Do spell checking and suggest the first candidate, if:
+ - the word matches partly the suggested word; or
+ - the quality of the suggested word is good enough.
+
+ The quality is measured here using the Levenshtein Distance,
+ which may be suboptimal for the purpose, but gives some clue
+ how much the suggested word differs from the given word.
+ */
+ if (autoCorrect && wordList->size() > 1 && (!spellCheck(word) || suggestCapitalization)) {
+ if (lastWordCompletionIndex > firstWordCompletionIndex || levenshteinDistance(word, wordList->wordAt(firstWordCompletionIndex)) < 3)
+ wordList->setIndex(firstWordCompletionIndex);
+ }
+ }
+ Hunspell_free_list(hunspell, &slst, n);
+
+ for (int i = 0, count = wordList->size(); i < count; ++i) {
+ HunspellWordList::Flags flags;
+ wordList->wordAt(i, word, flags);
+ if (flags.testFlag(HunspellWordList::CompoundWord))
+ continue;
+ if (Hunspell_spell(hunspell, QByteArray { textEncoder(word) }.constData()) != 0)
+ wordList->updateWord(i, word, wordList->wordFlagsAt(i) | HunspellWordList::SpellCheckOk);
+ }
+}
+
+bool HunspellBuildSuggestionsTask::spellCheck(const QString &word)
+{
+ if (!hunspell)
+ return false;
+ if (word.contains(QRegularExpression(QLatin1String("[0-9]"))))
+ return true;
+ return Hunspell_spell(hunspell, QByteArray { textEncoder(word) }.constData()) != 0;
+}
+
+// source: http://en.wikipedia.org/wiki/Levenshtein_distance
+int HunspellBuildSuggestionsTask::levenshteinDistance(const QString &s, const QString &t)
+{
+ if (s == t)
+ return 0;
+ if (s.size() == 0)
+ return t.size();
+ if (t.size() == 0)
+ return s.size();
+ QList<int> v0(t.size() + 1);
+ QList<int> v1(t.size() + 1);
+ for (int i = 0; i < v0.size(); i++)
+ v0[i] = i;
+ for (int i = 0; i < s.size(); i++) {
+ v1[0] = i + 1;
+ for (int j = 0; j < t.size(); j++) {
+ int cost = (s[i].toLower() == t[j].toLower()) ? 0 : 1;
+ v1[j + 1] = qMin(qMin(v1[j] + 1, v0[j + 1] + 1), v0[j] + cost);
+ }
+ for (int j = 0; j < v0.size(); j++)
+ v0[j] = v1[j];
+ }
+ return v1[t.size()];
+}
+
+QString HunspellBuildSuggestionsTask::removeAccentsAndDiacritics(const QString& s)
+{
+ QString normalized = s.normalized(QString::NormalizationForm_D);
+ for (int i = 0; i < normalized.size();) {
+ QChar::Category category = normalized[i].category();
+ if (category <= QChar::Mark_Enclosing) {
+ normalized.remove(i, 1);
+ } else {
+ i++;
+ }
+ }
+ return normalized;
+}
+
+/*!
+ \class QtVirtualKeyboard::HunspellUpdateSuggestionsTask
+ \internal
+*/
+
+void HunspellUpdateSuggestionsTask::run()
+{
+ emit updateSuggestions(wordList, tag);
+}
+
+void HunspellAddWordTask::run()
+{
+ auto fromUtf16 = QStringEncoder(Hunspell_get_dic_encoding(hunspell));
+ if (!fromUtf16.isValid())
+ return;
+
+ QString tmpWord;
+ tmpWord.reserve(64);
+ for (int i = 0, count = wordList->size(); i < count; ++i) {
+ const QString word(wordList->wordAt(i));
+ if (word.size() < 2)
+ continue;
+ Hunspell_add(hunspell, QByteArray { fromUtf16(word) }.constData());
+ if (HunspellAddWordTask::alternativeForm(word, tmpWord))
+ Hunspell_add(hunspell, QByteArray { fromUtf16(tmpWord) }.constData());
+ }
+}
+
+bool HunspellAddWordTask::alternativeForm(const QString &word, QString &alternativeForm)
+{
+ if (word.size() < 2)
+ return false;
+ if (!word.mid(1).isLower())
+ return false;
+
+ const QChar initial(word.at(0));
+ const QChar newInitial = initial.isUpper() ? initial.toLower() : initial.toUpper();
+ if (newInitial == initial)
+ return false;
+
+ alternativeForm.truncate(0);
+ alternativeForm.append(word);
+ alternativeForm[0] = newInitial;
+
+ return true;
+}
+
+void HunspellRemoveWordTask::run()
+{
+ auto fromUtf16 = QStringEncoder(Hunspell_get_dic_encoding(hunspell));
+ if (!fromUtf16.isValid())
+ return;
+
+ QString tmpWord;
+ tmpWord.reserve(64);
+ for (int i = 0, count = wordList->size(); i < count; ++i) {
+ const QString word(wordList->wordAt(i));
+ if (word.isEmpty())
+ continue;
+ Hunspell_remove(hunspell, QByteArray { fromUtf16(word) }.constData());
+ if (HunspellAddWordTask::alternativeForm(word, tmpWord))
+ Hunspell_remove(hunspell, QByteArray { fromUtf16(tmpWord) }.constData());
+ }
+}
+
+void HunspellLoadWordListTask::run()
+{
+ wordList->clear();
+
+ QFile inputFile(filePath);
+ if (inputFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QTextStream inStream(&inputFile);
+ QString word;
+ word.reserve(64);
+ while (inStream.readLineInto(&word)) {
+ if (!word.isEmpty())
+ wordList->appendWord(word);
+ }
+ inputFile.close();
+ }
+}
+
+void HunspellSaveWordListTask::run()
+{
+ QFile outputFile(filePath);
+ if (!QFileInfo::exists(filePath))
+ QDir().mkpath(QFileInfo(filePath).absoluteDir().path());
+ if (outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ QTextStream outStream(&outputFile);
+ for (int i = 0, count = wordList->size(); i < count; ++i) {
+ const QString word(wordList->wordAt(i));
+ outStream << word.toUtf8() << '\n';
+ }
+ outputFile.close();
+ }
+}
+
+void HunspellFilterWordTask::run()
+{
+ if (filterList->isEmpty())
+ return;
+
+ filterList->rebuildSearchIndex();
+
+ for (int i = startIndex, count = wordList->size(); i < count;) {
+ if (filterList->contains(wordList->wordAt(i))) {
+ wordList->removeWordAt(i);
+ --count;
+ } else {
+ ++i;
+ }
+ }
+}
+
+void HunspellBoostWordTask::run()
+{
+ if (boostList->isEmpty())
+ return;
+
+ boostList->rebuildSearchIndex();
+
+ const QString word(wordList->wordAt(0));
+ const QString wordCompletion(boostList->findWordCompletion(word));
+ if (!wordCompletion.isEmpty()) {
+ int from = wordList->indexOfWord(wordCompletion);
+ if (from != 1) {
+ int to;
+ for (to = 1; to < wordList->size() && wordList->wordAt(to).startsWith(word); ++to)
+ ;
+ if (from != -1) {
+ if (to < from)
+ wordList->moveWord(from, to);
+ } else {
+ wordList->insertWord(to, wordCompletion, HunspellWordList::SpellCheckOk);
+ }
+ }
+ }
+}
+
+/*!
+ \class QtVirtualKeyboard::HunspellWorker
+ \internal
+*/
+
+HunspellWorker::HunspellWorker(QObject *parent) :
+ QThread(parent),
+ idleSema(),
+ taskSema(),
+ taskLock(),
+ hunspell(nullptr)
+{
+ abort = false;
+ qRegisterMetaType<QSharedPointer<HunspellWordList>>("QSharedPointer<HunspellWordList>");
+}
+
+HunspellWorker::~HunspellWorker()
+{
+ abort = true;
+ taskSema.release(1);
+ wait();
+}
+
+void HunspellWorker::addTask(QSharedPointer<HunspellTask> task)
+{
+ if (task) {
+ QMutexLocker guard(&taskLock);
+ taskList.append(task);
+ taskSema.release();
+ }
+}
+
+void HunspellWorker::removeAllTasks()
+{
+ QMutexLocker guard(&taskLock);
+ taskList.clear();
+}
+
+void HunspellWorker::waitForAllTasks()
+{
+ qCDebug(lcHunspell) << "waitForAllTasks enter";
+ while (isRunning()) {
+ idleSema.acquire();
+ QMutexLocker guard(&taskLock);
+ if (taskList.isEmpty()) {
+ idleSema.release();
+ break;
+ }
+ idleSema.release();
+ }
+ qCDebug(lcHunspell) << "waitForAllTasks leave";
+}
+
+void HunspellWorker::run()
+{
+ QElapsedTimer perf;
+ while (!abort) {
+ idleSema.release();
+ taskSema.acquire();
+ if (abort)
+ break;
+ idleSema.acquire();
+ QSharedPointer<HunspellTask> currentTask;
+ {
+ QMutexLocker guard(&taskLock);
+ if (!taskList.isEmpty()) {
+ currentTask = taskList.front();
+ taskList.pop_front();
+ }
+ }
+ if (currentTask) {
+ QSharedPointer<HunspellLoadDictionaryTask> loadDictionaryTask(currentTask.objectCast<HunspellLoadDictionaryTask>());
+ if (loadDictionaryTask)
+ loadDictionaryTask->hunspellPtr = &hunspell;
+ else if (hunspell)
+ currentTask->hunspell = hunspell;
+ else
+ continue;
+ perf.start();
+ currentTask->run();
+ qCDebug(lcHunspell) << QString(QLatin1String(currentTask->metaObject()->className()) + QLatin1String("::run(): time:")).toLatin1().constData() << perf.elapsed() << "ms";
+ }
+ }
+ if (hunspell) {
+ Hunspell_destroy(hunspell);
+ hunspell = nullptr;
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/module/hunspellworker_p.h b/src/plugins/hunspell/module/hunspellworker_p.h
new file mode 100644
index 00000000..24207174
--- /dev/null
+++ b/src/plugins/hunspell/module/hunspellworker_p.h
@@ -0,0 +1,213 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef HUNSPELLWORKER_P_H
+#define HUNSPELLWORKER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QThread>
+#include <QSemaphore>
+#include <QMutex>
+#include <QStringList>
+#include <QSharedPointer>
+#include <QList>
+#include <QLoggingCategory>
+#include <QStringDecoder>
+#include <QStringEncoder>
+#include <hunspell/hunspell.h>
+#include "hunspellwordlist_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtVirtualKeyboard {
+
+Q_DECLARE_LOGGING_CATEGORY(lcHunspell)
+
+class HunspellTask : public QObject
+{
+ Q_OBJECT
+public:
+ explicit HunspellTask(QObject *parent = nullptr) :
+ QObject(parent),
+ hunspell(nullptr)
+ {}
+
+ virtual void run() = 0;
+
+ Hunhandle *hunspell;
+};
+
+class HunspellLoadDictionaryTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ explicit HunspellLoadDictionaryTask(const QString &locale, const QStringList &searchPaths);
+
+ void run() override;
+
+signals:
+ void completed(bool success);
+
+public:
+ Hunhandle **hunspellPtr;
+ const QString locale;
+ const QStringList searchPaths;
+};
+
+class HunspellBuildSuggestionsTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+ bool autoCorrect;
+
+ void run() override;
+ bool spellCheck(const QString &word);
+ int levenshteinDistance(const QString &s, const QString &t);
+ QString removeAccentsAndDiacritics(const QString& s);
+
+private:
+ QStringDecoder textDecoder;
+ QStringEncoder textEncoder;
+};
+
+class HunspellUpdateSuggestionsTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+
+ void run() override;
+
+signals:
+ void updateSuggestions(const QSharedPointer<HunspellWordList> &wordList, int tag);
+
+public:
+ int tag;
+};
+
+class HunspellAddWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+
+ void run() override;
+
+ static bool alternativeForm(const QString &word, QString &alternativeForm);
+};
+
+class HunspellRemoveWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+
+ void run() override;
+};
+
+class HunspellLoadWordListTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+ QString filePath;
+
+ void run() override;
+};
+
+class HunspellSaveWordListTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ QSharedPointer<HunspellWordList> wordList;
+ QString filePath;
+
+ void run() override;
+};
+
+class HunspellFilterWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ HunspellFilterWordTask() :
+ HunspellTask(),
+ startIndex(1)
+ {}
+
+ QSharedPointer<HunspellWordList> wordList;
+ QSharedPointer<HunspellWordList> filterList;
+ int startIndex;
+
+ void run() override;
+};
+
+class HunspellBoostWordTask : public HunspellTask
+{
+ Q_OBJECT
+public:
+ HunspellBoostWordTask() :
+ HunspellTask()
+ {}
+
+ QSharedPointer<HunspellWordList> wordList;
+ QSharedPointer<HunspellWordList> boostList;
+
+ void run() override;
+};
+
+class HunspellWorker : public QThread
+{
+ Q_OBJECT
+public:
+ explicit HunspellWorker(QObject *parent = nullptr);
+ ~HunspellWorker();
+
+ void addTask(QSharedPointer<HunspellTask> task);
+ void removeAllTasks();
+ void waitForAllTasks();
+
+ template <class X>
+ void removeAllTasksOfType() {
+ QMutexLocker guard(&taskLock);
+ for (int i = 0; i < taskList.size();) {
+ QSharedPointer<X> task(taskList[i].objectCast<X>());
+ if (task) {
+ qCDebug(lcHunspell) << "Remove task" << QLatin1String(task->metaObject()->className());
+ taskList.removeAt(i);
+ } else {
+ i++;
+ }
+ }
+ }
+
+protected:
+ void run() override;
+
+private:
+ void createHunspell();
+
+private:
+ friend class HunspellLoadDictionaryTask;
+ QList<QSharedPointer<HunspellTask> > taskList;
+ QSemaphore idleSema;
+ QSemaphore taskSema;
+ QMutex taskLock;
+ Hunhandle *hunspell;
+ QBasicAtomicInt abort;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // HUNSPELLWORKER_P_H
diff --git a/src/plugins/hunspell/module/qhunspellinputmethod_global.h b/src/plugins/hunspell/module/qhunspellinputmethod_global.h
new file mode 100644
index 00000000..433535c6
--- /dev/null
+++ b/src/plugins/hunspell/module/qhunspellinputmethod_global.h
@@ -0,0 +1,10 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QHUNSPELLINPUTMETHOD_GLOBAL_H
+#define QHUNSPELLINPUTMETHOD_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+#include <QtHunspellInputMethod/qthunspellinputmethodexports.h>
+
+#endif
diff --git a/src/plugins/hunspell/plugin/CMakeLists.txt b/src/plugins/hunspell/plugin/CMakeLists.txt
deleted file mode 100644
index 44f195b0..00000000
--- a/src/plugins/hunspell/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardHunspellPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardHunspellPlugin
- OUTPUT_NAME qtvirtualkeyboard_hunspell
- TYPE virtualkeyboard
- SOURCES
- hunspellplugin.cpp hunspellplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::HunspellInputMethodPrivate
- Qt::Qml
- Qt::VirtualKeyboard
-)
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "hunspell.json"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:plugin.pro:EXISTS ../3rdparty/hunspell/data:
-# INSTALLS = "hunspell_data"
-# hunspell_data.files = "$$PWD/../3rdparty/hunspell/data/*.dic" "$$PWD/../3rdparty/hunspell/data/*.aff"
-# hunspell_data.path = "$$VIRTUALKEYBOARD_INSTALL_DATA/hunspell"
-
-#### Keys ignored in scope 4:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "hunspell_data"
-
-#### Keys ignored in scope 6:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Hunspell (Qt $$QT_VERSION)"
diff --git a/src/plugins/hunspell/plugin/hunspell.json b/src/plugins/hunspell/plugin/hunspell.json
deleted file mode 100644
index 449e440c..00000000
--- a/src/plugins/hunspell/plugin/hunspell.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "default",
- "Provider": "Qt Hunspell Extension",
- "InputMethod": "DefaultInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/hunspell/plugin/hunspellplugin.cpp b/src/plugins/hunspell/plugin/hunspellplugin.cpp
deleted file mode 100644
index 0a952675..00000000
--- a/src/plugins/hunspell/plugin/hunspellplugin.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "hunspellplugin.h"
-#include <QtHunspellInputMethod/private/hunspellinputmethod_p.h>
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardHunspellPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<HunspellInputMethod>(uri, 1, 0, "HunspellInputMethod");
- qmlRegisterType<HunspellInputMethod>(uri, 2, 0, "HunspellInputMethod");
- qmlRegisterType<HunspellInputMethod>(uri, 2, 3, "DefaultInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/hunspell/plugin/hunspellplugin.h b/src/plugins/hunspell/plugin/hunspellplugin.h
deleted file mode 100644
index f79c1535..00000000
--- a/src/plugins/hunspell/plugin/hunspellplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HUNSPELLPLUGIN_H
-#define HUNSPELLPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardHunspellPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "hunspell.json")
-public:
- void registerTypes(const char *uri) const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/hunspell/plugin/plugin.pro b/src/plugins/hunspell/plugin/plugin.pro
deleted file mode 100644
index c791dee3..00000000
--- a/src/plugins/hunspell/plugin/plugin.pro
+++ /dev/null
@@ -1,40 +0,0 @@
-TARGET = qtvirtualkeyboard_hunspell
-QT += qml virtualkeyboard hunspellinputmethod-private
-
-include(../../../shared.pri)
-
-HEADERS += \
- hunspellplugin.h
-SOURCES += \
- hunspellplugin.cpp
-OTHER_FILES += \
- hunspell.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-qtConfig(3rdparty-hunspell) {
- exists(../3rdparty/hunspell/data) {
- hunspell_data.files = \
- $$PWD/../3rdparty/hunspell/data/*.dic \
- $$PWD/../3rdparty/hunspell/data/*.aff
- hunspell_data.path = $$VIRTUALKEYBOARD_INSTALL_DATA/hunspell
- INSTALLS += hunspell_data
- !prefix_build: COPIES += hunspell_data
- } else {
- error("Hunspell dictionaries are missing! Please copy .dic and .aff" \
- "files to src/plugins/hunspell/3rdparty/hunspell/data directory.")
- }
-}
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Hunspell (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardHunspellPlugin
-load(qt_plugin)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/CMakeLists.txt
deleted file mode 100644
index 2aeedf41..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-# Generated from lipi-toolkit.pro.
-
-add_subdirectory(src)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/MIT_LICENSE.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/MIT_LICENSE.txt
deleted file mode 100644
index 5d391355..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/MIT_LICENSE.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/license.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/license.txt
deleted file mode 100644
index 219193f6..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/license.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-LICENSE
-
-Lipi core toolkit is licensed under the MIT license.
-
-- MIT-Style License
-http://www.opensource.org/licenses/mit-license.php
-
-This is the weakest license, meaning it applies the least restrictions. It is used for
-most parts of the Lipi Toolkit, and especially for libraries which are potentially
-included (by copying) into other libraries (as sub-components). The intention is to make
-sure the covered software can be used really everywhere and for every reason without any
-real restrictions.
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/lipi-toolkit.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/lipi-toolkit.pro
deleted file mode 100644
index 9593051a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/lipi-toolkit.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- src
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg
deleted file mode 100644
index 73e13e21..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.cfg
+++ /dev/null
@@ -1,382 +0,0 @@
-#------------------------------------------------------------------------------
-# SVN MACROS
-#
-# $LastChangedDate: 2009-06-08 19:11:25 +0530 (Mon, 08 Jun 2009) $
-# $Revision: 773 $
-# $Author: mnab $
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# nn.cfg
-#
-# Configuration file for Nearest Neighbor Classification Method for
-# Lipi Toolkit 3.0
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# The standard format for the configuration entries is the name of the
-# configuration parameter seperated by an equal to sign and then the value of
-# the configuration parameter. For example:
-# ConfigurationEntryName = value
-#
-# Lines starting with a # are commnet lines
-#
-# A cfg entry is strictly a key value pair and leaving the key without the
-# value or specification of a value out of the range is not permitted
-#
-# If a cfg entry is not specified at all, then default values are used by the
-# recognizer
-#------------------------------------------------------------------------------
-
-#-------------------------------
-# PREPROCESSING
-#-------------------------------
-
-#-------------------------------------------------------------------------------
-# ResampTraceDimension
-#
-# Description: The number of target points for resampling. In other words,
-# each character will be resampled to this number of points. In case of
-# multistroke characters, this number of points will be distributed between
-# the strokes in proportion to their lengths in proportion to their initial
-# number of points.
-#
-# Valid values: Any integer > 0
-# Units: Points
-# Default value: 60
-# Typical value: Average number of points per character in the training data set.
-#-------------------------------------------------------------------------------
-ResampTraceDimension = 60
-
-
-
-#-------------------------------------------------------------------------------
-# ResampPointAllocation
-#
-# Description: Method to be used for point allocation among different strokes
-# during resampling. Two schemes have been implemented lengthbased and point
-# based. In lengthbased allocation scheme, the number of points allocated to
-# each stroke is proportional to the length of the stroke. Length of a stroke
-# is calculated as the sum of the distances between each point in the stroke.
-# In the pointbased allocation scheme, the target stroke point allocation is
-# proportional to the number of points in the initial stroke.
-#
-# Valid value: [lengthbased | pointbased]
-# Default value: lengthbased
-#-------------------------------------------------------------------------------
-ResampPointAllocation = pointbased
-
-
-#-------------------------------------------------------------------------------
-# NormDotSizeThreshold
-#
-# Description: This threshold is used to determine whether a character is a dot.
-# It is expressed in real length terms (inches) and converted internally to
-# points using knowledge of the devices spatial resolution. If the width
-# and height are both less than this threshold, then all the points are replaced
-# with the center of the of the normalized character, basically to represent it
-# as a dot
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormDotSizeThreshold = 0.001
-
-#-------------------------------------------------------------------------------
-# NormLineWidthThreshold
-#
-# Description: This threshold is used to detect whether the character is a
-# vertical or horizontal line. If only the height is less than this threshold
-# then the character is detected as a horizontal line and if only the width is
-# less than this threshold then the character is detected as a vertical line.
-# Assuming the height is along the y-dimension and width is along the x-
-# dimension, during normalization of a horizontal line only the x-coordinates
-# are scaled and the y-coordinates are translated to the center of the character,
-# with out scaling. Similarly for the vertical line only the y-coordinates are
-# normalized and the x-coordinates are translated to the center with out scaling
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormLineWidthThreshold = 0.001
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatio
-#
-# Description: This parameter is used to indicate whether the aspect ratio
-# has to be preserved during normalization. The aspect ratio is the calculated
-# as maximum of (height/width , width/height). The aspect ratio is preserved only
-# if the calculated aspect ratio is greater than the threshold value specified
-# through NormPreserveAspectRatioThreshold and this configuration variable is
-# set to true. If this configuration variable is set to false the aspect ratio
-# is not preserved during normalization.
-#
-# Valid value: [true | false]
-# Default value: true
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatio = false
-
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatioThreshold
-#
-# Description: Aspect ratio is preserved during normalization if the computed
-# aspect ratio (max(height/width, width/height)) is greater than this threshold
-# and the configuration value NormPreserveAspectRatio is set to true. During
-# aspect ratio preserving normalization, the larger of the two dimensions is
-# normalized to the standard size and the other dimension is normalized
-# proportional to the initial height and width ratio, so that the initial
-# aspect ratio is maintained.
-#
-# Valid values: Any real number >= 1
-# Default value: 3
-# Typical value: >= 1.5
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatioThreshold = 1
-
-#-------------------------------------------------------------------------------
-# NormPreserveRelativeYPosition
-#
-# Description: The relative Y position is the mean of the y-coordinates in the
-# input character. During normalization if this parameter is set to true, each
-# y-coordinate of the character point is translated by the initial y-mean value,
-# so that the mean of the y-coordinates remains the same before and after
-# normalization. This is typically used in the word recognition context where
-# each stroke of the character has to be normalized separately and the relative
-# position of the strokes should be maintained even after normalization.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NormPreserveRelativeYPosition = false
-
-#-------------------------------------------------------------------------------
-# SmoothWindowSize
-#
-# Description: The configuration value specifies the length of the moving
-# average filter (size of the window) for smoothing the character image.
-# If this value is set to N, then each point in the input character is replaced
-# by the average of value of this point, (N-1)/2 points on the right and (N-1)/2
-# on the left of this point.
-#
-# Valid value: Any integer > 0
-# Units: Points
-# Typical value: 5
-# Default value: 3
-#-------------------------------------------------------------------------------
-SmoothWindowSize = 3
-
-#-------------------------------------------------------------------------------
-# PreprocSequence
-#
-# Description: This variable is used to specify the sequence of preprocessing
-# operations to be carried out on the input character sample before extracting
-# the features. A valid preprocessing sequence can consist of combination of one
-# or more of the functions selected from the valid values set mentioned below.
-# The CommonPreProc prefix is used specify the default preprocessing module of
-# LipiTk. The user can add his own preprocessing functions in other modules and
-# specify them in the preprocessing sequence.
-#
-# Valid values: Any sequence formed from the following set
-# CommonPreProc::normalizeSize;
-# CommonPreProc::removeDuplicatePoints;
-# CommonPreProc::smoothenTraceGroup;
-# CommonPreProc::dehookTraces;
-# CommonPreProc::normalizeOrientation;
-# CommonPreProc::resampleTraceGroup;
-# Default value: {CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-#-------------------------------------------------------------------------------
-PreprocSequence={CommonPreProc::smoothenTraceGroup,CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-
-
-#---------------------------------------
-# TRAINING
-#---------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeSelectionMethod
-#
-# Description: This is used to specify the prototype selection method to be used
-# while training the shape recognizer. When set to hier-clustering, the
-# prototypes are selected using hierarchical clustering method.
-#
-# Valid value: [hier-clustering]
-# Default value: hier-clustering
-#-------------------------------------------------------------------------------
-NNTrainPrototypeSelectionMethod=hier-clustering
-
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeReductionFactorPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This config parameter is used to specify the amount of the
-# initial prototypes to be excluded during prototype selection.
-# Set it to automatic if the number of clusters is to be determined
-# automatically. Set it to none if no prototype selection is required. If the
-# value of this parameter is set to a number between 1-100, say 25, then 75%
-# (i.e 100-25) of the initial training data are retained as prototypes.
-# This parameter can be specified only if the NNTrainNumPrototypesPerClass
-# is not specified.
-#
-# Valid value: [automatic | none | any real number from 0-100]
-# Default value: automatic
-#-------------------------------------------------------------------------------
-NNTrainPrototypeReductionFactorPerClass = 50
-
-#-------------------------------------------------------------------------------
-# NNTrainNumPrototypesPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This is used to specify the number of prototypes to be selected
-# from the training data. This parameter can be specified only if
-# PrototypeReductionFactor is not specified. This config entry is commented as
-# only one of NNTrainPrototypeReductionFactorPerClass or
-# NNTrainNumPrototypesPerClass can be active in a valid cfg file.
-#
-# Valid value: [automatic | none | any integer from 1-N]
-# (N is the number of samples # per class)
-# Default value: automatic
-#-------------------------------------------------------------------------------
-#NNTrainNumPrototypesPerClass=automatic
-
-# Note: Only one of either PrototypeReductionFactor or NumClusters can be
-# enabled at any particular instance
-
-#-----------------------------------------
-# FEATURE EXTRACTION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# FeatureExtractor
-#
-# Description: The configuration value is used to specify the feature extraction
-# module to be used for feature extraction. The point float feature extraction
-# module extracts the x,y,cosine and sine angle features at every point of the
-# character.
-#
-# Valid value: [PointFloatShapeFeatureExtractor|L7ShapeFeatureExtractor|
-# NPenShapeFeatureExtractor|SubStrokeShapeFeatureExtractor]
-# Default value: PointFloatShapeFeatureExtractor
-#-------------------------------------------------------------------------------
-FeatureExtractor=PointFloatShapeFeatureExtractor
-
-#-----------------------------------------
-# RECOGNITION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNRecoDTWEuFilterOutputSize
-#
-# Description: This config parameter is used to set the number of nearest
-# neighbours (filtered based on euclidean distance)to be considered for
-# calculating dtw distance. Set to all if all samples are to be considered for
-# calculating dtw distance. This is mainly used to increase the speed of
-# recognition.
-#
-# Valid value: [all| any integer from 1-N](N is the size of prototype set)
-# Default Value: all
-#-------------------------------------------------------------------------------
-NNRecoDTWEuFilterOutputSize = 15
-
-#-------------------------------------------------------------------------------
-# NNRecoRejectThreshold
-#
-# Description: Threshold to reject the test sample. If the confidence obtained
-# for the recognition of test sample is less than this threshold then the test
-# sample is rejected.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.001
-#-------------------------------------------------------------------------------
-NNRecoRejectThreshold = 0.001
-
-#-------------------------------------------------------------------------------
-# NNRecoNumNearestNeighbors
-#
-# Description: Number of nearest neighbors to be considered during recognition
-# and computation of confidence. If the value is set to 1, nearest neighbor
-# classifier is used, otherwise k-nearest neighbor or Adaptive k-nearest
-# neighbor classifiers are used. By default, nearest neighbor classifier is used.
-#
-# Valid value: Any integer >= 1
-# Default value: 1
-#-------------------------------------------------------------------------------
-NNRecoNumNearestNeighbors = 4
-
-#-------------------------------------------------------------------------------
-# NNRecoUseAdaptiveKNN
-#
-# Description: This parameter is used to specify whether Adaptive k-nearest
-# neighbor recognizer (A-kNN) is to be used. If set to true, A-kNN recognizer is
-# used, otherwise kNN recognizer is used. The A-kNN recognizer automatically
-# determines the number of nearest neighbors to be considered for recognition in
-# each class. If NNRecoNumNearestNeighbors is set to 1, this parameter is
-# automatically set to false and the manually set value will not be considered.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NNRecoUseAdaptiveKNN = false
-
-#--------------------------------------------
-# COMMON FOR TRAINING AND RECOGNITION
-#--------------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNPrototypeDistanceMeasure
-#
-# Description: This configuration parameter is used to specify the distance
-# measure to be used in clustering and recognition. DTW or Euclidean distance
-# measures can be used.
-#
-# Valid value [dtw | eu]
-# Default value: dtw
-#-------------------------------------------------------------------------------
-NNPrototypeDistanceMeasure = dtw
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the banding radius
-# to be used for DTW computation. This is used to speed up the computation
-# process. If this value is zero no banding is done. The value is specified as
-# fraction of ResampTraceDimension to be used while computing the DTW
-# distance.
-#
-# Valid values: Any real number > 0 and <= 1
-# Default Value: 0.33
-#-------------------------------------------------------------------------------
-NNDTWBandingRadius=0.33
-
-#-------------------------------------------------------------------------------
-# NNMDTFileUpdateFreq
-#
-# Description: This configuration parameter specifies the number of iterations after
-# which MDT file is to be updated.
-# Every call to addClass or deleteClass will add/delete the given class. These
-# in-memory changes will be reflected in nn.mdt only after the specified
-# number of such iterations and on application exit.
-#
-# Valid values: Any integer > 0
-# Default value: 5
-# Typical value: 5
-#-------------------------------------------------------------------------------
-NNMDTFileUpdateFreq = 5
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the mode for
-# opening the mdt file.
-#
-# Valid values: ascii, binary
-# Default Value: ascii
-#-------------------------------------------------------------------------------
-
-NNMDTFileOpenMode=binary
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt
deleted file mode 100644
index 3941986b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/nn.mdt
+++ /dev/null
Binary files differ
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg
deleted file mode 100644
index ddf5704f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/default/profile.cfg
+++ /dev/null
@@ -1 +0,0 @@
-ShapeRecMethod = nn
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg
deleted file mode 100644
index 32fe6ba1..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/project.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-ProjectType = SHAPEREC
-NumShapes = dynamic
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini
deleted file mode 100644
index 7b75d3f0..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/alphanumeric/config/unicodeMapfile_alphanumeric.ini
+++ /dev/null
@@ -1,76 +0,0 @@
-#Font name
-Font=english
-
-#Mapping of character class ids to unicode value
-0= 0X0041
-1= 0X0042
-2= 0X0043
-3= 0X0044
-4= 0X0045
-5= 0X0046
-6= 0X0047
-7= 0X0048
-8= 0X0049
-9= 0X004A
-10= 0X004B
-11= 0X004C
-12= 0X004D
-13= 0X004E
-14= 0X004F
-15= 0X0050
-16= 0X0051
-17= 0X0052
-18= 0X0053
-19= 0X0054
-20= 0X0055
-21= 0X0056
-22= 0X0057
-23= 0X0058
-24= 0X0059
-25= 0X005A
-26= 0X0061
-27= 0X0062
-28= 0X0063
-29= 0X0064
-30= 0X0065
-31= 0X0066
-32= 0X0067
-33= 0X0068
-34= 0X0069
-35= 0X006A
-36= 0X006B
-37= 0X006C
-38= 0X006D
-39= 0X006E
-40= 0X006F
-41= 0X0070
-42= 0X0071
-43= 0X0072
-44= 0X0073
-45= 0X0074
-46= 0X0075
-47= 0X0076
-48= 0X0077
-49= 0X0078
-50= 0X0079
-51= 0X007A
-52= 0X0030
-53= 0X0031
-54= 0X0032
-55= 0X0033
-56= 0X0034
-57= 0X0035
-58= 0X0036
-59= 0X0037
-60= 0X0038
-61= 0X0039
-62= 0X002E
-63= 0X002C
-64= 0X003F
-65= 0X002D
-66= 0X0040
-67= 0X003A
-68= 0X003B
-69= 0X0028
-70= 0X0029
-71= 0X002B \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.cfg
deleted file mode 100644
index f7322e5c..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.cfg
+++ /dev/null
@@ -1,362 +0,0 @@
-#------------------------------------------------------------------------------
-# nn.cfg
-#
-# Configuration file for Nearest Neighbor Classification Method for
-# Lipi Toolkit 2.2
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# The standard format for the configuration entries is the name of the
-# configuration parameter seperated by an equal to sign and then the value of
-# the configuration parameter. For example:
-# ConfigurationEntryName = value
-#
-# Lines starting with a # are commnet lines
-#
-# A cfg entry is strictly a key value pair and leaving the key without the
-# value or specification of a value out of the range is not permitted
-#
-# If a cfg entry is not specified at all, then default values are used by the
-# recognizer
-#------------------------------------------------------------------------------
-
-#-------------------------------
-# PREPROCESSING
-#-------------------------------
-
-#-------------------------------------------------------------------------------
-# ResampTraceDimension
-#
-# Description: The number of target points for resampling. In other words,
-# each character will be resampled to this number of points. In case of
-# multistroke characters, this number of points will be distributed between
-# the strokes in proportion to their lengths in proportion to their initial
-# number of points.
-#
-# Valid values: Any integer > 0
-# Units: Points
-# Default value: 60
-# Typical value: Average number of points per character in the training data set.
-#-------------------------------------------------------------------------------
-ResampTraceDimension = 60
-
-
-#-------------------------------------------------------------------------------
-# ResampPointAllocation
-#
-# Description: Method to be used for point allocation among different strokes
-# during resampling. Two schemes have been implemented lengthbased and point
-# based. In lengthbased allocation scheme, the number of points allocated to
-# each stroke is proportional to the length of the stroke. Length of a stroke
-# is calculated as the sum of the distances between each point in the stroke.
-# In the pointbased allocation scheme, the target stroke point allocation is
-# proportional to the number of points in the initial stroke. In the
-# interpointdistbased scheme, the distance between consecutive points is fixed
-# resulting in variable number based on the length of the trajectory.
-#
-# Valid value: [lengthbased | pointbased | interpointdistbased]
-# Default value: lengthbased
-#-------------------------------------------------------------------------------
-ResampPointAllocation = lengthbased
-
-
-#-------------------------------------------------------------------------------
-# NormDotSizeThreshold
-#
-# Description: This threshold is used to determine whether a character is a dot.
-# It is expressed in real length terms (inches) and converted internally to
-# points using knowledge of the devices spatial resolution. If the width
-# and height are both less than this threshold, then all the points are replaced
-# with the center of the of the normalized character, basically to represent it
-# as a dot
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormDotSizeThreshold = 0.01
-
-#-------------------------------------------------------------------------------
-# NormLineWidthThreshold
-#
-# Description: This threshold is used to detect whether the character is a
-# vertical or horizontal line. If only the height is less than this threshold
-# then the character is detected as a horizontal line and if only the width is
-# less than this threshold then the character is detected as a vertical line.
-# Assuming the height is along the y-dimension and width is along the x-
-# dimension, during normalization of a horizontal line only the x-coordinates
-# are scaled and the y-coordinates are translated to the center of the character,
-# with out scaling. Similarly for the vertical line only the y-coordinates are
-# normalized and the x-coordinates are translated to the center with out scaling
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormLineWidthThreshold = 0.01
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatio
-#
-# Description: This parameter is used to indicate whether the aspect ratio
-# has to be preserved during normalization. The aspect ratio is the calculated
-# as maximum of (height/width , width/height). The aspect ratio is preserved only
-# if the calculated aspect ratio is greater than the threshold value specified
-# through NormPreserveAspectRatioThreshold and this configuration variable is
-# set to true. If this configuration variable is set to false the aspect ratio
-# is not preserved during normalization.
-#
-# Valid value: [true | false]
-# Default value: true
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatio = true
-
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatioThreshold
-#
-# Description: Aspect ratio is preserved during normalization if the computed
-# aspect ratio (max(height/width, width/height)) is greater than this threshold
-# and the configuration value NormPreserveAspectRatio is set to true. During
-# aspect ratio preserving normalization, the larger of the two dimensions is
-# normalized to the standard size and the other dimension is normalized
-# proportional to the initial height and width ratio, so that the initial
-# aspect ratio is maintained.
-#
-# Valid values: Any real number >= 1
-# Default value: 3
-# Typical value: >= 1.5
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatioThreshold = 3
-
-#-------------------------------------------------------------------------------
-# NormPreserveRelativeYPosition
-#
-# Description: The relative Y position is the mean of the y-coordinates in the
-# input character. During normalization if this parameter is set to true, each
-# y-coordinate of the character point is translated by the initial y-mean value,
-# so that the mean of the y-coordinates remains the same before and after
-# normalization. This is typically used in the word recognition context where
-# each stroke of the character has to be normalized separately and the relative
-# position of the strokes should be maintained even after normalization.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NormPreserveRelativeYPosition = false
-
-#-------------------------------------------------------------------------------
-# SmoothWindowSize
-#
-# Description: The configuration value specifies the length of the moving
-# average filter (size of the window) for smoothing the character image.
-# If this value is set to N, then each point in the input character is replaced
-# by the average of value of this point, (N-1)/2 points on the right and (N-1)/2
-# on the left of this point.
-#
-# Valid value: Any integer > 0
-# Units: Points
-# Typical value: 5
-# Default value: 3
-#-------------------------------------------------------------------------------
-SmoothWindowSize = 3
-
-#-------------------------------------------------------------------------------
-# PreprocSequence
-#
-# Description: This variable is used to specify the sequence of preprocessing
-# operations to be carried out on the input character sample before extracting
-# the features. A valid preprocessing sequence can consist of combination of one
-# or more of the functions selected from the valid values set mentioned below.
-# The CommonPreProc prefix is used specify the default preprocessing module of
-# LipiTk. The user can add his own preprocessing functions in other modules and
-# specify them in the preprocessing sequence.
-#
-# Valid values: Any sequence formed from the following set
-# CommonPreProc::normalizeSize;
-# CommonPreProc::removeDuplicatePoints;
-# CommonPreProc::smoothenTraceGroup;
-# CommonPreProc::dehookTraces;
-# CommonPreProc::normalizeOrientation;
-# CommonPreProc::resampleTraceGroup;
-# Default value: {CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-#-------------------------------------------------------------------------------
-PreprocSequence={CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-
-#---------------------------------------
-# TRAINING
-#---------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeSelectionMethod
-#
-# Description: This is used to specify the prototype selection method to be used
-# while training the shape recognizer. When set to hier-clustering, the
-# prototypes are selected using hierarchical clustering method.
-#
-# Valid value: [hier-clustering]
-# Default value: hier-clustering
-#-------------------------------------------------------------------------------
-NNTrainPrototypeSelectionMethod=hier-clustering
-
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeReductionFactorPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This config parameter is used to specify the amount of the
-# initial prototypes to be excluded during prototype selection.
-# Set it to automatic if the number of clusters is to be determined
-# automatically. Set it to none if no prototype selection is required. If the
-# value of this parameter is set to a number between 1-100, say 25, then 75%
-# (i.e 100-25) of the initial training data are retained as prototypes.
-# This parameter can be specified only if the NNTrainNumPrototypesPerClass
-# is not specified.
-#
-# Valid value: [automatic | none | any real number from 0-100]
-# Default value: automatic
-#-------------------------------------------------------------------------------
-NNTrainPrototypeReductionFactorPerClass = none
-
-#-------------------------------------------------------------------------------
-# NNTrainNumPrototypesPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This is used to specify the number of prototypes to be selected
-# from the training data. This parameter can be specified only if
-# PrototypeReductionFactor is not specified. This config entry is commented as
-# only one of NNTrainPrototypeReductionFactorPerClass or
-# NNTrainNumPrototypesPerClass can be active in a valid cfg file.
-#
-# Valid value: [automatic | none | any integer from 1-N]
-# (N is the number of samples # per class)
-# Default value: automatic
-#-------------------------------------------------------------------------------
-#NNTrainNumPrototypesPerClass=automatic
-
-# Note: Only one of either PrototypeReductionFactor or NumClusters can be
-# enabled at any particular instance
-
-#-----------------------------------------
-# FEATURE EXTRACTION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# FeatureExtractor
-#
-# Description: The configuration value is used to specify the feature extraction
-# module to be used for feature extraction. The point float feature extraction
-# module extracts the x,y,cosine and sine angle features at every point of the
-# character.
-#
-# Valid value: [PointFloatShapeFeatureExtractor|L7ShapeFeatureExtractor|
-# NPenShapeFeatureExtractor|SubStrokeShapeFeatureExtractor]
-# Default value: PointFloatShapeFeatureExtractor
-#-------------------------------------------------------------------------------
-FeatureExtractor=PointFloatShapeFeatureExtractor
-
-#-----------------------------------------
-# RECOGNITION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNRecoDTWEuFilterOutputSize
-#
-# Description: This config parameter is used to set the number of nearest
-# neighbours (filtered based on euclidean distance)to be considered for
-# calculating dtw distance. The value is specified as fraction of total number
-# of prototypes.
-# Set to all if all samples are to be considered for
-# calculating dtw distance. This is mainly used to increase the speed of
-# recognition.
-#
-# Valid value: [all| any integer from 1-100]
-# Default Value: all
-#-------------------------------------------------------------------------------
-NNRecoDTWEuFilterOutputSize = all
-
-#-------------------------------------------------------------------------------
-# NNRecoRejectThreshold
-#
-# Description: Threshold to reject the test sample. If the confidence obtained
-# for the recognition of test sample is less than this threshold then the test
-# sample is rejected.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.001
-#-------------------------------------------------------------------------------
-NNRecoRejectThreshold = 0.001
-
-#-------------------------------------------------------------------------------
-# NNRecoNumNearestNeighbors
-#
-# Description: Number of nearest neighbors to be considered during recognition
-# and computation of confidence. If the value is set to 1, nearest neighbor
-# classifier is used, otherwise k-nearest neighbor or Adaptive k-nearest
-# neighbor classifiers are used. By default, nearest neighbor classifier is used.
-#
-# Valid value: Any integer >= 1
-# Default value: 1
-#-------------------------------------------------------------------------------
-NNRecoNumNearestNeighbors = 1
-
-#-------------------------------------------------------------------------------
-# NNRecoUseAdaptiveKNN
-#
-# Description: This parameter is used to specify whether Adaptive k-nearest
-# neighbor recognizer (A-kNN) is to be used. If set to true, A-kNN recognizer is
-# used, otherwise kNN recognizer is used. The A-kNN recognizer automatically
-# determines the number of nearest neighbors to be considered for recognition in
-# each class. If NNRecoNumNearestNeighbors is set to 1, this parameter is
-# automatically set to false and the manually set value will not be considered.
-# The confidence values obtained do not add to 1 for all classes when
-# Adaptive-kNN is used.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NNRecoUseAdaptiveKNN = false
-
-#--------------------------------------------
-# COMMON FOR TRAINING AND RECOGNITION
-#--------------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNPrototypeDistanceMeasure
-#
-# Description: This configuration parameter is used to specify the distance
-# measure to be used in clustering and recognition. DTW or Euclidean distance
-# measures can be used.
-#
-# Valid value [dtw | eu]
-# Default value: dtw
-#-------------------------------------------------------------------------------
-NNPrototypeDistanceMeasure = dtw
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the banding radius
-# to be used for DTW computation. This is used to speed up the computation
-# process. If this value is zero no banding is done. The value is specified as
-# fraction of ResampTraceDimension to be used while computing the DTW
-# distance.
-#
-# Valid values: Any real number > 0 and <= 1
-# Default Value: 0.33
-#-------------------------------------------------------------------------------
-NNDTWBandingRadius=0.33
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the mode for
-# opening the mdt file.
-#
-# Valid values: ascii, binary
-# Default Value: ascii
-#-------------------------------------------------------------------------------
-
-NNMDTFileOpenMode=ascii
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.mdt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.mdt
deleted file mode 100644
index 5430d396..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/nn.mdt
+++ /dev/null
@@ -1,61 +0,0 @@
-<CKS=84e1d0a><HEADERLEN=754><DATAOFFSET=755><ASP_RATIO_THRES=3><BYTEORDER=LE><COMMENTLEN=0><CREATETIME=Tue Feb 14 16:31:45 2012><DOT_SIZE_THRES=0.01><DOT_THRES=0.01><FE_NAME=PointFloatShapeFeatureExtractor><FE_VER=3.0.0><HEADERVER=1.0.0><MDT_OPEN_MODE=ascii><MODTIME=Tue Feb 14 16:31:45 2012><NORM_LN_WID_THRES=0.01><NUMSHAPES=0><OSVERSION=Linux 2.6.35-30-generic><PLATFORM=Linux><PREPROC_SEQ={CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}><PRESER_ASP_RATIO=true><PRESER_REL_Y_POS=false><PROCESSOR_ARCHITEC=x86_64><PROJNAME=demonumerals><RECNAME=nn><RECVERSION=4.0.0><RESAMP_POINT_ALLOC=lengthbased><SIZEOFCHAR=1><SIZEOFFLOAT=4><SIZEOFINT=4><SIZEOFSHORTINT=2><SIZEOFUINT=4><SMOOTH_WIND_SIZE=3><TRACE_DIM=60>0
-0 4.32432,0,5,9.99999,0|3.70146,0,5,8.04663e-05,0|3.0786,0,5,8.04663e-05,0|2.45574,0,5,8.04663e-05,0|1.96275,0.129869,6.27368,0.165048,0|1.59963,0.38961,7.90887,0.933385,0|1.35135,0.764188,9.16751,2.23763,0|0.945946,1.1368,8.38347,1.3188,0|0.675675,1.56698,9.23364,2.34006,0|0.540541,2.0547,9.81837,3.66497,0|0.405405,2.62001,9.8629,3.83753,0|0.220931,3.1643,9.73533,3.39509,0|0.135135,3.75062,9.94723,4.27607,0|0.135135,4.37348,9.99992,5,0|0,4.93879,9.8629,3.83754,0|0,5.56165,9.99992,5,0|0,6.18451,9.99992,5,0|0.261571,6.62338,9.29492,7.55981,0|0.525811,7.1287,9.43071,7.31687,0|0.844237,7.46684,8.63999,8.42774,0|1.23615,7.94123,8.85465,8.18447,0|1.65168,8.32614,8.39767,8.6681,0|2.14883,8.68849,7.94502,9.04055,0|2.65199,9.04218,7.87531,9.09045,0|3.10811,9.4159,8.16889,8.86746,0|3.61406,9.61039,6.79395,9.66699,0|4.15842,9.85535,7.05176,9.55954,0|4.72562,10,6.23558,9.84484,0|5.34848,10,5,9.99992,0|5.97134,10,5,9.99992,0|6.5942,10,5,9.99992,0|7.18748,9.87013,3.93082,9.88426,0|7.75972,9.64793,3.19016,9.66087,0|8.24324,9.37931,2.57191,9.37075,0|8.72574,9.01682,1.99677,8.99747,0|9.0341,8.47991,0.664267,7.4901,0|9.37021,7.96375,0.810105,7.72836,0|9.67392,7.43364,0.661632,7.48551,0|9.75035,6.82366,0.0388792,5.62167,0|9.99106,6.25096,0.390645,6.93728,0|10,5.63028,0.000599623,5.07204,0|10,5.00742,8.04663e-05,5,0|10,4.38456,8.04663e-05,5,0|10,3.7617,8.04663e-05,5,0|9.86487,3.17189,0.126363,3.88338,0|9.59459,2.81931,1.03181,1.95824,0|9.32374,2.46697,1.03603,1.95273,0|8.91421,2.0734,1.53546,1.39499,0|8.41922,1.70794,2.0302,0.977628,0|7.87828,1.448,2.83448,0.493375,0|7.34171,1.16883,2.69224,0.564528,0|6.80483,0.955292,3.15214,0.354081,0|6.20212,0.902316,4.56221,0.0192857,0|5.6073,0.779221,3.98676,0.103826,0|5.03672,0.64935,3.89033,0.12478,0|4.46615,0.51948,3.89033,0.124779,0|3.89558,0.38961,3.89034,0.124778,0|3.27272,0.38961,5,8.04663e-05,0|2.64986,0.38961,5,8.04663e-05,0|2.02703,0.38961,5,8.04663e-05,1|
-0 4.58333,0,5,9.99999,0|3.96307,0,5,8.07643e-05,0|3.34281,0,5,8.07643e-05,0|2.72255,0,5,8.07643e-05,0|2.16076,0.166667,6.42205,0.206577,0|1.66667,0.292838,6.23708,0.155554,0|1.25357,0.5,7.24133,0.530619,0|0.983084,0.880201,9.07408,2.10158,0|0.738181,1.33333,9.39858,2.62271,0|0.343051,1.66667,8.22397,1.17834,0|0.208334,2.15221,9.81789,3.66324,0|0,2.67234,9.64143,3.14091,0|0,3.2926,9.99992,5,0|0,3.91286,9.99992,5,0|0,4.53312,9.99992,5,0|0,5.15338,9.99992,5,0|0,5.77364,9.99992,5,0|0,6.3939,9.99992,5,0|0,7.01416,9.99992,5,0|0.13442,7.5,9.81886,6.33326,0|0.504814,7.90385,8.68481,8.37954,0|0.906597,8.33333,8.65126,8.41577,0|1.42054,8.63643,7.5399,9.30674,0|1.96481,8.86926,6.96648,9.59697,0|2.50111,9.16756,7.43038,9.36949,0|3.03111,9.42489,7.18381,9.49779,0|3.59292,9.66667,6.97649,9.59267,0|4.15472,9.83333,6.42205,9.79342,0|4.77498,9.83333,5,9.99992,0|5.22857,10,6.7244,9.69312,0|5.84883,10,5,9.99992,0|6.46909,10,5,9.99992,0|7.08935,10,5,9.99992,0|7.70961,10,5,9.99992,0|8.32987,10,5,9.99992,0|8.81497,9.61469,1.89023,8.91516,0|9.16667,9.16346,1.05644,8.07368,0|9.38737,8.64688,0.402129,6.96435,0|9.64881,8.11429,0.511689,7.20323,0|10,7.62244,0.930901,7.90544,0|10,7.00218,8.07643e-05,5,0|10,6.38192,8.07643e-05,5,0|10,5.76166,8.07643e-05,5,0|10,5.1414,8.07643e-05,5,0|10,4.52114,8.07643e-05,5,0|10,3.90088,8.07643e-05,5,0|10,3.28062,8.07643e-05,5,0|10,2.66036,8.07643e-05,5,0|10,2.0401,8.07643e-05,5,0|9.58333,1.7283,2.00438,0.996839,0|9.21941,1.35443,1.41719,1.51253,0|8.81118,1.04894,2.00437,0.996848,0|8.43322,0.666667,1.44453,1.48465,0|7.88133,0.471733,3.33477,0.285537,0|7.30962,0.333334,3.82361,0.140447,0|6.85603,0.166667,3.27557,0.306886,0|6.23577,0.166667,5,8.07643e-05,0|5.61551,0.166667,5,8.07643e-05,0|4.99525,0.166667,5,8.07643e-05,0|4.375,0.166667,5,8.07643e-05,1|
-0 3.20755,0,5,9.99998,0|2.58352,0,5,8.01682e-05,0|1.9595,0,5,8.01682e-05,0|1.64039,0.334194,8.61614,1.54711,0|1.26044,0.770967,8.77233,1.71844,0|0.943396,1.23874,9.13884,2.19481,0|0.701077,1.78033,9.56393,2.95801,0|0.566038,2.33781,9.85938,3.82289,0|0.377359,2.86884,9.71137,3.32604,0|0.188679,3.43687,9.74499,3.42386,0|0,3.96791,9.71137,3.32604,0|0,4.59193,9.99992,5,0|0,5.21596,9.99992,5,0|0,5.83998,9.99992,5,0|0.213421,6.39582,9.66766,6.79223,0|0.478435,6.88923,9.40478,7.36581,0|0.754717,7.3771,9.3507,7.46384,0|1.02544,7.82609,9.28177,7.58177,0|1.42746,8.1979,8.39491,8.67065,0|1.88679,8.59555,8.27253,8.78017,0|2.12087,8.98551,9.28689,7.57323,0|2.61216,9.23028,7.22963,9.47525,0|3.14041,9.53943,7.52546,9.31523,0|3.71042,9.71014,6.43448,9.78972,0|4.28521,9.85507,6.22243,9.84818,0|4.86,10,6.22242,9.84818,0|5.48402,10,5,9.99992,0|6.10805,10,5,9.99992,0|6.73208,10,5,9.99992,0|7.3561,10,5,9.99992,0|7.73585,9.75572,2.29507,9.20502,0|8.11321,9.50906,2.26435,9.1851,0|8.49057,9.26239,2.26433,9.18509,0|8.78121,8.80142,0.770589,7.66668,0|9.0566,8.36663,0.776105,7.6754,0|9.31916,7.85752,0.55623,7.29173,0|9.43396,7.26757,0.0921413,5.95503,0|9.76284,6.74115,0.759585,7.64916,0|9.89092,6.17074,0.121562,6.09544,0|10,5.60048,0.0891203,5.93936,0|10,4.97645,8.01682e-05,5,0|10,4.35243,8.01682e-05,5,0|10,3.7284,8.01682e-05,5,0|10,3.10437,8.01682e-05,5,0|10,2.48035,8.01682e-05,5,0|10,1.85632,8.01682e-05,5,0|9.81132,1.32529,0.288633,3.32604,0|9.44798,0.88033,1.12725,1.83757,0|8.92608,0.579711,2.50438,0.66744,0|8.49057,0.391199,3.01388,0.411506,0|8.11321,0.144531,2.26432,0.814912,0|7.63371,0,3.55704,0.212844,0|7.00969,0,5,8.01682e-05,0|6.38566,0,5,8.01682e-05,0|5.76164,0,5,8.01682e-05,0|5.13761,0,5,8.01682e-05,0|4.51359,0,5,8.01682e-05,0|3.88956,0,5,8.01682e-05,0|3.26553,0,5,8.01682e-05,0|2.64151,0,5,8.01682e-05,1|
-0 3.66667,0.121952,5.16621,9.99722,0|3.08731,0.180019,5.49863,0.025011,0|2.63853,0.386442,7.08936,0.457581,0|2.35249,0.83964,9.22818,2.33138,0|2.0343,1.19442,8.72214,1.66165,0|1.81143,1.59338,9.36503,2.56168,0|1.38317,1.91475,8.001,1.00087,0|1.16667,2.32113,9.41268,2.64901,0|0.891778,2.71935,9.11476,2.15963,0|0.532479,3.14697,8.82802,1.78357,0|0.333333,3.64425,9.64155,3.14122,0|0.166666,4.15802,9.75592,3.45717,0|0.0680418,4.70631,9.92093,4.11484,0|0,5.27012,9.96389,4.40095,0|0,5.86845,9.99992,5,0|0,6.46679,9.99992,5,0|0,7.06512,9.99992,5,0|0.377958,7.47168,8.66192,8.40433,0|0.801124,7.89148,8.52134,8.54956,0|1.27761,8.25191,8.01635,8.98758,0|1.77584,8.57653,7.72945,9.18919,0|2.29024,8.87091,7.48343,9.33956,0|2.82,9.13659,7.24141,9.46937,0|3.37973,9.34624,6.75382,9.68223,0|3.84152,9.63415,7.64521,9.24287,0|4.33333,9.84101,6.93855,9.6088,0|4.85478,10,6.45818,9.78255,0|5.45311,10,5,9.99992,0|6.05145,10,5,9.99992,0|6.64978,10,5,9.99992,0|7.24811,10,5,9.99992,0|7.84392,9.99226,4.93502,9.99949,0|8.28298,9.7561,2.63156,9.40335,0|8.66667,9.37725,1.48706,8.55785,0|8.85531,8.87028,0.313984,6.74365,0|9.12408,8.35501,0.566911,7.31233,0|9.39285,7.83973,0.566914,7.31233,0|9.5,7.27451,0.0875783,5.93126,0|9.66667,6.72768,0.2173,6.45771,0|9.83333,6.21392,0.244083,6.54283,0|9.83333,5.61558,8.37445e-05,5,0|10,5.10182,0.244082,6.54283,0|10,4.50348,8.37445e-05,5,0|10,3.90515,8.37445e-05,5,0|9.71615,3.45084,0.759691,2.35069,0|9.49637,3.04613,0.606181,2.61394,0|9.16667,2.61509,1.02866,1.96231,0|8.83333,2.18589,1.05113,1.93316,0|8.5,1.92089,1.88855,1.08621,0|8.12516,1.67695,2.27281,0.809376,0|7.67871,1.46342,2.84268,0.489459,0|7.19351,1.1172,2.09584,0.929986,0|6.65313,0.909681,3.20753,0.332434,0|6.11655,0.695039,3.14299,0.357733,0|5.56936,0.538554,3.62525,0.192797,0|5.16667,0.308746,2.52181,0.657481,0|4.75513,0.121952,2.9335,0.447147,0|4.1587,0.116122,4.95113,0.000322759,0|3.59831,0,3.98548,0.104095,0|3,0,5,8.37445e-05,1|
-0 3.85965,0,5,9.99999,0|3.24846,0,5,8.19564e-05,0|2.63727,0,5,8.19564e-05,0|2.0782,0.144928,6.25466,0.160066,0|1.61194,0.289856,6.48408,0.225433,0|1.22807,0.609986,8.20227,1.16015,0|0.877194,1.05592,8.92937,1.90821,0|0.701754,1.58447,9.74534,3.42492,0|0.701754,2.19566,9.99992,5,0|0.548982,2.7349,9.81058,3.63711,0|0.350877,3.25278,9.6699,3.21363,0|0.175439,3.78134,9.74534,3.42494,0|0,4.3099,9.74534,3.42493,0|0,4.92109,9.99992,5,0|0,5.53228,9.99992,5,0|0,6.14347,9.99992,5,0|0.175439,6.7057,9.77294,6.48935,0|0.479229,7.20748,9.27712,7.58948,0|0.701754,7.74753,9.62286,6.90481,0|0.914418,8.23306,9.57985,7.00601,0|1.28409,8.64328,8.71426,8.34714,0|1.68516,9.01607,8.40397,8.66225,0|2.17977,9.27536,7.32149,9.4283,0|2.61836,9.55976,7.72027,9.19514,0|3.17635,9.71015,6.30112,9.82765,0|3.76643,9.81657,5.88743,9.92053,0|4.36998,9.85507,5.31832,9.98977,0|4.92905,10,6.25466,9.83993,0|5.54024,10,5,9.99992,0|6.15143,10,5,9.99992,0|6.76262,10,5,9.99992,0|7.37381,10,5,9.99992,0|7.985,10,5,9.99992,0|8.59619,10,5,9.99992,0|9.18801,9.94614,4.54682,9.97934,0|9.58766,9.61599,1.81565,8.85473,0|9.82456,9.11638,0.48224,7.14218,0|9.85967,8.52172,0.0087747,5.29467,0|10,7.97663,0.157974,6.24655,0|10,7.36544,8.19564e-05,5,0|10,6.75425,8.19564e-05,5,0|10,6.14306,8.19564e-05,5,0|10,5.53187,8.19564e-05,5,0|10,4.92068,8.19564e-05,5,0|9.96166,4.34783,0.0112462,4.66614,0|9.64912,3.95637,1.09269,1.88039,0|9.32305,3.49875,0.928044,2.09857,0|9.06587,3.01996,0.595306,2.63404,0|8.65765,2.65922,1.68913,1.25337,0|8.18645,2.26996,1.81564,1.14526,0|7.71524,1.88071,1.81565,1.14525,0|7.20708,1.5942,2.5444,0.644638,0|6.8042,1.27304,1.88333,1.09034,0|6.40455,0.942889,1.81565,1.14527,0|5.96466,0.724638,2.7778,0.521071,0|5.40559,0.579711,3.74535,0.160064,0|4.7944,0.579711,5,8.19564e-05,0|4.32813,0.434783,3.51592,0.225433,0|3.74963,0.343897,4.22401,0.0606698,0|3.15789,0.289856,4.54527,0.0208056,1|
-0 2.44444,0,5,9.99998,0|1.82433,0,5,8.07643e-05,0|1.22518,0.0705357,5.58459,0.0343752,0|0.917029,0.434782,8.81716,1.77072,0|0.666666,0.906382,9.41617,2.65554,0|0.444445,1.40612,9.56859,2.96847,0|0.32535,1.96173,9.88886,3.95207,0|0.222221,2.52598,9.91844,4.10105,0|0.222221,3.1461,9.99992,5,0|0.222221,3.76622,9.99992,5,0|0.110614,4.34847,9.91052,4.05875,0|0,4.93107,9.91216,4.06736,0|0,5.55119,9.99992,5,0|0,6.1713,9.99992,5,0|0,6.79142,9.99992,5,0|0.0192386,7.39758,9.9974,5.15861,0|0.549628,7.67343,7.30703,9.43585,0|0.98773,8.09994,8.48776,8.58256,0|1.46067,8.48884,8.17569,8.86189,0|2.02395,8.72689,6.94634,9.60553,0|2.44444,9.05753,8.09048,8.9304,0|2.82691,9.40008,8.3358,8.72444,0|3.38978,9.60203,6.68852,9.70617,0|3.93468,9.85507,7.10587,9.53481,0|4.51172,10,6.21796,9.8493,0|5.13183,10,5,9.99992,0|5.75195,10,5,9.99992,0|6.37207,10,5,9.99992,0|6.99219,10,5,9.99992,0|7.61231,10,5,9.99992,0|8.23077,9.99443,4.95495,9.99972,0|8.66453,9.71014,2.25929,9.18181,0|8.94151,9.24104,0.694577,7.54213,0|9.33333,8.83318,1.39432,8.46384,0|9.52607,8.4058,0.442144,7.05545,0|9.77778,7.93554,0.591859,7.35952,0|9.77778,7.31543,8.07643e-05,5,0|10,6.91753,0.634767,7.43796,0|10,6.29741,8.07643e-05,5,0|10,5.6773,8.07643e-05,5,0|10,5.05718,8.07643e-05,5,0|10,4.43706,8.07643e-05,5,0|9.94153,3.83678,0.0236344,4.51528,0|9.65241,3.31474,0.626081,2.57761,0|9.29087,2.87085,1.1233,1.84241,0|9.01424,2.40059,0.690415,2.46493,0|8.66667,1.96875,1.10497,1.86506,0|8.27617,1.73913,2.46569,0.689994,0|7.95469,1.41972,1.47599,1.45314,0|7.52058,1.13661,2.26871,0.81203,0|7.08169,0.869565,2.40108,0.728626,0|6.6065,0.724637,3.54141,0.217582,0|6.06076,0.474411,2.91608,0.455063,0|5.45751,0.40281,4.41069,0.0349328,0|4.85534,0.289855,4.07819,0.0857919,0|4.23522,0.289855,5,8.07643e-05,0|3.63814,0.144927,3.82064,0.141165,0|3.01802,0.144927,5,8.07643e-05,0|2.3979,0.144927,5,8.07643e-05,0|1.77778,0.144927,5,8.07643e-05,1|
-1 5.44444,0,5,9.99999,0|5.16339,0.282304,8.54331,1.47244,0|4.87001,0.550886,8.37611,1.3121,0|4.62984,0.862764,8.96138,1.9494,0|4.38358,1.16925,8.8976,1.86832,0|4.14978,1.48678,9.02625,2.03553,0|3.93823,1.7957,9.12526,2.17495,0|3.69628,2.02978,8.47647,1.40658,0|3.45536,2.31266,8.80647,1.75817,0|3.27009,2.58929,9.15425,2.21778,0|3.08822,2.87554,9.22009,2.3187,0|2.88889,3.17836,9.1763,2.25098,0|2.67598,3.47466,9.06033,2.08241,0|2.50465,3.7909,9.3962,2.61839,0|2.33333,4.10714,9.39619,2.61838,1|5.33333,0.178571,1.02617,8.03456,0|5.33333,0.586948,9.99988,5,0|5.33333,0.995324,9.99988,5,0|5.33333,1.4037,9.99988,5,0|5.33333,1.81208,9.99988,5,0|5.33333,2.22045,9.99988,5,0|5.33333,2.62883,9.99988,5,0|5.33333,3.03721,9.99988,5,0|5.44403,3.39253,9.77356,6.48721,0|5.44444,3.80071,9.99988,5.00503,0|5.44444,4.20908,9.99988,5,0|5.49425,4.59359,9.95845,5.64221,0|5.55555,4.97258,9.9357,5.79845,0|5.55555,5.38096,9.99988,5,0|5.55555,5.78933,9.99988,5,0|5.66667,6.14446,9.77175,6.493,0|5.69393,6.53977,9.98802,5.34402,0|5.80347,6.89564,9.77863,6.47083,0|6,7.20982,9.23884,7.65158,0|6,7.6182,9.99988,5.00002,0|6,8.02658,9.99988,5,0|6,8.43495,9.99988,5,0|6,8.84333,9.99988,4.99998,0|5.88889,9.19845,9.77175,3.507,0|5.77778,9.55357,9.77175,3.50701,1|0,10,5.38518,0.0148675,0|0.522866,9.91072,4.1584,9.92857,0|1.05461,9.91071,4.99999,9.99991,0|1.58636,9.91072,5.00001,9.99991,0|2.1181,9.91072,5,9.99991,0|2.61842,9.82143,4.12159,9.92213,0|3.11874,9.73214,4.12161,9.92214,0|3.65048,9.73214,5,9.99991,0|4.18223,9.73214,5,9.99991,0|4.71397,9.73214,5,9.99991,0|5.24572,9.73214,5,9.99991,0|5.77746,9.73214,4.99999,9.99991,0|6.30921,9.73214,5,9.99991,0|6.84096,9.73214,5.00001,9.99991,0|7.3727,9.73214,5.00001,9.99991,0|7.90445,9.73214,4.99999,9.99991,0|8.43619,9.73214,5.00001,9.99991,0|8.96794,9.73214,4.99999,9.99991,0|9.46826,9.64286,4.12159,9.92213,0|10,9.64286,5,9.99991,1|
-1 2.73684,3.87232,9.08312,7.88583,0|2.94951,3.47497,0.591805,7.35939,0|3.31648,3.22925,2.21814,9.15453,0|3.67123,2.995,2.24494,9.17234,0|4,2.74917,2.0059,9.00427,0|4.21053,2.51083,1.25265,8.30996,0|4.37462,2.18051,0.522215,7.22443,0|4.52632,1.847,0.448816,7.07011,0|4.63158,1.44128,0.160356,6.25565,0|4.73684,1.09578,0.217189,6.45717,0|4.85624,0.69637,0.209596,6.43207,0|4.94737,0.284349,0.118089,6.07971,0|5.1579,0.0460026,1.25265,8.30995,0|5.26316,0,2.9979,9.58118,0|5.26316,0.452659,9.99989,5,0|5.26316,0.905317,9.99989,5,0|5.26316,1.35798,9.99989,5,0|5.26316,1.81063,9.99989,5,0|5.26316,2.26329,9.99989,5,0|5.26316,2.71595,9.99989,5,0|5.26316,3.16861,9.99989,5,0|5.26316,3.62127,9.99989,5,0|5.26316,4.07393,9.99989,5.00001,0|5.26316,4.52659,9.99989,4.99999,0|5.26316,4.97925,9.99989,5,0|5.26316,5.4319,9.99989,5,0|5.26316,5.88456,9.99989,5,0|5.26316,6.33722,9.99989,5,0|5.26316,6.78988,9.99989,5,0|5.26316,7.24254,9.99989,5,0|5.26316,7.6952,9.99989,5,0|5.26316,8.14786,9.99989,5,0|5.26316,8.60052,9.99989,5,0|5.26316,9.05317,9.99989,5,0|5.26316,9.50583,9.99989,5,1|0,10,5.4674,0.0219038,0|0.421604,10,5,9.99988,0|0.843208,10,5,9.99988,0|1.26481,10,5,9.99988,0|1.68642,10,5,9.99988,0|2.10802,10,5,9.99988,0|2.52962,10,5,9.99988,0|2.95087,9.99835,4.98047,9.99984,0|3.35152,9.90117,3.82132,9.85896,0|3.77313,9.90117,5,9.99988,0|4.19473,9.90117,5,9.99988,0|4.61633,9.90117,5,9.99988,0|5.03794,9.90117,4.99999,9.99988,0|5.45954,9.90117,5.00001,9.99988,0|5.88115,9.90117,5,9.99988,0|6.30275,9.90117,4.99999,9.99988,0|6.72435,9.90117,5.00001,9.99988,0|7.12465,9.80233,3.80153,9.85412,0|7.54625,9.80233,4.99999,9.99988,0|7.96786,9.80233,5,9.99988,0|8.38946,9.80233,4.99999,9.99988,0|8.81106,9.80233,5.00001,9.99988,0|9.21286,9.75073,4.36305,9.95914,0|9.61633,9.7035,4.41871,9.96597,0|10,9.60466,3.75275,9.84181,1|
-1 4.49275,0,5,9.99999,0|4.13652,0.253406,7.89817,0.925756,0|3.78028,0.506812,7.89817,0.925755,0|3.63269,0.907555,9.69182,3.2721,0|3.2852,1.16826,8.00056,1.00057,0|2.9894,1.48177,8.63666,1.56874,0|2.66862,1.77042,8.34443,1.28333,0|2.33737,2.04868,8.21592,1.17159,0|2.03786,2.3585,8.59483,1.52494,0|1.85334,2.70226,9.40534,2.63532,0|1.5942,3.00575,8.80235,1.75333,0|1.44928,3.298,9.47931,2.77868,0|1.151,3.51114,7.90693,0.932025,0|0.878772,3.80788,8.68433,1.61999,0|0.57971,4.02062,7.89816,0.925774,1|4.34783,0.309278,1.49141,8.56226,0|4.57555,0.714243,9.35812,7.45066,0|4.63768,1.16257,9.95255,5.6864,0|4.63768,1.62717,9.99989,5,0|4.63768,2.09177,9.99989,5.00001,0|4.63768,2.55637,9.99989,4.99999,0|4.63768,3.02097,9.99989,5,0|4.63768,3.48556,9.99989,5,0|4.63768,3.95016,9.99989,5,0|4.63768,4.41476,9.99989,5,0|4.63768,4.87936,9.99989,5,0|4.63768,5.34396,9.99989,5,0|4.63768,5.80856,9.99989,5,0|4.63768,6.27316,9.99989,5,0|4.63768,6.73776,9.99989,5,0|4.63768,7.20235,9.99989,5,0|4.77815,7.62252,9.74191,6.58531,0|4.92754,8.03987,9.70742,6.68496,0|4.92754,8.50447,9.99989,4.99999,0|4.92754,8.96907,9.99989,5,1|0,10,6.02392,0.105974,0|0.419615,9.92538,4.12458,9.92265,0|0.843301,9.89691,4.66477,9.98863,0|1.16641,9.79381,3.4802,9.76327,0|1.5926,9.79381,5,9.99988,0|2.0188,9.79381,5,9.99988,0|2.41207,9.69072,3.73216,9.83646,0|2.80535,9.58763,3.73216,9.83646,0|3.23154,9.58763,5,9.99988,0|3.65774,9.58763,5,9.99988,0|4.08394,9.58763,4.99999,9.99988,0|4.51014,9.58763,5.00001,9.99988,0|4.92745,9.53611,4.38744,9.96222,0|5.34475,9.48454,4.38669,9.96212,0|5.77095,9.48454,5,9.99988,0|6.19714,9.48454,5,9.99988,0|6.59042,9.38144,3.73216,9.83646,0|7.01661,9.38144,5,9.99988,0|7.44281,9.38144,5,9.99988,0|7.86901,9.38144,5,9.99988,0|8.29521,9.38144,5.00001,9.99988,0|8.72141,9.38144,4.99999,9.99988,0|9.1476,9.38144,5,9.99988,0|9.5738,9.38144,5,9.99988,0|10,9.38144,5,9.99988,1|
-1 4.91525,0,5,9.99999,0|4.60409,0.226648,7.94375,0.958585,0|4.3742,0.49856,8.81811,1.7719,0|4.19063,0.817209,9.33238,2.50418,0|3.93692,1.09001,8.66126,1.59503,0|3.68035,1.32277,8.35939,1.29688,0|3.38983,1.53539,7.9529,0.965279,0|3.12199,1.79355,8.46978,1.4001,0|2.87646,2.04238,8.55896,1.48825,0|2.58798,2.2899,8.25573,1.20542,0|2.37288,2.54726,8.83634,1.79361,0|2.07483,2.75541,7.86283,0.900873,0|1.81826,2.98817,8.35938,1.29688,0|1.64295,3.26913,9.24179,2.35317,0|1.35593,3.51852,8.27938,1.22583,1|5.08475,0,1.56851,8.63659,0|5.42149,0.182739,7.38475,9.3945,0|5.49463,0.579161,9.91689,5.90716,0|5.59322,0.968671,9.84702,6.22686,0|5.59322,1.38589,9.99988,5.00001,0|5.59322,1.8031,9.99988,5,0|5.59322,2.22031,9.99988,5,0|5.71391,2.56593,9.72033,6.64836,0|5.76271,2.9542,9.96084,5.62349,0|5.76271,3.37142,9.99988,5.00001,0|5.76271,3.78863,9.99988,4.99999,0|5.76271,4.20584,9.99988,5,0|5.76271,4.62306,9.99988,5,0|5.76271,5.04027,9.99988,5.00001,0|5.76271,5.45749,9.99988,4.99999,0|5.76271,5.8747,9.99988,5.00001,0|5.76271,6.29192,9.99988,4.99999,0|5.76271,6.70913,9.99988,5,0|5.76271,7.12634,9.99988,5.00001,0|5.76271,7.54356,9.99988,4.99999,0|5.76271,7.96077,9.99988,5.00001,0|5.76271,8.37799,9.99988,4.99999,0|5.76271,8.7952,9.99988,5.00001,0|5.76271,9.21242,9.99988,4.99999,0|5.76271,9.62963,9.99988,5,1|0,10,5.32069,0.0103033,0|0.531843,10,5,9.99991,0|1.06369,10,5,9.99991,0|1.59553,10,5,9.99991,0|2.12737,10,5,9.99991,0|2.65921,10,5,9.99991,0|3.19106,10,5,9.99991,0|3.71048,9.90741,4.12255,9.92231,0|4.24232,9.90741,4.99998,9.99991,0|4.77417,9.90741,5.00001,9.99991,0|5.30601,9.90741,5,9.99991,0|5.83785,9.90741,5,9.99991,0|6.36969,9.90741,5,9.99991,0|6.90154,9.90741,5,9.99991,0|7.43338,9.90741,5,9.99991,0|7.87263,9.81481,3.96871,9.89237,0|8.40447,9.81481,5,9.99991,0|8.93631,9.81481,5,9.99991,0|9.46816,9.81481,5,9.99991,0|10,9.81481,5,9.99991,1|
-1 0.267857,0,5,9.99981,0|0.267857,0.173071,9.99971,5,0|0.267857,0.346141,9.99971,5,0|0.267857,0.519212,9.99971,5,0|0.267857,0.692282,9.99971,5,0|0.267857,0.865353,9.99971,5,0|0.267857,1.03842,9.99971,5,0|0.267857,1.21149,9.99971,5,0|0.267857,1.38456,9.99971,5,0|0.267857,1.55764,9.99971,5,0|0.267857,1.73071,9.99971,5,0|0.280726,1.90074,9.98545,5.37734,0|0.358697,2.05513,9.46285,7.2539,0|0.446428,2.19186,9.20797,7.69998,0|0.446428,2.36493,9.99971,5,0|0.446428,2.538,9.99971,5,0|0.446428,2.71107,9.99971,5,0|0.446428,2.88414,9.99971,5,0|0.446428,3.05721,9.99971,5,0|0.446428,3.23028,9.99971,5,0|0.446428,3.40335,9.99971,5,0|0.446428,3.57642,9.99971,5,0|0.446428,3.74949,9.99971,5,0|0.446428,3.92256,9.99971,5,0|0.446428,4.09563,9.99971,5,0|0.446428,4.2687,9.99971,5,0|0.446428,4.44177,9.99971,5,0|0.357142,4.57786,9.18029,2.25735,0|0.343856,4.74543,9.98406,4.60482,0|0.267857,4.88702,9.40521,2.63548,0|0.267857,5.06009,9.99971,5,0|0.178571,5.19618,9.18028,2.25734,0|0.133228,5.35854,9.81545,3.65522,0|0.0892859,5.52124,9.82676,3.69638,0|0.0892859,5.69431,9.99971,5,0|0.0892859,5.86738,9.99971,5,0|0.0232787,6.02487,9.61108,3.06738,0|0,6.19245,9.95215,4.31207,0|0,6.36552,9.99971,5,0|0,6.53859,9.99971,5,0|0,6.71166,9.99971,5,0|0,6.88473,9.99971,5,0|0,7.0578,9.99971,5,0|0,7.23087,9.99971,5,0|0,7.40394,9.99971,5,0|0,7.57701,9.99971,5,0|0,7.75008,9.99971,5,0|0,7.92315,9.99971,5,0|0,8.09622,9.99971,5,0|0,8.26929,9.99971,5,0|0,8.44236,9.99971,5,0|0,8.61544,9.99971,5,0|0,8.78851,9.99971,5,0|0,8.96158,9.99971,5,0|0,9.13465,9.99971,5,0|0,9.30772,9.99971,5,0|0,9.48079,9.99971,5,0|0,9.65386,9.99971,5,0|0,9.82693,9.99971,5,0|0,10,9.99971,5,1|
-1 2.72727,3.59101,8.98182,8.02407,0|3.04607,3.29557,1.60142,8.66722,0|3.35059,3.05846,1.92825,8.945,0|3.50649,2.70908,0.434094,7.03745,0|3.84597,2.45239,1.9844,8.98811,0|4.02597,2.17312,0.797494,7.70877,0|4.15584,1.80495,0.28489,6.66327,0|4.28571,1.43679,0.284891,6.66327,0|4.41558,1.06863,0.28489,6.66327,0|4.54545,0.762696,0.397663,6.95371,0|4.69692,0.401633,0.389387,6.93416,0|4.80519,0,0.172466,6.30143,0|5.06493,0.0791961,6.45819,9.78245,0|5.06493,0.516426,9.99989,5,0|5.19481,0.910959,9.74919,6.56331,0|5.19481,1.34819,9.99989,5,0|5.19481,1.78542,9.99989,5,0|5.1948,2.22265,9.99989,4.99999,0|5.19481,2.65988,9.99989,5.00001,0|5.19481,3.09711,9.99989,5,0|5.19481,3.53434,9.99989,5,0|5.20614,3.96784,9.99818,5.13069,0|5.32467,4.3661,9.79213,6.42628,0|5.32467,4.80333,9.99989,5,0|5.45455,5.19786,9.74919,6.56331,0|5.58442,5.5924,9.74919,6.56332,0|5.58442,6.02963,9.99989,4.99999,0|5.58442,6.46686,9.99989,5.00001,0|5.58442,6.90408,9.99989,4.99999,0|5.58442,7.34132,9.99989,5,0|5.45455,7.70948,9.71511,3.33673,0|5.45455,8.14671,9.99989,5,0|5.45455,8.58394,9.99989,5,0|5.45455,9.02116,9.99989,5,0|5.45455,9.4584,9.99989,5,1|0,10,5.49404,0.0244766,0|0.415763,9.92775,4.14402,9.92606,0|0.836102,9.90973,4.78582,9.99529,0|1.25796,9.90973,5,9.99988,0|1.67982,9.90973,5,9.99988,0|2.10168,9.90973,5,9.99988,0|2.52354,9.90973,5,9.99988,0|2.9454,9.90973,5,9.99988,0|3.36726,9.90973,5.00001,9.99988,0|3.78912,9.90973,4.99999,9.99988,0|4.21098,9.90973,5,9.99988,0|4.63284,9.90973,5,9.99988,0|5.0547,9.90973,5,9.99988,0|5.47269,9.92234,5.15076,9.99761,0|5.87069,10,5.95752,9.90733,0|6.29255,10,5,9.99988,0|6.71441,10,5,9.99988,0|7.13627,10,5,9.99988,0|7.55813,10,5,9.99988,0|7.97999,10,5,9.99988,0|8.40185,10,5,9.99988,0|8.82371,10,5,9.99988,0|9.24557,10,5,9.99988,0|9.66743,10,5,9.99988,0|10,9.90973,3.69031,9.82527,1|
-2 1.15385,2.45342,9.52458,7.12791,0|1.15385,1.85772,8.40425e-05,5,0|1.15385,1.26202,8.40425e-05,5,0|1.45118,0.791706,0.773807,7.67178,0|1.92308,0.457069,2.10782,9.07853,0|2.4027,0.184739,2.53124,9.34791,0|2.98092,0.1124,4.37932,9.96124,0|3.54481,0,4.0226,9.90345,0|4.13702,0,5,9.99992,0|4.72923,0,5,9.99992,0|5.32143,0,5,9.99992,0|5.91364,0,5,9.99992,0|6.50585,0,5,9.99992,0|7.06953,0.175204,6.48403,9.7746,0|7.5989,0.431103,7.17606,9.50154,0|7.96171,0.826094,8.68231,8.38226,0|8.20513,1.31333,9.47278,7.23458,0|8.33333,1.86431,9.86981,6.13314,0|8.33333,2.46001,9.99992,5,0|8.33333,3.05572,9.99992,4.99999,0|8.11864,3.57174,9.61632,3.07939,0|7.73493,4.00747,8.75235,1.69561,0|7.3703,4.43804,8.81553,1.76877,0|6.92308,4.77321,7.99853,0.999008,0|6.53515,5.1543,8.50391,1.43325,0|6.00578,5.4102,7.17606,0.498454,0|5.48223,5.65263,7.10091,0.462895,0|4.91648,5.77793,6.08117,0.11838,0|4.34724,5.8957,6.01297,0.103775,0|3.78906,6.05178,6.34643,0.184789,0|3.23304,6.21534,6.41101,0.203315,0|2.69231,6.38319,6.48226,0.224855,0|2.26441,6.67894,7.84283,0.886928,0|1.76781,6.95137,7.4048,0.616387,0|1.34735,7.23684,7.8085,0.863414,0|0.945172,7.62649,8.47913,1.40907,0|0.641026,8.08989,9.17999,2.2565,0|0.420918,8.56383,9.53472,2.89396,0|0.128205,8.99759,9.14452,2.20322,0|0,9.52237,9.85706,3.8134,0|0,10,9.9999,5,0|0.319044,9.5284,0.858735,7.80161,0|0.772505,9.15736,1.83374,8.86962,0|1.27263,8.83833,2.31108,9.21531,0|1.8395,8.75054,4.23479,9.94101,0|2.41912,8.66876,4.30146,9.95088,0|3.01133,8.66876,5,9.99992,0|3.60354,8.66876,5,9.99992,0|4.19574,8.66876,5,9.99992,0|4.78795,8.66876,5,9.99992,0|5.36837,8.74536,5.65419,9.95693,0|5.89028,8.99132,7.13146,9.52283,0|6.41032,9.24131,7.16621,9.50629,0|6.83708,9.59527,8.19199,8.84841,0|7.37726,9.81369,6.87426,9.63533,0|7.96947,9.81369,5,9.99992,0|8.56168,9.81369,5,9.99992,0|9.15388,9.81369,5,9.99992,0|9.61758,9.56835,2.66169,9.41943,0|10,9.24123,1.74993,8.79948,1|
-2 1.30435,3.3913,9.66672,6.79489,0|1.25386,2.84319,0.0211677,4.5414,0|1.55321,2.33466,0.691182,7.53638,0|1.87267,1.83975,0.799232,7.71159,0|2.29082,1.40812,1.40887,8.47893,0|2.76709,1.0354,1.91859,8.93752,0|3.28825,0.722704,2.42756,9.28739,0|3.83141,0.459272,2.81813,9.49874,0|4.40321,0.287733,3.56329,9.78905,0|4.97066,0.0869565,3.33225,9.71357,0|5.55502,0,4.26407,9.94546,0|6.16371,0,5,9.99992,0|6.77241,0,5,9.99992,0|7.3811,0,5,9.99992,0|7.98373,0.0605148,5.49957,9.9749,0|8.56958,0.223048,6.33666,9.81794,0|9.13044,0.439731,6.80188,9.66395,0|9.43305,0.869565,9.08833,7.8783,0|9.71015,1.29143,9.17904,7.74493,0|9.85507,1.8153,9.8189,6.33314,0|10,2.36857,9.83673,6.26695,0|10,2.97379,9.99992,5,0|9.98813,3.57234,9.99893,4.90084,0|9.57867,3.99193,8.57841,1.50799,0|9.31898,4.49557,9.44392,2.70856,0|8.92597,4.84395,8.31663,1.25848,0|8.50297,5.18774,8.15348,1.11997,0|8.06461,5.59602,8.4077,1.34121,0|7.54345,5.90871,7.57243,0.712604,0|7.00638,6.17252,7.20437,0.512248,0|6.51538,6.52555,7.91884,0.940498,0|5.96359,6.76967,7.02289,0.427572,0|5.391,6.95079,6.50787,0.232874,0|4.84183,7.19962,7.0636,0.445803,0|4.32158,7.43872,7.0879,0.456893,0|3.79809,7.65217,6.88783,0.370184,0|3.27262,7.94947,7.46207,0.64829,0|2.75147,8.26216,7.57244,0.712607,0|2.20272,8.5131,7.0793,0.452948,0|1.7534,8.861,8.06106,1.04665,0|1.30941,9.20828,8.08043,1.06172,0|0.900225,9.45986,7.61874,0.740755,0|0.432823,9.73913,7.5645,0.707866,0|0,9.914,6.87295,0.364161,0|0.195092,10,7.01678,9.57496,0|0.794234,9.93564,4.46601,9.97132,0|1.39957,9.91304,4.81348,9.99644,0|2.00827,9.91304,4.99998,9.99992,0|2.61696,9.91304,5.00002,9.99992,0|3.22566,9.91304,5,9.99992,0|3.83435,9.91304,5,9.99992,0|4.44305,9.91304,5,9.99992,0|5.04027,9.83574,4.3582,9.95855,0|5.64753,9.82609,4.92048,9.99929,0|6.25623,9.82609,4.99999,9.99992,0|6.86492,9.82609,5.00001,9.99992,0|7.47361,9.82609,4.99999,9.99992,0|8.08231,9.82609,5.00001,9.99992,0|8.691,9.82609,5,9.99992,0|9.27536,9.73913,4.2641,9.94546,1|
-2 0,2.65869,9.99998,5,0|0.22232,2.10533,0.360523,6.86398,0|0.344828,1.53672,0.112241,6.05307,0|0.700168,1.11319,1.16967,8.21367,0|1.15348,0.722253,1.73464,8.78637,0|1.6092,0.353653,1.85566,8.88745,0|2.14121,0.19106,3.53867,9.78159,0|2.72679,0.0805662,4.07291,9.91321,0|3.31732,0,4.32413,9.95402,0|3.92138,0,5,9.99992,0|4.52544,0,5,9.99992,0|5.1295,0,5,9.99992,0|5.73356,0,5,9.99992,0|6.33762,0,5,9.99992,0|6.93198,0.0867753,5.72231,9.94747,0|7.5271,0.191059,5.863,9.92488,0|8.12529,0.27266,5.6758,9.95403,0|8.72101,0.357423,5.70434,9.95006,0|9.30179,0.514425,6.30478,9.82667,0|9.79944,0.766205,7.2572,9.46141,0|10,1.28631,9.66508,6.79892,0|9.97589,1.88683,9.99589,4.79939,0|9.69138,2.42141,9.41378,2.65101,0|9.48531,2.97737,9.68823,3.26229,0|9.31034,3.52897,9.76589,3.48825,0|8.89321,3.91787,8.40949,1.34288,0|8.50593,4.35039,8.72493,1.66472,0|8.15069,4.77491,8.83452,1.79134,0|7.79592,5.25095,9.00902,2.0122,0|7.30013,5.59846,7.86981,0.905694,0|6.7871,5.90691,7.57633,0.714944,0|6.24162,6.14178,6.97733,0.407687,0|5.74983,6.44152,7.60211,0.730558,0|5.20085,6.66707,6.90015,0.375221,0|4.66672,6.9287,7.19941,0.509816,0|4.12638,7.1704,7.04157,0.435887,0|3.70742,7.4121,7.49849,0.669123,0|3.21735,7.69445,7.496,0.667669,0|2.81737,8.01546,8.12947,1.10058,0|2.39491,8.40536,8.39112,1.32584,0|2.12454,8.86229,9.30302,2.45382,0|1.79517,9.21534,8.65592,1.58925,0|1.49425,9.61008,8.97631,1.96884,0|1.42981,10,9.93295,4.18468,0|1.88488,9.69219,2.19871,9.14148,0|2.35157,9.40778,2.39808,9.26955,0|2.9452,9.34569,4.47987,9.97279,0|3.53574,9.26513,4.32413,9.95403,0|4.1398,9.26513,5,9.99992,0|4.74386,9.26513,4.99999,9.99992,0|5.34792,9.26513,5,9.99992,0|5.95197,9.26513,5,9.99992,0|6.55603,9.26513,5,9.99992,0|7.12813,9.38657,6.03824,9.89093,0|7.61429,9.60708,7.06531,9.55341,0|8.09429,9.82909,7.09896,9.538,0|8.67325,9.90966,5.68914,9.9522,0|9.19697,9.828,4.22969,9.94021,0|9.54023,9.45553,1.32335,8.3884,0|9.77011,9.02343,0.585913,7.34836,1|
-2 0.768045,2.25657,9.73333,6.61103,0|0.927216,1.72135,0.20753,6.42525,0|1.39866,1.3436,1.87359,8.90189,0|1.85501,1.01722,2.0914,9.06684,0|2.35807,0.752191,2.66951,9.42357,0|2.86466,0.50146,2.78212,9.48108,0|3.39184,0.334307,3.48884,9.76608,0|3.95148,0.199605,3.82995,9.86108,0|4.5396,0.0835769,4.03224,9.90537,0|5.15035,0,4.32211,9.95375,0|5.78171,0,5,9.99992,0|6.41306,0,5,9.99992,0|7.03363,0.0835769,5.66735,9.95518,0|7.63812,0.215687,6.06753,9.88463,0|8.25359,0.336656,5.96427,9.90606,0|8.81259,0.630172,7.32439,9.42678,0|9.12648,1.08852,9.12525,7.82514,0|9.36331,1.62522,9.57435,7.01854,0|9.36331,2.25666,9.99992,5,0|9.36331,2.8881,9.99992,5,0|8.99835,3.30845,8.77542,1.722,0|8.64301,3.76519,8.94627,1.9298,0|8.23826,4.10665,8.22407,1.17843,0|7.7716,4.48631,8.15538,1.1215,0|7.2163,4.74251,7.09461,0.459979,0|6.6697,5.01137,7.20688,0.51348,0|6.14717,5.19893,6.68917,0.294066,0|5.5629,5.42731,6.82027,0.343195,0|5.01093,5.62839,6.71138,0.302094,0|4.43934,5.88944,7.07716,0.451964,0|3.866,6.14599,7.04211,0.436122,0|3.42379,6.44858,7.82358,0.87369,0|2.88728,6.74346,7.40829,0.618294,0|2.32828,7.03697,7.32439,0.573215,0|1.91726,7.41995,8.40843,1.3419,0|1.4741,7.86694,8.55069,1.4798,0|1.24556,8.37441,9.55891,2.94686,0|0.821046,8.80348,8.55428,1.48343,0|0.499054,9.2511,9.05889,2.08032,0|0.29053,9.69352,9.52271,2.86831,0|0,10,8.62862,1.56024,0|0.317994,9.5969,1.07453,8.09672,0|0.768045,9.23753,1.8801,8.90709,0|1.20002,8.90696,1.96144,8.97067,0|1.74609,8.59632,2.52775,9.34594,0|2.27626,8.44125,3.59639,9.79885,0|2.90761,8.44125,5,9.99992,0|3.53897,8.44125,5,9.99992,0|4.15954,8.52483,5.66735,9.95518,0|4.69367,8.6638,6.25899,9.8388,0|5.29784,8.81388,6.20539,9.85245,0|5.75091,9.02629,7.12235,9.5271,0|6.19453,9.27702,7.46015,9.35278,0|6.6707,9.52775,7.32955,9.42405,0|7.28614,9.65103,5.98203,9.90253,0|7.91184,9.6949,5.34973,9.98767,0|8.54319,9.6949,5,9.99992,0|9.06746,9.51594,3.38476,9.73182,0|9.64471,9.29642,3.22277,9.6734,0|10,8.94271,1.47245,8.54336,1|
-2 0.950339,3.09735,9.78005,6.46663,0|1.05937,2.58438,0.109353,6.03953,0|1.20948,2.09055,0.216226,6.45415,0|1.50221,1.629,0.777678,7.67789,0|1.84176,1.20783,1.10755,8.13813,0|2.23418,0.836302,1.5625,8.6308,0|2.66437,0.530973,2.10611,9.07731,0|3.13752,0.260178,2.51643,9.33947,0|3.61453,0,2.60586,9.38944,0|4.18615,0,5,9.99991,0|4.75777,0,5,9.99991,0|5.32938,0,5,9.99991,0|5.89554,0.0399849,5.35224,9.98749,0|6.45541,0.150273,5.96635,9.90564,0|7.01039,0.282609,6.15973,9.86355,0|7.56624,0.384005,5.89725,9.91875,0|8.10839,0.530973,6.30818,9.82574,0|8.4447,0.861539,8.50489,8.56577,0|8.47355,1.41183,9.99305,5.26177,0|8.47355,1.97556,9.99991,5,0|8.47355,2.53928,9.99991,5,0|8.33079,3.0636,9.82428,3.68646,0|8.12718,3.57111,9.64038,3.1383,0|7.85753,4.06633,9.39117,2.60904,0|7.56986,4.55154,9.30083,2.45011,0|7.21007,4.98958,8.86366,1.82648,0|6.8164,5.38046,8.52287,1.45198,0|6.35161,5.70457,7.8599,0.898768,0|5.96288,6.10739,8.59781,1.52799,0|5.48601,6.40713,7.66081,0.766895,0|5.01343,6.71394,7.72255,0.806332,0|4.59912,6.99731,7.82271,0.873098,0|4.20863,7.35027,8.35276,1.29082,0|3.73337,7.65266,7.68402,0.78157,0|3.25602,7.95161,7.65378,0.76248,0|2.82264,8.28814,8.06656,1.05092,0|2.31843,8.53561,7.20296,0.511565,0|1.86097,8.84956,7.82917,0.877514,0|1.37487,9.12446,7.46127,0.647843,0|0.950531,9.46871,8.15004,1.11718,0|0.491621,9.69943,7.24586,0.532882,0|0,9.97488,7.44391,0.638074,0|0.28252,10,5.4428,9.98018,0|0.854137,10,5,9.99991,0|1.42575,10,5,9.99991,0|1.99737,10,5,9.99991,0|2.56899,10,5,9.99991,0|3.1406,10,5,9.99991,0|3.71222,10,5,9.99991,0|4.28384,10,5,9.99991,0|4.85545,10,5,9.99991,0|5.42707,10,5,9.99991,0|5.99869,10,5,9.99991,0|6.5703,10,5,9.99991,0|7.14192,10,5,9.99991,0|7.71354,10,5,9.99991,0|8.28516,10,5,9.99991,0|8.85677,10,5,9.99991,0|9.42839,10,5,9.99991,0|10,10,5,9.99991,1|
-2 2.55814,1.71013,7.77879,9.1567,0|2.72447,1.16029,0.214268,6.44772,0|3.02326,0.723727,0.873917,7.82391,0|3.44295,0.444233,2.22864,9.16156,0|3.96481,0.248195,3.24173,9.68055,0|4.4903,0.0591469,3.30744,9.70472,0|5.06187,0,4.48535,9.97336,0|5.64362,0,5,9.99991,0|6.22537,0,5,9.99991,0|6.80712,0,5,9.99991,0|7.37127,0.102304,5.89215,9.91967,0|7.93701,0.206876,5.9088,9.91663,0|8.45859,0.427533,6.94807,9.6048,0|8.84359,0.688749,7.80717,9.13748,0|9.06977,1.16307,9.51309,7.15199,0|9.06977,1.75502,9.99992,5,0|9.18605,2.31003,9.89366,6.02527,0|9.18605,2.90198,9.99992,5,0|8.87115,3.37035,9.14931,2.21032,0|8.55331,3.8378,9.13468,2.18867,0|8.1367,4.19191,8.23814,1.19033,0|7.72178,4.54771,8.25469,1.20447,0|7.2162,4.7833,7.11186,0.467987,0|6.70747,5.05839,7.37823,0.601913,0|6.17513,5.29536,7.03335,0.432217,0|5.652,5.48922,6.73736,0.311646,0|5.11593,5.70053,6.83356,0.348423,0|4.61905,5.98547,7.48728,0.662653,0|4.09945,6.22016,7.05815,0.44334,0|3.59294,6.50712,7.46461,0.64973,0|3.0994,6.78454,7.44996,0.641468,0|2.59676,7.07812,7.5217,0.682572,0|2.08924,7.35636,7.40359,0.615724,0|1.63285,7.68833,7.94112,0.956621,0|1.1414,7.96785,7.47191,0.653879,0|0.683826,8.21882,7.40446,0.616213,0|0.348837,8.52087,8.34813,1.28665,0|0.116279,8.99187,9.4832,2.78641,0|0,9.4655,9.85571,3.8079,0|0.110459,10,9.89644,6.01189,0|0.377641,9.89759,3.21055,9.66863,0|0.745074,9.54189,1.52235,8.59235,0|1.16825,9.14921,1.59909,8.66509,0|1.65297,8.92623,2.91041,9.54232,0|2.21394,8.80548,3.94785,9.88796,0|2.78127,8.72168,4.26939,9.94624,0|3.34972,8.6444,4.32646,9.95434,0|3.93005,8.63617,4.92913,9.99941,0|4.5118,8.63617,5,9.99991,0|5.00952,8.72168,5.84658,9.92771,0|5.5369,8.89269,6.54225,9.75611,0|6.03462,8.9782,5.84658,9.92771,0|6.54728,9.23472,7.23734,9.4714,0|7.11833,9.32643,5.79282,9.93666,0|7.68293,9.45161,6.08231,9.88136,0|8.25133,9.54714,5.82871,9.93076,0|8.81491,9.66225,6.00055,9.89878,0|9.30233,9.67943,5.1761,9.99679,0|9.65116,9.2689,1.18987,8.23759,0|10,8.89269,1.33366,8.39956,1|
-3 0.357142,1.76,9.9001,5.99434,0|0.944364,1.41692,2.47778,9.31714,0|1.46051,1.09138,2.33269,9.22902,0|2.02794,0.785742,2.62891,9.40195,0|2.67956,0.599778,3.62788,9.80797,0|3.33119,0.413813,3.62788,9.80797,0|3.97177,0.220645,3.55647,9.78701,0|4.63926,0.16,4.54759,9.97942,0|5.23377,0,3.70061,9.82812,0|5.91422,0,5,9.99993,0|6.59468,0,5,9.99993,0|7.27513,0,5,9.99993,0|7.95558,0,5,9.99993,0|8.55603,0.0800002,5.66032,9.95612,0|8.92857,0.549613,8.91705,8.10739,0|9.35382,0.99051,8.59877,8.47103,0|9.64286,1.51964,9.38793,7.39692,0|9.82143,2.12032,9.79263,6.42476,0|9.82072,2.80032,9.99992,4.9948,0|9.46428,3.18698,8.67624,1.61115,0|8.92857,3.55632,7.83801,0.883581,0|8.39286,3.92566,7.838,0.883571,0|7.85688,4.24024,7.53084,0.687919,0|7.27608,4.58032,7.52641,0.685312,0|6.6551,4.85852,7.04421,0.437052,0|6.09344,5.12,7.11025,0.467228,0|5.52719,5.36,6.95116,0.396505,0|4.84674,5.36,5,7.36117e-05,0|4.18339,5.44,5.59865,0.0360432,0|3.60572,5.6,6.3346,0.181493,0|4.27732,5.52,4.4086,9.96483,0|4.94067,5.44,4.40135,9.96396,0|5.62112,5.44,5,9.99993,0|6.30157,5.44,5,9.99993,0|6.98047,5.44725,5.0534,9.99964,0|7.64537,5.52,5.54381,9.97026,0|8.29162,5.68,6.20162,9.85339,0|8.89207,5.76,5.66032,9.95612,0|9.44324,6.07057,7.45452,9.35598,0|9.77218,6.53794,9.08871,7.87777,0|10,7.07082,9.5974,6.96547,0|10,7.75127,9.99993,5,0|9.74538,8.24,9.43422,2.68984,0|9.28572,8.58658,8.01014,1.00773,0|8.77088,8.87064,7.41545,0.622241,0|8.26315,9.25811,8.03325,1.02525,0|7.64217,9.53631,7.0442,0.43705,0|7.00039,9.75191,6.59226,0.260383,0|6.33793,9.84,5.65904,0.0436994,0|5.67986,9.96771,5.95255,0.0916499,0|5.00298,10,5.23824,0.00575334,0|4.32253,10,5,7.36117e-05,0|3.64208,10,5,7.36117e-05,0|3.06249,9.806,3.41296,0.258643,0|2.48423,9.6,3.32213,0.290016,0|1.96429,9.43949,3.52519,0.222552,0|1.47325,9.14002,2.3966,0.731343,0|0.892508,8.79984,2.4729,0.685722,0|0.357142,8.46618,2.35543,0.756718,0|0,8.08,1.32921,1.60525,1|
-3 0.499475,0.185185,6.73815,9.68806,0|1.22786,0.185185,5,9.99993,0|1.95625,0.185185,5,9.99993,0|2.68464,0.185185,5,9.99993,0|3.41303,0.185185,5,9.99993,0|4.14142,0.185185,5,9.99993,0|4.86981,0.185185,5,9.99993,0|5.5982,0.185185,5,9.99993,0|6.31367,0.0962125,4.38298,9.96171,0|7.04153,0.0925927,4.97513,9.99987,0|7.76992,0.0925927,5,9.99993,0|8.49831,0.0925927,5,9.99993,0|9.21745,0.0589975,4.76668,9.99448,0|9.9296,0,4.5872,9.98286,0|10,0.0896732,8.93249,8.08726,0|9.38969,0.438435,7.48073,0.658886,0|8.80138,0.845947,7.84705,0.889815,0|8.21025,1.25278,7.83467,0.881267,0|7.60369,1.63516,7.6664,0.770388,0|7.00775,2.02864,7.75491,0.827502,0|6.41186,2.42895,7.78813,0.849623,0|5.81787,2.83186,7.80678,0.86221,0|5.20888,3.21425,7.65877,0.765587,0|4.57718,3.56556,7.43013,0.630358,0|3.94548,3.91687,7.43013,0.630358,0|3.33344,4.25525,7.41916,0.624279,0|2.68339,4.53704,6.98862,0.412552,0|2.16439,4.84078,7.5255,0.68479,0|2.33088,4.80165,3.85587,9.86704,0|2.86826,4.53704,2.79127,9.48561,0|3.57117,4.44444,4.34701,9.95711,0|4.17849,4.25926,3.54171,9.78253,0|4.90688,4.25926,5,9.99993,0|5.63527,4.25926,5,9.99993,0|6.35022,4.32971,5.49035,9.97583,0|7.05423,4.46157,5.92043,9.91448,0|7.67377,4.63805,6.36982,9.80862,0|8.33801,4.91487,6.92335,9.61519,0|9.00224,5.19169,6.92336,9.61519,0|9.49003,5.55582,7.99098,9.00665,0|9.7904,6.09297,9.36397,7.44028,0|9.9895,6.68693,9.74065,6.58916,0|9.9895,7.39256,9.99993,5,0|9.9895,8.0982,9.99993,4.99999,0|9.68642,8.61111,9.30457,2.45641,0|9.32353,9.0331,8.791,1.74003,0|8.8114,9.45148,8.16326,1.12792,0|8.12506,9.648,6.37629,0.193222,0|7.44259,9.81481,6.18718,0.143058,0|6.7294,9.92534,5.76575,0.0590554,0|6.00832,10,5.5149,0.0266525,0|5.27993,10,5,6.88434e-05,0|4.55154,10,5,6.88434e-05,0|3.82315,10,5,6.88434e-05,0|3.09476,10,5,6.88434e-05,0|2.36637,10,5,6.88434e-05,0|1.66999,9.86252,4.03162,0.0947449,0|1.03553,9.62963,3.27707,0.306306,0|0.596676,9.33258,2.19739,0.859414,0|0,9.07407,3.01231,0.412155,1|
-3 0.136986,1.48148,9.97873,5.46036,0|0.2415,0.832374,0.0636536,5.79481,0|0.698038,0.37037,1.44355,8.51438,0|1.25788,0.208704,3.61284,9.80364,0|1.93522,0.074074,4.02527,9.904,0|2.57255,0,4.42277,9.96649,0|3.28396,0,5,9.99993,0|3.99537,0,5,9.99993,0|4.70677,0,5,9.99993,0|5.41818,0,5,9.99993,0|6.09215,0.183161,6.31125,9.82493,0|6.75618,0.37037,6.35673,9.81233,0|7.38689,0.518519,6.14332,9.86745,0|7.96525,0.825652,7.34504,9.41588,0|8.48537,1.25505,8.18319,8.85572,0|8.90411,1.7877,8.93071,8.09011,0|9.17808,2.3358,9.47231,7.23554,0|9.17808,3.04721,9.99993,5,0|8.77655,3.54536,8.89278,1.86225,0|8.35616,3.96169,8.5183,1.44743,0|7.79985,4.26152,7.37217,0.598632,0|7.12164,4.44444,6.30203,0.172579,0|6.45192,4.63953,6.39833,0.199588,0|5.7528,4.74091,5.71754,0.051825,0|5.06194,4.89243,6.07115,0.116155,0|4.37822,5.03704,6.03458,0.108279,0|3.74417,5.13584,5.76981,0.0596961,0|3.04915,5.25926,5.87422,0.0770915,0|2.34412,5.33057,5.50313,0.0254497,0|2.12859,5.40741,6.67899,0.290562,0|2.79558,5.20712,3.56204,9.78869,0|3.43,5.11111,4.25186,9.94363,0|4.06733,5.03704,4.42277,9.96649,0|4.77874,5.03704,5,9.99993,0|5.49015,5.03704,5,9.99993,0|6.20156,5.03704,5,9.99993,0|6.90126,5.12516,5.62475,9.96074,0|7.58416,5.27276,6.05627,9.88708,0|8.26878,5.40741,5.96491,9.90594,0|8.85641,5.67791,7.09073,9.54181,0|9.32494,6.08475,8.27818,8.77527,0|9.60676,6.68583,9.52704,7.12254,0|9.86301,7.29692,9.61092,6.93355,0|10,7.9547,9.89491,6.01938,0|9.81825,8.56693,9.79317,3.57708,0|9.27275,9.00873,8.14682,1.11454,0|8.74012,9.42201,8.06511,1.04976,0|8.19761,9.6725,7.09594,0.460595,0|7.53425,9.80294,5.96466,0.0940156,0|6.88159,9.92593,5.92592,0.0865576,0|6.24426,10,5.57723,0.0335097,0|5.53285,10,5,7.03335e-05,0|4.82144,10,5,7.03335e-05,0|4.11003,10,5,7.03335e-05,0|3.39863,10,5,7.03335e-05,0|2.70018,9.8782,4.14102,0.0744089,0|2.00211,9.77778,4.28808,0.0510144,0|1.33321,9.60981,3.78226,0.15063,0|0.666614,9.3975,3.48266,0.235867,0|0,9.18519,3.48262,0.235881,1|
-3 0.32258,1.52174,9.89128,6.03686,0|0.75091,1.03945,1.26157,8.32014,0|1.25442,0.668302,2.03336,9.02471,0|1.82404,0.339925,2.50283,9.33167,0|2.4947,0.217391,4.10136,9.91851,0|3.16946,0.0851213,4.03819,9.90655,0|3.84945,0,4.37895,9.96121,0|4.54637,0,5,9.99993,0|5.2433,0,5,9.99993,0|5.94022,0,5,9.99993,0|6.63715,0,5,9.99993,0|7.33407,0,5,9.99993,0|8.031,0,5,9.99993,0|8.72632,0.00747663,5.05376,9.99964,0|9.32132,0.217391,6.66347,9.71509,0|9.67742,0.672083,8.93639,8.08285,0|10,1.19274,9.25027,7.63332,0|10,1.88967,9.99993,5,0|9.96254,2.56989,9.99236,4.72509,0|9.51613,3.03534,8.60848,1.53907,0|9.08614,3.45405,8.48822,1.41789,0|8.55303,3.83849,7.92449,0.944557,0|8.00103,4.18093,7.63575,0.751227,0|7.41768,4.49313,7.35927,0.591699,0|6.80448,4.66711,6.36473,0.189935,0|6.13573,4.85357,6.34284,0.183772,0|5.54468,5.11761,7.03936,0.434891,0|4.8611,5.21236,5.68651,0.0474271,0|4.24523,5.36232,6.18287,0.142014,0|3.57188,5.50725,6.05205,0.112008,0|3.23824,5.57692,6.02204,0.105721,0|3.9119,5.43478,3.9678,9.89222,0|4.60079,5.36232,4.47695,9.97249,0|5.28573,5.30641,4.59324,9.98335,0|5.97911,5.28986,4.88065,9.9985,0|6.67603,5.28986,5,9.99993,0|7.37296,5.28986,5,9.99993,0|7.92495,5.43478,6.2697,9.83601,0|8.51835,5.65217,6.71993,9.69479,0|8.93664,6.14596,8.8151,8.23175,0|9.21529,6.68621,9.44363,7.29201,0|9.51613,7.21656,9.34898,7.4669,0|9.67742,7.75219,9.78756,6.44164,0|9.63791,8.42355,9.99129,4.70623,0|9.33678,8.92927,9.29601,2.44198,0|8.9221,9.34783,8.55188,1.48101,0|8.348,9.65525,7.36027,0.592239,0|7.75083,9.85507,6.58661,0.258495,0|7.12637,9.92754,5.57634,0.0334075,0|6.42945,9.92754,4.99999,7.18236e-05,0|5.74805,10,5.52875,0.0281098,0|5.05113,10,5,7.18236e-05,0|4.3542,10,5,7.18236e-05,0|3.67281,9.92754,4.47126,0.028109,0|2.99142,9.85507,4.47126,0.028109,0|2.32783,9.68959,3.79016,0.148655,0|1.66773,9.49275,3.57127,0.208549,0|1.0933,9.18684,2.6498,0.586859,0|0.479543,8.91304,2.963,0.433831,0|0,8.69565,2.93561,0.446171,1|
-3 0,0.0763357,9.99935,5,0|0.646363,0,4.41358,9.96542,0|1.30056,0,5,9.99992,0|1.95476,0,5,9.99992,0|2.60896,0,5,9.99992,0|3.26316,0,5,9.99992,0|3.91736,0,5,9.99992,0|4.57156,0,5,9.99992,0|5.22576,0,5,9.99992,0|5.87995,0,5,9.99992,0|6.53415,0,5,9.99992,0|7.18835,0,5,9.99992,0|7.84255,0,5,9.99992,0|8.49675,0,5,9.99992,0|9.14963,0.00972298,5.07445,9.99937,0|9.78441,0.152672,6.09843,9.87777,0|10,0.355731,8.42808,8.63958,0|9.46702,0.659333,7.47475,0.655487,0|8.94658,1.01162,7.80276,0.859497,0|8.36687,1.28729,7.14718,0.484599,0|7.82656,1.64543,7.7624,0.832465,0|7.28886,2.00146,7.76042,0.831147,0|6.7822,2.40889,8.13321,1.10357,0|6.22601,2.74378,7.57913,0.716623,0|5.66084,3.06666,7.48022,0.658603,0|5.12492,3.43604,7.83748,0.883211,0|4.58901,3.80541,7.83748,0.883215,0|4.0754,4.2038,8.06444,1.04925,0|3.50816,4.48559,7.2245,0.522186,0|2.95319,4.81496,7.55179,0.70028,0|2.4682,5.09897,7.52666,0.685476,0|2.87189,4.92354,3.00718,9.58558,0|3.50103,4.80916,4.10568,9.91929,0|4.12759,4.73282,4.39531,9.96322,0|4.70425,4.65649,4.34386,9.95667,0|5.35845,4.65649,5,9.99992,0|6.01265,4.65649,5,9.99992,0|6.66684,4.65649,5,9.99992,0|7.30611,4.73139,5.58187,9.96595,0|7.74177,5.04607,7.92759,9.05318,0|8.10776,5.52726,8.9796,8.02687,0|8.44884,6.03002,9.13762,7.807,0|8.61619,6.54679,9.75669,6.54044,0|8.73363,7.13599,9.90346,5.97735,0|8.73363,7.78004,9.99992,5,0|8.71228,8.41411,9.99709,4.83174,0|8.28474,8.8446,8.54761,1.4767,0|7.83699,9.19429,8.07752,1.05944,0|7.29628,9.54198,7.70426,0.794505,0|6.71259,9.77099,6.82617,0.345508,0|6.0836,9.86847,5.76572,0.0590599,0|5.4483,9.94686,5.61228,0.0377089,0|4.8047,10,5.41145,0.0170356,0|4.1505,10,5,7.6592e-05,0|3.4963,10,5,7.6592e-05,0|2.94728,9.84733,3.66044,0.182873,0|2.33872,9.68077,3.68007,0.177449,0|1.81151,9.38931,2.58097,0.624219,0|1.3829,9.00763,1.67488,1.266,0|1.04424,8.54962,0.979722,2.02738,1|
-3 0,2.73147,9.99998,5,0|0.277778,2.09268,0.414821,6.99384,0|0.416667,1.40599,0.0993076,5.99121,0|0.601095,0.758771,0.19149,6.37021,0|0.860319,0.201459,0.466498,7.10868,0|1.5701,0.129159,4.49331,9.97419,0|2.28849,0.171974,5.29746,9.99107,0|2.99169,0.308629,5.95381,9.90811,0|3.71058,0.385631,5.5325,9.97149,0|4.4395,0.398364,5.08733,9.99917,0|5.17041,0.398364,5,9.99993,0|5.90132,0.398364,5,9.99993,0|6.63222,0.398364,5,9.99993,0|7.36313,0.398364,5,9.99993,0|8.09403,0.398364,5,9.99993,0|8.70943,0.218894,3.60017,9.79997,0|9.39687,0.0701606,3.94269,9.88686,0|9.92213,3.72529e-09,4.33803,9.95589,0|9.32637,0.384914,7.71335,0.800357,0|8.76296,0.838667,8.13614,1.10591,0|8.19488,1.29529,8.13247,1.10296,0|7.62696,1.7521,8.13374,1.10398,0|7.05895,2.20881,8.1331,1.10346,0|6.4562,2.62137,7.82407,0.873992,0|5.81791,2.92091,7.12409,0.473685,0|5.19096,3.28858,7.52933,0.687019,0|4.53005,3.57351,6.97947,0.408593,0|3.91522,3.97075,7.71335,0.800354,0|3.3004,4.36798,7.71335,0.800354,0|2.76961,4.62118,7.15272,0.487248,0|2.22222,4.7659,6.27799,0.166176,0|2.77778,4.39953,2.24738,9.174,0|3.42989,4.25697,3.93214,9.88456,0|4.1608,4.25697,5,9.99993,0|4.89171,4.25697,5,9.99993,0|5.62261,4.25697,5,9.99993,0|6.3253,4.39535,5.96613,9.9057,0|6.99453,4.64826,6.76754,9.67708,0|7.69199,4.81253,6.14622,9.86677,0|8.38738,5.00976,6.36432,9.81019,0|8.99898,5.24405,6.78857,9.66907,0|9.36372,5.7303,8.99976,8.00018,0|9.61499,6.36178,9.64564,6.84859,0|9.86111,7.02535,9.68786,6.73874,0|10,7.71204,9.90069,5.99121,0|10,8.44662,9.99993,5,0|9.6029,8.98764,9.03069,2.04149,0|9.02778,9.37558,7.79601,0.854928,0|8.42268,9.64106,7.00883,0.421371,0|7.79422,9.81522,6.33527,0.181671,0|7.09037,9.91027,5.66912,0.0450459,0|6.38569,10,5.63158,0.0401214,0|5.65478,10,5,6.85453e-05,0|4.92387,10,5,6.85453e-05,0|4.19547,9.97629,4.83735,0.00271469,0|3.47158,9.90999,4.54396,0.0209105,0|2.77735,9.73052,3.74858,0.15921,0|2.25489,9.32433,1.93115,1.05267,0|1.84218,8.76737,0.982777,2.02322,0|1.52778,8.2053,0.636355,2.55913,1|
-4 6.33333,0,5,9.99999,0|6.33333,0.53658,9.99991,5,0|6.33333,1.07316,9.99991,5,0|6.33333,1.60974,9.99991,5,0|6.33333,2.14632,9.99991,5,0|6.33333,2.6829,9.99991,5,0|6.33333,3.21948,9.99991,5,0|6.33333,3.75606,9.99991,4.99999,0|6.33333,4.29264,9.99991,5.00001,0|6.33333,4.82922,9.99991,5,0|6.33333,5.3658,9.99991,4.99999,0|6.33333,5.90238,9.99991,5.00001,0|6.33333,6.43896,9.99991,5,0|6.33333,6.97554,9.99991,5,0|6.33333,7.51213,9.99991,5,0|6.33333,8.04871,9.99991,5,0|6.33333,8.58529,9.99991,5,0|6.44444,9.01075,9.83765,6.26334,0|6.55556,9.51607,9.88325,6.07375,0|6.66667,10,9.8731,6.11887,1|6.22222,0.090909,0.00502646,4.77596,0|5.87768,0.47289,8.71272,1.65115,0|5.55607,0.817347,8.65457,1.58781,0|5.21169,1.19044,8.67401,1.60874,0|4.91043,1.60111,9.0315,2.04263,0|4.56938,1.98304,8.72938,1.66972,0|4.25569,2.3724,8.89353,1.86321,0|3.94109,2.64185,8.25243,1.20257,0|3.6383,3.02321,8.91574,1.89099,0|3.33333,3.41488,8.94503,1.92824,0|3.08121,3.75174,9.00288,2.00405,0|2.72455,4.09091,8.44553,1.37684,0|2.48248,4.36364,8.73935,1.68098,0|2.1207,4.62852,7.95367,0.965807,0|1.75623,4.92672,8.16612,1.13029,0|1.40304,5.21569,8.16612,1.1303,0|1.04986,5.50466,8.16612,1.1303,0|0.615028,5.76952,7.60098,0.72988,0|0.261842,6.05849,8.16613,1.13031,0|0,6.33229,8.61346,1.54434,0|0.392544,6.45455,6.48671,9.77373,0|0.907341,6.45455,5,9.9999,0|1.42214,6.45455,5,9.9999,0|1.93693,6.45455,5,9.9999,0|2.45173,6.45455,5,9.9999,0|2.96653,6.45455,5,9.9999,0|3.48133,6.45455,5,9.9999,0|3.99612,6.45455,5,9.9999,0|4.47847,6.54545,5.92605,9.91339,0|4.99326,6.54545,5,9.9999,0|5.50806,6.54545,5,9.9999,0|6.00498,6.63636,5.89978,9.91827,0|6.51978,6.63636,5,9.9999,0|7.03458,6.63636,5,9.9999,0|7.54937,6.63636,5,9.9999,0|7.97326,6.72727,6.04845,9.88872,0|8.48806,6.72727,5,9.9999,0|9.00286,6.72727,5,9.9999,0|9.4852,6.81818,5.92604,9.91339,0|10,6.81818,5,9.9999,1|
-4 6.23466,0,5,9.99999,0|5.88083,0.305898,8.26994,1.21762,0|5.62404,0.633478,8.93496,1.91538,0|5.33098,0.982385,8.82859,1.78429,0|5.11206,1.34221,9.27142,2.4012,0|4.77769,1.66775,8.48783,1.41754,0|4.48663,2.03243,8.90788,1.88112,0|4.13484,2.33693,8.27217,1.21955,0|3.91834,2.71551,9.34029,2.51792,0|3.67423,3.08386,9.16778,2.23804,0|3.33308,3.38009,8.2781,1.22469,0|3.02741,3.7179,8.70747,1.64537,0|2.77055,4.05068,8.95797,1.94496,0|2.46933,4.33532,8.43399,1.36593,0|2.31871,4.65139,9.51359,2.84916,0|2.01749,4.96654,8.61441,1.54531,0|1.83759,5.3125,9.43597,2.69329,0|1.47758,5.51443,7.44597,0.639266,0|1.11424,5.7029,7.3022,0.561684,0|0.812578,6.01779,8.61048,1.54121,0|0.577343,6.25,8.51247,1.44177,0|0.276321,6.45004,7.76726,0.835759,0|-7.45058e-09,6.74962,8.67524,1.6101,0|0.19679,6.875,7.68658,9.21665,0|0.656393,6.79832,4.17719,9.93173,0|1.11556,6.71829,4.14153,9.92564,0|1.57503,6.64062,4.16664,9.92995,0|2.04459,6.64062,5.00001,9.99989,0|2.51415,6.64062,4.99999,9.99989,0|2.98372,6.64062,5.00001,9.99989,0|3.45328,6.64062,4.99999,9.99989,0|3.92138,6.62393,4.82185,9.99672,0|4.38202,6.53518,4.05406,9.9096,0|4.84498,6.48438,4.45458,9.97005,0|5.31454,6.48438,5,9.99989,0|5.7841,6.48438,5,9.99989,0|6.25366,6.48438,5,9.99989,0|6.72323,6.48438,5,9.99989,0|7.19279,6.48438,5,9.99989,0|7.66235,6.48438,5,9.99989,0|8.13191,6.48438,5,9.99989,0|8.60147,6.48438,5,9.99989,0|9.06694,6.45293,4.66302,9.98852,0|9.53044,6.40625,4.49897,9.97473,0|10,6.40625,5,9.99989,1|7.59018,4.45312,1.85176,1.11562,0|7.59018,4.85788,9.99988,5,0|7.59018,5.26263,9.99988,5,0|7.59018,5.66738,9.99988,5,0|7.55079,6.05649,9.97445,4.49644,0|7.28896,6.35723,8.77092,1.71687,0|7.28896,6.76198,9.99988,5,0|7.28896,7.16673,9.99988,5,0|7.28896,7.57149,9.99988,5,0|7.28896,7.97624,9.99988,5,0|7.28896,8.38099,9.99988,5,0|7.28896,8.78574,9.99988,5,0|7.28896,9.1905,9.99988,5,0|7.28896,9.59525,9.99988,5,0|7.28896,10,9.99988,5,1|
-4 7.4446,0,5,9.99999,0|7.02854,0.214237,7.28888,0.554781,0|6.68267,0.521492,8.32066,1.26207,0|6.31759,0.809741,8.09831,1.0758,0|6.01185,1.15909,8.76248,1.70718,0|5.63104,1.42904,7.89153,0.921034,0|5.30595,1.76382,8.587,1.51685,0|4.95045,2.06322,8.22081,1.17569,0|4.58481,2.34779,8.07088,1.05429,0|4.27431,2.69464,8.72524,1.66511,0|3.94505,3.01662,8.49578,1.42531,0|3.63242,3.31898,8.47587,1.40596,0|3.35043,3.68801,8.97283,1.96429,0|3.00404,3.99201,8.29797,1.24204,0|2.68304,4.26609,8.24659,1.19757,0|2.35821,4.54466,8.25486,1.20465,0|2.07828,4.80368,8.39573,1.33016,0|1.71019,5.07727,7.98262,0.987156,0|1.3643,5.31474,7.8299,0.878046,0|1.08388,5.52632,8.01143,1.00878,0|0.74355,5.74091,7.66674,0.770668,0|0.335387,5.93341,7.1328,0.477827,0|7.45058e-09,6.16367,7.82989,0.878046,0|0.260966,6.22807,6.19797,9.85417,0|0.729875,6.22807,4.99999,9.99989,0|1.19878,6.22807,5.00001,9.99989,0|1.66769,6.22807,5,9.99989,0|2.1366,6.22807,5,9.99989,0|2.60509,6.22447,4.96156,9.99974,0|3.05927,6.11062,3.7843,9.84984,0|3.51833,6.05263,4.37338,9.96047,0|3.98724,6.05263,5,9.99989,0|4.45614,6.05263,5,9.99989,0|4.92505,6.05263,5.00001,9.99989,0|5.39396,6.05263,5,9.99989,0|5.86287,6.05263,4.99999,9.99989,0|6.33178,6.05263,5,9.99989,0|6.80069,6.05263,5,9.99989,0|7.2696,6.05263,5,9.99989,0|7.71082,5.96491,4.02507,9.90392,0|8.17973,5.96491,5.00001,9.99989,0|8.62096,5.87719,4.02505,9.90391,0|9.08987,5.87719,5.00001,9.99989,0|9.5311,5.78947,4.02506,9.90392,0|10,5.78947,5,9.99989,1|7.4446,3.94737,2.07616,0.944013,0|7.44461,4.3797,9.99988,5.00001,0|7.44461,4.81203,9.99988,5,0|7.44461,5.24436,9.99988,5,0|7.44461,5.67669,9.99988,5,0|7.44461,6.10902,9.99988,5,0|7.44461,6.54135,9.99988,5,0|7.4446,6.97368,9.99988,4.99999,0|7.44461,7.40601,9.99988,5.00001,0|7.44461,7.83835,9.99988,5,0|7.4446,8.27068,9.99988,4.99999,0|7.4446,8.70301,9.99988,5,0|7.44461,9.13534,9.99988,5.00001,0|7.4446,9.56767,9.99988,4.99999,0|7.4446,10,9.99988,5.00001,1|
-4 7.13252,0,5,9.99999,0|6.76503,0.271485,7.97093,0.978499,0|6.39755,0.542971,7.97093,0.978495,0|6.03799,0.823826,8.07785,1.05973,0|5.70276,1.1334,8.39207,1.32675,0|5.38952,1.4642,8.63052,1.56223,0|5.08052,1.79889,8.67361,1.60832,0|4.72937,2.09073,8.19579,1.15477,0|4.37974,2.3843,8.21512,1.17091,0|4.03821,2.68707,8.31678,1.25863,0|3.69668,2.98984,8.31678,1.25863,0|3.38005,3.31715,8.59356,1.52362,0|3.04795,3.62836,8.41885,1.35166,0|2.6968,3.92019,8.19579,1.15477,0|2.33918,4.20416,8.10921,1.08442,0|1.97827,4.48413,8.06452,1.04935,0|1.63545,4.78312,8.28637,1.23189,0|1.33008,5.12151,8.71193,1.6503,0|1.0247,5.45991,8.71194,1.65031,0|0.719334,5.7983,8.71193,1.6503,0|0.385511,6.09187,8.30184,1.24544,0|0.0985216,6.26168,7.54606,0.696967,0|-7.45058e-09,6.4486,9.42297,2.6687,0|0.458845,6.4486,5,9.99989,0|0.91769,6.4486,4.99999,9.99989,0|1.37653,6.4486,5,9.99989,0|1.83538,6.4486,5,9.99989,0|2.29422,6.4486,5.00001,9.99989,0|2.75307,6.4486,4.99999,9.99989,0|3.21191,6.4486,5.00001,9.99989,0|3.67076,6.4486,5,9.99989,0|4.1296,6.4486,5,9.99989,0|4.58845,6.4486,5,9.99989,0|5.04729,6.4486,5,9.99989,0|5.50614,6.4486,5,9.99989,0|5.96498,6.4486,5,9.99989,0|6.42383,6.4486,5,9.99989,0|6.88267,6.4486,5,9.99989,0|7.34152,6.4486,5,9.99989,0|7.80036,6.4486,5,9.99989,0|8.25921,6.4486,5,9.99989,0|8.71805,6.4486,5,9.99989,0|9.1769,6.4486,5,9.99989,0|9.63574,6.4486,5,9.99989,0|10,6.35514,3.75743,9.843,1|7.9759,4.48598,1.60787,1.32668,0|8.14505,4.86034,9.55635,7.05874,0|8.31325,5.207,9.49833,7.18259,0|8.31325,5.617,9.99988,5,0|8.31325,6.02701,9.99988,5.00001,0|8.31325,6.43701,9.99988,4.99999,0|8.31325,6.84701,9.99988,5.00001,0|8.31325,7.25701,9.99988,4.99999,0|8.31325,7.66702,9.99988,5,0|8.31325,8.07702,9.99988,5,0|8.31325,8.48702,9.99988,5,0|8.31325,8.89702,9.99988,5,0|8.35008,9.29315,9.9784,5.46292,0|8.56329,9.62287,9.19858,7.7149,0|8.6506,10,9.87103,6.12774,1|
-4 5.74664,0,5,9.99999,0|5.46504,0.398227,9.08237,2.11327,0|5.15728,0.775472,8.87419,1.83937,0|4.82646,1.13454,8.67716,1.61215,0|4.53335,1.52109,8.98403,1.97899,0|4.23678,1.90217,8.94578,1.92921,0|3.92463,2.2759,8.83749,1.7949,0|3.62723,2.66146,8.95898,1.94623,0|3.24954,2.96869,8.15509,1.12129,0|2.90532,3.30911,8.51582,1.44501,0|2.58832,3.67938,8.79811,1.74833,0|2.30905,4.05783,9.02308,2.0312,0|2.10584,4.47738,9.49983,2.82044,0|1.72046,4.7693,8.01906,1.0145,0|1.32005,5.00546,7.54001,0.693345,0|1.01748,5.37402,8.86447,1.82749,0|0.662456,5.70025,8.38297,1.31836,0|0.323602,5.9737,8.13997,1.10906,0|0,6.24385,8.20423,1.16181,0|0.264288,6.31579,6.31311,9.8243,0|0.755332,6.31579,5,9.9999,0|1.24565,6.2957,4.79536,9.99571,0|1.73545,6.26107,4.64734,9.98744,0|2.22408,6.215,4.53066,9.97782,0|2.71104,6.1524,4.36245,9.95908,0|3.19802,6.09022,4.36682,9.95964,0|3.68906,6.09023,5,9.9999,0|4.18011,6.09022,5,9.9999,0|4.667,6.03238,4.41014,9.96498,0|5.1531,5.96363,4.29988,9.95064,0|5.64244,5.93985,4.75725,9.994,0|6.13348,5.93985,5,9.9999,0|6.62453,5.93985,5,9.9999,0|7.11557,5.93985,5,9.9999,0|7.60662,5.93985,5,9.9999,0|8.09766,5.93985,5,9.9999,0|8.5887,5.93985,5,9.9999,0|9.06659,5.86466,4.22291,9.93914,0|9.53329,5.78947,4.20475,9.93624,0|10,5.71428,4.20475,9.93624,1|5.6403,0.0751879,1.04433,1.9418,0|5.87812,0.544097,9.45919,7.26156,0|5.95931,1.03939,9.93405,5.80877,0|6.17197,1.46771,9.47825,7.22356,0|6.17197,2.00436,9.99991,5,0|6.17198,2.54101,9.99991,5.00001,0|6.17197,3.07767,9.99991,4.99999,0|6.17197,3.61432,9.99991,5,0|6.17197,4.15098,9.99991,5,0|6.17197,4.68763,9.99991,5,0|6.17197,5.22428,9.99991,5,0|6.17197,5.76094,9.99991,5,0|6.17197,6.29759,9.99991,5,0|6.17197,6.83425,9.99991,5,0|6.17197,7.3709,9.99991,5,0|6.17197,7.90755,9.99991,5,0|6.17197,8.44421,9.99991,5,0|6.17197,8.98086,9.99991,5,0|6.17197,9.51752,9.99991,5,0|6.27831,10,9.88272,6.0761,1|
-4 7.10411,0,5,9.99999,0|6.6821,0.136806,6.54184,0.243784,0|6.30045,0.345197,7.39614,0.611677,0|5.95953,0.624577,8.16913,1.13277,0|5.66084,0.94733,8.66963,1.60402,0|5.32819,1.2352,8.27176,1.2192,0|5.02823,1.55417,8.64239,1.57482,0|4.70033,1.84607,8.32451,1.2655,0|4.38699,2.15377,8.50314,1.43253,0|4.05655,2.43913,8.26791,1.21587,0|3.68417,2.67513,7.67647,0.776803,0|3.38549,2.99788,8.66963,1.60402,0|3.01398,3.23027,7.6516,0.761149,0|2.71657,3.54803,8.6504,1.58336,0|2.37835,3.82994,8.20121,1.15929,0|2.03575,4.10759,8.14807,1.11561,0|1.69315,4.38525,8.14807,1.1156,0|1.30876,4.59474,7.3926,0.609746,0|0.966156,4.8724,8.14807,1.11561,0|0.60594,5.10204,7.68779,0.784004,0|0.30297,5.30612,7.79331,0.853186,0|1.49012e-08,5.5102,7.79331,0.853185,0|0.0473554,5.5102,5,9.99894,0|0.491833,5.5102,5,9.99989,0|0.93631,5.5102,5,9.99989,0|1.38079,5.5102,5,9.99989,0|1.82526,5.5102,5,9.99989,0|2.26974,5.5102,5,9.99989,0|2.71422,5.5102,5.00001,9.99989,0|3.1587,5.5102,4.99999,9.99989,0|3.60317,5.5102,5.00001,9.99989,0|4.04316,5.55329,5.48729,9.97608,0|4.47844,5.64148,5.99286,9.90032,0|4.91405,5.72802,5.97427,9.90405,0|5.35122,5.80676,5.88621,9.92072,0|5.78838,5.88549,5.88621,9.92072,0|6.2298,5.91837,5.37137,9.98608,0|6.67428,5.91837,5,9.99989,0|7.11876,5.91837,5,9.99989,0|7.56324,5.91837,5,9.99989,0|8.00771,5.91837,5,9.99989,0|8.45219,5.91837,5,9.99989,0|8.89667,5.91837,5,9.99989,0|9.34114,5.91837,5.00001,9.99989,0|9.74818,5.81633,3.78419,9.84981,1|10,4.28571,0.0663555,5.81168,0|9.8791,4.67765,9.77773,3.52619,0|9.87409,5.08639,9.9995,4.93876,0|9.87409,5.49585,9.99988,4.99999,0|9.87409,5.90532,9.99988,5.00002,0|9.87409,6.31479,9.99988,4.99999,0|9.87409,6.72426,9.99988,5.00001,0|9.87409,7.13373,9.99988,4.99999,0|9.87409,7.54319,9.99988,5,0|9.87409,7.95266,9.99988,5,0|9.87409,8.36213,9.99988,5,0|9.87409,8.7716,9.99988,5,0|9.87409,9.18106,9.99988,5,0|9.87409,9.59053,9.99988,5,0|9.87409,10,9.99988,5,1|
-5 0.983606,0.0826445,5.41863,9.98239,0|1.14754,0.708816,9.8369,6.26632,0|1.14754,1.3734,9.99992,5,0|1.11747,2.02895,9.99467,4.77089,0|0.819672,2.58577,9.40898,2.642,0|0.655737,3.18285,9.82149,3.67621,0|0.623494,3.83416,9.99381,4.75279,0|0.491803,4.44452,9.88745,3.94548,0|0.327868,5.00816,9.80097,3.60365,0|0.327868,4.57518,0.000115633,5,0|0.576792,4.04654,0.476478,7.13,0|1.04293,3.80165,2.67465,9.42626,0|1.53523,3.57996,2.94702,9.55898,0|2.19458,3.53773,4.6804,9.9897,0|2.85089,3.47107,4.49479,9.97433,0|3.51548,3.47107,5,9.99992,0|4.18007,3.47107,5,9.99992,0|4.84465,3.47107,5,9.99992,0|5.4635,3.66342,6.484,9.77462,0|6.07449,3.88879,6.73035,9.69096,0|6.68548,4.11417,6.73035,9.69096,0|7.25253,4.40004,7.25078,9.46466,0|7.86352,4.62541,6.73036,9.69096,0|8.45696,4.92458,7.25078,9.46467,0|8.71127,5.46601,9.52557,7.12566,0|9.01639,5.97616,9.29097,7.56647,0|9.18033,6.57323,9.82149,6.3238,0|9.18033,7.23782,9.99992,4.99999,0|9.13464,7.87427,9.98709,4.64196,0|8.78158,8.33592,8.97161,1.96265,0|8.39533,8.80801,8.86974,1.83388,0|7.94123,9.13707,7.93378,0.951293,0|7.34013,9.37607,6.84733,0.353862,0|6.74855,9.58678,6.67765,0.289936,0|6.18626,9.75207,6.4101,0.203046,0|5.5332,9.84494,5.70395,0.0498784,0|4.8776,9.91736,5.54896,0.0303039,0|4.23267,10,5.63551,0.0406298,0|3.56808,10,5,7.53999e-05,0|2.90349,10,5,7.53999e-05,0|2.24558,9.9462,4.59249,0.0167099,0|1.59043,9.8927,4.59305,0.0166655,0|0.959291,9.75206,3.91257,0.119762,0|0.327868,9.65591,4.24727,0.0570637,0|0,9.2562,1.13423,1.82906,1|0.819672,0.247934,0.0205758,5.45308,0|1.47208,0.165708,4.37479,9.96068,0|2.11973,0.0855218,4.38564,9.96204,0|2.76731,0.00493541,4.38255,9.96165,0|3.42427,0,4.96244,9.99978,0|4.08184,0,5,9.99992,0|4.73941,0,5,9.99992,0|5.39699,0,5,9.99992,0|6.05456,0,5,9.99992,0|6.71213,0,5,9.99992,0|7.36971,0,5,9.99992,0|8.02728,0,5,9.99992,0|8.68485,0,5,9.99992,0|9.34243,0,5,9.99992,0|10,0,5,9.99992,1|
-5 2.94118,0,5,9.99998,0|2.8442,0.549468,9.92382,4.13102,0|2.55094,1.04626,9.3057,2.45833,0|2.35294,1.57393,9.68118,3.2434,0|2.26697,2.12961,9.94113,4.23557,0|2.05882,2.65473,9.64808,3.15759,0|1.90886,3.19441,9.81739,3.66139,0|1.68417,3.7233,9.60183,3.04494,0|1.40616,4.2201,9.3632,2.55836,0|1.09145,4.70349,9.19016,2.27205,0|0.989857,5.2498,9.91563,4.08583,0|0.735294,5.7424,9.44185,2.70457,0|0.613908,6.27172,9.87341,3.88242,0|0.441176,6.37914,7.64037,0.754299,0|0.739494,5.97975,0.994203,7.99209,0|1.06783,5.56998,1.09814,8.12642,0|1.45525,5.2838,2.02929,9.02167,0|1.86919,4.98342,2.06349,9.04672,0|2.40859,4.78825,3.29879,9.7016,0|2.97615,4.71505,4.36041,9.95884,0|3.54421,4.64567,4.39386,9.96304,0|4.11676,4.59333,4.54487,9.97915,0|4.69161,4.56693,4.77057,9.99465,0|5.2688,4.56693,5,9.99991,0|5.84598,4.56693,5,9.99991,0|6.40342,4.64567,5.69932,9.95076,0|6.82384,4.96875,8.04661,8.9645,0|7.20887,5.35593,8.54527,8.52564,0|7.61481,5.7135,8.30485,8.75194,0|7.82699,6.17693,9.54608,7.08138,0|8.08824,6.65111,9.37924,7.41274,0|8.08824,7.22829,9.99991,5,0|8.08824,7.80548,9.99991,5,0|8.05631,8.36355,9.99175,4.71447,0|7.64706,8.72572,8.31352,1.25571,0|7.38894,9.13386,9.22572,2.3275,0|6.9673,9.43395,7.89925,0.926504,0|6.51032,9.68504,7.40768,0.61798,0|5.96324,9.84252,6.38309,0.195193,0|5.40581,9.92126,5.69933,0.0492373,0|4.83898,10,5.68795,0.047642,0|4.2618,10,5,8.67248e-05,0|3.68461,10,5,8.67248e-05,0|3.10742,10,5,8.67248e-05,0|2.53024,10,5,8.67248e-05,0|1.97573,9.89901,4.10415,0.0809985,0|1.41317,9.78778,4.03014,0.0950539,0|0.844261,9.74338,4.61101,0.0152424,0|0.300595,9.60977,3.8067,0.144578,0|0,9.2126,1.01321,1.98263,1|3.08824,0.0787406,0.263418,6.60148,0|3.86496,0.0787406,5,9.99994,0|4.64168,0.0787406,5,9.99994,0|5.4184,0.0787406,5,9.99994,0|6.19513,0.0787406,5,9.99994,0|6.97185,0.0787406,5,9.99994,0|7.66983,0,4.4395,9.96841,0|8.44656,0,5,9.99994,0|9.22328,0,5,9.99994,0|10,0,5,9.99994,1|
-5 9.10256,0.0980391,5.05385,9.9997,0|8.4551,0.0931159,4.96198,0.000221729,0|7.83749,0,4.25459,0.0559565,0|7.18836,0,5,7.7188e-05,0|6.53923,0,5,7.7188e-05,0|5.8901,0,5,7.7188e-05,0|5.24097,0,5,7.7188e-05,0|4.59184,0,5,7.7188e-05,0|3.94271,0,5,7.7188e-05,0|3.29358,0,5,7.7188e-05,0|2.64445,0,5,7.7188e-05,0|1.99532,0,5,7.7188e-05,0|1.34619,0,5,7.7188e-05,0|0.697059,0,5,7.7188e-05,0|0.365712,0.421067,8.92921,1.90802,0|0.155186,1.01653,9.71398,3.33338,0|0.128205,1.66004,9.99553,4.79054,0|0.128205,2.30917,9.99992,5,0|0.128205,2.9583,9.99992,5,0|0,3.56924,9.89334,3.97314,0|0,4.21837,9.99992,5,0|0,4.8675,9.99992,5,0|0.215302,4.57267,0.962215,7.94871,0|0.596601,4.05358,0.970366,7.95994,0|1.0221,3.62745,1.4619,8.53285,0|1.53331,3.33728,2.53182,9.34825,0|2.14791,3.23529,4.18155,9.93248,0|2.79704,3.23529,5,9.99992,0|3.44617,3.23529,5,9.99992,0|4.0953,3.23529,5,9.99992,0|4.74443,3.23529,5,9.99992,0|5.39356,3.23529,5,9.99992,0|6.04269,3.23529,5,9.99992,0|6.69182,3.23529,5,9.99992,0|7.34096,3.23529,5,9.99992,0|7.99009,3.23529,5,9.99992,0|8.60268,3.34322,5.86756,9.92408,0|9.10256,3.74532,8.13383,8.89594,0|9.47305,4.19407,8.85567,8.18323,0|9.77504,4.63189,9.11579,7.8389,0|10,5.16985,9.61283,6.92897,0|10,5.81898,9.99992,5,0|10,6.46811,9.99992,5,0|10,7.11724,9.99992,5,0|9.62656,7.62996,9.04155,2.05635,0|9.2851,8.15221,9.18478,2.2638,0|8.97436,8.65844,9.26119,2.38439,0|8.56349,9.03968,8.40087,1.33486,0|8.04785,9.434,8.0372,1.02827,0|7.47305,9.69168,7.04533,0.437563,0|6.87784,9.90196,6.66555,0.285644,0|6.22871,9.90196,5,7.7188e-05,0|5.61277,10,5.78595,0.0622389,0|4.96364,10,5,7.7188e-05,0|4.31451,10,5,7.7188e-05,0|3.67619,9.96807,4.75018,0.00632346,0|3.08145,9.80739,3.69592,0.17314,0|2.48672,9.64671,3.69593,0.17314,0|1.99623,9.36966,2.54105,0.646533,0|1.53846,8.92157,1.50246,1.42699,1|
-5 1.36364,0,5,9.99996,0|1.21212,0.636335,9.86395,3.84187,0|1.21212,1.29999,9.99992,5,0|1.06061,1.90399,9.84966,3.78345,0|0.909091,2.50799,9.84966,3.78346,0|0.909091,3.17165,9.99992,5,0|0.896612,3.82783,9.99902,4.90493,0|0.757576,4.40831,9.86238,3.83535,0|0.757576,5.07196,9.99992,5,0|0.802131,4.87805,0.12723,6.11964,0|1.06061,4.47287,0.784768,7.68901,0|1.36364,4.11225,1.17212,8.21656,0|1.87112,3.84759,2.68798,9.43325,0|2.49042,3.65854,3.5402,9.78207,0|3.15407,3.65854,5,9.99992,0|3.81772,3.65854,5,9.99992,0|4.48138,3.65854,5,9.99992,0|5.14503,3.65854,5,9.99992,0|5.80261,3.6827,5.18361,9.99655,0|6.43197,3.8578,6.34019,9.81696,0|7.07369,3.98374,5.96286,9.90634,0|7.68213,4.20342,6.69795,9.70279,0|8.29348,4.45016,6.87131,9.63653,0|8.71266,4.87863,8.574,8.49652,0|8.94456,5.44993,9.63279,6.88054,0|9.24242,5.93538,9.26166,7.61484,0|9.24242,6.59903,9.99992,4.99999,0|9.24242,7.26269,9.99992,5.00001,0|9.09091,7.83569,9.83378,3.72183,0|8.6729,8.33478,8.83308,1.78959,0|8.21476,8.76281,8.41342,1.34654,0|7.73399,9.06324,7.64962,0.759876,0|7.33225,9.39896,8.2061,1.16334,0|6.71145,9.56947,6.32424,0.178631,0|6.08933,9.78904,6.6641,0.285128,0|5.45248,9.9187,5.99749,0.100587,0|4.79955,10,5.6178,0.0383908,0|4.13589,10,5,7.53999e-05,0|3.47224,10,5,7.53999e-05,0|2.80859,10,5,7.53999e-05,0|2.14493,10,5,7.53999e-05,0|1.49279,9.9127,4.33659,0.0442836,0|0.847382,9.80429,4.17174,0.0691572,0|0.303031,9.58804,3.15409,0.353306,0|0,9.10569,0.766256,2.3402,1|1.51515,0.081301,0.0690213,5.82789,0|2.12702,0.081301,5,9.99992,0|2.73889,0.081301,5,9.99992,0|3.35075,0.081301,5,9.99992,0|3.96262,0.081301,5,9.99992,0|4.57449,0.081301,5,9.99992,0|5.18636,0.081301,5,9.99992,0|5.79823,0.081301,5,9.99992,0|6.41009,0.081301,5,9.99992,0|7.02196,0.081301,5,9.99992,0|7.63383,0.081301,5,9.99992,0|8.2457,0.081301,5,9.99992,0|8.85757,0.081301,5,9.99992,0|9.39394,0.156794,5.69685,9.95111,0|10,0.162602,5.04791,9.99969,1|
-5 9.86547,0.252101,5.12773,9.99836,0|9.17309,0.252101,5,7.24196e-05,0|8.48071,0.252101,5,7.24196e-05,0|7.78834,0.252101,5,7.24196e-05,0|7.09596,0.252101,5,7.24196e-05,0|6.40358,0.252101,5,7.24196e-05,0|5.71121,0.252101,5,7.24196e-05,0|5.02521,0.210994,4.70092,0.00902563,0|4.33949,0.168067,4.68761,0.00984132,0|3.66016,0.0840337,4.38619,0.0378934,0|2.96778,0.0840337,5,7.24196e-05,0|2.2999,0,4.37583,0.0391865,0|1.60752,0,5,7.24196e-05,0|1.12085,0.3234,7.76726,0.835697,0|0.851786,0.930051,9.57055,2.97284,0|0.601095,1.56221,9.6478,3.15685,0|0.334922,2.15831,9.56546,2.96141,0|0.313657,2.83717,9.99747,4.84346,0|0.179124,3.39004,9.85815,3.81785,0|0.0710007,4.01712,9.92721,4.15042,0|0.044592,4.68888,9.99607,4.80359,0|0.044592,5.37509,9.99993,5,0|0,5.1539,0.0988355,4.01189,0|0.408261,4.70588,1.30434,8.36768,0|0.851787,4.39949,2.15815,9.11375,0|1.4743,4.233,3.70823,9.83017,0|2.15316,4.17339,4.56262,9.98076,0|2.8124,4.03361,3.96292,9.89119,0|3.50477,4.03361,5,9.99993,0|4.19715,4.03361,5,9.99993,0|4.88953,4.03361,5,9.99993,0|5.5819,4.03361,5,9.99993,0|6.27428,4.03361,5,9.99993,0|6.96666,4.03361,5,9.99993,0|7.63455,4.11765,5.62417,9.96081,0|8.21764,4.28571,6.38476,9.80433,0|8.64939,4.57818,7.80416,9.13954,0|9.25093,4.91026,7.41641,9.37724,0|9.68275,5.31795,8.43248,8.63555,0|9.86547,5.91394,9.78031,6.46555,0|10,6.52658,9.88356,6.07241,0|10,7.21278,9.99993,5,0|9.92842,7.85984,9.9696,4.45021,0|9.5964,8.39159,9.2411,2.35193,0|9.14103,8.85587,8.56957,1.49894,0|8.68228,9.2437,8.22799,1.18172,0|8.26876,9.57983,8.15374,1.12019,0|7.6828,9.83193,6.97603,0.407124,0|6.99895,9.88686,5.4003,0.0161231,0|6.31109,9.91597,5.21139,0.00454307,0|5.63176,10,5.61382,0.0378945,0|4.93938,10,5,7.24196e-05,0|4.24701,10,5,7.24196e-05,0|3.55463,10,5,7.24196e-05,0|2.88413,9.92493,4.4437,0.0311181,0|2.19711,9.91324,4.91493,0.000796616,0|1.67157,9.7479,3.49948,0.230563,0|1.02817,9.57983,3.73632,0.162401,0|0.456586,9.33298,3.01762,0.409864,0|0.044592,8.9916,1.8099,1.15003,1|
-5 0.188679,0,5,9.99973,0|0.188679,0.705389,9.99993,5,0|0.188679,1.41078,9.99993,5,0|0.188679,2.11617,9.99993,5,0|0.188679,2.82156,9.99993,5,0|0.188679,3.52695,9.99993,5,0|0.239878,4.2011,9.98557,5.37863,0|0.377358,4.82262,9.88191,6.07989,0|0.6653,5.39088,9.46004,7.25992,0|0.947207,4.94949,0.786208,7.69128,0|1.41187,4.56311,1.80319,8.84442,0|1.96358,4.23233,2.429,9.28826,0|2.61171,3.99592,3.28662,9.69719,0|3.30512,3.8835,4.19981,9.93548,0|4.00303,3.82446,4.57859,9.98214,0|4.70361,3.78641,4.7288,9.99257,0|5.409,3.78641,5,9.99993,0|6.11439,3.78641,5,9.99993,0|6.81977,3.78641,5,9.99993,0|7.47814,3.98058,6.41443,9.79569,0|8.07415,4.17476,6.5488,9.75399,0|8.74374,4.36893,6.39257,9.80209,0|9.25495,4.56311,6.77536,9.6741,0|9.62264,4.9008,8.38208,8.68246,0|10,5.31363,8.69045,8.37338,0|10,6.01902,9.99993,5,0|10,6.72441,9.99993,5,0|10,7.4298,9.99993,5,0|9.811,8.05842,9.78818,3.56035,0|9.40849,8.55679,8.88977,1.85851,0|8.91967,9.0025,8.36877,1.30532,0|8.42339,9.41748,8.20731,1.16433,0|7.86212,9.70874,7.30298,0.562041,0|7.18024,9.80583,5.7048,0.049997,0|6.48714,9.90291,5.6936,0.0484139,0|5.79404,10,5.69361,0.0484151,0|5.08865,10,5,7.09295e-05,0|4.38326,10,5,7.09295e-05,0|3.67787,10,5,7.09295e-05,0|2.97249,10,5,7.09295e-05,0|2.2671,10,5,7.09295e-05,0|1.69811,9.79002,3.26893,0.309311,0|1.13207,9.5771,3.23962,0.32023,0|0.943396,9.06038,0.303411,3.28502,0|1.13207,8.93204,2.1879,9.134,1|0,0.194175,0.0414488,4.35757,0|0.70327,0.103706,4.36206,9.95907,0|1.41191,0.0970874,4.95331,9.99971,0|2.12098,0.0970874,5,9.99993,0|2.83004,0.0970874,5,9.99993,0|3.53911,0.0970874,5,9.99993,0|4.24817,0.0970874,5,9.99993,0|4.95724,0.0970874,5,9.99993,0|5.66017,0.145577,5.34409,9.98808,0|6.36308,0.194175,5.34486,9.98802,0|7.07215,0.194175,5,9.99993,0|7.78121,0.194175,5,9.99993,0|8.49028,0.194175,5,9.99993,0|9.19934,0.194175,5,9.99993,0|9.81132,0.0970874,4.21659,9.93816,1|
-6 7.61905,0,5,9.99999,0|7.00221,0.108952,5.86968,0.0762963,0|6.43806,0.373982,7.12597,0.474578,0|5.83508,0.547444,6.38227,0.194949,0|5.25798,0.781951,6.88228,0.367915,0|4.68088,1.01646,6.88228,0.367915,0|4.1527,1.31744,7.47546,0.655895,0|3.61704,1.6176,7.44412,0.638179,0|3.14595,2.02562,8.27345,1.22062,0|2.60622,2.34352,7.53755,0.691861,0|2.18838,2.79814,8.68122,1.61654,0|1.79645,3.213,8.63449,1.5664,0|1.42857,3.60183,8.63196,1.56374,0|1.05154,4.06398,8.8742,1.83935,0|0.714286,4.541,9.08262,2.11359,0|0.395126,5.02479,9.17352,2.24666,0|0.208195,5.58235,9.74058,3.41066,0|0,6.10761,9.64811,3.15766,0|0,6.73505,9.99992,5,0|0,7.36249,9.99992,5,0|0.29891,7.8782,9.32581,7.5073,0|0.595238,8.29597,9.07817,7.89267,0|0.968177,8.70772,8.7058,8.35651,0|1.49163,9.02499,7.59163,9.27582,0|2.01332,9.24054,6.90929,9.62101,0|2.59855,9.41191,6.40511,9.79842,0|3.17195,9.63318,6.80001,9.66467,0|3.7736,9.77385,6.13835,9.86861,0|4.39551,9.79452,5.16608,9.99716,0|5.00466,9.86301,5.55869,9.96861,0|5.62138,9.93903,5.61163,9.96237,0|6.24022,10,5.49025,9.97583,0|6.86766,10,5,9.99992,0|7.4951,10,5,9.99992,0|7.98556,9.86301,3.65497,9.81559,0|8.45238,9.60201,2.55999,9.36411,0|8.84385,9.22682,1.54043,8.60977,0|9.16667,8.78608,0.96631,7.95439,0|9.47247,8.3857,1.02653,8.03488,0|9.88043,7.94551,1.33279,8.39864,0|10,7.38722,0.110964,6.04712,0|10,6.75978,7.98702e-05,5,0|9.93405,6.15699,0.0297385,4.45624,0|9.54243,5.77485,1.50811,1.42148,0|9.26116,5.34247,0.808823,2.27364,0|8.97619,5,1.1567,1.80189,0|8.5113,4.74298,2.58081,0.624318,0|8.02684,4.45205,2.42598,0.713566,0|7.45429,4.24658,3.31107,0.293972,0|6.84515,4.17808,4.44132,0.0313926,0|6.21771,4.17808,5,7.98702e-05,0|5.60857,4.10959,4.44132,0.031392,0|4.98113,4.10959,5,7.98702e-05,0|4.36049,4.13506,5.20503,0.00428587,0|3.74784,4.21274,5.62894,0.0397959,0|3.19211,4.31507,5.9054,0.0827473,0|2.57432,4.38356,5.55096,0.0305298,0|2.03367,4.52055,6.22804,0.153247,0|1.42507,4.59106,5.57541,0.033302,0|0.952381,4.79452,6.97681,0.407478,1|
-6 7.55319,0,5,9.99999,0|6.91254,0.0354918,5.27657,0.00773281,0|6.32434,0.24661,6.68909,0.294029,0|5.74049,0.488844,6.91606,0.381786,0|5.17394,0.789231,7.34213,0.582577,0|4.56175,0.980525,6.49123,0.227637,0|3.98614,1.26841,7.23655,0.528193,0|3.37608,1.45833,6.4862,0.226068,0|2.79681,1.71597,7.03186,0.431548,0|2.25562,2.06925,7.73307,0.81317,0|1.79898,2.443,8.16683,1.13085,0|1.39257,2.91041,8.77309,1.7193,0|1.06383,3.40026,9.15166,2.21381,0|0.67257,3.84298,8.74652,1.689,0|0.425532,4.28085,9.35466,2.54318,0|0.212766,4.83349,9.66605,3.20358,0|0.106383,5.42219,9.92023,4.11088,0|0.106383,6.06849,9.99992,5,0|0.106383,6.7148,9.99992,5,0|0.319149,7.2459,9.64132,6.85936,0|0.606717,7.68772,9.19047,7.72746,0|0.758157,8.20324,9.7972,6.40923,0|1.06383,8.63526,9.08156,7.88788,0|1.53429,9.02778,8.20313,8.83916,0|2.04609,9.33411,7.56777,9.29019,0|2.65683,9.51209,6.39896,9.80022,0|3.24992,9.69092,6.44338,9.78705,0|3.86625,9.79167,5.80657,9.93443,0|4.47123,9.93056,6.11877,9.87315,0|5.11754,9.93056,4.99999,9.99992,0|5.75279,10,5.54335,9.97031,0|6.39909,10,5,9.99992,0|7.04539,10,5,9.99992,0|7.5992,9.8461,3.66124,9.81735,0|8.11942,9.56094,2.59667,9.38442,0|8.6205,9.1644,1.89726,8.92074,0|9.04255,8.77385,1.60418,8.66982,0|9.3617,8.34913,1.00283,8.00361,0|9.68085,7.92441,1.00282,8.0036,0|9.89362,7.49088,0.511515,7.20283,0|10,6.90218,0.0797728,5.88912,0|9.78723,6.37107,0.358678,3.14063,0|9.39649,5.87876,1.08367,1.89169,0|8.94938,5.49474,1.74227,1.20707,0|8.53074,5.22146,2.26694,0.813189,0|7.94689,4.97922,3.08393,0.381788,0|7.33573,4.86111,4.05131,0.0909081,0|6.77953,4.72222,3.78865,0.149045,0|6.20267,4.65278,4.40241,0.035927,0|5.55637,4.65278,5,7.7486e-05,0|4.91007,4.65278,5,7.7486e-05,0|4.26377,4.65278,5,7.7486e-05,0|3.63813,4.72222,5.55159,0.030598,0|3.07232,4.86111,6.19194,0.144239,0|2.46244,5.02962,6.33158,0.180652,0|1.88445,5.27778,6.97257,0.405638,0|1.3393,5.48611,6.78487,0.329519,0|0.828755,5.77845,7.48449,0.661054,0|0.319149,6.06088,7.42369,0.626803,0|0,6.45833,8.89858,1.86949,1|
-6 10,0,5,10,0|9.42465,0.190058,6.56831,0.252413,0|8.90978,0.481095,7.46036,0.647327,0|8.35343,0.711001,6.90954,0.379087,0|7.78782,0.909091,6.65269,0.281126,0|7.20528,1.04895,6.16723,0.138236,0|6.64816,1.28136,6.92497,0.385496,0|6.09854,1.5379,7.11476,0.469331,0|5.57079,1.84053,7.48718,0.662593,0|5.02131,2.09179,7.07928,0.452939,0|4.48923,2.38421,7.40811,0.618197,0|3.97511,2.6856,7.52863,0.686628,0|3.42452,2.93423,7.05772,0.44314,0|2.91195,3.23385,7.52321,0.683455,0|2.44166,3.56643,7.88695,0.917764,0|1.95122,3.84707,7.48319,0.660312,0|1.57858,4.19969,8.43661,1.36837,0|1.09756,4.55435,7.96711,0.975648,0|0.731708,4.95077,8.67431,1.60905,0|0.420008,5.39244,9.08505,2.11704,0|0.121951,5.88911,9.28719,2.42723,0|0,6.42683,9.87608,3.89414,0|0,7.0352,9.99992,5,0|0,7.64357,9.99992,5,0|0.14314,8.19397,9.83895,6.25846,0|0.56943,8.51991,8.03691,8.97193,0|0.853659,8.85398,8.80814,8.2399,0|1.2082,9.15436,8.23196,8.81489,0|1.64695,9.40594,7.48717,9.33739,0|2.20885,9.58042,6.48269,9.77501,0|2.73876,9.68237,5.94458,9.90987,0|3.33041,9.79021,5.89659,9.91887,0|3.9232,9.90106,5.91902,9.91473,0|4.52749,9.93007,5.23977,9.99416,0|5.1306,9.96752,5.30984,9.99031,0|5.73441,10,5.2686,9.9927,0|6.34278,10,5,9.99992,0|6.95115,10,5,9.99992,0|7.48289,9.90492,4.1199,9.92184,0|7.92683,9.60503,2.20125,9.1432,0|8.32807,9.28041,1.85517,8.88704,0|8.7345,8.90749,1.61968,8.68409,0|9.14634,8.58901,1.9414,8.95525,0|9.44219,8.15203,0.859737,7.80308,0|9.63415,7.65486,0.335688,6.8009,0|9.63415,7.04649,8.22544e-05,4.99999,0|9.63415,6.43812,8.22544e-05,5.00001,0|9.27069,6.01536,1.2086,1.74049,0|8.90329,5.59489,1.23494,1.7101,0|8.56561,5.13818,0.97964,2.02749,0|8.16847,4.75395,1.52341,1.40662,0|7.67758,4.47246,2.51282,0.662599,0|7.13174,4.2126,2.85079,0.485573,0|6.56595,4.04481,3.57846,0.206425,0|6.02203,3.80285,2.96776,0.431722,0|5.46784,3.56643,3.03816,0.401048,0|4.91685,3.34075,3.10485,0.373169,0|4.38442,3.21344,3.83728,0.137165,0|3.81242,3.07692,3.83927,0.136684,0|3.29268,2.93706,3.70075,0.171852,1|
-6 7.47899,0,5,9.99999,0|6.89076,0.12474,6.03721,0.108848,0|6.33772,0.272703,6.29225,0.169969,0|5.73895,0.493039,6.72669,0.30769,0|5.12252,0.684966,6.48635,0.226113,0|4.53704,0.935252,6.96537,0.402551,0|4.00638,1.15108,6.88369,0.368496,0|3.44517,1.43902,7.28248,0.551461,0|2.87467,1.75509,7.423,0.62641,0|2.32968,2.10625,7.70815,0.797005,0|1.84577,2.44858,7.88763,0.918239,0|1.36096,2.86364,8.25165,1.20185,0|0.983643,3.35592,8.96835,1.9584,0|0.756302,3.91118,9.62711,3.10552,0|0.465841,4.43775,9.37802,2.58503,0|0.168067,4.98757,9.39653,2.61889,0|0,5.56599,9.80135,3.60492,0|0,6.22178,9.99992,5,0|0.0840335,6.83888,9.9542,5.67463,0|0.29203,7.4065,9.69465,6.7203,0|0.66441,7.90021,8.99179,8.01078,0|1.11079,8.28909,8.28433,8.76993,0|1.51985,8.71124,8.59069,8.47939,0|1.97129,9.11721,8.34328,8.71775,0|2.47948,9.44265,7.69644,9.21051,0|3.06004,9.67011,6.82389,9.65539,0|3.6902,9.78417,5.89056,9.91997,0|4.33022,9.86564,5.63134,9.9599,0|4.97213,9.98005,5.87737,9.92234,0|5.62512,10,5.15265,9.99759,0|6.2809,10,5,9.99992,0|6.93669,10,5,9.99992,0|7.59134,9.99192,4.9383,9.99954,0|8.20609,9.80917,3.57529,9.79264,0|8.8055,9.61203,3.43789,9.74963,0|9.27635,9.36855,2.70338,9.44124,0|9.59049,8.98368,1.12658,8.16158,0|9.78095,8.46091,0.302154,6.71153,0|9.95091,7.85384,0.185214,6.34798,0|10,7.21134,0.0146079,5.3809,0|9.84273,6.62795,0.172432,3.69856,0|9.63329,6.06276,0.311616,3.2627,0|9.2715,5.56337,0.950989,2.06662,0|8.85296,5.15648,1.5148,1.41496,0|8.2869,4.89209,2.88407,0.469876,0|7.73594,4.60846,2.71156,0.554525,0|7.0934,4.54718,4.52524,0.0226691,0|6.45072,4.46043,4.33122,0.0450066,0|5.79493,4.46043,5,7.62939e-05,0|5.13915,4.46043,5,7.62939e-05,0|4.48336,4.46043,5,7.62939e-05,0|3.82758,4.46043,5,7.62939e-05,0|3.22856,4.64605,6.47993,0.224121,0|2.73565,4.96403,7.7104,0.798467,0|2.1971,5.31327,7.72046,0.804963,0|1.84269,5.76057,8.9189,1.89494,0|1.46809,6.15322,8.6176,1.54862,0|1.09244,6.56133,8.67872,1.61383,0|0.781617,7.02869,9.16328,2.23121,0|0.504201,7.48201,9.26472,2.39017,1|
-6 6.52632,0,5,9.99999,0|5.98851,0.150654,6.34869,0.185426,0|5.45086,0.444062,7.39511,0.611081,0|4.94453,0.714286,7.35415,0.588977,0|4.43078,0.993401,7.38688,0.6066,0|3.94248,1.25332,7.34932,0.586406,0|3.47368,1.58322,7.87747,0.911076,0|3.02695,1.946,8.1519,1.11868,0|2.57792,2.32352,8.2176,1.17296,0|2.15365,2.75288,8.55648,1.48566,0|1.68421,3.14295,8.19541,1.15442,0|1.40947,3.615,9.32129,2.48493,0|1.0566,4.06605,8.93796,1.91916,0|0.842105,4.59201,9.62974,3.11197,0|0.591352,5.0273,9.33244,2.50421,0|0.315789,5.5201,9.364,2.55979,0|0.119531,6.05206,9.69085,3.26938,0|0.105263,6.66502,9.99856,4.88365,0|0.105263,7.28267,9.99992,5,0|0.315789,7.80994,9.64346,6.85402,0|0.631579,8.21076,8.92742,8.09425,0|1.05263,8.53766,8.06625,8.94932,0|1.47161,8.92576,8.39769,8.66808,0|1.86766,9.31224,8.492,8.57841,0|2.3545,9.5977,7.52898,9.31316,0|2.92454,9.78572,6.56616,9.74829,0|3.50845,9.92857,6.18821,9.85668,0|4.10434,9.99937,5.58992,9.96499,0|4.72179,10,5.00508,9.99992,0|5.33944,10,5,9.99992,0|5.95708,10,5,9.99992,0|6.57473,10,5,9.99992,0|7.19237,10,5,9.99992,0|7.79672,9.92365,4.37334,9.96049,0|8.31579,9.71936,3.16888,9.65254,0|8.89463,9.57143,3.76196,9.84422,0|9.39695,9.35714,3.03815,9.59894,0|9.82898,8.97319,1.67861,8.73732,0|10,8.44617,0.244212,6.54323,0|10,7.82853,8.10623e-05,5,0|9.99659,7.21429,0.00015825,4.97227,0|9.71589,6.75727,0.739577,2.38316,0|9.38321,6.32645,1.04262,1.94415,0|9.01613,5.97523,1.54345,1.38734,0|8.54086,5.59117,1.85743,1.11111,0|8.02199,5.44349,3.63129,0.191081,0|7.49736,5.30178,3.69618,0.173082,0|6.88466,5.28571,4.86892,0.00180036,0|6.26701,5.28571,5,8.10623e-05,0|5.64936,5.28571,5,8.10623e-05,0|5.03172,5.28571,5,8.10623e-05,0|4.41407,5.28571,5,8.10623e-05,0|3.79643,5.28571,5,8.10623e-05,0|3.17878,5.28571,5,8.10623e-05,0|2.65055,5.4157,6.19469,0.144921,0|2.08499,5.58519,6.43533,0.210535,0|1.57844,5.78571,6.84034,0.351106,0|1.05416,5.92857,6.31448,0.175975,0|0.506493,6.15631,6.91975,0.383321,0|0,6.35714,6.84297,0.352145,1|
-6 9,0,5,9.99999,0|8.32679,0,5,7.45058e-05,0|7.65358,0,5,7.45058e-05,0|7.01862,0.149254,6.14409,0.132734,0|6.391,0.339179,6.44818,0.214396,0|5.76968,0.545017,6.57238,0.253754,0|5.15198,0.746269,6.54889,0.246035,0|4.52856,0.959491,6.61806,0.269133,0|3.91271,1.15197,6.49155,0.227737,0|3.42096,1.4769,7.75633,0.828456,0|2.85251,1.82649,7.61922,0.741016,0|2.29522,2.17131,7.63083,0.748184,0|1.7891,2.50407,7.74679,0.822161,0|1.4,2.93486,8.71047,1.64865,0|1,3.40747,8.81648,1.76988,0|0.618091,3.87385,8.86837,1.83221,0|0.418969,4.46346,9.73707,3.4002,0|0.2,5.0466,9.6808,3.24237,0|0.0999999,5.6894,9.9405,4.23142,0|0.0999999,6.36261,9.99993,5,0|0.3,6.93552,9.72054,6.64792,0|0.5,7.50843,9.72054,6.64792,0|0.839013,8.0433,9.2231,7.67668,0|1.2321,8.53142,8.89415,8.13604,0|1.69676,8.95281,8.35881,8.70373,0|2.24529,9.32836,7.82462,9.12562,0|2.74447,9.55224,7.0461,9.56208,0|3.37943,9.70149,6.14409,9.86727,0|4.01439,9.85075,6.14409,9.86727,0|4.68207,9.88137,5.22909,9.99467,0|5.32256,10,5.91058,9.91631,0|5.99577,10,5,9.99993,0|6.66898,10,5,9.99993,0|7.32787,9.91844,4.38578,9.96205,0|7.99278,9.85075,4.49358,9.97421,0|8.64209,9.74471,4.19414,9.93455,0|9.17059,9.42493,2.41165,9.27781,0|9.69003,9.11192,2.41939,9.28248,0|9.9,8.54401,0.310355,6.7339,0|10,7.90121,0.0595036,5.76859,0|10,7.228,7.45058e-05,5,0|10,6.55479,7.45058e-05,5,0|9.83708,5.95086,0.172653,3.69772,0|9.49328,5.44275,0.858924,2.19809,0|9.03365,5.09974,2.00963,0.992903,0|8.57402,4.75673,2.00963,0.992905,0|8.03473,4.50353,2.87504,0.474105,0|7.45572,4.36994,3.87596,0.128072,0|6.80979,4.25373,4.11467,0.0790837,0|6.16136,4.1791,4.42834,0.0328642,0|5.51293,4.10448,4.42835,0.032863,0|4.83972,4.10448,5,7.45058e-05,0|4.16651,4.10448,5,7.45058e-05,0|3.4933,4.10448,5,7.45058e-05,0|2.9195,4.25373,6.25865,0.161099,0|2.29667,4.40547,6.18353,0.142173,0|1.69696,4.62687,6.73159,0.309498,0|1.09846,4.85189,6.75964,0.319949,0|0.499361,5.0751,6.74563,0.314703,0|0,5.29851,7.04183,0.436011,1|
-7 0,0.162602,9.99969,5,0|0.380818,0.162602,5,9.99987,0|0.761636,0.162602,5,9.99987,0|1.14245,0.162602,5,9.99987,0|1.52327,0.162602,5,9.99987,0|1.90409,0.162602,5,9.99987,0|2.28491,0.162602,5,9.99987,0|2.66573,0.162602,5,9.99987,0|3.04655,0.162602,5,9.99987,0|3.42736,0.162602,5,9.99987,0|3.80818,0.162602,5,9.99987,0|4.189,0.162602,5,9.99987,0|4.56982,0.162602,5,9.99987,0|4.95064,0.162602,5,9.99987,0|5.33145,0.162602,5,9.99987,0|5.71227,0.162602,5,9.99987,0|6.06747,0.081301,3.88443,9.87382,0|6.44829,0.081301,5,9.99987,0|6.82911,0.081301,5,9.99987,0|7.20992,0.081301,5,9.99987,0|7.59074,0.081301,5,9.99987,0|7.97156,0.081301,5,9.99987,0|8.32675,0,3.88442,9.87382,0|8.70757,0,5,9.99987,0|9.08839,0,5,9.99987,0|9.46921,0,5,9.99987,0|9.85003,0,5,9.99987,0|10,0.0712622,7.14577,9.51582,0|9.82187,0.35569,9.23746,2.34623,0|9.6287,0.63231,9.09927,2.13739,0|9.39096,0.909399,8.79454,1.74422,0|9.23893,1.24219,9.5478,2.92246,0|9.03258,1.54713,9.14085,2.19787,0|8.83681,1.86869,9.27073,2.40009,0|8.66915,2.20685,9.47945,2.77893,0|8.44592,2.5122,9.03628,2.04922,0|8.36715,2.86384,9.87896,3.90711,0|8.17866,3.18685,9.31838,2.48004,0|8.08335,3.51427,9.80062,3.60265,0|7.92016,3.82596,9.42944,2.68082,0|7.78163,4.15256,9.60291,3.04763,0|7.60786,4.47376,9.39758,2.62095,0|7.51283,4.82915,9.83014,3.70832,0|7.37012,5.13894,9.5412,2.9081,0|7.25125,5.47774,9.71788,3.34463,0|7.10621,5.80815,9.5782,2.99035,0|6.89463,6.11723,9.12577,2.17569,0|6.77575,6.45602,9.71788,3.34463,0|6.70514,6.79626,9.89555,3.98404,0|6.65688,7.1481,9.95347,4.32049,0|6.47242,7.39837,9.02481,2.03363,0|6.33805,7.64228,9.37919,2.58734,0|6.28838,7.97561,9.94526,4.26319,0|6.08255,8.26528,9.07572,2.10394,0|5.94364,8.57405,9.55969,2.94872,0|5.82477,8.83329,9.54482,2.91605,0|5.7059,9.14848,9.67818,3.2356,0|5.58702,9.48727,9.71788,3.34464,0|5.34928,9.68481,8.19526,1.15439,0|5.23041,10,9.6782,3.23563,1|
-7 0.404245,1.38211,9.79891,6.4036,0|0.241537,1.01152,0.421928,2.99002,0|0.0226475,0.685012,0.847021,2.21585,0|0,0.487805,0.0328991,4.42957,0|0.339899,0.629843,6.9278,9.61327,0|0.719934,0.813008,7.17081,9.50404,0|1.06963,0.894309,6.13222,9.86998,0|1.41933,0.97561,6.13222,9.86998,0|1.82722,1.05691,5.97735,9.90343,0|2.23511,1.13821,5.97735,9.90343,0|2.66753,1.13821,5,9.99988,0|3.07542,1.21951,5.97736,9.90343,0|3.50785,1.21951,5,9.99988,0|3.9353,1.25041,5.36045,9.98687,0|4.35959,1.30081,5.58983,9.96497,0|4.79202,1.30081,5,9.99988,0|5.22445,1.30081,5,9.99988,0|5.65688,1.30081,5,9.99988,0|6.06477,1.21951,4.02265,9.90343,0|6.41446,1.13821,3.86778,9.86998,0|6.8366,1.07442,4.25297,9.94376,0|7.25769,0.978871,3.89357,9.87593,0|7.68408,0.956767,4.74115,9.99318,0|8.08454,0.813008,3.31069,9.70585,0|8.49243,0.731707,4.02265,9.90343,0|8.84213,0.650406,3.86778,9.86998,0|9.1695,0.495146,2.8575,9.51756,0|9.57314,0.399757,3.85009,9.86585,0|9.88686,0.199242,2.30731,9.21285,0|10,0,0.652344,7.46895,0|9.76718,0.275735,8.82019,1.77436,0|9.68061,0.650406,9.87151,3.87436,0|9.52223,0.945894,9.40677,2.63804,0|9.40995,1.33333,9.80227,3.60824,0|9.18099,1.65648,9.07963,2.10944,0|9.04832,2.03602,9.71983,3.35016,0|8.89388,2.37863,9.55817,2.94531,0|8.67219,2.71072,9.15844,2.22401,0|8.49404,3.04069,9.39963,2.62472,0|8.29059,3.3825,9.29639,2.44271,0|8.0621,3.72328,9.15277,2.21554,0|7.909,4.10426,9.63928,3.13563,0|7.6546,4.4189,8.88802,1.85643,0|7.45411,4.76229,9.31782,2.47905,0|7.273,5.09069,9.37818,2.58542,0|7.0186,5.38001,8.75481,1.69847,0|6.8914,5.73715,9.71005,3.32246,0|6.637,6.02648,8.75481,1.69847,0|6.46796,6.39496,9.54447,2.91516,0|6.22011,6.71179,8.93807,1.91935,0|5.97226,7.02862,8.93807,1.91935,0|5.74661,7.37819,9.20071,2.28839,0|5.60745,7.72358,9.63762,3.13154,0|5.36501,7.96746,8.54592,1.47509,0|5.14123,8.27311,9.03419,2.04637,0|4.98341,8.63925,9.5915,3.0209,0|4.85622,8.99639,9.71005,3.32246,0|4.60182,9.28571,8.75482,1.69848,0|4.50187,9.65738,9.82833,3.70156,0|4.34742,10,9.55814,2.94524,1|
-7 0,0,5,5,0|0.361558,0,5,9.99986,0|0.723116,0,5,9.99986,0|1.08467,0,5,9.99986,0|1.44623,0,5,9.99986,0|1.80779,0,5,9.99986,0|2.16935,0,5,9.99986,0|2.53091,0,5,9.99986,0|2.89246,0,5,9.99986,0|3.25402,0,5,9.99986,0|3.61558,0,5,9.99986,0|3.97714,0,5,9.99986,0|4.33869,0,5,9.99986,0|4.70025,0,5,9.99986,0|5.06181,0,5,9.99986,0|5.42337,0,5,9.99986,0|5.78493,0,5,9.99986,0|6.14648,0,5,9.99986,0|6.50804,0,5,9.99986,0|6.8696,0,5,9.99986,0|7.23116,0,5,9.99986,0|7.59272,0,5,9.99986,0|7.95427,0,5,9.99986,0|8.31583,0,5,9.99986,0|8.67739,0,5,9.99986,0|9.03895,0,5,9.99986,0|9.40051,0,5,9.99986,0|9.76206,0,5,9.99986,0|10,0.0813007,6.61662,9.73123,0|9.73986,0.288917,8.11885,1.09215,0|9.61373,0.601467,9.63654,3.1289,0|9.47046,0.918485,9.5562,2.94098,0|9.37583,1.24301,9.79994,3.60031,0|9.19454,1.54653,9.29249,2.4362,0|9.06144,1.88153,9.64654,3.15384,0|8.93875,2.22062,9.70156,3.29885,0|8.75046,2.52655,9.258,2.3793,0|8.58949,2.83816,9.44219,2.70533,0|8.49854,3.17599,9.82797,3.70026,0|8.3324,3.49625,9.43816,2.69754,0|8.20049,3.83171,9.65304,3.17029,0|8.04838,4.15708,9.52937,2.88259,0|7.86715,4.46928,9.3241,2.48986,0|7.76045,4.81061,9.77213,3.50823,0|7.70852,5.16564,9.94722,4.27636,0|7.63198,5.50711,9.87881,3.90649,0|7.47522,5.83018,9.49827,2.8173,0|7.39576,6.18215,9.87713,3.89899,0|7.22057,6.49284,9.35518,2.54418,0|7.06797,6.81777,9.52561,2.87456,0|6.93772,7.15434,9.66287,3.19548,0|6.67233,7.39934,8.39151,1.32627,0|6.47015,7.68071,9.06035,2.08244,0|6.39069,8.03269,9.87713,3.899,0|6.38706,8.39308,9.99961,4.94961,0|6.38706,8.75388,9.99986,4.99999,0|6.21741,9.04966,9.33711,2.51243,0|6.05669,9.36745,9.46172,2.74352,0|5.98108,9.70514,9.87905,3.90756,0|5.83645,10,9.4889,2.79813,1|
-7 0,1.86275,9.99997,5,0|0,1.42929,0.000115633,5,0|0,0.995843,0.000115633,5,0|0,0.562391,0.000115633,5,0|0.225186,0.332798,1.43048,8.501,0|0.628688,0.484968,6.76428,9.67826,0|1.00524,0.697317,7.45597,9.35512,0|1.4067,0.854058,6.81844,9.65748,0|1.8245,0.911646,5.6827,9.95305,0|2.23918,0.980392,5.81773,9.93256,0|2.67314,0.980392,5,9.99988,0|3.10709,0.980392,5,9.99988,0|3.54105,0.980392,5,9.99988,0|3.975,0.980392,5,9.99988,0|4.40896,0.980392,5,9.99988,0|4.84291,0.980392,5,9.99988,0|5.27687,0.980392,5,9.99988,0|5.71082,0.980392,5,9.99988,0|6.14478,0.980392,5,9.99988,0|6.57873,0.980392,5,9.99988,0|7.01269,0.980392,5,9.99988,0|7.44664,0.980392,5,9.99988,0|7.78244,0.882353,3.59876,9.79949,0|8.18891,0.784314,3.82765,9.86049,0|8.56747,0.585459,2.67487,9.42635,0|8.97184,0.435216,3.2586,9.68683,0|9.38553,0.337122,3.84642,9.86499,0|9.71111,0.182452,2.85457,9.51616,0|10,0,2.33016,9.22735,0|9.68867,0.193059,7.63495,0.750804,0|9.48072,0.448584,8.87797,1.84408,0|9.16361,0.735603,8.35519,1.29304,0|8.95028,1.09268,9.29223,2.43572,0|8.63317,1.3797,8.3552,1.29305,0|8.39684,1.72854,9.13938,2.19566,0|8.06437,1.97813,8.00174,1.00146,0|7.89551,2.3632,9.57899,2.9921,0|7.54131,2.60749,7.83865,0.884068,0|7.39948,2.99307,9.69254,3.27406,0|7.13201,3.31695,8.85515,1.8162,0|6.84941,3.64372,8.78178,1.72938,0|6.62059,3.99525,9.19034,2.27238,0|6.48511,4.38019,9.71632,3.34016,0|6.27179,4.73727,9.29223,2.43571,0|5.97325,5.05032,8.61835,1.54944,0|5.67511,5.36375,8.62276,1.55406,0|5.46179,5.72083,9.29223,2.43571,0|5.18611,6.05558,8.85955,1.82152,0|4.96139,6.39952,9.18565,2.2652,0|4.68286,6.67651,8.52561,1.45475,0|4.44604,6.99997,9.03424,2.04641,0|4.19842,7.32067,8.95749,1.94434,0|4.02655,7.65969,9.4595,2.73912,0|3.79174,7.99201,9.08343,2.1148,0|3.67253,8.3585,9.75469,3.45352,0|3.39103,8.66672,8.69182,1.62817,0|3.31038,9.01961,9.87418,3.886,0|3.0674,9.31414,8.85681,1.81822,0|2.9066,9.65726,9.52736,2.87828,0|2.74512,10,9.52302,2.86904,1|
-7 0,0.839695,9.99994,5,0|0.019239,0.366846,0.00423938,5.20327,0|0.475484,0.251863,3.77813,9.84829,0|0.95561,0.229007,4.76226,9.99424,0|1.43384,0.17585,4.44764,9.96929,0|1.90398,0.0704775,3.9065,9.87885,0|2.37738,0,4.26375,9.94539,0|2.85969,0,5,9.9999,0|3.342,0,5,9.9999,0|3.82431,0,5,9.9999,0|4.30661,0,5,9.9999,0|4.78892,0,5,9.9999,0|5.27123,0,5,9.9999,0|5.75354,0,5,9.9999,0|6.23585,0,5,9.9999,0|6.71816,0,5,9.9999,0|7.20047,0,5,9.9999,0|7.68278,0,5,9.9999,0|8.16508,0,5,9.9999,0|8.64042,0.0204742,5.21516,9.99526,0|8.88906,0.262676,8.48876,8.5815,0|8.61386,0.586263,8.80876,1.76084,0|8.41724,0.991283,9.49791,2.81649,0|8.26557,1.43333,9.72925,3.3773,0|8.06154,1.84404,9.47779,2.77553,0|7.92372,2.28557,9.77278,3.51019,0|7.72277,2.71723,9.53282,2.88991,0|7.59695,3.17112,9.81818,3.66432,0|7.38601,3.60336,9.49337,2.80716,0|7.15852,3.95797,9.20841,2.30035,0|7.00827,4.38419,9.71546,3.33768,0|6.83168,4.82306,9.63847,3.13358,0|6.63366,5.24678,9.52965,2.88312,0|6.36423,5.61694,9.04243,2.05761,0|6.21455,6.04833,9.72361,3.36098,0|6.02197,6.4394,9.48555,2.79122,0|5.75915,6.83189,9.15447,2.21803,0|5.54455,7.23279,9.40808,2.64041,0|5.45867,7.68969,9.91383,4.07634,0|5.26405,8.07887,9.47188,2.76367,0|5.14851,8.45404,9.77844,3.52851,0|4.9505,8.87776,9.52966,2.88314,0|4.76928,9.28706,9.57185,2.97587,0|4.65346,9.66539,9.78087,3.53643,0|4.45544,10,9.30286,2.45361,1|3.06931,5.9542,0.269925,3.37942,0|3.56606,5.9542,5,9.9999,0|4.06281,5.9542,5,9.9999,0|4.55957,5.9542,5,9.9999,0|5.05632,5.9542,5,9.9999,0|5.55307,5.9542,5,9.9999,0|6.04983,5.9542,5,9.9999,0|6.54658,5.9542,5,9.9999,0|7.04333,5.9542,5,9.9999,0|7.53649,5.98266,5.28808,9.99159,0|8.02719,6.03053,5.4855,9.97627,0|8.52394,6.03053,5,9.9999,0|9.00649,6.10687,5.78123,9.93849,0|9.50325,6.10687,5,9.9999,0|10,6.10687,5,9.9999,1|
-7 0,1.77966,9.99997,5,0|0,1.36641,0.000121295,5,0|0,0.953158,0.000121295,5,0|0,0.539907,0.000121295,5,0|0.0432739,0.169492,0.0339085,5.58016,0|0.460749,0.169492,5,9.99988,0|0.878224,0.169492,5,9.99988,0|1.2957,0.169492,5,9.99988,0|1.71317,0.169492,5,9.99988,0|2.13065,0.169492,5,9.99988,0|2.54813,0.169492,5,9.99988,0|2.9656,0.169492,5,9.99988,0|3.38308,0.169492,5,9.99988,0|3.80055,0.169492,5,9.99988,0|4.21803,0.169492,5,9.99988,0|4.6355,0.169492,5,9.99988,0|5.05298,0.169492,5,9.99988,0|5.47045,0.169492,5,9.99988,0|5.88793,0.169492,5,9.99988,0|6.3054,0.169492,5,9.99988,0|6.72288,0.169492,5,9.99988,0|7.14035,0.169492,5,9.99988,0|7.55783,0.169492,5,9.99988,0|7.9753,0.169492,5,9.99988,0|8.30717,0.0847456,3.76292,9.84439,0|8.63903,0,3.76292,9.8444,0|9.0565,0,5,9.99988,0|9.47398,0,5,9.99988,0|9.89146,0,5,9.99988,0|10,0.149053,9.04164,7.94321,0|9.69812,0.425241,8.375,1.31108,0|9.54492,0.785993,9.6021,3.04567,0|9.29403,1.11327,8.96805,1.95806,0|9.14072,1.47582,9.60506,3.05265,0|9.02464,1.86077,9.78698,3.55653,0|8.79894,2.20567,9.18369,2.2622,0|8.62055,2.53503,9.39644,2.61883,0|8.3959,2.85321,9.08439,2.11616,0|8.21646,3.16889,9.34676,2.52931,0|8.12475,3.53228,9.84786,3.77651,0|7.93048,3.84487,9.24658,2.36084,0|7.81238,4.22932,9.77943,3.53172,0|7.6651,4.5921,9.63266,3.11926,0|7.46247,4.9484,9.34617,2.52825,0|7.24168,5.29439,9.21486,2.31043,0|7.1389,5.67241,9.8247,3.68813,0|6.95409,5.99526,9.33922,2.51609,0|6.80184,6.35633,9.60704,3.05735,0|6.61848,6.68336,9.36115,2.55479,0|6.46776,6.99079,9.48937,2.79906,0|6.26737,7.2831,9.12389,2.17297,0|6.00925,7.6079,8.91433,1.88924,0|5.80407,7.95083,9.29053,2.43289,0|5.65724,8.28669,9.58119,2.99718,0|5.38785,8.55346,8.51811,1.44732,0|5.25727,8.89571,9.67144,3.2178,0|5.04945,9.19596,9.1111,2.15439,0|4.84906,9.44016,8.86509,1.82833,0|4.71437,9.72008,9.50537,2.83205,0|4.57967,10,9.50538,2.83207,1|
-8 8.29545,0.96,5.57479,9.96685,0|7.73674,0.486666,1.76804,1.18506,0|7.0307,0.24,3.35094,0.279837,0|6.29453,0.0956746,4.03808,0.0934696,0|5.53397,0,4.37595,0.0391626,0|4.76148,0,5,6.4671e-05,0|3.98898,0,5,6.4671e-05,0|3.21649,0,5,6.4671e-05,0|2.483,0.16,6.0656,0.114939,0|1.78651,0.4,6.62891,0.272848,0|1.18101,0.784286,7.6792,0.778488,0|0.590233,1.26448,8.15366,1.12008,0|0.19597,1.88408,9.21833,2.31579,0|0,2.57134,9.80827,3.62894,0|0.210359,3.26809,9.78654,6.44511,0|0.663076,3.76,8.679,8.38589,0|1.18804,4.19638,8.19616,8.84498,0|1.89605,4.4,6.38193,9.80516,0|2.63395,4.56,6.05952,9.88638,0|3.34651,4.8,6.59595,9.73838,0|4.10195,4.90926,5.71569,9.94845,0|4.8511,5.01518,5.69994,9.9507,0|5.56506,5.2,6.25304,9.84037,0|6.33224,5.24597,5.29903,9.99098,0|7.08892,5.3753,5.84238,9.92846,0|7.82502,5.52,5.96441,9.90604,0|8.50784,5.84,7.12175,9.52742,0|9.09091,6.32547,8.19925,8.84241,0|9.50987,6.8,8.7481,8.30922,0|9.77273,7.3643,9.53234,7.11118,0|10,8.01886,9.72331,6.64001,0|9.8792,8.73009,9.92933,4.16274,0|9.38295,9.23441,8.56387,1.49313,0|8.72758,9.60789,7.47561,0.655959,0|7.98939,9.83182,6.45143,0.215369,0|7.26851,10,6.13595,0.130816,0|6.49602,10,5,6.4671e-05,0|5.72352,10,5,6.4671e-05,0|4.95102,10,5,6.4671e-05,0|4.17853,10,5,6.4671e-05,0|3.41265,9.96126,4.74738,0.00645071,0|2.6937,9.73636,3.50733,0.228075,0|2.08602,9.38856,2.51632,0.660571,0|1.59091,8.85028,1.32002,1.61518,0|1.47727,8.13675,0.0622973,4.21362,0|1.47727,7.36426,6.4671e-05,5,0|1.74322,6.77277,0.439829,7.05038,0|2.24405,6.26019,1.42376,8.49425,0|2.8075,5.80705,1.86651,8.89622,0|3.43408,5.44,2.47279,9.31422,0|4.12653,5.15373,3.08976,9.62064,0|4.81094,4.82655,2.84353,9.51098,0|5.53505,4.61166,3.57753,9.79332,0|6.22769,4.33571,3.14943,9.64486,0|6.864,3.94387,2.3783,9.25747,0|7.32917,3.48027,1.47046,8.54141,0|7.6742,2.87472,0.655796,7.47531,0|7.95692,2.23833,0.430674,7.02991,0|8.18182,1.55982,0.253992,6.57312,0|8.40909,0.96,0.324448,6.77156,1|
-8 10,1.92,5.94278,9.91031,0|9.70071,1.24127,0.425095,2.98268,0|9.11504,0.746192,1.7722,1.18154,0|8.35208,0.412891,2.99841,0.418184,0|7.57613,0.16,3.45068,0.246161,0|6.77257,0.00849426,4.07361,0.0866315,0|5.93469,0,4.94931,0.000316799,0|5.09544,0,5,5.96046e-05,0|4.25618,0,5,5.96046e-05,0|3.41693,0,5,5.96046e-05,0|2.64084,0.24648,6.51346,0.234621,0|1.92772,0.559993,7.01227,0.422867,0|1.3253,0.99995,7.94885,0.962227,0|0.761689,1.56136,8.52856,1.45759,0|0.240964,2.19124,8.85359,1.81421,0|0.120481,2.9902,9.94404,4.25445,0|0.375764,3.69426,9.70049,6.70433,0|0.969355,4.24,8.38401,8.68074,0|1.64849,4.5964,7.32338,9.42733,0|2.42378,4.88469,6.74268,9.68641,0|3.23792,5.04,5.93689,9.91138,0|4.07718,5.04,5,9.99994,0|4.8235,5.2,6.04809,9.88885,0|5.62251,5.33335,5.82307,9.93173,0|6.39829,5.56423,6.42624,9.7922,0|7.14007,5.94101,7.26429,9.45785,0|7.76644,6.35691,7.76577,9.16531,0|8.35173,6.85278,8.23199,8.81492,0|8.79518,7.46332,9.04546,7.9383,0|9.03614,8.22199,9.76535,6.51354,0|9.03615,9.06124,9.99994,5.00001,0|8.47466,9.50641,8.1063,1.08207,0|7.71016,9.76045,6.57669,0.255168,0|6.91807,9.9832,6.35356,0.186761,0|6.08153,10,5.10038,0.00106752,0|5.24227,10,5,5.96046e-05,0|4.40302,10,5,5.96046e-05,0|3.58476,9.87014,4.21631,0.0618607,0|2.76331,9.76,4.33556,0.0444064,0|1.97738,9.54199,3.6635,0.181996,0|1.18112,9.35213,3.84035,0.1364,0|0.602409,8.96405,2.21522,0.847375,0|0.240964,8.37452,0.73745,2.38658,0|0,7.64018,0.24929,3.44112,0|0,6.80092,5.96046e-05,5,0|0.411687,6.22332,0.928437,7.90201,0|0.974603,5.75286,1.79366,8.83649,0|1.62723,5.31952,2.23423,9.16532,0|2.34969,4.99981,2.97663,9.57224,0|3.1199,4.72,3.29277,9.69944,0|3.86442,4.55402,3.91207,9.88014,0|4.62413,4.26479,3.221,9.67274,0|5.41944,4.05383,3.71808,9.83281,0|6.22867,3.92,4.18419,9.93293,0|6.95704,3.70052,3.55747,9.78732,0|7.74947,3.49435,3.74103,9.83884,0|8.52764,3.21764,3.32485,9.71097,0|9.13374,2.8152,2.23423,9.16531,0|9.39759,2.17333,0.375542,6.90096,0|9.87952,1.68,1.42344,8.49392,1|
-8 9.6,2,6.01977,9.8949,0|9.11837,1.36565,1.01779,1.97653,0|8.53333,0.788619,1.48896,1.44023,0|7.8478,0.321543,2.18472,0.86798,0|7.03469,0.160005,4.02572,0.0959021,0|6.19556,0.0833333,4.54505,0.0208011,0|5.36125,0,4.50307,0.0248155,0|4.51422,0,5,5.90086e-05,0|3.67724,0.0350574,5.20924,0.00444025,0|2.88868,0.27791,6.47161,0.221533,0|2.12038,0.591429,6.88909,0.370667,0|1.35208,0.904948,6.88909,0.370667,0|0.764736,1.46075,8.43661,1.36832,0|0.266666,2.05168,8.82309,1.77769,0|0,2.69148,9.6151,3.07644,0|0.103322,3.48124,9.95769,5.64859,0|0.884456,3.75,6.62669,9.72792,0|1.55623,4,6.74386,9.68596,0|2.35546,4.16667,6.0207,9.89465,0|3.17706,4.33333,5.99403,9.90013,0|3.96358,4.58333,6.5146,9.76502,0|4.80249,4.68789,5.61837,9.96156,0|5.5969,4.91667,6.38368,9.80467,0|6.38754,5.16667,6.50741,9.7673,0|7.18524,5.41667,6.49528,9.77112,0|7.93128,5.77692,7.17419,9.50248,0|8.66667,6.11923,7.10999,9.53292,0|9.26693,6.54183,7.8783,9.08836,0|9.77966,7.14124,8.79953,8.25007,0|10,7.88385,9.79338,6.42226,0|9.71054,8.59758,9.63339,3.1209,0|9.07655,9.03858,7.85512,0.895412,0|8.4439,9.44462,7.70061,0.792146,0|7.65312,9.66667,6.35171,0.186242,0|6.83787,9.84533,6.07036,0.115972,0|6.00511,9.91667,5.42673,0.0183037,0|5.16667,10,5.49451,0.0245738,0|4.31963,10,5,5.90086e-05,0|3.4726,10,5,5.90086e-05,0|2.62557,10,5,5.90086e-05,0|1.78862,9.93394,4.60661,0.0155595,0|1.08808,9.58333,2.76223,0.528788,0|0.8,8.96494,0.467736,2.88864,0|0.666667,8.16469,0.0680479,4.17828,0|0.666667,7.31765,5.90086e-05,5,0|1.13659,6.66259,0.937329,7.91446,0|1.6,6.15124,1.2951,8.35753,0|2.13333,5.70749,1.80208,8.84352,0|2.8,5.36582,2.71955,9.44959,0|3.56679,5.09371,3.32785,9.71204,0|4.3076,4.83333,3.34206,9.71705,0|5.06667,4.61532,3.61976,9.80565,0|5.78849,4.46553,3.98406,9.89563,0|6.57187,4.23796,3.6052,9.80145,0|7.32792,4,3.49893,9.76929,0|8.06965,3.70647,3.16017,9.64913,0|8.71469,3.41667,2.95095,9.56078,0|9.20772,2.91667,1.43978,8.51057,0|9.73333,2.38982,1.46036,8.53132,0|10,1.75,0.384877,6.92352,1|
-8 8.35443,1.62963,5.95727,9.9075,0|7.89367,1.0637,1.12266,1.84318,0|7.34967,0.675914,2.09771,0.928638,0|6.68801,0.432243,3.27212,0.308122,0|5.96608,0.190075,3.40988,0.259657,0|5.22345,0.0196502,3.88164,0.126745,0|4.44531,0,4.87378,0.0016579,0|3.66184,0,5,6.3777e-05,0|2.89845,0.074074,5.48289,0.0234386,0|2.15514,0.222222,5.97731,0.0965112,0|1.50777,0.525084,7.11873,0.47117,0|0.886076,0.790063,6.96044,0.40044,0|0.452305,1.2168,8.50646,1.43574,0|0.134698,1.84235,9.45822,2.73647,0|0,2.55024,9.9118,4.06537,0|0.126582,3.287,9.92773,5.84663,0|0.506329,3.79871,9.01509,7.97964,0|1.00453,4.21271,8.19556,8.84546,0|1.63146,4.58433,7.54955,9.30106,0|2.23179,4.86156,7.09623,9.53928,0|2.94106,5.15683,6.92158,9.61594,0|3.67251,5.40741,6.62043,9.73007,0|4.35121,5.62963,6.55581,9.75171,0|5.08925,5.83222,6.32353,9.82158,0|5.84777,6.00975,6.13939,9.86838,0|6.59458,6.22222,6.36823,9.80908,0|7.33224,6.43887,6.40894,9.79732,0|8.05077,6.68893,6.64339,9.72214,0|8.77442,6.93598,6.61543,9.73178,0|9.40931,7.28397,7.40315,9.38454,0|9.85738,7.83309,8.8739,8.16104,0|10,8.53805,9.90065,5.99142,0|9.65087,9.09319,9.2325,2.3382,0|9.07778,9.56261,8.16824,1.13198,0|8.35443,9.73727,6.17357,0.139747,0|7.63118,9.91532,6.19522,0.145027,0|6.86931,10,5.55232,0.0306654,0|6.08584,10,5,6.3777e-05,0|5.30237,10,5,6.3777e-05,0|4.5189,10,5,6.3777e-05,0|3.81921,9.85821,4.00698,0.0996715,0|3.1308,9.7037,3.90503,0.121441,0|2.45021,9.49469,3.53216,0.220383,0|1.90426,9.11435,2.1419,0.897498,0|1.35593,8.64532,1.74999,1.20043,0|1.13924,8.0401,0.292689,3.31464,0|1.20544,7.29459,0.0196633,5.44224,0|1.67058,6.72611,1.1303,8.16619,0|2.21538,6.29607,1.90215,8.92462,0|2.76531,5.78919,1.61133,8.67644,0|3.31617,5.32601,1.78222,8.8269,0|3.95141,4.94695,2.43794,9.29362,0|4.62761,4.55125,2.47472,9.31536,0|5.27454,4.24675,2.87069,9.52386,0|5.88893,3.92593,2.68566,9.43205,0|6.53477,3.60649,2.78334,9.48171,0|7.1403,3.22901,2.35495,9.243,0|7.59494,2.76024,1.41082,8.48095,0|8.13326,2.33293,1.89143,8.91613,0|8.48101,1.7037,0.623928,7.41853,1|
-8 8.7571,1.60305,5.90033,9.91827,0|8.58269,1.0687,0.246854,3.44864,0|7.92733,0.690127,2.49904,0.670502,0|7.21977,0.401044,3.10893,0.371478,0|6.50748,0.168747,3.44976,0.246466,0|5.82095,0,3.80655,0.144595,0|5.04162,0,5,6.4373e-05,0|4.26229,0,5,6.4373e-05,0|3.48296,0,5,6.4373e-05,0|2.76132,0.21661,6.43744,0.211149,0|2.05407,0.51646,6.95165,0.396694,0|1.39749,0.808777,7.03358,0.432302,0|0.819629,1.14504,7.51472,0.678491,0|0.280209,1.62688,8.33088,1.27112,0|0,2.30496,9.62092,3.09045,0|0.147645,3.00887,9.89345,6.02639,0|0.628223,3.51344,8.6205,8.44837,0|1.19059,3.92522,7.95388,9.03409,0|1.8192,4.38551,7.95389,9.03409,0|2.52123,4.65649,6.80048,9.66451,0|3.25168,4.8855,6.49578,9.77095,0|4.0039,5.03817,5.99452,9.90003,0|4.73436,5.22237,6.22255,9.84816,0|5.46378,5.37479,6.02272,9.89422,0|6.2148,5.49618,5.79782,9.93587,0|6.94107,5.69315,6.30873,9.82562,0|7.64083,6.00353,7.02726,9.57051,0|8.20614,6.39047,7.82408,9.12599,0|8.84598,6.77139,7.55771,9.29622,0|9.48179,7.17187,7.66476,9.23065,0|9.90386,7.75743,9.05612,7.92356,0|10,8.47922,9.95616,5.66017,0|9.5479,9.00763,8.79917,1.74953,0|8.95501,9.38931,7.70643,0.795889,0|8.30418,9.69466,7.12367,0.473488,0|7.57884,9.88046,6.24073,0.156455,0|6.82971,10,5.78787,0.0625306,0|6.05037,10,5,6.4373e-05,0|5.27104,10,5,6.4373e-05,0|4.50527,9.92366,4.50404,0.0247234,0|3.77593,9.77099,3.97558,0.106138,0|3.06015,9.54198,3.47639,0.237862,0|2.40721,9.31298,3.34519,0.281856,0|1.87652,8.85909,1.75017,1.20028,0|1.62106,8.25185,0.391282,3.0612,0|1.56377,7.49082,0.0141761,4.62463,0|1.66802,6.74427,0.0481158,5.6915,0|2.06541,6.19757,0.955645,7.93981,0|2.45946,5.64886,0.938804,7.9165,0|2.96843,5.231,1.8274,8.86444,0|3.51841,4.69475,1.50946,8.57988,0|4.08492,4.34414,2.36875,9.25156,0|4.73738,4.01206,2.73204,9.45597,0|5.43571,3.72973,3.12594,9.63543,0|6.10464,3.39259,2.74969,9.46491,0|6.74651,3.12977,3.1054,9.62707,0|7.37975,2.8406,2.92305,9.54814,0|8.01466,2.52372,2.76726,9.47372,0|8.59038,2.21374,2.62965,9.40235,0|8.86135,1.60305,0.429754,7.02783,1|
-8 8.7013,0.75188,5.43045,9.98143,0|8.03347,0.451128,2.9469,0.441044,0|7.37937,0.150376,2.91127,0.457259,0|6.61154,0.0683343,4.46879,0.0283638,0|5.84002,0,4.55888,0.0195622,0|5.05015,0,5,6.34789e-05,0|4.2664,0.0431841,5.27508,0.00763625,0|3.492,0.153173,5.70309,0.0497445,0|2.71644,0.302842,5.94742,0.0906456,0|1.93925,0.416081,5.7209,0.0523064,0|1.16634,0.529205,5.72407,0.0527707,0|0.571629,0.947252,7.87536,0.909567,0|0.25974,1.5573,9.45186,2.72398,0|0,2.14243,9.5699,2.97139,0|0,2.9323,9.99994,5,0|0.51948,3.42079,8.42516,8.64246,0|1.06626,3.79101,7.80327,9.14016,0|1.6862,4.13534,7.42776,9.37096,0|2.3585,4.44212,7.07566,9.54873,0|3.10807,4.6591,6.39028,9.80276,0|3.84114,4.91613,6.65432,9.71832,0|4.59677,5.12269,6.31839,9.82299,0|5.3713,5.27665,5.97487,9.90398,0|6.13637,5.46993,6.22461,9.84765,0|6.88295,5.71419,6.55475,9.75207,0|7.61895,5.91473,6.31445,9.82406,0|8.27241,6.21786,7.10404,9.53567,0|8.96104,6.51025,6.95409,9.60227,0|9.40613,7.0246,8.78087,8.27174,0|9.74026,7.67495,9.4473,7.28492,0|10,8.20508,9.48995,7.19988,0|9.6655,8.79699,9.35294,2.54008,0|9.05752,9.1364,7.43719,0.634293,0|8.3468,9.3985,6.72998,0.308889,0|7.59732,9.54887,5.98358,0.0977641,0|6.81811,9.62406,5.48023,0.0231794,0|6.06086,9.78689,6.05111,0.111799,0|5.31075,10,6.36642,0.190399,0|4.52088,10,5,6.34789e-05,0|3.76186,9.84963,4.02831,0.0953937,0|3.09897,9.54369,2.90481,0.460232,0|2.45651,9.16655,2.46883,0.688097,0|1.85346,8.71485,2.00252,0.998194,0|1.2987,8.25335,1.80241,1.15621,0|1.16883,7.53836,0.0805628,4.10644,0|1.16883,6.74849,6.34789e-05,5,0|1.54125,6.11013,0.681298,7.51955,0|2.04703,5.58179,1.38826,8.45755,0|2.57586,5.12525,1.73267,8.78469,0|3.10596,4.73684,2.04485,9.03315,0|3.65648,4.42445,2.53236,9.34856,0|4.37823,4.13534,3.14082,9.64142,0|5.04222,3.77255,2.60266,9.38772,0|5.70393,3.46464,2.89061,9.53319,0|6.41323,3.12918,2.86233,9.51993,0|7.11428,2.7985,2.86693,9.5221,0|7.75851,2.42552,2.49485,9.32707,0|8.23424,2.07491,2.03366,9.02492,0|8.57143,1.53444,0.757917,7.6465,0|8.96104,1.05263,1.11217,8.14388,1|
-9 0,10,10,5,0|0.593524,9.8388,3.68954,9.82513,0|1.19873,9.75,4.27411,9.94695,0|1.79805,9.59682,3.7619,9.8442,0|2.41146,9.54163,4.55195,9.9798,0|3.00982,9.4375,4.14273,9.92588,0|3.59716,9.3125,3.95923,9.89039,0|4.07651,9.125,3.17864,9.65636,0|4.64686,8.9375,3.43851,9.74983,0|5.14222,8.72894,3.05989,9.60815,0|5.66438,8.42218,2.4673,9.31099,0|6.13586,8.16634,2.61538,9.39462,0|6.64809,7.876,2.53445,9.34974,0|7.10611,7.625,2.59717,9.38469,0|7.55169,7.31338,2.13453,9.09734,0|8.0423,7,2.30848,9.21365,0|8.37965,6.625,1.28284,8.34391,0|8.61702,6.15003,0.527524,7.23518,0|8.86174,5.66873,0.543114,7.26611,0|9.04705,5.11971,0.26268,6.59904,0|9.3617,4.65762,0.867202,7.81409,0|9.57447,4.11455,0.344629,6.82392,0|9.78724,3.61497,0.399905,6.95914,0|9.89362,3.0545,0.0877935,5.93239,0|10,2.49404,0.0877932,5.93239,0|9.89362,1.93357,0.0877935,4.06761,0|9.68085,1.41225,0.370786,3.11069,0|9.36375,1.0625,1.29589,1.64165,0|8.9639,0.75,1.92111,1.06053,0|8.56406,0.4375,1.92111,1.06052,0|8.05621,0.1875,2.79174,0.514169,0|7.45186,0.125,4.48567,0.0266072,0|6.84751,0.0625,4.48567,0.0266072,0|6.24316,0,4.48567,0.0266072,0|5.62182,0,5,8.04663e-05,0|5.00047,0,5,8.04663e-05,0|4.39612,0.0625,5.51433,0.0266072,0|3.84559,0.182858,6.06787,0.115457,0|3.33283,0.416965,7.07657,0.451705,0|2.85906,0.625,7.01025,0.422015,0|2.36439,0.923422,7.58272,0.718797,0|2.04421,1.36153,9.03676,2.04981,0|1.80851,1.80249,9.40953,2.64308,0|1.70213,2.36295,9.91221,4.06761,0|1.59575,2.94516,9.91848,4.10128,0|1.48936,3.50563,9.9122,4.0676,0|1.53115,4.1116,9.98807,5.34398,0|1.89854,4.49039,8.58906,8.48105,0|2.24804,4.82072,8.43441,8.6337,0|2.67661,5.1875,8.251,8.7987,0|3.09346,5.4375,7.5716,9.28787,0|3.51064,5.68717,7.56755,9.2903,0|4.03515,5.875,6.6857,9.70718,0|4.56,6.0625,6.68209,9.70847,0|5.16106,6.20356,6.14238,9.86766,0|5.69623,6.375,6.52535,9.76156,0|6.30058,6.4375,5.51433,9.97339,0|6.9063,6.49495,5.4721,9.97758,0|7.46377,6.5625,5.60145,9.9636,0|8.08511,6.5625,5,9.99992,1|
-9 10,0.927152,5.4616,9.97864,0|9.6,0.579026,1.71756,1.22845,0|9.14037,0.382541,3.03468,0.402555,0|8.67493,0.23384,3.47837,0.237269,0|8.2037,0.13245,3.94829,0.111967,0|7.67749,0.0662253,4.37567,0.0392267,0|7.15128,0,4.37567,0.0392273,0|6.60953,0,5,9.23872e-05,0|6.06778,0,5,9.23872e-05,0|5.52603,0,5,9.23872e-05,0|4.98428,0,5,9.23872e-05,0|4.44253,0,5,9.23872e-05,0|3.90078,0,5,9.23872e-05,0|3.35902,0,5,9.23872e-05,0|2.82463,0.0601097,5.55887,0.0314257,0|2.29491,0.158548,5.91351,0.084253,0|1.84456,0.369729,7.12276,0.473094,0|1.39617,0.564816,6.99476,0.415251,0|1.00701,0.853967,7.98195,0.986651,0|0.69475,1.24433,8.90443,1.87679,0|0.4,1.6577,9.07097,2.0972,0|0.266667,2.1168,9.8015,3.60554,0|0.133333,2.60306,9.82192,3.67783,0|0,3.06216,9.8015,3.60554,0|0.133333,3.47058,9.75301,6.55168,0|0.405976,3.84106,9.02696,7.96353,0|0.81017,4.11101,7.77692,9.15784,0|1.24026,4.37086,7.58555,9.27948,0|1.6,4.55287,7.25721,9.46136,0|2.02696,4.77491,7.30686,9.43592,0|2.53066,4.96556,6.76994,9.67615,0|3.02978,5.14724,6.71021,9.69832,0|3.49927,5.3304,6.81719,9.65798,0|3.93354,5.49669,6.78792,9.66929,0|4.45352,5.58949,5.87851,9.92212,0|4.98596,5.62914,5.37125,9.9861,0|5.51217,5.69536,5.62434,9.96077,0|6.03838,5.76159,5.62432,9.96077,0|6.58014,5.76159,5,9.99991,0|7.12189,5.76159,5,9.99991,0|7.66364,5.76159,5,9.99991,0|8.20539,5.76159,5,9.99991,0|8.7316,5.69536,4.37568,9.96077,0|9.25781,5.62914,4.37566,9.96077,0|9.73333,5.56291,4.31034,9.9521,1|9.86667,0.993377,0.00213832,5.14583,0|9.86667,1.65019,9.99992,5,0|9.86667,2.30701,9.99992,5,0|9.86667,2.96383,9.99992,5,0|9.7024,3.47444,9.75966,3.46876,0|9.6,4.08864,9.93185,4.17779,0|9.6,4.74546,9.99992,5,0|9.6,5.40228,9.99992,5,0|9.6,6.0591,9.99992,5,0|9.6,6.71591,9.99992,5,0|9.6,7.37273,9.99992,5,0|9.6,8.02955,9.99992,5,0|9.6,8.68637,9.99992,4.99999,0|9.6,9.34318,9.99992,5.00001,0|9.6,10,9.99992,5,1|
-9 10,1.17647,5.58421,9.96575,0|9.56168,0.854174,2.0381,0.971818,0|9.09256,0.588235,2.53422,0.650401,0|8.64206,0.441177,3.44846,0.24693,0|8.11898,0.364107,4.27118,0.0534979,0|7.62459,0.147059,2.99009,0.421862,0|7.15406,0.0735294,4.22804,0.0600582,0|6.61,0.0735294,5,9.20892e-05,0|6.06594,0.0735294,5,9.20892e-05,0|5.52188,0.0735294,5,9.20892e-05,0|4.97782,0.0735294,5,9.20892e-05,0|4.50729,0,4.22804,0.0600582,0|3.96323,0,5,9.20892e-05,0|3.41917,0,5,9.20892e-05,0|2.90291,0.147059,6.36977,0.191382,0|2.44297,0.294118,6.52269,0.23761,0|1.99351,0.444997,6.59113,0.260038,0|1.58375,0.747427,7.96914,0.977165,0|1.13496,1.02355,7.62008,0.74157,0|0.834133,1.4211,8.98703,1.98295,0|0.54416,1.76471,8.82108,1.77537,0|0.259252,2.12691,8.92982,1.90882,0|0.125,2.59419,9.80549,3.61935,0|0,3.06675,9.83366,3.72144,0|0,3.61081,9.99991,5,0|0.0372259,4.11765,9.98647,5.36625,0|0.285658,4.42225,8.87461,8.16008,0|0.653558,4.70588,8.05274,8.95976,0|1.00906,5.00533,8.22109,8.82407,0|1.46537,5.25337,7.38789,9.39284,0|1.875,5.57022,8.05908,8.95488,0|2.25399,5.73529,6.99659,9.58393,0|2.70127,5.90478,6.7717,9.67547,0|3.20511,6.07654,6.61323,9.7325,0|3.71665,6.23692,6.49585,9.7709,0|4.23821,6.32353,5.81904,9.93237,0|4.70534,6.42069,6.01815,9.89513,0|5.24222,6.47059,5.46272,9.97845,0|5.78628,6.47059,5,9.99991,0|6.31975,6.54412,5.6827,9.95308,0|6.86381,6.54412,5,9.99991,0|7.40787,6.54412,5,9.99991,0|7.95193,6.54412,5,9.99991,0|8.47597,6.47059,4.30525,9.9514,0|9,6.39706,4.30524,9.9514,1|9.875,1.39706,0.0748578,5.8619,0|9.875,2.04548,9.99992,5,0|9.75,2.6224,9.88653,3.94125,0|9.656,3.21706,9.9386,4.21936,0|9.625,3.84774,9.99389,4.75451,0|9.5,4.42467,9.88653,3.94125,0|9.375,5.00159,9.88653,3.94126,0|9.25,5.57852,9.88653,3.94125,0|9.25,6.22693,9.99992,5,0|9.25,6.87535,9.99992,5,0|9.26539,7.51811,9.99849,5.11971,0|9.375,8.12624,9.92064,5.88686,0|9.375,8.77466,9.99992,5.00001,0|9.375,9.42308,9.99992,5,0|9.5,10,9.88653,6.05875,1|
-9 8.20896,5.18248,7.66918,9.22793,0|7.60823,5.10949,4.3969,0.0365889,0|7.00306,5.10949,5,8.28505e-05,0|6.39789,5.10949,5,8.28505e-05,0|5.79558,5.09711,4.89724,0.00113934,0|5.21323,4.9635,3.88196,0.126691,0|4.625,4.89006,4.3805,0.0386122,0|4.02857,4.81752,4.39637,0.0366548,0|3.45471,4.68223,3.85272,0.133492,0|2.86891,4.59854,4.29288,0.05034,0|2.30673,4.41278,3.43129,0.252548,0|1.74791,4.21248,3.31297,0.293294,0|1.31286,3.98484,2.68197,0.569907,0|0.777264,3.73779,2.90573,0.459828,0|0.433894,3.3441,1.23195,1.71353,0|0.149254,2.88904,0.761041,2.34853,0|0,2.37702,0.199877,3.60076,0|0,1.77185,8.28505e-05,5,0|0.0741973,1.24088,0.0482056,5.69195,0|0.499599,0.948905,2.17065,9.12236,0|0.895523,0.683558,2.21641,9.15338,0|1.38003,0.492979,3.1698,9.65289,0|1.95557,0.364964,3.91442,9.88064,0|2.48775,0.291971,4.32058,9.95353,0|3.00304,0.145985,3.63712,9.81057,0|3.60319,0.104329,4.65379,9.98792,0|4.19579,0,4.13308,9.92419,0|4.80096,0,5,9.99992,0|5.40614,0,5,9.99992,0|6.01131,0,5,9.99992,0|6.61648,0,5,9.99992,0|7.22165,0,5,9.99992,0|7.75383,0.0729928,5.67942,9.95353,0|8.263,0.245409,6.60363,9.73576,0|8.77142,0.42106,6.63269,9.72582,0|9.27194,0.66584,7.1966,9.49155,0|9.70149,1.03328,8.25007,8.79949,0|9.70149,1.63845,9.99992,5,0|9.94657,2.09066,9.39584,7.38236,0|10,2.66249,9.97823,5.46512,0|10,3.26766,9.99992,5,0|10,3.87283,9.99992,5,0|9.85075,4.32875,9.75176,3.44444,0|9.70149,4.84077,9.80012,3.60076,0|9.55224,5.35279,9.80012,3.60076,0|9.24904,5.76872,9.04033,2.05471,0|8.86077,6.15078,8.50687,1.43616,0|8.52791,6.55934,8.87629,1.84192,0|8.18098,6.94799,8.72997,1.67038,0|7.71481,7.27165,7.85151,0.892932,0|7.31343,7.67759,8.55544,1.48461,0|6.87376,7.95225,7.64895,0.75947,0|6.51165,8.27532,8.32867,1.26919,0|6.08398,8.55747,7.75336,0.826507,0|5.67146,8.90511,8.22199,1.17667,0|5.22863,9.12177,7.19733,0.508817,0|4.78687,9.34307,7.23944,0.529663,0|4.32836,9.61002,7.51573,0.679103,0|3.79201,9.82434,6.8553,0.35705,0|3.28358,10,6.6327,0.274181,1|
-9 9.18919,0.638298,5.34647,9.98798,0|9.0249,0.141844,0.253244,3.42922,0|8.48853,0.0709221,4.3446,0.0432348,0|7.89038,0,4.41128,0.0348637,0|7.28308,0,5,8.25524e-05,0|6.67579,0,5,8.25524e-05,0|6.06849,0,5,8.25524e-05,0|5.46119,0,5,8.25524e-05,0|4.85389,0,5,8.25524e-05,0|4.2466,0,5,8.25524e-05,0|3.6393,0,5,8.25524e-05,0|3.1204,0.141844,6.31839,0.177043,0|2.58126,0.418348,7.28166,0.551047,0|2.03256,0.672308,7.10012,0.462528,0|1.60852,0.999783,8.05608,1.0428,0|1.25066,1.37394,8.61329,1.54411,0|0.839035,1.6725,7.93563,0.952643,0|0.540541,2.16037,9.26497,2.39056,0|0.27027,2.63191,9.33788,2.51366,0|0.135135,3.18514,9.85711,3.81357,0|0,3.71074,9.84242,3.755,0|0.187086,4.1844,9.65029,6.83679,0|0.563815,4.56344,8.54626,8.52465,0|1.04696,4.87571,7.71406,9.19917,0|1.5847,5.15793,7.32351,9.42724,0|2.10897,5.39007,7.02436,9.57177,0|2.63837,5.51503,6.14863,9.86618,0|3.15355,5.68568,6.57217,9.7463,0|3.74125,5.79328,5.90045,9.91817,0|4.3328,5.89098,5.81469,9.9331,0|4.90624,6.02837,6.16499,9.8623,0|5.44261,6.09929,5.65541,9.95676,0|6.04991,6.09929,5,9.99992,0|6.65721,6.09929,5,9.99992,0|7.26451,6.09929,5,9.99992,0|7.8718,6.09929,5,9.99992,0|8.4791,6.09929,5,9.99992,0|9.04364,5.89199,3.27655,9.69349,0|9.54143,5.63074,2.67648,9.42723,0|10,5.46099,3.26432,9.68897,1|9.05405,0.212766,0.0792998,4.11309,0|9.18919,0.754622,9.85132,6.20987,0|9.18919,1.32702,9.99991,5,0|9.32432,1.81772,9.82045,6.32751,0|9.45946,2.30843,9.82045,6.32751,0|9.45946,2.88082,9.99991,5,0|9.45946,3.45322,9.99991,5,0|9.19271,3.75887,8.767,1.71237,0|9.01153,4.22904,9.66548,3.20215,0|8.78378,4.68269,9.46843,2.75675,0|8.64865,5.17339,9.82045,3.67248,0|8.64865,5.74579,9.99991,4.99999,0|8.64865,6.31818,9.99991,5.00002,0|8.63878,6.88461,9.99915,4.91287,0|8.37838,7.32722,9.30941,2.46465,0|8.28018,7.80142,9.89602,3.98613,0|8.10811,8.28281,9.70816,3.31706,0|8.10811,8.85521,9.99991,5,0|8.10811,9.4276,9.99991,5,0|8.10811,10,9.99991,5,1|
-9 9.85915,1.28571,5.64657,9.95801,0|9.5935,0.936704,1.02151,1.97171,0|9.17481,0.652938,2.1949,0.861109,0|8.73239,0.466827,3.06124,0.391293,0|8.21306,0.357143,3.9668,0.108011,0|7.67255,0.214286,3.72239,0.166076,0|7.12313,0.142857,4.3554,0.0418153,0|6.64238,0.0114957,3.68211,0.176913,0|6.07863,0,4.89807,0.00112772,0|5.51213,0,5,8.85129e-05,0|4.94563,0,5,8.85129e-05,0|4.37913,0,5,8.85129e-05,0|3.81665,0.0322074,5.28582,0.00826567,0|3.26858,0.128075,5.86151,0.0748703,0|2.71453,0.214286,5.76873,0.0595394,0|2.3633,0.436449,7.67276,0.774466,0|1.89565,0.662175,7.17341,0.497189,0|1.42415,0.857143,6.91061,0.379548,0|0.985915,1.1772,7.94884,0.962252,0|0.704225,1.57071,9.06561,2.08972,0|0.347354,1.9334,8.56392,1.49322,0|0.0199527,2.33691,8.88261,1.8497,0|0,2.89522,9.99672,4.82143,0|0,3.46173,9.99991,5,0|0.140845,3.94173,9.79763,6.40774,0|0.377191,4.38258,9.40657,7.36244,0|0.704749,4.78571,8.88044,8.15297,0|1.09776,5.05672,7.83836,9.11615,0|1.48373,5.35714,8.07106,8.94557,0|1.8903,5.57143,7.33125,9.42314,0|2.39437,5.74256,6.60739,9.73449,0|2.90064,5.85714,6.10366,9.87657,0|3.44115,6,6.27761,9.83392,0|4.00765,6,5,9.99991,0|4.57415,6,5,9.99991,0|5.14065,6,5,9.99991,0|5.70715,6,5,9.99991,0|6.27365,6,5,9.99991,0|6.84016,6,5,9.99991,0|7.39774,5.92857,4.36469,9.95938,0|7.94717,5.85714,4.3554,9.95818,0|8.44224,5.78571,4.28602,9.94866,0|8.87324,5.59586,2.98446,9.57565,0|9.3268,5.42857,3.26979,9.69099,0|9.85915,5.28571,3.70412,9.82906,1|10,1.07143,0.00280172,5.16701,0|9.71831,1.63831,9.47758,2.77503,0|9.6768,2.32781,9.99089,4.69957,0|9.43662,2.93585,9.65026,3.16306,0|9.43662,3.64237,9.99993,5.00001,0|9.43662,4.3489,9.99993,5,0|9.43662,5.05542,9.99993,5,0|9.43662,5.76195,9.99993,5,0|9.29577,6.32763,9.85179,3.79199,0|9.04733,6.78571,9.39511,2.6163,0|9.01408,7.45899,9.99384,4.75339,0|8.87324,8.10776,9.88611,3.93926,0|8.87324,8.81429,9.99993,4.99999,0|8.85243,9.5,9.99763,4.84831,0|8.59155,10,9.43282,2.68716,1|
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/profile.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/profile.cfg
deleted file mode 100644
index ddf5704f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/pointfloat_nn/profile.cfg
+++ /dev/null
@@ -1 +0,0 @@
-ShapeRecMethod = nn
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg
deleted file mode 100644
index 98fa2526..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/project.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-ProjectType=SHAPEREC
-ProjectName ="demonumerals"
-NumShapes=Dynamic \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini
deleted file mode 100644
index e45c7afc..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/demonumerals/config/unicodeMapfile_demonumerals.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-#Font name
-Font=english
-
-#Mapping of character class ids to unicode value
-0= 0X0030
-1= 0X0031
-2= 0X0032
-3= 0X0033
-4= 0X0034
-5= 0X0035
-6= 0X0036
-7= 0X0037
-8= 0X0038
-9= 0X0039 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/lipiengine.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/lipiengine.cfg
deleted file mode 100644
index c924d943..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/projects/lipiengine.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-SHAPEREC_NUMERALS = demonumerals(pointfloat_nn)
-SHAPEREC_ALPHANUM = alphanumeric(default)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/qt_attribution.json b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/qt_attribution.json
deleted file mode 100644
index ca799c73..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/qt_attribution.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "Id": "lipitk",
- "Name": "Lipi Toolkit",
- "QDocModule": "qtvirtualkeyboard",
- "Description": "Lipi Toolkit (LipiTk) is an open source toolkit for online Handwriting Recognition.",
- "QtUsage": "Optionally used in Qt Virtual Keyboard.",
-
- "Homepage": "http://lipitk.sourceforge.net/lipi-toolkit.htm",
- "Version": "4.0.0",
- "DownloadLocation": "https://sourceforge.net/projects/lipitk/files/Lipi%20Toolkit/lipi_toolkit4.0/lipi-toolkit4.0.0-src-linux.tar.gz/download",
- "License": "MIT License",
- "LicenseId": "MIT",
- "LicenseFile": "MIT_LICENSE.txt",
- "Copyright": "Copyright (c) 2006, 2017 Hewlett-Packard Development Company, L.P."
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/CMakeLists.txt
deleted file mode 100644
index 7e750596..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Generated from src.pro.
-
-add_subdirectory(common)
-add_subdirectory(util)
-add_subdirectory(reco)
-add_subdirectory(lipiengine)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/.prev_CMakeLists.txt
deleted file mode 100644
index d27cc166..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-# Generated from common.pro.
-
-#####################################################################
-## common Generic Library:
-#####################################################################
-
-qt_add_cmake_library(common
- STATIC
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/lib"
- SOURCES
- ../include/LTKCaptureDevice.h
- ../include/LTKChannel.h
- ../include/LTKClassifierDefaults.h
- ../include/LTKErrorsList.h
- ../include/LTKException.h
- ../include/LTKInc.h
- ../include/LTKLipiEngineInterface.h
- ../include/LTKLogger.h
- ../include/LTKLoggerInterface.h
- ../include/LTKMacros.h
- ../include/LTKOSUtil.h
- ../include/LTKOSUtilFactory.h
- ../include/LTKPreprocDefaults.h
- ../include/LTKPreprocessor.h
- ../include/LTKPreprocessorInterface.h
- ../include/LTKRecognitionContext.h
- ../include/LTKRefCountedPtr.h
- ../include/LTKScreenContext.h
- ../include/LTKShapeFeatureMacros.h
- ../include/LTKShapeRecoConfig.h
- ../include/LTKShapeRecoEngine.h
- ../include/LTKShapeRecoResult.h
- ../include/LTKShapeRecoUtil.h
- ../include/LTKShapeRecognizer.h
- ../include/LTKTrace.h
- ../include/LTKTraceFormat.h
- ../include/LTKTraceGroup.h
- ../include/LTKTypes.h
- ../include/LTKWordRecoConfig.h
- ../include/LTKWordRecoResult.h
- ../include/LTKWordRecognizer.h
- LTKCaptureDevice.cpp
- LTKChannel.cpp
- LTKException.cpp
- LTKScreenContext.cpp
- LTKTrace.cpp
- LTKTraceFormat.cpp
- LTKTraceGroup.cpp
- INCLUDE_DIRECTORIES
- ../include
- ../util/lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(common)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(common CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/CMakeLists.txt
deleted file mode 100644
index 1042e056..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/CMakeLists.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-# Generated from common.pro.
-
-#####################################################################
-## ltkcommon Generic Library:
-#####################################################################
-
-qt_add_cmake_library(ltkcommon
- STATIC
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/lib"
- SOURCES
- ../include/LTKCaptureDevice.h
- ../include/LTKChannel.h
- ../include/LTKClassifierDefaults.h
- ../include/LTKErrorsList.h
- ../include/LTKException.h
- ../include/LTKInc.h
- ../include/LTKLipiEngineInterface.h
- ../include/LTKLogger.h
- ../include/LTKLoggerInterface.h
- ../include/LTKMacros.h
- ../include/LTKOSUtil.h
- ../include/LTKOSUtilFactory.h
- ../include/LTKPreprocDefaults.h
- ../include/LTKPreprocessor.h
- ../include/LTKPreprocessorInterface.h
- ../include/LTKRecognitionContext.h
- ../include/LTKRefCountedPtr.h
- ../include/LTKScreenContext.h
- ../include/LTKShapeFeatureMacros.h
- ../include/LTKShapeRecoConfig.h
- ../include/LTKShapeRecoEngine.h
- ../include/LTKShapeRecoResult.h
- ../include/LTKShapeRecoUtil.h
- ../include/LTKShapeRecognizer.h
- ../include/LTKTrace.h
- ../include/LTKTraceFormat.h
- ../include/LTKTraceGroup.h
- ../include/LTKTypes.h
- ../include/LTKWordRecoConfig.h
- ../include/LTKWordRecoResult.h
- ../include/LTKWordRecognizer.h
- LTKCaptureDevice.cpp
- LTKChannel.cpp
- LTKException.cpp
- LTKScreenContext.cpp
- LTKTrace.cpp
- LTKTraceFormat.cpp
- LTKTraceGroup.cpp
- INCLUDE_DIRECTORIES
- ../include
- ../util/lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(ltkcommon)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(ltkcommon CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp
deleted file mode 100644
index 0b2b2a26..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKCaptureDevice.cpp
+++ /dev/null
@@ -1,556 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/*******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- *****************************************************************************/
-/*****************************************************************************
- * FILE DESCR: Implementation of LTKCaptureDevice which holds the information
- * about the digitizer.
- *
- * CONTENTS:
- * getSampleRate
- * getLatency
- * getXDPI
- * getYDPI
- * isUniformSamplingRate
- * setXDPI
- * setYDPI
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- *****************************************************************************/
-
-#include "LTKCaptureDevice.h"
-#include "LTKErrorsList.h"
-#include "LTKLoggerUtil.h"
-#include "LTKMacros.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKCaptureDevice
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKCaptureDevice::LTKCaptureDevice():
- m_samplingRate(DEFAULT_SAMPLING_RATE),
- m_xDpi(DEFAULT_X_DPI),
- m_yDpi(DEFAULT_Y_DPI),
- m_latency(DEFAULT_LATENCY),
- m_isUniformSamplingRate(true)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::LTKCaptureDevice()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::LTKCaptureDevice()" << endl;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKCaptureDevice
-* DESCRIPTION : Initializes the members of the class
-* ARGUMENTS : sRate - sampling rate of the digitizer
-* uniform - type of the sampling
-* lValue - latency of the digitizer
-* xDpiVal - resolution in the x direction of the digitizer
-* (in dots per inch)
-* yDpiVal - resolution in the y direction of the digitizer
- (in dots per inch)
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKCaptureDevice::LTKCaptureDevice(int sRate, bool uniform, float lValue,
- int xDpiVal, int yDpiVal) :
- m_samplingRate(sRate),
- m_xDpi(xDpiVal),
- m_yDpi(yDpiVal),
- m_latency(lValue),
- m_isUniformSamplingRate(uniform)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::LTKCaptureDevice(int, bool, float, int, int)"
- << endl;
-
- if (m_samplingRate <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_SAMPLING_RATE <<": "<<
- getErrorMessage(EINVALID_SAMPLING_RATE) <<
- "LTKCaptureDevice::LTKCaptureDevice(int, bool, float, int, int)"<<endl;
-
- throw LTKException(EINVALID_SAMPLING_RATE);
- }
-
- if (m_xDpi <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_RESOLUTION <<": "
- <<getErrorMessage(EINVALID_X_RESOLUTION) <<
- "LTKCaptureDevice::LTKCaptureDevice(int, bool, float, int, int)"<<endl;
-
- throw LTKException(EINVALID_X_RESOLUTION);
- }
-
- if (m_yDpi <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_Y_RESOLUTION <<": "
- <<getErrorMessage(EINVALID_Y_RESOLUTION) <<
- "LTKCaptureDevice::LTKCaptureDevice(int, bool, float, int, int)"<<endl;
-
- throw LTKException(EINVALID_Y_RESOLUTION);
- }
-
- if (m_latency < 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_LATENCY <<": "
- <<getErrorMessage(EINVALID_LATENCY) <<
- "LTKCaptureDevice::LTKCaptureDevice(int, bool, float, int, int)"<<endl;
-
- throw LTKException(EINVALID_LATENCY);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " m_samplingRate = " << m_samplingRate <<
- " m_xDpi = " << m_xDpi <<
- " m_yDpi = " << m_yDpi <<
- " m_latency = " << m_latency <<
- " m_isUniformSamplingRate = " << m_isUniformSamplingRate << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::LTKCaptureDevice(int, bool, float, int, int)"
- << endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKCaptureDevice
-* DESCRIPTION : Copy Constructor
-* ARGUMENTS : captureDevice - LTKCaptureDevice to be copied
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-LTKCaptureDevice::LTKCaptureDevice(const LTKCaptureDevice& captureDevice)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Enter: LTKCaptureDevice:LTKCaptureDevice(const LTKCaptureDevice&)"
- << endl;
-
- m_samplingRate = captureDevice.m_samplingRate;
-
- m_isUniformSamplingRate = captureDevice.m_isUniformSamplingRate;
-
- m_latency = captureDevice.m_latency;
-
- m_xDpi = captureDevice.m_xDpi;
-
- m_yDpi = captureDevice.m_yDpi;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " m_samplingRate = " << m_samplingRate <<
- " m_xDpi = " << m_xDpi <<
- " m_yDpi = " << m_yDpi <<
- " m_latency = " << m_latency <<
- " m_isUniformSamplingRate = " << m_isUniformSamplingRate << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::LTKCaptureDevice(const LTKCaptureDevice&)"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : operator=
-* DESCRIPTION : Overloaded assignment operator
-* ARGUMENTS : captureDevice - LTKCaptureDevice to be assigned to
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKCaptureDevice& LTKCaptureDevice::operator =
- (const LTKCaptureDevice& captureDevice)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice:: operator =()" << endl;
-
- if(this != &captureDevice)
- {
- m_samplingRate = captureDevice.m_samplingRate;
-
- m_isUniformSamplingRate = captureDevice.m_isUniformSamplingRate;
-
- m_latency = captureDevice.m_latency;
-
- m_xDpi = captureDevice.m_xDpi;
-
- m_yDpi = captureDevice.m_yDpi;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " m_samplingRate = " << m_samplingRate <<
- " m_xDpi = " << m_xDpi <<
- " m_yDpi = " << m_yDpi <<
- " m_latency = " << m_latency <<
- " m_isUniformSamplingRate = " << m_isUniformSamplingRate << endl;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice:: operator =()" << endl;
-
- return *this;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getSampleRate
-* DESCRIPTION : returns back the sampling rate of the digitizer
-* ARGUMENTS :
-* RETURNS : sampling rate of the digitizer
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKCaptureDevice::getSamplingRate() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::getSampleRate()" << endl;
-
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::getSampleRate()" << endl;
-
- return m_samplingRate;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getLatency
-* DESCRIPTION : gets the latency of the digitizer
-* ARGUMENTS :
-* RETURNS : latency of the digitizer
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-float LTKCaptureDevice::getLatency() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::getLatency()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::getLatency()" << endl;
-
- return m_latency;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getXDPI
-* DESCRIPTION : gets the x resolution of the digitizer (in dots per inch)
-* ARGUMENTS :
-* RETURNS : x resolution of the digitizer (in dots per inch)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKCaptureDevice::getXDPI() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::getXDPI()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::getXDPI()" << endl;
-
- return m_xDpi;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getYDPI
-* DESCRIPTION : gets the y resolution of the digitizer (in dots per inch)
-* ARGUMENTS :
-* RETURNS : y resolution of the digitizer (in dots per inch)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKCaptureDevice::getYDPI() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::getYDPI()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::getYDPI()" << endl;
-
- return m_yDpi;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : isUniformSamplingRate
-* DESCRIPTION : gets the type of sampling
-* ARGUMENTS :
-* RETURNS : type of sampling : true if uniform, false if not
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-bool LTKCaptureDevice::isUniformSampling() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::isUniformSamplingRate()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::isUniformSamplingRate()" << endl;
-
- return m_isUniformSamplingRate;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setSamplingRate
-* DESCRIPTION : sets the sampling rate of the device
-* ARGUMENTS : samplingRate - sampling rate of the device
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKCaptureDevice::setSamplingRate(int samplingRate)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::setSamplingRate()" << endl;
-
- if (samplingRate <= 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_SAMPLING_RATE <<": "<<
- getErrorMessage(EINVALID_SAMPLING_RATE) <<
- "LTKCaptureDevice::setSamplingRate()"<<endl;
-
- LTKReturnError(EINVALID_SAMPLING_RATE);
- }
-
- m_samplingRate = samplingRate;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_samplingRate = " << m_samplingRate << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::setSamplingRate()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setLatency
-* DESCRIPTION : sets the latency of the device
-* ARGUMENTS : latency - latency of the device
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKCaptureDevice::setLatency(float latency)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::setLatency()" << endl;
-
- if (m_latency < 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_LATENCY <<": "<<
- getErrorMessage(EINVALID_LATENCY) <<
- "LTKCaptureDevice::setLatency()"<<endl;
-
- LTKReturnError(EINVALID_LATENCY);
- }
-
- m_latency = latency;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_latency = " << m_latency << endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::setLatency()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setUniformSampling
-* DESCRIPTION : sets the type of sampling
-* ARGUMENTS : uniform - type of sampling
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-void LTKCaptureDevice::setUniformSampling(bool uniform)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::setUniformSampling()" << endl;
-
- m_isUniformSamplingRate = uniform;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::setUniformSampling()" << endl;
-
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setXDPI
-* DESCRIPTION : sets the x resolution of the digitizer (in dots per inch)
-* ARGUMENTS : xDpiVal - x resolution of the digitizer (in dots per inch)
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKCaptureDevice::setXDPI(int xDpiVal)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::setXDPI()" << endl;
-
- if (xDpiVal <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_RESOLUTION <<": "<<
- getErrorMessage(EINVALID_X_RESOLUTION) <<
- "LTKCaptureDevice::setXDPI()"<<endl;
-
- LTKReturnError(EINVALID_X_RESOLUTION);
- }
-
- m_xDpi = xDpiVal;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<"m_xDpi = " << m_xDpi << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exit: LTKCaptureDevice::setXDPI()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setYDPI
-* DESCRIPTION : sets the y resolution of the digitizer (in dots per inch)
-* ARGUMENTS : yDpiVal - y resolution of the digitizer (in dots per inch)
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKCaptureDevice::setYDPI (int yDpiVal)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKCaptureDevice::setYDPI()" << endl;
-
- if ( yDpiVal <= 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_Y_RESOLUTION <<": "<<
- getErrorMessage(EINVALID_Y_RESOLUTION) <<
- "LTKCaptureDevice::setYDPI()"<<endl;
-
- LTKReturnError(EINVALID_Y_RESOLUTION);
- }
- m_yDpi = yDpiVal;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<"m_yDpi = " << m_yDpi << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKCaptureDevice::setYDPI()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKCaptureDevice
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKCaptureDevice::~LTKCaptureDevice ()
-{
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp
deleted file mode 100644
index 918419c9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKChannel.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:33:34 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 564 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Implementation of LTKChannel which has the description of a
- * particular input stream like x-coordinate stream,
- * y-coordinate stream, time, pressure etc.
- *
- * CONTENTS:
- * getChannelType
- * getChannelName
- * isRegularChannel
- * setChannelType
- * setChannelName
- * setRegularChannel
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- *****************************************************************************/
-
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKChannel.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKChannel
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKChannel::LTKChannel():
- m_channelName(DEFAULT_CHANNEL_NAME),
- m_channelType(DEFAULT_DATA_TYPE),
- m_isRegularChannel(true)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::LTKChannel()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::LTKChannel()" << endl;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKChannel
-* DESCRIPTION : Parameterized Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKChannel::LTKChannel(const string& channelName):
- m_channelName(channelName),
- m_channelType(DEFAULT_DATA_TYPE),
- m_isRegularChannel(true)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::LTKChannel(const string&)" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::LTKChannel(const string&)" << endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKChannel
-* DESCRIPTION : Initializes the members of the class
-* ARGUMENTS : channelName - logical name of the input stream
-* channelType - data type of the values from this input stream
-* isRegular - type of channel : true for regular, false for
- intermittent
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKChannel::LTKChannel(const string& channelName, ELTKDataType channelType,
- bool isRegular) :
- m_channelName(channelName),
- m_channelType(channelType),
- m_isRegularChannel(isRegular)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::LTKChannel(const string&,ELTKDataType,bool)" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::LTKChannel(const string&,ELTKDataType,bool)" << endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKChannel
-* DESCRIPTION : Copy Constructor
-* ARGUMENTS : channel - LTKChannel to be copied
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKChannel::LTKChannel(const LTKChannel& channel)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::LTKChannel(const LTKChannel&)" << endl;
-
- m_channelName = channel.m_channelName;
-
- m_channelType = channel.m_channelType;
-
- m_isRegularChannel = channel.m_isRegularChannel;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::LTKChannel(const LTKChannel&)" << endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : operator=
-* DESCRIPTION : Overloaded assignment operator
-* ARGUMENTS : channel - LTKChannel to be assigned to
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKChannel& LTKChannel::operator=(const LTKChannel& channel)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::operator=()" << endl;
-
- if ( this != &channel )
- {
- m_channelName = channel.m_channelName;
-
- m_channelType = channel.m_channelType;
-
- m_isRegularChannel = channel.m_isRegularChannel;
- }
-/* LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::operator=()" << endl;*/
-
- return *this;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKChannel
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKChannel::~LTKChannel()
-{
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getChannelType
-* DESCRIPTION : returns data type of the values from the channel
-* ARGUMENTS :
-* RETURNS : data type of the values from the channel
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-ELTKDataType LTKChannel::getChannelType() const
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::getChannelType()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::getChannelType()" << endl;*/
-
- return m_channelType;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getChannelName
-* DESCRIPTION : returns the logical name of the channel
-* ARGUMENTS :
-* RETURNS : logical name of the channel
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-string LTKChannel::getChannelName() const
-{
-/* LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::getChannelName()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::getChannelName()" << endl;*/
-
- return m_channelName;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : isRegularChannel
-* DESCRIPTION : returns the type of the channel
-* ARGUMENTS :
-* RETURNS : type ofthe channel : true for regular, false for intermittent
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-bool LTKChannel::isRegularChannel() const
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::isRegularChannel()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::isRegularChannel()" << endl;*/
-
- return m_isRegularChannel;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setChannelType
-* DESCRIPTION : sets the data type of the values from the channel
-* ARGUMENTS : channelType - data type of the values from the channel
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* *****************************************************************************/
-
-void LTKChannel::setChannelType(ELTKDataType channelType)
-{
-/* LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::setChannelType()" << endl;*/
-
- m_channelType = channelType;
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_channelType = " << m_channelType << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::setChannelType()" << endl;*/
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setChannelName
-* DESCRIPTION : sets the name of the channel
-* ARGUMENTS : channelName - name of the channel
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKChannel::setChannelName(const string& channelName)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::setChannelName()" << endl;*/
-
- if( channelName.length() == 0)
- {
- LTKReturnError(EEMPTY_STRING);
- }
-
- m_channelName = channelName;
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_channelName = " << m_channelName << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::setChannelName()" << endl;*/
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setRegularChannel
-* DESCRIPTION : sets the type of the channel
-* ARGUMENTS : isRegular - type of the channel : true for regular,
- false for intermittent
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-void LTKChannel::setRegularChannel(bool isRegular)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKChannel::setRegularChannel()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKChannel::setRegularChannel()" << endl;*/
-
- m_isRegularChannel = isRegular;
-
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKException.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKException.cpp
deleted file mode 100644
index 48a0c834..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKException.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Implementation of LTKException class. The error messages are
- * thrown embedded in objects of this class
- *
- * CONTENTS:
- * getExceptionMessage
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKMacros.h"
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKException
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKException::LTKException():
- m_errorCode(DEFAULT_ERROR_CODE)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKException::LTKException()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKException::LTKException()" << endl;*/
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKException
-* DESCRIPTION : Initialization Constructor
-* ARGUMENTS : exceptionMsg - error message
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* *****************************************************************************/
-
-LTKException::LTKException(int errorCode) :
- m_errorCode(errorCode)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKException::LTKException(int)" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKException::LTKException(int)" << endl;*/
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getExceptionMessage
-* DESCRIPTION : returns the error message
-* ARGUMENTS :
-* RETURNS : error message string
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-string LTKException::getExceptionMessage() const
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKException::getExceptionMessage()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKException::getExceptionMessage()" << endl;*/
-
- return string(getErrorMessage(m_errorCode));
-}
-
-/*****************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 22-Feb-2007
-* NAME : getErrorCode
-* DESCRIPTION : returns the error code
-* ARGUMENTS :
-* RETURNS : error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-int LTKException::getErrorCode() const
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKException::getErrorCode()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKException::getErrorCode()" << endl;*/
-
- return m_errorCode;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKException
-* DESCRIPTION : Destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ****************************************************************************/
-
-LTKException::~LTKException()
-{
-}
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp
deleted file mode 100644
index 735e7437..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKScreenContext.cpp
+++ /dev/null
@@ -1,441 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-*******************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
- * $Revision: 827 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKScreenContext which holds the co-ordinates
- of the writing area provided for the set of traces being sent
- for recognition
- *
- * CONTENTS:
- * getBboxLeft
- * getBboxBottom
- * getBboxRight
- * getBboxTop
- * setBboxLeft
- * setBboxBottom
- * setBboxRight
- * setBboxTop
- *
- * AUTHOR: Mudit Agrawal.
- *
- * DATE: February 23, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKScreenContext.h"
-#include "LTKMacros.h"
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKScreenContext
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKScreenContext::LTKScreenContext() :
- m_bboxBottom(0.0),
- m_bboxLeft(0.0),
- m_bboxRight(0.0),
- m_bboxTop(0.0)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::LTKScreenContext()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::LTKScreenContext()" << endl;*/
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKScreenContext
-* DESCRIPTION : Initialization Constructor
-* ARGUMENTS : bboxLeft - left x co-ordinate of the writing area
-* bboxBottom - bottom y co-ordinate of the writing area
-* bboxRight - right x co-ordinate of the writing area
-* bboxTop - top y co-ordinate of the writing area
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKScreenContext::LTKScreenContext(float bboxLeft, float bboxBottom,
- float bboxRight,float bboxTop) :
- m_bboxLeft(bboxLeft),
- m_bboxBottom(bboxBottom),
- m_bboxRight(bboxRight),
- m_bboxTop(bboxTop)
-{
-/* LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::LTKScreenContext(float,float,float,float)" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::LTKScreenContext(float,float,float,float)" << endl;*/
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getBboxLeft
-* DESCRIPTION : gets the left x co-ordinate of the writing area
-* ARGUMENTS :
-* RETURNS : left x co-ordinate of the writing area
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-float LTKScreenContext::getBboxLeft() const
-{
-/* LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::getBboxLeft()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::getBboxLeft()" << endl;*/
-
- return m_bboxLeft;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getBboxBottom
-* DESCRIPTION : gets the bottom y co-ordinate of the writing area
-* ARGUMENTS :
-* RETURNS : bottom y co-ordinate of the writing area
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-float LTKScreenContext::getBboxBottom() const
-{
-/* LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::getBboxBottom()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::getBboxBottom()" << endl;*/
-
- return m_bboxBottom;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getBboxRight
-* DESCRIPTION : gets the right x co-ordinate of the writing area
-* ARGUMENTS :
-* RETURNS : right x co-ordinate of the writing area
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-float LTKScreenContext::getBboxRight() const
-{
-/* LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::getBboxRight()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::getBboxRight()" << endl;*/
-
- return m_bboxRight;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getBboxTop
-* DESCRIPTION : gets the top y co-ordinate of the writing area
-* ARGUMENTS :
-* RETURNS : top y co-ordinate of the writing area
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-float LTKScreenContext::getBboxTop() const
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::getBboxTop()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::getBboxTop()" << endl;*/
-
- return m_bboxTop;
-}
-
-/******************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 01-MAR-2005
-* NAME : getAllHLines
-* DESCRIPTION : gets the horizontal lines in the screen context
-* ARGUMENTS : none
-* RETURNS : const reference to vector of ordinates of horizontal lines
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-const floatVector& LTKScreenContext::getAllHLines() const
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::getAllHLines()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::getAllHLines()" << endl;*/
-
- return m_hLines;
-}
-
-/******************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 01-MAR-2005
-* NAME : getAllVLines
-* DESCRIPTION : gets the horizontal lines in the screen context
-* ARGUMENTS : none
-* RETURNS : const reference to vector of ordinates of horizontal lines
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-const floatVector& LTKScreenContext::getAllVLines() const
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::getAllVLines()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::getAllVLines()" << endl;*/
-
- return m_vLines;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setBboxLeft
-* DESCRIPTION : sets the left x co-ordinate of the writing area
-* ARGUMENTS : bboxLeft - left x co-ordinate of the writing area
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKScreenContext::setBboxLeft(float bboxLeft)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::setBboxLeft()" << endl;*/
-
- if(bboxLeft <0)
- {
- return FAILURE;
- }
-
- m_bboxLeft = bboxLeft;
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::setBboxLeft()" << endl;*/
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setBboxBottom
-* DESCRIPTION : sets the bottom y co-ordinate of the writing area
-* ARGUMENTS : bboxBottom - bottom y co-ordinate of the writing area
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKScreenContext::setBboxBottom(float bboxBottom)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::setBboxBottom()" << endl;*/
-
- if(bboxBottom<0)
- {
- return FAILURE;
- }
-
- m_bboxBottom = bboxBottom;
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::setBboxBottom()" << endl;*/
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setBboxRight
-* DESCRIPTION : sets the right x co-ordinate of the writing area
-* ARGUMENTS : bboxRight - right x co-ordinate of the writing area
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKScreenContext::setBboxRight(float bboxRight)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::setBboxRight()" << endl;*/
-
- if(bboxRight<0)
- {
- return FAILURE;
- }
-
- m_bboxRight = bboxRight;
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::setBboxRight()" << endl;*/
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setBboxTop
-* DESCRIPTION : sets the top y co-ordinate of the writing area
-* ARGUMENTS : bboxTop - top y co-ordinate of the writing area
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKScreenContext::setBboxTop(float bboxTop)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::setBboxTop()" << endl;*/
-
- if(bboxTop<0)
- {
- return FAILURE;
- }
-
- m_bboxTop = bboxTop;
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::setBboxTop()" << endl;*/
-
- return SUCCESS;
-}
-/******************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 01-MAR-2005
-* NAME : addHLine
-* DESCRIPTION : This function adds a horizontal line in the screen context
-* ARGUMENTS : ordinate - position of the horizontal line
-* RETURNS : SUCCESS on successful add operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-int LTKScreenContext::addHLine(float ordinate)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::addHLine()" << endl;*/
-
- if(ordinate<0)
- {
- return FAILURE;
- }
-
- m_hLines.push_back(ordinate);
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::addHLine()" << endl;*/
-
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 01-MAR-2005
-* NAME : addVLine
-* DESCRIPTION : This function adds a vertical line in the screen context
-* ARGUMENTS : ordinate - position of the vertical line
-* RETURNS : SUCCESS on successful add operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKScreenContext::addVLine(float abscissa)
-{
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKScreenContext::addVLine()" << endl;*/
-
- if(abscissa <0)
- {
- return FAILURE;
- }
-
- m_vLines.push_back(abscissa);
-
- /*LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKScreenContext::addVLine()" << endl;*/
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKScreenContext
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKScreenContext::~LTKScreenContext ()
-{
-}
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp
deleted file mode 100644
index 3625ce50..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTrace.cpp
+++ /dev/null
@@ -1,730 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
- * $Revision: 827 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: implementation of LTKTrace which holds series of points
- * from a pen down event to the next immediate pen up event
- *
- * CONTENTS:
- * getNumberOfPoints
- * getPointAt
- * getChannelValues
- * getChannelValues (overloaded)
- * getChannelValueAt
- * setChannelValues
- * addPoint
- * getChannelNames
- * addChannel
- * getChannelIndex
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKTrace.h"
-#include "LTKMacros.h"
-#include "LTKTraceFormat.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKChannel.h"
-#include "LTKException.h"
-#include "LTKLoggerUtil.h"
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTrace
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTrace::LTKTrace()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::LTKTrace()"<<endl;
-
- floatVector emptyChannel;
-
- m_traceChannels.assign(2,emptyChannel);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::LTKTrace()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTrace
-* DESCRIPTION : Initialization constructor
-* ARGUMENTS : inputStream - incoming data
-* traceFormat - format of the incoming data
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTrace::LTKTrace(const floatVector& inputStream,
- const LTKTraceFormat& traceFormat)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::LTKTrace(const floatVector&,const LTKTraceFormat& )"<<endl;
-
- int inputStreamSize = inputStream.size();
- int numChannels = traceFormat.getNumChannels();
-
- floatVector tempChannel;
-
- if(numChannels == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EZERO_CHANNELS <<": "<<
- getErrorMessage(EZERO_CHANNELS) <<
- "LTKTrace::LTKTrace(const floatVector&,const LTKTraceFormat&() "<<endl;
-
- throw LTKException(EZERO_CHANNELS);
- }
-
- if(inputStreamSize==0 || ((inputStreamSize % numChannels) != 0))
- {
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_INPUT_STREAM <<": "<<
- getErrorMessage(EINVALID_INPUT_STREAM) <<
- "LTKTrace::LTKTrace(const floatVector&,const LTKTraceFormat&() "<<endl;
-
- throw LTKException(EINVALID_INPUT_STREAM);
- }
-
- m_traceFormat = traceFormat;
-
- /*
- * values of individual channels are separated from contiguous channel values.
- * vector<float> of these individual channels is computed, and such vectors
- * for all channels are collected into another vector.
- */
-
- for(int channelIndex = 0; channelIndex < numChannels; ++channelIndex)
- {
- for(int inputIndex = channelIndex; inputIndex < inputStreamSize;
- inputIndex += numChannels)
- {
- tempChannel.push_back(inputStream[inputIndex]);
- }
-
- m_traceChannels.push_back(tempChannel);
-
- tempChannel.clear();
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::LTKTrace(const floatVector&,const LTKTraceFormat& )"<<endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTrace
-* DESCRIPTION : Trace format initialization constructor
-* ARGUMENTS : traceFormat - format of the incoming data
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTrace::LTKTrace(const LTKTraceFormat& traceFormat)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::LTKTrace(const LTKTraceFormat&)"<<endl;
-
- floatVector tempChannel;
-
- int numChannels = traceFormat.getNumChannels();
-
- m_traceFormat = traceFormat;
-
- m_traceChannels.assign(numChannels, tempChannel);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::LTKTrace(const LTKTraceFormat&)"<<endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTrace
-* DESCRIPTION : copy constructor
-* ARGUMENTS : trace - trace to be copied
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTrace::LTKTrace(const LTKTrace& trace)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::LTKTrace(const LTKTrace&)"<<endl;
-
- m_traceChannels = trace.m_traceChannels;
- m_traceFormat = trace.m_traceFormat;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::LTKTrace(const LTKTrace&)"<<endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : operator=
-* DESCRIPTION : assignment operator
-* ARGUMENTS : trace - trace to be assigned
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTrace& LTKTrace::operator=(const LTKTrace& trace)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::operator=()"<<endl;
-
- if ( this != &trace )
- {
- m_traceChannels = trace.m_traceChannels;
- m_traceFormat = trace.m_traceFormat;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::operator=()"<<endl;
-
- return *this;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getNumberOfPoints
-* DESCRIPTION : get number of points in the trace
-* ARGUMENTS :
-* RETURNS : number of points in the trace
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTrace::getNumberOfPoints() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::getNumberOfPoints()"<<endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::getNumberOfPoints()"<<endl;
-
- return m_traceChannels[0].size();
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getPointAt
-* DESCRIPTION : returns the point at a specified index
-* ARGUMENTS : pointIndex - index of the point whose values are required
-* RETURNS : point at the specified index
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTrace::getPointAt(int pointIndex, floatVector& outPointCoordinates) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::getPointAt()"<<endl;
-
- if ( pointIndex < 0 || pointIndex >= m_traceChannels[0].size() )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EPOINT_INDEX_OUT_OF_BOUND <<": "<<
- getErrorMessage(EPOINT_INDEX_OUT_OF_BOUND) <<
- "LTKTrace::getPointAt() "<<endl;
-
- LTKReturnError(EPOINT_INDEX_OUT_OF_BOUND);
- }
-
- vector<floatVector>::const_iterator channelIterator = m_traceChannels.begin();
-
- vector<floatVector>::const_iterator traceChannelsEnd = m_traceChannels.end();
-
- for(; channelIterator != traceChannelsEnd; ++channelIterator)
- {
- outPointCoordinates.push_back((*channelIterator)[pointIndex]);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::getPointAt()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getChannelValues
-* DESCRIPTION : get the values of the channel given its name
-* ARGUMENTS : channelName - name of the channel whose values are required
-* RETURNS : values of the channel with the specified name
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKTrace::getChannelValues(const string& channelName,
- floatVector& outChannelValues) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::getChannelValues(const string&, floatVector&)"<<endl;
-
- int channelIndex = -1;
-
- int errorCode = 0;
-
- if ((errorCode=m_traceFormat.getChannelIndex(channelName, channelIndex)) != SUCCESS )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: LTKTrace::getChannelValues(string&, floatVector&) "<<endl;
-
- LTKReturnError(errorCode);
- }
-
- outChannelValues = m_traceChannels[channelIndex];
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::getChannelValues(string&, floatVector&)"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getChannelValues
-* DESCRIPTION : get the values of the channel given its index
-* ARGUMENTS : channelIndex - index of the channel whose values are required
-* RETURNS : values of the channel at the specified index
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKTrace::getChannelValues(int channelIndex,
- floatVector& outChannelValues) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::getChannelValues(int, floatVector&)"<<endl;
-
- if(channelIndex < 0 || channelIndex >= m_traceFormat.getNumChannels())
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_INDEX_OUT_OF_BOUND <<": "<<
- getErrorMessage(ECHANNEL_INDEX_OUT_OF_BOUND) <<
- "LTKTrace::getChannelValues() "<<endl;
-
- LTKReturnError(ECHANNEL_INDEX_OUT_OF_BOUND);
- }
-
- outChannelValues = m_traceChannels[channelIndex];
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::getChannelValues(int, floatVector&)"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getChannelValueAt
-* DESCRIPTION : gets the value of a particular channel at a particular point
-* ARGUMENTS : channelName - name of the channel to get the value from
-* pointIndex - index of the point at which the channel value
-* is required
-* RETURNS : value of the specified channel at the specified point
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKTrace::getChannelValueAt(const string& channelName, int pointIndex,
- float& outValue) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::getChannelValueAt(const string&, floatVector&)"<<endl;
-
- if (pointIndex < 0 || pointIndex >= m_traceChannels[0].size() )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_INDEX_OUT_OF_BOUND <<": "<<
- getErrorMessage(ECHANNEL_INDEX_OUT_OF_BOUND) <<
- "LTKTrace::getChannelValueAt() "<<endl;
-
- LTKReturnError(EPOINT_INDEX_OUT_OF_BOUND);
- }
-
- int channelIndex = -1;
-
- if (m_traceFormat.getChannelIndex(channelName, channelIndex) != SUCCESS )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_NOT_FOUND <<": "<<
- getErrorMessage(ECHANNEL_NOT_FOUND) <<
- "LTKTrace::getChannelValueAt() "<<endl;
-
- LTKReturnError(ECHANNEL_NOT_FOUND);
- }
-
- outValue = m_traceChannels[channelIndex][pointIndex];
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::getChannelValueAt()"<<endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setChannelValues
-* DESCRIPTION : resets the data of the given channel
-* ARGUMENTS : channelName - name of the channel whose data is to be reset
-* channelData - new data for the channel reset
-* RETURNS : SUCCESS on successful reset
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKTrace::reassignChannelValues(const string &channelName,
- const floatVector &channelData)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::reassignChannelValues(const string&, floatVector&)"<<endl;
-
- if(channelData.size() != m_traceChannels[0].size())
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_SIZE_MISMATCH <<": "<<
- getErrorMessage(ECHANNEL_SIZE_MISMATCH) <<
- "LTKTrace::reassignChannelValues() "<<endl;
-
- LTKReturnError(ECHANNEL_SIZE_MISMATCH);
- }
-
- int channelIndex = -1;
-
- if (m_traceFormat.getChannelIndex(channelName, channelIndex) != SUCCESS )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_NOT_FOUND <<": "<<
- getErrorMessage(ECHANNEL_NOT_FOUND) <<
- "LTKTrace::reassignChannelValues() "<<endl;
-
- LTKReturnError(ECHANNEL_NOT_FOUND);
- }
-
- // updating the changed values of a channel in m_traceChannels vector.
- m_traceChannels[channelIndex] = channelData;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::reassignChannelValues()"<<endl;
-
- return SUCCESS;
-}
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setAllChannelValues
-* DESCRIPTION : This method reassigns the values of all the channels. The number
-* of rows in the input 2D vector must be equal to the current number
-* of channels with each row having the same length. And this assumes
-* one-to-one correspondence with the channel vector.
-* ARGUMENTS : allChannelValues - new values of all the channels
-* channelData - new data for the channel reset
-* RETURNS : SUCCESS on successful reset
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTrace::setAllChannelValues(const float2DVector& allChannelValues)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::setAllChannelValues()"<<endl;
-
- if(allChannelValues.size() != m_traceFormat.getNumChannels())
- {
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ENUM_CHANNELS_MISMATCH <<": "<<
- getErrorMessage(ENUM_CHANNELS_MISMATCH) <<
- "LTKTrace::setAllChannelValues() "<<endl;
-
- LTKReturnError(ENUM_CHANNELS_MISMATCH);
- }
-
- if(allChannelValues[0].size()==0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EEMPTY_VECTOR <<": "<<
- getErrorMessage(EEMPTY_VECTOR) <<
- "LTKTrace::setAllChannelValues() "<<endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- int prevRowSize=allChannelValues[0].size();
- int currRowSize=0;
-
- for(int i=1; i<allChannelValues.size(); ++i)
- {
- currRowSize = allChannelValues[i].size();
-
- if(currRowSize != prevRowSize)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EUNEQUAL_LENGTH_VECTORS <<": "<<
- getErrorMessage(EUNEQUAL_LENGTH_VECTORS) <<
- "LTKTrace::setAllChannelValues() "<<endl;
-
- LTKReturnError(EUNEQUAL_LENGTH_VECTORS);
- }
-
- prevRowSize = currRowSize;
- }
-
- m_traceChannels = allChannelValues;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::setAllChannelValues()"<<endl;
-
-
- return SUCCESS;
-}
-
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : addPoint
-* DESCRIPTION : adds a point to the trace
-* ARGUMENTS : pointVec - point to be added to the trace
-* RETURNS : SUCCESS on successful addition
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKTrace::addPoint(const floatVector& pointVec)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::setAllChannelValues()"<<endl;
-
- int numChannels = m_traceFormat.getNumChannels();
-
- if ( pointVec.size() != numChannels )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EUNEQUAL_LENGTH_VECTORS <<": "<<
- getErrorMessage(EUNEQUAL_LENGTH_VECTORS) <<
- "LTKTrace::setAllChannelValues() "<<endl;
-
- LTKReturnError(ENUM_CHANNELS_MISMATCH);
- }
-
- // Adding the new point in m_traceChannels vector.
- for(int index=0; index < numChannels; ++index)
- {
- (m_traceChannels[index]).push_back(pointVec[index]);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::setAllChannelValues()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : addChannel
-* DESCRIPTION : adds a new channel to the trace
-* ARGUMENTS : channelValuesVec - values of the new channel
-* channelName - new channel name
-* RETURNS : SUCCESS on successful addition
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-
-int LTKTrace::addChannel(const floatVector &channelValuesVec,
- const LTKChannel& channel)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::addChannel()"<<endl;
-
- if ( m_traceChannels[0].size() !=0 &&
- channelValuesVec.size() != m_traceChannels[0].size() )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_SIZE_MISMATCH <<": "<<
- m_traceChannels[0].size() <<
- "LTKTrace::addChannel() "<<endl;
-
- LTKReturnError(ECHANNEL_SIZE_MISMATCH);
- }
-
- int errorCode = m_traceFormat.addChannel(channel);
-
- if (errorCode != SUCCESS)
- {
- LTKReturnError(errorCode);
- }
-
- m_traceChannels.push_back(channelValuesVec);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::addChannel()"<<endl;
-
- return SUCCESS;
-}
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKTrace
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTrace::~LTKTrace()
-{
-}
-
-/******************************************************************************
-* AUTHOR : Bharath A
-* DATE : 17-DEC-2007
-* NAME : emptyTrace
-* DESCRIPTION : To empty the channel values but retain the trace format
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-void LTKTrace::emptyTrace()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::emptyTrace()"<<endl;
-
- for(int i=0;i<m_traceChannels.size();++i)
- {
- m_traceChannels[i].clear();
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::emptyTrace()"<<endl;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 17-Dec-2007
-* NAME : isEmpty
-* DESCRIPTION : Checks if the data vector is empty
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-bool LTKTrace::isEmpty() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::isEmpty()"<<endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::isEmpty()"<<endl;
-
- return (m_traceChannels[0].size()==0);
-}
-
-
-/******************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 17-Dec-2007
-* NAME : getTraceFormat
-* DESCRIPTION : Getter on the current trace format
-* ARGUMENTS :
-* RETURNS : const LTKTraceFormat&
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-const LTKTraceFormat& LTKTrace::getTraceFormat() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTrace::getTraceFormat()"<<endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTrace::getTraceFormat()"<<endl;
-
- return m_traceFormat;
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp
deleted file mode 100644
index 65706dea..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceFormat.cpp
+++ /dev/null
@@ -1,418 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:33:34 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 564 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKTraceFormat which holds the information
- * about type and number of channel data available at each pen point
- *
- * CONTENTS:
- * getChannelIndex
- * getChannelName
- * getNumChannels
- * getRegularChannelNames
- * getAllChannelNames
- * setChannelFormat
- * addChannel
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKTraceFormat.h"
-#include "LTKChannel.h"
-#include "LTKException.h"
-#include "LTKErrorsList.h"
-#include "LTKErrors.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTraceFormat
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceFormat::LTKTraceFormat()
-{
- LTKChannel xChannel(X_CHANNEL_NAME);
- LTKChannel yChannel(Y_CHANNEL_NAME);
- m_channelVector.push_back(xChannel);
- m_channelVector.push_back(yChannel);
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTraceFormat
-* DESCRIPTION : Initialization Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceFormat::LTKTraceFormat(const LTKChannelVector& channelsVec)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::LTKTraceFormat()"<<endl;
- if(channelsVec.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EZERO_CHANNELS <<":"<< getErrorMessage(EZERO_CHANNELS)
- <<" LTKTraceFormat::LTKTraceFormat(LTKChannelVector&)" <<endl;
-
- throw LTKException(EZERO_CHANNELS);
- }
- else
- {
- m_channelVector = channelsVec;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::LTKTraceFormat()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTraceGroup
-* DESCRIPTION : Copy Constructor
-* ARGUMENTS : traceFormat - object to be copied
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceFormat::LTKTraceFormat(const LTKTraceFormat& traceFormat)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::LTKTraceFormat(const LTKTraceFormat&)"<<endl;
-
- m_channelVector = traceFormat.m_channelVector;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::LTKTraceFormat(const LTKTraceFormat&)"<<endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : operator=
-* DESCRIPTION : Assignment operator
-* ARGUMENTS : traceFormat - object to be assigned
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceFormat& LTKTraceFormat::operator=(const LTKTraceFormat& traceFormat)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::operator=()"<<endl;
-
- if ( this != &traceFormat )
- {
- m_channelVector = traceFormat.m_channelVector;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::operator=()"<<endl;
-
- return *this;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getChannelIndex
-* DESCRIPTION : returns position of the channel given its name
-* ARGUMENTS : channelName - name of the channel whose position is required
-* RETURNS : position of the channel with the given name
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTraceFormat::getChannelIndex(const string& channelName,
- int& outReturnIndex) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::getChannelIndex()"<<endl;
-
- int numChannels = m_channelVector.size();
-
- for(int channelIndex = 0 ; channelIndex < numChannels; ++channelIndex)
- {
- if((m_channelVector[channelIndex]).getChannelName() == channelName)
- {
- outReturnIndex = channelIndex;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::getChannelIndex()"<<endl;
- return SUCCESS;
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_NOT_FOUND <<": "<<
- getErrorMessage(ECHANNEL_NOT_FOUND) <<
- "LTKCaptureDevice::getChannelIndex()"<<endl;
-
- return ECHANNEL_NOT_FOUND;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getChannelName
-* DESCRIPTION :
-* ARGUMENTS : channelIndex - given channel index
-* RETURNS : corresponding channel name
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTraceFormat::getChannelName(int channelIndex,
- string& outChannelName) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::getChannelName()"<<endl;
-
- if ( channelIndex < 0 || channelIndex >= m_channelVector.size() )
- {
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ECHANNEL_INDEX_OUT_OF_BOUND <<": "<<
- getErrorMessage(ECHANNEL_INDEX_OUT_OF_BOUND) <<
- "LTKCaptureDevice::getChannelName()"<<endl;
-
- LTKReturnError(ECHANNEL_INDEX_OUT_OF_BOUND);
- }
-
- outChannelName = m_channelVector[channelIndex].getChannelName();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::getChannelName()"<<endl;
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getNumChannels
-* DESCRIPTION : returns the number of channels in the trace format
-* ARGUMENTS :
-* RETURNS : number of channels in the trace format
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTraceFormat::getNumChannels() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::getNumChannels()"<<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::getNumChannels()"<<endl;
-
- return m_channelVector.size();
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getRegularChannelNames
-* DESCRIPTION : returns list of regular channel names
-* ARGUMENTS :
-* RETURNS : list of regular channel names
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-stringVector LTKTraceFormat::getRegularChannelNames() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::getRegularChannelNames()"<<endl;
-
- stringVector regularChannelNamesVector;
-
- vector<LTKChannel>::const_iterator channelIterator = m_channelVector.begin();
-
- vector<LTKChannel>::const_iterator channelVectorEnd = m_channelVector.end();
-
- for(; channelIterator != channelVectorEnd; ++channelIterator)
- {
-
- if( (*channelIterator).isRegularChannel() )
- {
- regularChannelNamesVector.push_back((*channelIterator).getChannelName());
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::getRegularChannelNames()"<<endl;
- return regularChannelNamesVector;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getAllChannelNames
-* DESCRIPTION : returns list of all channel names
-* ARGUMENTS :
-* RETURNS : list of all channel names
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-stringVector LTKTraceFormat::getAllChannelNames() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::getAllChannelNames()"<<endl;
-
- stringVector allChannelNamesVector;
-
- vector<LTKChannel>::const_iterator channelIterator = m_channelVector.begin();
-
- vector<LTKChannel>::const_iterator channelVectorEnd = m_channelVector.end();
-
- for(; channelIterator != channelVectorEnd; ++channelIterator)
- {
- allChannelNamesVector.push_back((*channelIterator).getChannelName());
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::getAllChannelNames()"<<endl;
-
- return allChannelNamesVector;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setChannelFormat
-* DESCRIPTION : resets the channel format
-* ARGUMENTS : channelFormatVector - reference to the vector to be reset to
-* RETURNS : SUCCESS on successful reset operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-void LTKTraceFormat::setChannelFormat(const LTKChannelVector& channelFormatVector)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::setChannelFormat()"<<endl;
-
- m_channelVector = channelFormatVector;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::setChannelFormat()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : addChannel
-* DESCRIPTION : adds a new channel to the trace format
-* ARGUMENTS : channel - new channel to be added
-* RETURNS : SUCCESS on successful addition
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTraceFormat::addChannel(const LTKChannel& channel)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKTraceFormat::addChannel()"<<endl;
-
- string inputChannelName = channel.getChannelName();
-
- // Check if the channel with the name already Exitings
- vector<LTKChannel>::const_iterator channelIterator = m_channelVector.begin();
-
- vector<LTKChannel>::const_iterator channelVectorEnd = m_channelVector.end();
-
- for(; channelIterator != channelVectorEnd; ++channelIterator)
- {
- if( (*channelIterator).getChannelName() == inputChannelName )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EDUPLICATE_CHANNEL <<": "<<
- getErrorMessage(EDUPLICATE_CHANNEL) <<
- "LTKCaptureDevice::addChannel()"<<endl;
-
- LTKReturnError(EDUPLICATE_CHANNEL);
- }
- }
-
- m_channelVector.push_back(channel);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKTraceFormat::addChannel()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKTraceFormat
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceFormat::~LTKTraceFormat()
-{
-}
-
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp
deleted file mode 100644
index 282789d5..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/LTKTraceGroup.cpp
+++ /dev/null
@@ -1,1134 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKTraceGroup which holds a sequence of LTKTrace type objects
- *
- * CONTENTS:
- * getAllTraces
- * getTraceAt
- * getNumTraces
- * addTrace
- * setAllTraces
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu V. March 7, 2005 Added new assignment operator (from LTKTrace)
- * and copy constructor (from LTKTrace )
- * Thanigai 09-AUG-2005 Added a to empty the trace group
-************************************************************************/
-
-#include "LTKTraceGroup.h"
-#include "LTKTrace.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKLoggerUtil.h"
-#include "LTKException.h"
-#include "LTKMacros.h"
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTraceGroup
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-LTKTraceGroup::LTKTraceGroup() :
- m_xScaleFactor(1.0),
- m_yScaleFactor(1.0)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::LTKTraceGroup()"<<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::LTKTraceGroup()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTraceGroup
-* DESCRIPTION : Initialization constructor
-* ARGUMENTS : inTraceVector - vector of traces to be set to class member
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-LTKTraceGroup::LTKTraceGroup(const LTKTraceVector& inTraceVector,
- float xScaleFactor, float yScaleFactor) :
- m_traceVector(inTraceVector)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;
-
- if(xScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_X_SCALE_FACTOR) <<
- "LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;
-
- throw LTKException(EINVALID_X_SCALE_FACTOR);
- }
-
- if(yScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_Y_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_Y_SCALE_FACTOR) <<
- "LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;
-
- throw LTKException(EINVALID_Y_SCALE_FACTOR);
- }
-
- m_xScaleFactor = xScaleFactor;
- m_yScaleFactor = yScaleFactor;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;
-
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKTraceGroup
-* DESCRIPTION : Copy Constructor
-* ARGUMENTS : traceGroup - trace group to be copied
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceGroup::LTKTraceGroup(const LTKTraceGroup& traceGroup)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::LTKTraceGroup(LTKTraceGroup&)"<<endl;
-
- m_traceVector = traceGroup.m_traceVector;
- m_xScaleFactor = traceGroup.m_xScaleFactor;
- m_yScaleFactor = traceGroup.m_yScaleFactor;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::LTKTraceGroup(LTKTraceGroup&)"<<endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 07-MAR-2005
-* NAME : LTKTraceGroup
-* DESCRIPTION : Constructor from LTKTrace
-* ARGUMENTS : trace - trace object to be copied
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceGroup::LTKTraceGroup(const LTKTrace& trace,
- float xScaleFactor, float yScaleFactor)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter:LTKTraceGroup::LTKTraceGroup(LTKTraceGroup&, float, float)"<<endl;
-
- if(xScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_X_SCALE_FACTOR) <<
- "LTKTraceGroup::LTKTraceGroup(LTKTrace&, float,float)"<<endl;
-
- throw LTKException(EINVALID_X_SCALE_FACTOR);
- }
-
- if(yScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_Y_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_Y_SCALE_FACTOR) <<
- "LTKTraceGroup::LTKTraceGroup(LTKTrace&, float,float)"<<endl;
-
- throw LTKException(EINVALID_Y_SCALE_FACTOR);
- }
-
- m_xScaleFactor = xScaleFactor;
- m_yScaleFactor = yScaleFactor;
-
- m_traceVector.push_back(trace);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit:LTKTraceGroup::LTKTraceGroup(LTKTraceGroup&, float, float)"<<endl;
-
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : operator=
-* DESCRIPTION : Overloaded assignment operator
-* ARGUMENTS : traceGroup - trace group to be assigned to
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceGroup& LTKTraceGroup::operator=(const LTKTraceGroup& traceGroup)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup:: operator =(LTKTraceGroup&)"<<endl;
-
- if(this != &traceGroup)
- {
- m_traceVector = traceGroup.m_traceVector;
- m_xScaleFactor = traceGroup.m_xScaleFactor;
- m_yScaleFactor = traceGroup.m_yScaleFactor;
- }
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup:: operator =(LTKTraceGroup&)"<<endl;
-
- return *this;
-}
-
-/******************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 07-MAR-2005
-* NAME : operator=
-* DESCRIPTION : Overloaded assignment operator (From LTKTrace)
-* ARGUMENTS : trace - trace to be assigned
-* RETURNS : LTKTraceGroup&
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceGroup& LTKTraceGroup::operator=(const LTKTrace& trace)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup:: operator =(LTKTrace&)"<<endl;
-
- emptyAllTraces();
- m_traceVector.push_back(trace);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup:: operator =(LTKTrace&)"<<endl;
-
- return *this;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getAllTraces
-* DESCRIPTION : gets traces composing the trace group as a vector
-* ARGUMENTS :
-* RETURNS : reference to traces composing the trace group as a vector
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-const LTKTraceVector& LTKTraceGroup::getAllTraces() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::getAllTraces()"<<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup:: getAllTraces()"<<endl;
-
- return m_traceVector;
-}
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getTraceAt
-* DESCRIPTION : gets the trace at the specified index
-* ARGUMENTS : traceIndex - index of the trace to return
-* RETURNS : reference to trace at the specified index
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTraceGroup::getTraceAt(int traceIndex, LTKTrace& outTrace) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::getTraceAt()"<<endl;
-
- if ( traceIndex < 0 || traceIndex >= m_traceVector.size() )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<ETRACE_INDEX_OUT_OF_BOUND <<": "<<
- getErrorMessage(ETRACE_INDEX_OUT_OF_BOUND) <<
- "LTKTraceGroup::getTraceAt()"<<endl;
-
-
- LTKReturnError(ETRACE_INDEX_OUT_OF_BOUND);
- }
-
- outTrace = m_traceVector[traceIndex];
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::getTraceAt()"<<endl;
-
- return SUCCESS;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getNumTraces
-* DESCRIPTION : gets the number of traces composing the trace group
-* ARGUMENTS :
-* RETURNS : number of traces composing the trace group
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTraceGroup::getNumTraces () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::getNumTraces()"<<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_traceVector size = "<<m_traceVector.size()<<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::getNumTraces()"<<endl;
-
- return m_traceVector.size();
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : addTrace
-* DESCRIPTION : adds a trace to the trace group
-* ARGUMENTS : trace - trace to be added to the trace group
-* RETURNS : SUCCESS on successful addition of trace
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-
-int LTKTraceGroup::addTrace(const LTKTrace& trace)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::addTrace()"<<endl;
-
- m_traceVector.push_back(trace);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::addTrace()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setAllTraces
-* DESCRIPTION : reassigns the trace vector member variable
-* ARGUMENTS : traceVector - vector of traces to be reassigned to
-* RETURNS : SUCCESS on successful reassignment
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-int LTKTraceGroup::setAllTraces(const LTKTraceVector& traceVector, float xScaleFactor,
- float yScaleFactor)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::setAllTraces()"<<endl;
-
- if (xScaleFactor <= 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_X_SCALE_FACTOR) <<
- "LTKTraceGroup::setAllTraces()"<<endl;
-
- LTKReturnError(EINVALID_X_SCALE_FACTOR);
- }
-
- if (yScaleFactor <= 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_Y_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_Y_SCALE_FACTOR) <<
- "LTKTraceGroup::setAllTraces()"<<endl;
-
- LTKReturnError(EINVALID_Y_SCALE_FACTOR);
- }
-
-
- m_traceVector = traceVector;
- m_xScaleFactor = xScaleFactor;
- m_yScaleFactor = yScaleFactor;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::setAllTraces()"<<endl;
-
- return SUCCESS;
-}
-
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 09-AUG-2005
-* NAME : emptyAllTraces
-* DESCRIPTION : To empty the trace vector
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void LTKTraceGroup::emptyAllTraces()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::emptyAllTraces()"<<endl;
-
- m_traceVector.clear();
- m_xScaleFactor = 1.0;
- m_yScaleFactor = 1.0;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::emptyAllTraces()"<<endl;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 18-Apr-2007
-* NAME : getScale
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-float LTKTraceGroup::getXScaleFactor() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::getXScaleFactor()"<<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::getXScaleFactor()"<<endl;
-
- return m_xScaleFactor;
-}
-
-
-/******************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 18-Apr-2007
-* NAME : getScale
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-float LTKTraceGroup::getYScaleFactor() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::getYScaleFactor()"<<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::getYScaleFactor()"<<endl;
-
- return m_yScaleFactor;
-}
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getBoundingBox
-* DESCRIPTION : gets the bounding box of the incoming trace group
-* ARGUMENTS : inTraceGroup - incoming trace group
-* RETURNS : SUCCESS on successful get operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-int LTKTraceGroup::getBoundingBox(float& outXMin,float& outYMin,
- float& outXMax,float& outYMax) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::getBoundingBox()"<<endl;
-
- int numTraces = getNumTraces(); // number of traces in the trace group
-
- int numPoints = -1; // number of points in a trace
-
- int pointIndex = -1; // variable to loop over points of a trace
-
- int errorCode;
-
- if ( numTraces == 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EEMPTY_TRACE_GROUP <<": "<<
- getErrorMessage(EEMPTY_TRACE_GROUP) <<
- "LTKTraceGroup::getBoundingBox()"<<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
-
- outXMin = outYMin = FLT_MAX;
- outXMax = outYMax = -FLT_MAX;
-
-
- for(int traceIndex = 0 ; traceIndex < numTraces; ++traceIndex)
- {
- const LTKTrace& tempTrace = m_traceVector[traceIndex];
-
- floatVector xVec;
-
- errorCode = tempTrace.getChannelValues(X_CHANNEL_NAME, xVec);
-
- if ( errorCode != SUCCESS )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: LTKTraceGroup::getBoundingBox()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- floatVector yVec;
- errorCode= tempTrace.getChannelValues(Y_CHANNEL_NAME, yVec);
- if ( errorCode != SUCCESS )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: LTKTraceGroup::getBoundingBox()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- numPoints = xVec.size();
-
- for(pointIndex =0 ; pointIndex < numPoints; pointIndex++)
- {
- float x,y;
-
- x = xVec[pointIndex];
- y = yVec[pointIndex];
-
-
- if ( x < outXMin )
- {
- outXMin = x;
- }
-
- if ( x > outXMax )
- {
- outXMax = x;
- }
-
- if ( y < outYMin )
- {
- outYMin = y;
- }
-
- if ( y > outYMax )
- {
- outYMax = y;
- }
- }
-
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::getBoundingBox()"<<endl;
-
-
- return SUCCESS;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : Bharath A.
-* DATE : 03-SEP-2007
-* NAME : scale
-* DESCRIPTION : scales the tracegroup according to the x and y scale factors.
-* After scaling, the tracegroup is translated in order to
-* preserve the "cornerToPreserve".
-* ARGUMENTS : xScaleFactor - factor by which x dimension has to be scaled
-* yScaleFactor - factor by which y dimension has to be scaled
-* cornerToPreserve - corner to be retained after scaling
-* RETURNS : SUCCESS on successful scale operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKTraceGroup::scale(float xScaleFactor, float yScaleFactor,
- TGCORNER cornerToPreserve)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::scale()"<<endl;
-
-
-
- LTKTrace trace;
- vector<LTKTrace> scaledTracesVec; // holds the scaled traces
-
- floatVector scaledXVec; // scaled x channel values of a trace
- floatVector scaledYVec; // scaled y channel values of a trace
-
- float x=0.0f;
- float y=0.0f;
- float xToPreserve=0.0f;
- float yToPreserve=0.0f;
- float xMin=0.0f;
- float yMin=0.0f;
- float xMax=0.0f;
- float yMax=0.0f;
-
- int numTraces=0;
- int traceIndex=0;
- int index=0;
- int numPoints=0;
- int errorCode=0;
-
- if(xScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_X_SCALE_FACTOR) <<
- "LTKTraceGroup::scale()"<<endl;
-
- LTKReturnError(EINVALID_X_SCALE_FACTOR);
- }
-
- if(yScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_Y_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_Y_SCALE_FACTOR) <<
- "LTKTraceGroup::scale()"<<endl;
-
- LTKReturnError(EINVALID_Y_SCALE_FACTOR);
- }
-
- errorCode = getBoundingBox(xMin, yMin, xMax, yMax);
-
- if( errorCode != SUCCESS )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: LTKTraceGroup::scale()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- switch ( cornerToPreserve )
- {
-
- case XMIN_YMIN:
-
- xToPreserve = xMin;
- yToPreserve = yMin;
-
- break;
-
- case XMIN_YMAX:
-
- xToPreserve=xMin;
- yToPreserve=yMax;
-
- break;
-
-
- case XMAX_YMIN:
-
- xToPreserve=xMax;
- yToPreserve=yMin;
-
- break;
-
-
- case XMAX_YMAX:
- xToPreserve=xMax;
- yToPreserve=yMax;
-
- break;
-
-
- default: break;//define an exception enum input validation
-
- }
-
- numTraces = getNumTraces();
- for(traceIndex=0; traceIndex < numTraces; ++traceIndex)
- {
-
- getTraceAt(traceIndex, trace);
-
- floatVector xVec;
-
- //no error handling required as the bounding box is found
- trace.getChannelValues(X_CHANNEL_NAME, xVec);
-
-
- floatVector yVec;
-
- trace.getChannelValues(Y_CHANNEL_NAME, yVec);
-
-
- numPoints = xVec.size();
-
- for(index=0; index < numPoints; ++index)
- {
- //the additive term is to translate back the scaled tracegroup
- //so that the corner asked for is preserved
- x= ( (xVec.at(index)*xScaleFactor)/m_xScaleFactor) +
- (xToPreserve*(1-(xScaleFactor/m_xScaleFactor)) );
-
- scaledXVec.push_back(x);
-
- //the additive term is to translate back the scaled tracegroup
- //so that the corner asked for is preserved
- y= ( (yVec.at(index)*yScaleFactor)/m_yScaleFactor) +
- (yToPreserve*(1-(yScaleFactor/m_yScaleFactor)) );
-
- scaledYVec.push_back(y);
- }
-
-
- trace.reassignChannelValues(X_CHANNEL_NAME, scaledXVec);
-
- trace.reassignChannelValues(Y_CHANNEL_NAME, scaledYVec);
-
- scaledXVec.clear();
-
- scaledYVec.clear();
-
- scaledTracesVec.push_back(trace);
-
- }
-
- m_traceVector = scaledTracesVec;
-
- m_xScaleFactor = xScaleFactor;
- m_yScaleFactor = yScaleFactor;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::scale()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Bharath A.
-* DATE : 03-SEP-2007
-* NAME : translateTo
-* DESCRIPTION : translates the tracegroup so that the "referenceCorner" is
- moved to (x,y)
-* ARGUMENTS : x: x value of point to which referenceCorner has to be moved
-* y: y value of point to which referenceCorner has to be moved
-* referenceCorner - the reference corner in the tracegroup that
- has to be moved to (x,y)
-* RETURNS : SUCCESS on successful translation operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-int LTKTraceGroup::translateTo(float x,float y,TGCORNER referenceCorner)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::translateTo()"<<endl;
-
- LTKTrace trace;
-
- vector<LTKTrace> translatedTracesVec; // holds the translated traces
-
- floatVector translatedXVec; // translated x channel values of a trace
- floatVector translatedYVec; // translated y channel values of a trace
-
- float xValue, yValue;
- float xReference, yReference;
- float xMin=0.0f;
- float yMin=0.0f;
- float xMax=0.0f;
- float yMax=0.0f;
-
- int errorCode;
- int traceIndex, index;
- int numPoints;
-
-
- if((errorCode = getBoundingBox(xMin,yMin,xMax,yMax))!=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: LTKTraceGroup::translateTo()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- switch(referenceCorner)
- {
-
- case XMIN_YMIN:
-
- xReference=xMin;
- yReference=yMin;
- break;
-
- case XMIN_YMAX:
-
- xReference=xMin;
- yReference=yMax;
-
- break;
-
-
- case XMAX_YMIN:
-
- xReference=xMax;
- yReference=yMin;
-
- break;
-
-
- case XMAX_YMAX:
- xReference=xMax;
- yReference=yMax;
-
- break;
-
-
- default: break;//define an exception
-
- }
-
- int numTraces = getNumTraces();
- for(traceIndex=0; traceIndex < numTraces; ++traceIndex)
- {
- getTraceAt(traceIndex, trace);
-
- floatVector xVec;
-
- //no error handling required as the bounding box is found
- trace.getChannelValues(X_CHANNEL_NAME, xVec);
-
-
- floatVector yVec;
-
- trace.getChannelValues(Y_CHANNEL_NAME, yVec);
-
-
- numPoints = xVec.size();
-
- for(index=0; index < numPoints; index++)
- {
-
- xValue=xVec.at(index)+(x-xReference);
- translatedXVec.push_back(xValue);
-
- yValue=yVec.at(index)+(y-yReference);
- translatedYVec.push_back(yValue);
-
- }
-
- trace.reassignChannelValues(X_CHANNEL_NAME,translatedXVec);
-
- trace.reassignChannelValues(Y_CHANNEL_NAME,translatedYVec);
-
- translatedXVec.clear();
-
- translatedYVec.clear();
-
- translatedTracesVec.push_back(trace);
-
- }
-
- m_traceVector=translatedTracesVec;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exit: LTKTraceGroup::translateTo()"<<endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A.
-* DATE : 03-SEP-2007
-* NAME : affineTransform
-* DESCRIPTION : scales the tracegroup according to the x and y scale factors.
-* After scaling, the "referenceCorner" of the tracegroup is translated to
-* (translateToX,translateToY)
-* ARGUMENTS : xScaleFactor - factor by which x dimension has to be scaled
-* yScaleFactor - factor by which y dimension has to be scaled
-* referenceCorner - corner to be retained after scaling and moved to (translateToX,translateToY)
-* RETURNS : SUCCESS on successful scale operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKTraceGroup::affineTransform(float xScaleFactor,float yScaleFactor,
- float translateToX,float translateToY,
- TGCORNER referenceCorner)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::translateTo()"<<endl;
-
- LTKTrace trace;
-
- vector<LTKTrace> scaledTracesVec; // holds the scaled traces
-
- floatVector scaledXVec; // scaled x channel values of a trace
- floatVector scaledYVec; // scaled y channel values of a trace
-
- float x, y;
- float xReference, yReference;
- float xMin=0.0f;
- float yMin=0.0f;
- float xMax=0.0f;
- float yMax=0.0f;
-
- int traceIndex, index;
- int errorCode;
- int numPoints;
-
- if(xScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_X_SCALE_FACTOR) <<
- "LTKTraceGroup::scale()"<<endl;
-
- LTKReturnError(EINVALID_X_SCALE_FACTOR);
- }
-
- if(yScaleFactor <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<EINVALID_X_SCALE_FACTOR <<": "<<
- getErrorMessage(EINVALID_X_SCALE_FACTOR) <<
- "LTKTraceGroup::scale()"<<endl;
-
- LTKReturnError(EINVALID_Y_SCALE_FACTOR);
- }
-
- if((errorCode = getBoundingBox(xMin,yMin,xMax,yMax))!=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: LTKTraceGroup::affineTransform()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- switch(referenceCorner)
- {
-
- case XMIN_YMIN:
-
- xReference=xMin;
- yReference=yMin;
- break;
-
- case XMIN_YMAX:
-
- xReference=xMin;
- yReference=yMax;
-
- break;
-
- case XMAX_YMIN:
-
- xReference=xMax;
- yReference=yMin;
-
- break;
-
- case XMAX_YMAX:
- xReference=xMax;
- yReference=yMax;
-
- break;
-
- default: break;//define an exception
-
- }
-
- int numTraces = m_traceVector.size();
- for(traceIndex=0; traceIndex < numTraces; ++traceIndex)
- {
- getTraceAt(traceIndex, trace);
-
- floatVector xVec;
-
- //no error handling required as the bounding box is found
- trace.getChannelValues(X_CHANNEL_NAME, xVec);
-
-
- floatVector yVec;
-
-
- trace.getChannelValues(Y_CHANNEL_NAME, yVec);
-
-
- numPoints = xVec.size();
-
- for(index=0; index < numPoints; index++)
- {
- //the additive term is to translate back the scaled tracegroup
- //so that the corner asked for is preserved at the destination
- //(translateToX,translateToY)
- x = ( (xVec.at(index) * xScaleFactor)/m_xScaleFactor) +
- (translateToX - (xReference*(xScaleFactor/m_xScaleFactor)) );
-
- scaledXVec.push_back(x);
-
- //the additive term is to translate back the scaled tracegroup
- //so that the corner asked for is preserved at the destination
- //(translateToX,translateToY)
- y= ( (yVec.at(index) * yScaleFactor)/m_yScaleFactor) +
- (translateToY - (yReference*(yScaleFactor/m_yScaleFactor)));
-
- scaledYVec.push_back(y);
-
- }
-
- trace.reassignChannelValues(X_CHANNEL_NAME,scaledXVec);
-
- trace.reassignChannelValues(Y_CHANNEL_NAME,scaledYVec);
-
- scaledXVec.clear();
-
- scaledYVec.clear();
-
- scaledTracesVec.push_back(trace);
-
- }
-
-
- m_traceVector = scaledTracesVec;
-
- m_xScaleFactor = xScaleFactor;
- m_yScaleFactor = yScaleFactor;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enter: LTKTraceGroup::affineTransform()"<<endl;
-
- return SUCCESS;
-}
-
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKTraceGroup
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-LTKTraceGroup::~LTKTraceGroup()
-{
-
-}
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 30-01-2007
- * NAME : checkEmptyTraces
- * DESCRIPTION : This method checks for empty traces
- * ARGUMENTS : inTraceGroup : LTKTraceGroup :
- * RETURNS : 1 if it contains empty trace group, 0 otherwise
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-bool LTKTraceGroup::containsAnyEmptyTrace() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKTraceGroup::containsAnyEmptyTrace()" <<endl;
-
-
- const vector<LTKTrace>& tracesVec = getAllTraces(); //traces in trace group
-
- int numTraces = tracesVec.size();
-
- if(numTraces == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Numer of traces in the tracegroup=0 "
- " LTKTraceGroup::containsAnyEmptyTrace()" <<endl;
- return true;
- }
-
- for(int traceIndex=0; traceIndex < numTraces; ++traceIndex)
- {
- const LTKTrace& trace = tracesVec.at(traceIndex);
-
- if(trace.isEmpty())
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Trace is Empty "
- " LTKTraceGroup::containsAnyEmptyTrace()" <<endl;
- return true;
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKTraceGroup::containsAnyEmptyTrace()" <<endl;
- return false;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/common.pro
deleted file mode 100644
index 4c049058..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/common/common.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-BASE_TARGET_NAME = ltkcommon
-include(../lipilib.pri)
-
-INCLUDEPATH += \
- ../util/lib
-
-SOURCES += \
- LTKCaptureDevice.cpp \
- LTKChannel.cpp \
- LTKException.cpp \
- LTKScreenContext.cpp \
- LTKTrace.cpp \
- LTKTraceFormat.cpp \
- LTKTraceGroup.cpp
-
-include(../include/headers.pri)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h
deleted file mode 100644
index 5acb9838..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKCaptureDevice.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ******************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of LTKCaptureDevice which holds the information about
- * the digitizer.
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- *****************************************************************************/
-
-#ifndef __LTKCAPTUREDEVICE_H
-#define __LTKCAPTUREDEVICE_H
-
-#include "LTKInc.h"
-
-/**
- * @class LTKCaptureDevice
- * <p> This class contains meta-data about hardware that was used to acquire
- * the ink contained in a file. </p>
- */
-
-class LTKCaptureDevice
-{
-private:
-
- int m_samplingRate; // sampling rate of the device
-
- int m_xDpi; // horizontal direction resolution of the device
-
- int m_yDpi; // vertical direction resolution of the device
-
- float m_latency; // interval between the time of actual input
- // to that of its registration
-
- bool m_isUniformSamplingRate; // flag to indicate if the sampling is uniform
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKCaptureDevice();
-
- /**
- * This constrcutor takes various paramaters about a digitizer.
- * @param sRate The sampling rate of bits
- * @param uniform Indicates the consistency of sampling rate
- * @param lVaue Device latency (in milliseconds) that applies to all channels
- * @param xDpi Dots per inch in horizontal direction.
- * @param yDpi Dots per inch in vertical direction.
- */
-
- LTKCaptureDevice(int sRate, bool uniform, float lValue, int xDpi, int yDpi);
-
- /**
- * Copy constructor
- */
-
- LTKCaptureDevice(const LTKCaptureDevice& captureDevice);
-
- /** Destructor */
-
- ~LTKCaptureDevice();
-
- // @}
-
- /**
- * @name Assignment operator
- */
- // @{
-
- /**
- * Assignment operator
- * @param captureDevice The object that has to be copied by assignment
- *
- * @return LTKCaptureDevice object
- */
-
- LTKCaptureDevice& operator=(const LTKCaptureDevice& captureDevice);
- // @}
-
- /**
- * @name Getter Functions
- */
- // @{
-
- /**
- * This function returns the sampling rate measured in samples/sec
- * @param void
- *
- * @return Sampling rate of bits.
- */
-
- int getSamplingRate() const;
-
- /**
- * This fucntion returns the latency of the real-time channel,
- * in msec, from physical action to the API time stamp.
- * @param void
- *
- * @return Basic device latency in milli seconds.
- */
-
- float getLatency() const;
-
- /**
- * This function returns dots per inch in X direction.
- * @param void
- *
- * @return X dpi of the device
- */
-
- int getXDPI() const;
-
- /**
- * This function returns dots per inch in Y direction.
- * @param void
- *
- * @return Y dpi of the device
- */
-
- int getYDPI() const;
-
- /**
- * This function returns a boolean to indicate if the sampling rate is
- * regular or irregular
- * @param void
- *
- * @return If the device samples the points uniformly or non-uniformly
- */
-
- bool isUniformSampling() const;
- // @}
-
- /**
- * @name Setter Functions
- */
- // @{
-
- /**
- * This function sets the sampling rate of the device
- * @param samplingRate Sampling rate of the device
- *
- * @return SUCCESS on successful set operation
- */
-
- int setSamplingRate(int samplingRate);
-
- /**
- * This fucntion returns the latency of the outputs from the device
- * in msec, from physical action to the API time stamp.
- * @param latency Latency of the device
- *
- * @return SUCCESS on successful set operation
- */
-
- int setLatency(float latency);
-
- /**
- * This function sets the boolean to indicate the consistency of sampling rate.
- * @param isUniform True if sampling ir regular, False if irregular
- *
- * @return SUCCESS on successful set operation
- */
-
- void setUniformSampling(bool isUniform);
-
- /**
- * This function sets the value for dots per inch to be taken in X direction.
- * @param xDpi The dots per inch in X direction.
- *
- * @return SUCCESS on successful set operation
- */
-
- int setXDPI(int xDpi);
-
- /**
- * This function sets the value for dots per inch to be taken in Y diretion.
- * @param yDpi The dots per inch in Y direction.
- *
- * @return SUCCESS on successful set operation
- */
-
- int setYDPI(int yDpi);
- // @}
-
-};
-
-#endif
-
-//#ifndef __LTKCAPTUREDEVICE_H
-//#define __LTKCAPTUREDEVICE_H
-
-
-
-
-
-
-
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKChannel.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKChannel.h
deleted file mode 100644
index e5328bfd..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKChannel.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definition of LTKChannel which has the description of a particular
- input stream like x-coordinate stream, y-coordinate stream,
- time, pressure etc.
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKCHANNEL_H
-#define __LTKCHANNEL_H
-
-#include "LTKTypes.h"
-
-/**
-* @ingroup Common_Classes
-*/
-
-/** @brief Stores information about a channel,whose value is captured by a digitizer.
- * @class LTKChannel
- * <p> Channels captured by a digitizer can have different data types. The memory storage for the
- * data types of these channels is thus different.
- * LIPI Toolkit requires coordinates to have "float" data type to have same memory allocation
- * for coordinate values. </p>
- *
- * <p> In order to retain the information about a channel,name, datatype, and a boolean (to indicate
- * if the channel is Regular or Intermittent) are stored in this class. </p>
- *
- * <p> LTKChannel class object has to be created prior to any request for recognition. These
- * objects are stored in LTKTraceFormat class. </p>
- *
- * @see LTKTraceFormat
- *
- */
-
-
-class LTKChannel
-{
-private:
-
- string m_channelName; // logical name of the channel
-
- ELTKDataType m_channelType; // data type of values obtained from channel
-
- bool m_isRegularChannel; // flag to indicate if a value for the channel
- // is available at every sampling instance
-
-public:
-
- /** @name Constructors and Destructor */
-
- //@{
-
- /**
- * Default Constructor.
- */
-
- LTKChannel();
-
-
- LTKChannel(const string& channelName);
-
- /**
- * This constructor initializes the members of the class
- * @param channelName Name of the channel
- * @param ELTKDataType Data type of the channel is stored. This is stored only for information.
- * Internally all channel values are stored as float.
- * @param isRegular Boolean variable that indicates if the channel is Regular or Intermittent.
- *
- */
-
- LTKChannel(const string& channelName, ELTKDataType channelType, bool isRegular);
-
- /**
- * Copy Constructor
- */
-
- LTKChannel(const LTKChannel& channel);
-
- /**
- * Destructor
- */
-
- ~LTKChannel();
- //@}
-
- /**
- * @name Assignment operator
- */
- //@{
-
- /**
- * Assignment operator
- * @param channelObj The object to be copied by assignment
- *
- * @return LTKChannel object
- */
-
- LTKChannel& operator=(const LTKChannel& channel);
- //@}
-
- /**
- * @name Getter Functions
- */
- //@{
-
- /**
- * This method returns data type of a channel
- * @param void
- *
- * @return enum data type of ELTKDataType .
- */
-
- ELTKDataType getChannelType() const;
-
- /**
- * This method returns name of the channel.
- * @param void
- *
- * @return name of the channel.
- */
-
- string getChannelName() const;
-
- /**
- * This method returns a boolen to indicate if the channel is regular or intermittent.
- * @param void
- *
- * @return True if channel is Regular, False if channel is Intermittent.
- */
-
- bool isRegularChannel() const;
- //@}
-
- /**
- * @name Setter Functions
- */
- //@{
-
- /**
- * This method sets the type of a channel
- * @param channelType The channel type passed should belong to ELTKDataType.
- *
- * @return SUCCESS on successful set operation
- */
-
- void setChannelType(ELTKDataType channelType);
-
- /**
- * This method sets the channel name
- * @param channelName The name of the channel which a digitizer can capture.
- *
- * @return SUCCESS on successful set operation
- */
-
- int setChannelName(const string& channelName);
-
- /**
- * This method sets a boolean to indicate if the channel is Regular or Intermittent.
- * @param isRegular boolean value to indicate if the channel is Regular or Intermittent.
- *
- * @return SUCCESS on successful set operation
- */
-
- void setRegularChannel(bool isRegular);
- //@}
-
-};
-
-#endif
-
-//#ifndef __LTKCHANNEL_H
-//#define __LTKCHANNEL_H
-
-
-
-
-
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h
deleted file mode 100644
index 745b0bf0..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKClassifierDefaults.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-11-24 17:23:35 +0530 (Tue, 24 Nov 2009) $
- * $Revision: 792 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of all classifier config variables (default) settings
- * CONTENTS:
- * AUTHOR: Balaji MNA
- * DATE: 22-Nov-2008
- * CHANGE HISTORY:
- * Author Date Description of change
- * Balaji MNA 22-Nov-2008 [LIPTKT-405] Cleaning up LTKPreprocDefaults
- ************************************************************************/
-
-#ifndef __CLASSIFIERDEFAULTS_H__
-#define __CLASSIFIERDEFAULTS_H__
-
-#define PREPROC_DEF_TRACE_DIMENSION 60
-#define PREPROC_DEF_RESAMPLINGMETHOD "lengthbased"
-#define PREPROC_DEF_SIZE_THRESHOLD 0.01f
-#define PREPROC_DEF_PRESERVE_ASPECT_RATIO true
-#define PREPROC_DEF_ASPECTRATIO_THRESHOLD 3.0f
-#define PREPROC_DEF_PRESERVE_RELATIVE_Y_POSITION false
-#define PREPROC_DEF_SMOOTHFILTER_LENGTH 3
-#define NN_DEF_PREPROC_SEQ "{CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}"
-#define NN_DEF_PROTOTYPESELECTION "hier-clustering"
-#define NN_DEF_PROTOTYPEREDUCTIONFACTOR -1
-#define NN_DEF_FEATURE_EXTRACTOR "PointFloatShapeFeatureExtractor"
-#define NN_DEF_DTWEUCLIDEANFILTER -1
-#define NN_DEF_REJECT_THRESHOLD 0.001
-#define NN_DEF_NEARESTNEIGHBORS 1
-#define NN_DEF_PROTOTYPEDISTANCE "dtw"
-#define NN_DEF_BANDING 0.33
-
-//ActiveDTW parameters
-#define ACTIVEDTW_DEF_PERCENTEIGENENERGY 90
-#define ACTIVEDTW_DEF_EIGENSPREADVALUE 16
-#define ACTIVEDTW_DEF_USESINGLETON true
-#define ACTIVEDTW_DEF_DTWEUCLIDEANFILTER 100
-
-#define NEURALNET_DEF_NORMALIZE_FACTOR 10.0
-#define NEURALNET_DEF_RANDOM_NUMBER_SEED 426
-#define NEURALNET_DEF_LEARNING_RATE 0.5
-#define NEURALNET_DEF_MOMEMTUM_RATE 0.25
-#define NEURALNET_DEF_TOTAL_ERROR 0.00001
-#define NEURALNET_DEF_INDIVIDUAL_ERROR 0.00001
-#define NEURALNET_DEF_HIDDEN_LAYERS_SIZE 1
-#define NEURALNET_DEF_HIDDEN_LAYERS_UNITS 25
-#define NEURALNET_DEF_MAX_ITR 100
-#endif //#ifdef __CLASSIFIERDEFAULTS_H__
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h
deleted file mode 100644
index 3307ae9a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKErrorsList.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-11-24 17:23:35 +0530 (Tue, 24 Nov 2009) $
- * $Revision: 792 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR: Vijayakumara M.
- *
- * DATE: 01-Sept-2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef _LTK_ERRORS_LIST_H__
-#define _LTK_ERRORS_LIST_H__
-
-/**
-* @ingroup util
-*/
-
-/** @file LTKErrorsList.h
-* @brief Contains the error macors used in Lipitk
-*/
-
-
-// File related errors.
-#define EINK_FILE_OPEN 100 /**< @brief Ink File Open Error. */
-#define ECONFIG_FILE_OPEN 101 /**< @brief Unable to open the .cfg file. */
-#define EHEADER_INFO_FILE_OPEN 102 /**< @brief Header information file open error */
-#define EMODEL_DATA_FILE_OPEN 103 /**< @brief Model Data file open error. */
-#define ETRAINLIST_FILE_OPEN 104 /**< @brief Training List file open error. */
-#define EMODEL_DATA_FILE_FORMAT 105 /**< @brief Model Data file is not in the format. */
-#define EINVALID_INPUT_FORMAT 106 /**< @brief Model Data file has been corrupted. */
-
-//dll related errors
-#define ELOAD_SHAPEREC_DLL 107 /**< @brief Error while Loading the shaperecognizer dll/so */
-#define ELOAD_WORDREC_DLL 108 /**< @brief Error while Loading the wordrecognizer dll/so */
-#define ELOAD_PREPROC_DLL 109 /**< @brief Error while Loading the preprocessing dll/so */
-#define EDLL_FUNC_ADDRESS 110 /**< @brief Unable to Get the function address in dll. */
-#define ECREATE_SHAPEREC 111 /**< @brief Unable to create the shaperecognizer instance. */
-#define ECREATE_WORDREC 112 /**< @brief Unable to create the wordrecognizer instance. */
-#define ECREATE_PREPROC 113 /**< @brief Unable to crete the preprocessing instance. */
-
-// Path set related errors.
-#define ELIPI_ROOT_PATH_NOT_SET 114 /**< @brief Lipi root path is not set */
-#define EINVALID_PROJECT_NAME 115 /**< @brief Invalid Project name given in command prompt. */
-#define EINVALID_CONFIG_ENTRY 116 /**< @brief Invalid configuration entry in cfg file */
-#define ENO_SHAPE_RECOGNIZER 117 /**< @brief Shape Reconginer is not entered in the cfg file. */
-#define ENO_WORD_RECOGNIZER 118 /**< @brief word Reconginer is not entered in the cfg file. */
-
-//Invalid Values
-#define EINVALID_NUM_OF_TRACES 119 /**< @brief Invalide number of traces processed. */
-#define EINVALID_NUM_OF_SHAPES 120 /**< @brief Invalid value for number of shapes. */
-#define EINVALID_TRACE_DIMENTION 121 /**< @brief Invalid value for Trace Dimension. */
-#define EINVALID_NUMEIGENVECTOR 122 /**< @brief Invalid value for EigenVectors. */
-#define EINVALID_FLOAT_SIZE 123 /**< @brief Invalid size of flaot in Model data header in model data file. */
-#define EINCOMPATIBLE_VERSION 124 /**< @brief Incompatible algorithm version number. */
-#define EINVALID_PREPROC_SEQUENCE 125 /**< @brief Preproccessing sequence error. */
-
-//General errors
-#define ENO_TOKEN_FOUND 126 /**< @brief No token found, invalid entry for project name */
-#define EINVALID_LOGICAL_NAME 127 /**< @brief Invalide Logical Name entered in project.cfg file. */
-
-#define EINVALID_SEGMENT 128 /**< @brief Only Boxed Recognition is supported */
-#define EINVALID_REC_MODE 129 /**< @brief Unsupported reccognizer mode */
-
-#define EUNSUPPORTED_STATISTICS 130 /**< @brief Bad name for the statistics to be computed */
-
-#define EMAP_NOT_FOUND 131 /**< @brief The function is not implemented for shape recognizer project */
-#define EINVALID_SHAPEID 132 /**< @brief Invalid value for shapID. */
-
-#define ENOMAPFOUND_LIPIENGINECFG 133 /**< @brief Cannot map the logical name, no entries in lipiengine.cfg */
-#define EINVALID_NUM_OF_POINTS 134 /**< @brief Number of points in the tracegroup is not normalized */
-#define EEMPTY_TRACE 135 /**< @brief Number of points in the trace is zero */
-#define EEMPTY_TRACE_GROUP 136 /**< @brief Number of traces in the trace group is zero */
-#define ECONFIG_FILE_RANGE 137 /**< @brief The config file variable is not within the correct range */
-
-#define EINITSHAPE_NONZERO 138 /**< @brief Intial shape id is not zero. */
-#define EINVALID_LINE_LISTFILE 139 /**< @brief Invalid line in the listfile (train or test ) */
-#define EINVALID_ORDER_LISTFILE 140 /**< @brief Invalid order of shape-ids in the list file ( train ). */
-#define ENUM_NNS 141 /**< @brief Invalid number of nearest neighbours specified */
-
-
-#define EINKFILE_EMPTY 142 /**< @brief Ink file name is empty */
-#define EINKFILE_CORRUPTED 143 /**< @brief ERROR: Incorrect or corrupted unipen ink file. */
-#define EDLL_FUNC_ADDRESS_CREATE 144 /**< @brief Unable to Get the create function address in dll. */
-#define EDLL_FUNC_ADDRESS_DELETE 145 /**< @brief Unable to Get the delete function address in dll. */
-#define ENO_RESAMPLETRACEGROUP 146 /**< @brief No ResampleTraceGroup in preProcSequence of cfg file */
-
-#define EINVALID_SAMPLING_RATE 147 /**< @brief Sampling rate cannot be negative */
-#define EINVALID_X_RESOLUTION 148 /**< @brief m_xDpi values cannot be negative */
-#define EINVALID_Y_RESOLUTION 149 /**< @brief m_yDpi values cannot be negative */
-#define EINVALID_LATENCY 150 /**< @brief m_latency cannot be negative */
-#define EPOINT_INDEX_OUT_OF_BOUND 151 /**< @brief Point index greater than number of points available */
-#define ECHANNEL_INDEX_OUT_OF_BOUND 152 /**< @brief Invalid Channel */
-#define ECHANNEL_SIZE_MISMATCH 153 /**< @brief New channel data not as long as the old one */
-#define ENUM_CHANNELS_MISMATCH 154 /**< @brief Point to be added does not have the same number of channels as the trace */
-#define EDUPLICATE_CHANNEL 155 /**< @brief Channel with the new channel name already present */
-#define ECHANNEL_NOT_FOUND 156 /**< @brief Channel not found */
-#define EZERO_CHANNELS 157 /**< @brief Number of channels cannot be zero */
-#define EINVALID_INPUT_STREAM 158 /**< @brief Input stream does not match with number of channels in the trace */
-#define ECOMPUTE_DISTANCE_ERROR 159 /**< @brief Error: Cannot find distance for test sample with more than 1 stroke */
-#define ECOMPARISON_ERROR 160 /**< @brief Error: Cannot compare with train sample having more than 1 stroke */
-#define ETRAIN_TEST_VECTOR_SIZE_MISMATCH 161 /**< @brief Incompatible: train vector and test vector sizes do not match */
-#define EGRAMMER_FILE_NOT_EXIST 162 /**< @brief Grammar file does not exists */
-#define EVALUES_NOT_PROVIDED 163 /**< @brief Values for the terminal is not Provided */
-#define ECONFIG_FILE_FORMAT 164 /**< @brief No productions or terminals identified in the CFG. Please check the CFG format */
-#define ECYCLIC_DEPENDENCY 165 /**< @brief Cyclic dependency exists! Unable to find paths */
-#define EFILE_OPEN_ERROR 166 /**< @brief Failed to open file */
-
-//Feature extractor errors
-#define ELOAD_FEATEXT_DLL 167 /**< @brief Error while Loading the Feature Extractor dll/so */
-#define EDLL_FUNC_ADDRESS_CREATE_FEATEXT 168 /**< @brief Unable to Get the create function address in Featuer extractor dll */
-#define EDLL_FUNC_ADDRESS_DELETE_FEATEXT 169 /**< @brief Unable to Get the delete function address in Featuer extractor dll */
-#define EFTR_EXTR_NOT_EXIST 170 /**< @brief Unable to find the feature extractor code */
-#define ENO_FTR_EXTR_IN_CFG 171 /**< @brief No Feature Extractor in Config file */
-#define EFTR_RPRCLASS_NOIMPLEMENTATION 172 /**< @brief No implementation provided */
-#define EINVALID_ORDER_FEATUREFILE 173 /**< @brief Invalid order of shape-ids in the Feature file. */
-
-#define ENUMSHAPES_NOT_SET 174 /**< @brief Error code when the NumShapes config value is not set */
-#define EUNEQUAL_LENGTH_VECTORS 175
-#define EINVALID_LOG_LEVEL 176
-#define EPROJ_NOT_DYNAMIC 177 /**< @brief Not allowed to ADD/Delete shape to project with Fixed number of Shapes */
-#define EMORPH_FVEC_SIZE_MISMATCH 178 /*Error: Cannot perform MORPH on features vectors of different sizes*/
-#define ESHAPE_RECOCLASS_NOIMPLEMENTATION 179 /*No implementation provided*/
-
-#define ENULL_POINTER 180 /*Null Pointer*/
-
-#define EINVALID_X_SCALE_FACTOR 181 /**< @brief Invalid X scale factor. Scale factor must be greater than zero */
-#define EINVALID_Y_SCALE_FACTOR 182 /**< @brief Invalid Y scale factor. Scale factor must be greater than zero */
-#define ECONFIG_MDT_MISMATCH 183 /**< @brief Parameter values in config file and MDT file do not match */
-#define ENEIGHBOR_INFO_VECTOR_EMPTY 184 /* "Distance Index Pair is empty"*/
-#define ERECO_RESULT_EMPTY 185 /*"Recognize result is empty"*/
-#define ESHAPE_SAMPLE_FEATURES_EMPTY 186/* "Features of input TraceGroup is empty"*/
-#define ENO_TOOLKIT_VERSION 187 /* Tookit version not specified */
-#define ETRACE_INDEX_OUT_OF_BOUND 188
-#define EINVALID_CFG_FILE_ENTRY 189
-#define EKEY_NOT_FOUND 190
-#define EFEATURE_INDEX_OUT_OF_BOUND 191
-
-
-#define EINVALID_FILE_HANDLE 192
-#define EFEATURE_FILE_OPEN 193 /**< @brief Feature file open error. */
-#define EFTR_DISTANCE_NOT_DEFINED 194 /**< @brief Distance between the features not defined */
-#define EINVALID_CLUSTER_ID 195 /**< @brief Distance between the features not defined */
-#define EPROTOTYPE_SET_EMPTY 196 /**< @brief Distance between the features not defined */
-#define ELOG_FILE_NOT_EXIST 197
-
-//LTKHierarchicalClustering Errors
-#define EDATA_HYPERLINK_VEC_SIZE_MISMATCH 198 //**< @brief Size of the data objects vector and their corresponding hyperlinks vector do not match */
-#define EFILE_CREATION_FAILED 199 //**< @brief File creation failed. Invalid path or no permission. */
-#define EINVALID_NUM_CLUSTERS 200 //**< @brief Invalid number of clusters specified. The number must be greater than or equal to 1 and less than number of data objects. */
-#define ENO_DATA_TO_CLUSTER 201 //**< @brief No elements in the input data vector for clustering. */
-#define EINSUFFICIENT_DATA_FOR_LMETHOD 202 //**< @brief Minimum 6 data objects are required to employ LMethod. */
-
-
-#define EMODULE_NOT_IN_MEMORY 203 /**< @brief Module index not found in module vector*/
-#define EINVALID_LOG_FILENAME 204 /*Specified Log filename is empty*/
-#define ECREATE_LOGGER 205 /*Error creating logger*/
-#define EINVALID_PROJECT_TYPE 206 /**< @brief Project type in CFG is missing or an invalid value */
-
-#define EEMPTY_STRING 207 /**< @brief Empty string */
-#define EEMPTY_VECTOR 208 /**< @brief Empty vector */
-
-#define ENON_POSITIVE_NUM 209 /**< @brief Negative or zero value */
-#define EEMPTY_WORDREC_RESULTS 210 /**< @brief The word recogniton result vector is empty */
-#define ENEGATIVE_NUM 211 /**< @brief Negative value */
-
-
-#define EINVALID_CLASS_ID 212 //**< @brief Invalid Class ID . */
-
-#define EINVALID_CONFIDENCE_VALUE 213 //**< @brief Invalid Confidence Value. */
-
-#define ENO_SHAPE_RECO_PROJECT 214 //**< @brief Shape Recognizer Project name missing in the word recognizer config file.*/
-
-#define EINVALID_RECOGNITION_MODE 215 //**< @brief Unsupported recognition mode */
-
-#define ELOGGER_LIBRARY_NOT_LOADED 216
-
-#define ESINGLE_POINT_TRACE 217 //**< @brief Single point trace */
-
-//ActiveDTW Errors
-#define EEMPTY_FEATUREMATRIX 218 /**Feature Matrix is empty **/
-
-#define EEMPTY_COVARIANCEMATRIX 219 /**Covariance Matrix is empty **/
-
-#define EEMPTY_CLUSTERMEAN 220 /** Empty Cluster Mean **/
-
-#define EEMPTY_MEANCORRECTEDDATA 221 /**Empty Mean Corrected Data **/
-
-#define EINVALID_RANK 222 /** The rank value to compute eigen vectors is Invalid **/
-
-#define EINVALID_NUM_OF_EIGENVECTORS 223 /** The number of eigen vectors is Invalid **/
-
-#define EEMPTY_EIGENVALUES 224 /** Eigen values are empty **/
-
-#define EEMPTY_EIGENVECTORS 225 /** Eigen Vectors are empty **/
-
-#define ENUM_EIGVALUES_NOTEQUALTO_NUM_EIGVECTORS 226 /** Number of eigen values is not equal to number of eigen vectors **/
-
-#define EPROTOYPESHAPE_INDEX_OUT_OF_BOUND 227 /** Invalid Index of Prototype Shape Accessed **/
-
-#define EINVALID_NUM_SAMPLES 228 /** Invalid Number of Samples in Cluster **/
-
-#define EADAPTSCHEME_NOT_SUPPORTED 229 /** Adapt scheme not supported **/
-
-//sub stroke
-#define EINVALID_SLOPE_VECTOR_DIMENSION 230 //**< @brief Slope vector has a different dimension */
-#define EINVALID_SLOPE 231 //**< @brief Nagative Slope is not allowed */
-#define ENO_SUBSTROKE 232 //**< @brief Sample has no valied substroke */
-#define EINVALID_DIRECTION_CODE 233 //**< @brief Direction code can't be nagative*/
-#define EEMPTY_SLOPE_VECTOR 234 //**< @brif Empty slope vector*/
-#define ESINGLE_SUBSTROKES 235 //**< @brief Single substroke found from the ink file*/
-#define EINVALID_FEATURE_VECTOR_DIMENSION 236 //**< @brif Invalide Feature vector dimention*/
-#define ENUMBER_OF_SUBSTROKES 237 //**< @brif Number of sub-stroke is either zero or less*/
-
-#define EINVALID_NUM_OF_INPUT_NODE 238 /**< @brief Invalid value for number of input node. */
-#define EINVALID_NUM_OF_OUTPUT_NODE 239 /**< @brief Invalid value for number of output node. */
-#define EINVALID_NETWORK_LAYER 240 /**< @brief Network layer does not specified correctly. */
-
-#endif //#ifndef _LTK_ERRORS_LIST_H__
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKException.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKException.h
deleted file mode 100644
index 1914ffa9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKException.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of LTKException which holds error message of thrown error
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKEXCEPTION_H
-#define __LTKEXCEPTION_H
-
-#include "LTKInc.h"
-
-/** @defgroup Exceptions
-*/
-
-/** @ingroup Exceptions
-*/
-
-/**
- * @class LTKException
- * <p>This class is used to contain error message thrown during an exception. </p>
- */
-
-class LTKException
-{
-
-protected:
-
- int m_errorCode; // Error Code of the exception defined in LTKMacros.h
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKException ();
-
- /**
- * Initialization Constructor
- *
- * @param exceptionMsg - error message
- *
- */
-
- LTKException (int errorCode);
-
- /**
- * Destructor
- */
-
- ~LTKException ();
-
- //@}
-
- /**
- * @name Getter Functions
- */
-
- // @{
-
- /**
- * This method returns the error message embedded in the class object
- *
- * @return error message
- *
- */
-
- string getExceptionMessage() const;
-
- /**
- * This method returns the error code embedded in the class object
- *
- * @return error code
- *
- */
-
- int getErrorCode() const;
-
-
- // @}
-
-};
-
-#endif
-
-//#ifndef __LTKEXCEPTION_H
-//#define __LTKEXCEPTION_H
-
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKInc.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKInc.h
deleted file mode 100644
index 91fb8dd1..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKInc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-04-14 13:27:55 +0530 (Thu, 14 Apr 2011) $
- * $Revision: 847 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Contains list of standard include files
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- * Balaji, MNA 06 Jan, 2011 Macros defined in the file are moved to LTKMacros.h
- ************************************************************************/
-
-#ifndef __LTKINC_H
-#define __LTKINC_H
-
-#include <exception>
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-
-#include <algorithm>
-#include <string>
-#include <string.h>
-#include <vector>
-#include <list>
-#include <map>
-#include <numeric> //STLOPT
-#include <cstdlib>
-#include <cfloat>
-#include <cmath>
-#include <ctime>
-#include <limits.h>
-
-using namespace std;
-
-
-#endif //#ifndef __LTKINC_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h
deleted file mode 100644
index 04d315b9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLipiEngineInterface.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-18 15:41:43 +0530 (Tue, 18 Jan 2011) $
- * $Revision: 829 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Interface definition of LipiEngine interface
- *
- * CONTENTS:
- *
- *
- * AUTHOR: Thanigai Murugan K
- *
- * DATE: July 29 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LIPIENGINEINTERFACE_H_
-#define __LIPIENGINEINTERFACE_H_
-
-#include "LTKShapeRecognizer.h"
-#include "LTKWordRecognizer.h"
-#include "LTKRecognitionContext.h"
-
-class LTKLipiEngineInterface{
-public:
-
-
- virtual void setLipiRootPath(const string& appLipiPath)=0;
-
- virtual void setLipiLibPath(const string& appLipiLibPath)=0;
-
- virtual int setLipiLogFileName(const string& appLipiPath) = 0;
-
- virtual int setLipiLogLevel(const string& appLogLevel)=0;
-
- /* To initialize the lipiengine */
- virtual int initializeLipiEngine() = 0;
-
- /* use this to create shape recognizer object, by passing the logical project name */
- virtual int createShapeRecognizer(string &strLogicalProjectName, LTKShapeRecognizer** outShapeRecognizerPtr) = 0;
-
- /* use this to create shape recognizer object, by passing the project name and profile name*/
- virtual int createShapeRecognizer(const string& strProjectName,
- const string& strProfileName,
- LTKShapeRecognizer** outShapeRecognizerPtr) = 0;
-
- /* use this to delete the shape recognizer object created using createShapeRecognizer call */
- virtual int deleteShapeRecognizer(LTKShapeRecognizer*) = 0;
-
- /* use this to create word recognizer object, by passing the project name and profile name*/
- virtual int createWordRecognizer(const string& strProjectName,
- const string& strProfileName,
- LTKWordRecognizer** outWordRecPtr) = 0;
-
- /* use this to create word recognizer object, by passing the logical project name*/
- virtual int createWordRecognizer(const string& strlogicalProjectName,
- LTKWordRecognizer** outWordRecPtr) = 0;
-
- /* use this to delete the word recognizer object created using createShapeRecognizer call */
- virtual int deleteWordRecognizer(LTKWordRecognizer*) = 0;
-
-};
-
-#endif //#ifndef __LIPIENGINEINTERFACE_H_
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLogger.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLogger.h
deleted file mode 100644
index e0594d90..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLogger.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2007-09-12 15:47:40 +0530 (Wed, 12 Sep 2007) $
- * $Revision: 188 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of the Debug Logging Module
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef LTKLOGGER_H
-#define LTKLOGGER_H
-
-#include "LTKInc.h"
-#include "LTKLoggerInterface.h"
-
-/**
-* @ingroup util
-*/
-
-/** @brief A concrete class that implements the logger interface
-* @class LTKLogger
-*/
-class LTKLogger : public LTKLoggerInterface
-{
-
-private:
-
- EDebugLevel m_debugLevel; // log level which determines which log messages are to be written into the file
-
- string m_logFileName; // name of the log file
-
- ofstream m_logFile; // file pointer to the log file
-
- ofstream m_ofstream; // used to ignore messages with priority lower than defined by application
-
- ELogStatus m_logStatus; // status of logging - active or inactive
-
- bool m_isTimeStamped; // flag to indicate if time is to be printed on the log file along with log message
-
- static LTKLoggerInterface* loggerInstance;
-
- /**
- * This is a method which writes auxiliary information like date, time and line number
- * into the log file
- * @param lineNumber - line number of the log message
- * @return SUCCESS on successful writing of auxiliary information into log file
- */
-
- int writeAuxInfo(const string& fileName, int lineNumber);
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKLogger();
-
-public:
-
- static void destroyLoggerInstance();
-
- static LTKLoggerInterface* getInstance();
-
- /**
- * Destructor
- */
-
- virtual ~LTKLogger();
-
- // @}
-
- /**
- * @name Function call operator
- */
- //@{
-
- /**
- * Function call operator
- * @param debugLevel reference to the log level of the message
- * @param lineNumber source code line number of the log message
- *
- * @return reference to an output stream object
- */
-
- ostream& operator()(const EDebugLevel& debugLevel, const string& fileName, int lineNumber = 0);
-
- // @}
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * This is a method sets the log level of the messages to be considered for
- * redirecting to the log file
- * @param debugLevel log level of the messages to be considered
- * @return SUCCESS on successful set operation
- */
-
- int setLogLevel(const EDebugLevel& debugLevel);
-
- /**
- * This is a method sets the name of the log file to be used
- * @param logFileName Name of the log file to be used for logging
- * @param traceGroup trace group into which the ink file has to be read into
- * @return SUCCESS on successful set operation
- */
-
- void setLogFileName(const string& logFileName);
-
- /**
- * This is a method which returns the log level of the messages to be considered for
- * redirecting to the log file
- * @return the log level of the messages to be considered for redirecting to the log file
- */
-
- EDebugLevel getLogLevel();
-
- /**
- * This is a method which returns the name of the file logging is done into
- * @return the name of the file logging is done into
- */
-
- const string& getLogFileName() ;
-
- /**
- * This is a method which starts the logging operation
- * @return SUCCESS on successful start of logging
- */
-
- int startLog(bool timeStamp = true);
-
- /**
- * This method will stop the logging operation.
- * @return SUCCESS on successful start of logging
- */
-
- int stopLog();
-
- // @}
-
-
-};
-
-#endif
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h
deleted file mode 100644
index 8bd94b5e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKLoggerInterface.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2007-09-17 19:00:29 +0530 (Mon, 17 Sep 2007) $
- * $Revision: 209 $
- * $Author: madant $
- *
- ************************************************************************/
-
-#ifndef __LTKLoggerINTERFACE_H_
-#define __LTKLoggerINTERFACE_H_
-
-#include <ostream>
-
-using namespace std;
-
-class LTKLoggerInterface
-{
-public:
- // create dummy stream which just dumps all output
- // this is what we use if the DebugLevel is higher than the message importance
- // this stream sets a failbit and hence won't attempt to process it's input
-
- enum ELogStatus
- {
- INACTIVE,
- ACTIVE
- };
-
- /*
- description of the debug levels
- ALL writes all messages
- DEBUG writes DEBUG, INFO and ERR messages
- INFO writes INFO and ERR messages
- ERR writes ERROR messages
- OFF does not log any messages
- */
-
-
- enum EDebugLevel
- {
- LTK_LOGLEVEL_ALL,
- LTK_LOGLEVEL_VERBOSE,
- LTK_LOGLEVEL_DEBUG,
- LTK_LOGLEVEL_INFO,
- LTK_LOGLEVEL_ERR,
- LTK_LOGLEVEL_OFF
- };
-
-public:
-
- virtual ostream& operator()(const EDebugLevel& debugLevel, const string &fileName, int lineNumber = 0) = 0;
-
- virtual int setLogLevel(const EDebugLevel& debugLevel) = 0;
-
- /**
- * This is a method sets the name of the log file to be used
- * @param logFileName Name of the log file to be used for logging
- * @param traceGroup trace group into which the ink file has to be read into
- * @return SUCCESS on successful set operation
- */
-
- virtual void setLogFileName(const string& logFileName) = 0;
-
- /**
- * This is a method which returns the log level of the messages to be considered for
- * redirecting to the log file
- * @return the log level of the messages to be considered for redirecting to the log file
- */
-
- virtual EDebugLevel getLogLevel() = 0;
-
- /**
- * This is a method which returns the name of the file logging is done into
- * @return the name of the file logging is done into
- */
-
- virtual const string& getLogFileName() = 0 ;
-
- /**
- * This is a method which starts the logging operation
- * @return SUCCESS on successful start of logging
- */
-
- virtual int startLog(bool timeStamp = true) = 0;
-
- virtual int stopLog() = 0;
-
- /**
- * Pure Virtual Destructor
- */
- virtual ~LTKLoggerInterface(){};
-
-};
-
-#endif //#ifndef __LTKLoggerINTERFACE_H_
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKMacros.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKMacros.h
deleted file mode 100644
index b9cc072d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKMacros.h
+++ /dev/null
@@ -1,894 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 11:00:11 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 832 $
- * $Author: dineshm $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Contains common macro Definitions.
- *
- * CONTENTS:
- *
- * AUTHOR: Vijayakumara M.
- *
- * DATE: December 01, Aug, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- * Balaji, MNA 06 Jan, 2011 Macros defined in LTKInc.h are moved to this file
- ************************************************************************/
-
-#ifndef __COMMONMACORS_H
-#define __COMMONMACORS_H
-
-#include "LTKTypes.h"
-
-/** @file LTKmacros.h
-* @brief Contains the macors used in reco/shaperec/pca and reco/shaperec/dtw modules.
-*/
-//macors used in reco/shaperec/pca and reco/shaperec/dtw modules.
-
-/** @file LTKInc.h
-*/
-#define SUCCESS 0
-#define FAILURE 1
-
-#ifdef WIN32
- #define SEPARATOR "\\"
-#else
- #define SEPARATOR "/"
-#endif
-
-#define COMMENTCHAR '#'
-#define LIST_FILE_DELIMITER " \t\r"
-
-//#define LTKReturnError(error) errorCode = error; return error;
-#define LTKReturnError(error) return error;
-
-#define SHAPESETFILE "shapeset.cfg"
-#define PROFILEFILE "profile.cfg"
-#define WORDFILE "word.cfg"
-#define WORDPROFILEFILE "wordprofile.cfg"
-#define STATSFILE "stats.txt"
-#define NETWORKFILE "network.txt"
-#define MODELSLISTFILE "modelslist.txt"
-#define DICTIONARYFILE "dictionary.txt"
-
-//File Extensions
-#define CONFIGFILEEXT ".cfg"
-#define DATFILEEXT ".mdt"
-#define POSFILEEXT ".pos"
-
-#define PI 3.1415926F
-#define EPS 0.00001F
-#define EPS1 0.001F
-
-//Isolated character recognizers
-#define PCA "pca"
-#define DTW "dtw"
-#define POS "pos"
-#define ZONE "zone"
-#define HOLISTIC "holistic"
-#define BCC "bcc"
-#define EigDef "eigdef"
-#define NN "nn"
-#define HMM "hmm"
-#define ACTIVEDTW "activedtw"
-#define NEURALNET "neuralnet"
-
-//Feature Extractors
-#define POINT_FLOAT "pointfloat"
-#define SUBSTROKE "substroke"
-#define PARAMETRIC_CURVE "parametriccurve"
-#define L7 "l7"
-#define L7RADIUS "L7Radius"
-#define NPEN "npen"
-#define NPEN_WINDOW_SIZE "NPenWindowSize"
-#define RELHANDPOSSC "relhandpossc"
-
-//Word recognizers
-#define DP "dp"
-#define BOXFLD "boxfld"
-
-//PCA Config values
-#define REVERSEFEATUREVECTORS "ReverseFeatureVectors"
-#define TRACEDIMENSION "ResampTraceDimension"
-#define NUMEIGENVECTORS "NumEigenVectors"
-#define SIZETHRESHOLD "NormLineWidthThreshold"
-#define ASPECTRATIOTHRESHOLD "NormPreserveAspectRatioThreshold"
-#define DOTTHRESHOLD "NormDotSizeThreshold"
-#define LOOPTHRESHOLD "LoopThreshold"
-#define HOOKLENGTHTHRESHOLD1 "HookLengthThreshold1"
-#define HOOKLENGTHTHRESHOLD2 "HookLengthThreshold2"
-#define HOOKANGLETHRESHOLD "HookAngleThreshold"
-#define SMOOTHFILTERLENGTH "SmoothWindowSize"
-#define DISTANCEMEASURE "DistanceMeasure"
-#define QUANTIZATIONSTEP "QuantizationStep"
-#define CONFIDENCEMAPPINGFILE "ConfidenceMappingFile"
-#define PRESERVEASPECTRATIO "NormPreserveAspectRatio"
-#define PRESERVERELATIVEYPOSITION "NormPreserveRelativeYPosition"
-#define RESAMPLINGMETHOD "ResampPointAllocation"
-
-
-//NN Config values
-#define FEATURES "Features"
-#define PROTOTYPEDISTANCE "NNPrototypeDistanceMeasure"
-#define NEARESTNEIGHBORS "NNRecoNumNearestNeighbors"
-#define FEATUREPOINTDISTANCE "FeaturePointDistance"
-#define DTWBANDING "NNDTWBandingRadius"
-#define FEATUREEXTRACTOR "FeatureExtractor"
-#define FEATUREREPRESENTATION "FeatureRepresentation"
-#define LENGTHBASED "lengthbased"
-#define POINTBASED "pointbased"
-#define INTERPOINTDISTBASED "interpointdistbased"
-#define LENGTHBASED_VARIABLE_NUMBER_OF_SAMPLES "lengthbasedvariablenumberofsamples"
-
-//ACTIVEDTW Config values
-#define RETAINPERCENTEIGENENERGY "ActiveDTWRetainPercentEigenEnergy"
-#define EIGENSPREADVALUE "ActiveDTWEigenSpreadValue"
-#define USESINGLETON "ActiveDTWUseSingleton"
-#define MINCLUSTERSIZE "ActiveDTWMinClusterSize"
-#define MAXCLUSTERSIZE "ActiveDTWMaxClusterSize"
-#define MDTFILEUPDATEFREQ "ActiveDTWMDTFileUpdateFreq"
-
-//NEURAL NET Config values
-#define RANDOM_NUMBER_SEED "SeedValueForRandomNumberGenaretor"
-#define NEURALNET_LEARNING_RATE "NeuralNetLearningRate"
-#define NEURALNET_MOMEMTUM_RATE "NeuralNetMomemtumRate"
-#define NEURALNET_TOTAL_ERROR "NeuralNetTotalError"
-#define NEURALNET_INDIVIDUAL_ERROR "NeuralNetIndividualError"
-#define NEURALNET_HIDDEN_LAYERS_SIZE "NeuralNetHiddenLayersSize"
-#define NEURALNET_HIDDEN_LAYERS_UNITS "NeuralNetHiddenLayersUnitSize"
-#define NEURALNET_NORMALISED_FACTOR "NeuralNetNormalizationFactor"
-#define NEURALNET_WEIGHT_REESTIMATION "ReestimateNeuralnetConnectionWeights"
-#define NEURALNET_TRAINING_ITERATION "NeuralnetTrainingIteration"
-#define NEURALNET_TRAINING_SEQUENCE "PrepareTrainingSequence"
-
-//holistic config values
-#define NUMNNS "numnns"
-#define WORSTCASEVALUE "worstcasevalue"
-#define NUMRESAMPLEPOINTS1 "NumResamplePoints1"
-#define NUMRESAMPLEPOINTS2 "NumResamplePoints2"
-#define SMOOTHFILTERLENGTH1 "SmoothFilterLength1"
-#define SMOOTHFILTERLENGTH2 "SmoothFilterLength2"
-#define SWANGNORMFACTOR "SwangNormFactor"
-#define SWANGHOOKTHRESH "SwangHookThresh"
-#define HORIZSTROKEANGLETHRESH "HorizStrokeAngleThresh"
-//#define CONFIDENCEMAPPINGFILE "ConfidenceMappingFile"
-//for bcc
-#define NUMCHOICES "NumChoices"
-#define COMBINATIONSCHEME "Combination"
-
-
-#define NORMALIZETRACES "normalizetraces"
-#define RESAMPLETRACES "resampletraces"
-#define CENTERTRACES "centertraces"
-#define REORDERTRACES "reordertraces"
-#define REORIENTTRACES "reorienttraces"
-#define NUMXGRIDS "numxgrids"
-#define NUMYGRIDS "numygrids"
-#define DISTRIBUTIONTHRESHOLD "distributionthreshold"
-#define MINSHAPESUBSET "minshapesubset"
-#define XTOLERANCE "xtolerance"
-#define YTOLERANCE "xtolerance"
-#define NUMXZONES "numxzones"
-#define NUMYZONES "numyzones"
-#define DENSITYTHRESH "densitythresh"
-#define SAMPLETHRESH "samplethresh"
-#define MAXBOXCOUNT "MaxBoxCount"
-#define BOXEDSHAPEPROJECT "BoxedShapeProject"
-#define BOXEDSHAPEPROFILE "BoxedShapeProfile"
-#define DPSHAPEPROJECT "DPShapeProject"
-#define DPSHAPEPROFILE "DPShapeProfile"
-#define NUMSYMBOLS "NumSymbols"
-#define NUMSHAPECHOICES "NumShapeChoices"
-#define MINSHAPECONFID "MinShapeConfid"
-
-
-//settings for DTW
-#define FLEXIBILITYINDEX "FlexibilityIndex"
-#define PROTOTYPESELECTION "NNTrainPrototypeSelectionMethod"
-#define BANDING "Banding"
-#define NUMFEATURES "NumFeatures"
-#define PROTOREDFACTOR "NNTrainPrototypeReductionFactorPerClass"
-#define NUMCLUSTERS "NNTrainNumPrototypesPerClass"
-#define DTWEUCLIDEANFILTER "NNRecoDTWEuFilterOutputSize"
-#define REJECT_THRESHOLD "NNRecoRejectThreshold"
-#define ADAPTIVE_kNN "NNRecoUseAdaptiveKNN"
-
-//settings of word recognizer
-#define REC_UNIT_INFO "rec_unit_info"
-#define USE_GRAMMAR "use_grammar"
-#define USE_WORDLIST "use_wordlist"
-#define USE_POSITIONAL INFO "use_positional_info"
-#define REC_MODE "rec_mode"
-#define DICTIONARY_MODE "dictionary_mode"
-
-//For Word recognizer
-
-#define LTK_TRUE 0x01
-#define LTK_FALSE 0x00
-
-//Reset parameters for Recognition context
-#define LTK_RST_INK 0x02
-#define LTK_RST_RECOGNIZER 0x04
-#define LTK_RST_ALL 0xff
-
-//Recognition units
-#define REC_UNIT_UNKNOWN 0x08 //No segment info
-#define REC_UNIT_SYMBOL 0x10 //Symbol
-#define REC_UNIT_CHAR 0x11 //Char
-#define REC_UNIT_WORD 0x12 //Word
-
-//Recognition mode for the recognizer
-#define REC_MODE_BATCH 0x14 //batch mode
-#define REC_MODE_STREAMING 0x16 //streaming (trace by trace)
-
-
-//Dictionary options
-#define DICT_DRIVEN 0x20 //recognizes only the words in the dictio
-#define DICT_ASSISTED 0x21
-#define DICT_OFF 0x22
-
-
-/**
-* @brief Defines the sequence of preprocessor functions to be executed
-*/
-#define PREPROCSEQUENCE "PreprocSequence"
-
-/**
-* @brief Defines the scale to be used to compute the number of iterations for LVQ training
-*/
-#define LVQITERATIONSCALE "LVQIterationScale"
-
-/**
-* @brief Defines initial value of alpha used in LVQ training
-*/
-#define LVQINITIALALPHA "LVQInitialAlpha"
-
-/**
-* @brief Defines the distance measure to be used in LVQ training.
-*/
-#define LVQDISTANCEMEASURE "LVQDistanceMeasure"
-
-/**
-* @brief Defines the name of the preprocessor dll file
-*/
-#define PREPROC "preproc"
-
-/**
-* @brief Defines the string compare functions
-*/
-#ifdef _WIN32
-#define LTKSTRCMP _stricmp
-#else
-#define LTKSTRCMP strcasecmp
-#endif
-
-/**
-* @brief Defines the name of the lipiengine dll file
-*/
-#define LIPIENGINE_MODULE_STR "lipiengine"
-
-/**
-* @brief Defines the name of the logger dll file
-*/
-#define LOGGER_MODULE_STR "logger"
-
-/**
-* @brief Defines the Lipi Root environment string
-*/
-#define LIPIROOT "$LIPI_ROOT"
-
-/**
-* @brief Defines the project is dynamic, where the numshapes can take any number of values
-*/
-#define DYNAMIC "Dynamic"
-
-/**
-* @brief Defines the header version for the model data file
-*/
-#define HEADERVERSION "1.0.0"
-
-
-#define VERSION_STR_LEN_SMALL 4
-
-/**
-* @brief Defines the length of the version information
-*/
-#define VERSION_STR_LEN 10
-
-/**
-* @brief Defines the checksum header string length
-*/
-#define CKSUM_HDR_STR_LEN 10
-
-/**
-* @brief Defines the starting error number
-*/
-#define ERROR_START_NO 100
-
-/**
-* @brief Defines the maximum error number
-*/
-#define MAX_ERROR_NO 240
-
-/**
-* @brief Defines the maximum file path length
-*/
-#define MAX_PATH_LEN 255
-
-/**
-* @brief Defines the maximum string length
-*/
-#define MAX_STRLEN 255
-
-/**
-* @brief Defines the lipi root environment string used in LipiEngine.cfg
-*/
-#define LIPIROOT_ENV_STRING "LIPI_ROOT"
-
-/**
-* @brief Defines the lipi library environment string used in LipiEngine.cfg
-*/
-#define LIPILIB_ENV_STRING "LIPI_LIB"
-
-/**
-* @brief Defines the type of project used in LipiEngine.cfg
-*/
-#define PROJECT_TYPE_STRING "ProjectType"
-
-#define PROJECT_TYPE_SHAPEREC "SHAPEREC"
-
-/**
-* @brief Defines the shape recognizer name used in LipiEngine.cfg
-*/
-#define SHAPE_RECOGNIZER_STRING "ShapeRecMethod"
-
-/**
-* @brief Defines the word recognizer name used in LipiEngine.cfg
-*/
-#define WORD_RECOGNIZER_STRING "WordRecognizer"
-
-/**
-* @brief Defines the path of the project directory in the Lipi tree
-*/
-#define PROJECTS_PATH_STRING SEPARATOR + "projects" + SEPARATOR
-
-/**
-* @brief Defines the path of the profile directory in the Lipi tree
-*/
-#define PROFILE_PATH_STRING SEPARATOR + "config" + SEPARATOR
-
-/**
-* @brief Defines the name of the default profile
-*/
-#define DEFAULT_PROFILE "default"
-
-/**
-* @brief Defines the name of profile config file
-*/
-#define PROFILE_CFG_STRING "profile.cfg"
-
-/**
-* @brief Defines the name of project config file
-*/
-#define PROJECT_CFG_STRING "project.cfg"
-
-/**
-* @brief Defines the NumShapes attributes in the project config file
-*/
-#define PROJECT_CFG_ATTR_NUMSHAPES_STR "NumShapes"
-
-/**
-* @brief Defines the name of the create shape recognizer function
-*/
-#define CREATESHAPERECOGNIZER_FUNC_NAME "createShapeRecognizer"
-
-/**
-* @brief Defines the name of the delete shape recognizer function
-*/
-#define DELETESHAPERECOGNIZER_FUNC_NAME "deleteShapeRecognizer"
-
-/**
-* @brief Defines the name of the createWordRecognizer function
-*/
-#define CREATEWORDRECOGNIZER_FUNC_NAME "createWordRecognizer"
-
-/**
-* @brief Defines the name of the deleteWordRecognizer function
-*/
-#define DELETEWORDRECOGNIZER_FUNC_NAME "deleteWordRecognizer"
-
-/**
-* @brief Defines the name of the resampleTraceGroup function
-*/
-#define RESAMPLE_TRACE_GROUP_FUNC "resampleTraceGroup"
-
-/**
-* @brief Defines the name of the resampleTraceGroup1 function
-*/
-#define RESAMPLE_TRACE_GROUP_ONE_FUNC "resampleTraceGroup1"
-
-/**
-* @brief Defines the name of the preprocess function
-*/
-#define PREPROCESS_FUNC "preprocess"
-
-/**
-* @brief Defines the name of the normalizeSize function
-*/
-#define NORMALIZE_FUNC "normalizeSize"
-
-#define NORMALIZE_LARGE_FUNC "normalizeLargerSize"
-
-/**
-* @brief Defines the name of the removeDuplicate function
-*/
-#define REMOVE_DUPLICATE_POINTS_FUNC "removeDuplicatePoints"
-
-/**
-* @brief Defines the name of another removeDuplicate function
-*/
-#define REMOVE_DUPLICATE_POINTS_BY_ISI_FUNC "removeDuplicatePointsByISI"
-
-/**
-* @brief Defines the name of the smoothenTraceGroup function
-*/
-#define SMOOTHEN_TRACE_GROUP_FUNC "smoothenTraceGroup"
-
-#define SMOOTHEN_MOVINGAVERAGE_TRACE_GROUP_FUNC "smoothingByMovingAverage"
-
-/**
-* @brief Defines the name of the dehookTraces function
-*/
-#define DEHOOKTRACES_FUNC "dehookTraces"
-
-/**
-* @brief Defines the name of the normalizeOrientation function
-*/
-#define NORMALIZE_ORIENTATION_FUNC "normalizeOrientation"
-
-/**
-* @brief Defines the Delimiter sequence for tokenize the strings
-*/
-#define DELEMITER_SEQUENCE " {},"
-
-/**
-* @brief Defines the Delimiter character for separating the function name with class name
-*/
-#define DELEMITER_FUNC "::"
-
-/**
-* @brief Defines the Delimiter sequence for tokenize the header information
-*/
-#define TOKENIZE_DELIMITER "<>=\n\r"
-
-/**
-* @brief Defines the string "CKS" (ChecKSum)
-*/
-#define CKS "CKS"
-
-/**
-* @brief Defines the project name used for header information
-*/
-#define PROJNAME "PROJNAME"
-
-/**
-* @brief Defines the project type used for header information
-*/
-#define PROJTYPE "PROJTYPE"
-
-/**
-* @brief Defines the recognizer name used for header information
-*/
-#define RECNAME "RECNAME"
-
-/**
-* @brief Defines the recognizer version used for header information
-*/
-#define RECVERSION "RECVERSION"
-
-/**
-* @brief Defines the string CREATETIME for header information
-*/
-#define CREATETIME "CREATETIME"
-
-/**
-* @brief Defines the string MODTIME for header information
-*/
-#define MODTIME "MODTIME"
-
-/**
-* @brief Defines the platform name (Windows or Linux)
-*/
-#define PLATFORM "PLATFORM"
-
-/**
-* @brief Defines the length of the comment used in header
-*/
-#define COMMENTLEN "COMMENTLEN"
-
-/**
-* @brief Defines the data offset length used in header
-*/
-#define DATAOFFSET "DATAOFFSET"
-
-/**
-* @brief Defines the number of shapes used in header information
-*/
-#define NUMSHAPES "NUMSHAPES"
-
-/**
-* @brief Defines the size of integer used in header information
-*/
-#define SIZEOFINT "SIZEOFINT"
-
-/**
-* @brief Defines the size of unsigned integer used in header information
-*/
-#define SIZEOFUINT "SIZEOFUINT"
-
-/**
-* @brief Defines the size of short integer used in header information
-*/
-#define SIZEOFSHORTINT "SIZEOFSHORTINT"
-
-/**
-* @brief Defines the size of float used in header information
-*/
-#define SIZEOFFLOAT "SIZEOFFLOAT"
-
-/**
-* @brief Defines the size of character used in header information
-*/
-#define SIZEOFCHAR "SIZEOFCHAR"
-
-/**
-* @brief Defines the header length
-*/
-#define HEADERLEN "HEADERLEN"
-
-#define HIDDENLAYERSUNIT "HIDDENLAYERSUNIT"
-
-/**
-* @brief Defines the dataset for header information
-*/
-#define DATASET "DATASET"
-
-/**
-* @brief Defines the comment information in header
-*/
-#define COMMENT "COMMENT"
-
-/**
-* @brief Defines the type of byte order (Little Endian or Big Endian)
-*/
-#define BYTEORDER "BYTEORDER"
-
-/**
-* @brief Defines the operating system version
-*/
-#define OSVERSION "OSVERSION"
-
-/**
-* @brief Defines the type of processor architecture
-*/
-#define PROCESSOR_ARCHITEC "PROCESSOR_ARCHITEC"
-
-/**
-* @brief Defines the Header version for header information
-*/
-#define HEADERVER "HEADERVER"
-
-
-#define PCA_ALGO "PCA"
-#define WINDOWS "Windows"
-#ifndef LINUX
-#define LINUX "Linux"
-#endif
-
-//Defined twice
-#define BYTEORDER "BYTEORDER"
-
-/**
-* @brief Defines the create preprocessor method name
-*/
-#define CREATEPREPROCINST "createPreprocInst"
-
-/**
-* @brief Defines the delete preprocessor method name
-*/
-#define DESTROYPREPROCINST "destroyPreprocInst"
-
-#define FI_MIN 0
-#define FI_MAX 2
-
-/**
-* @brief Defines the minimum value in which the prototype reduction factor can take
-*/
-#define PROTOTYPEREDFACT_MIN 0
-
-/**
-* @brief Defines the maximum value in which the prototype reduction factor can take
-*/
-#define PROTOTYPEREDFACT_MAX 100
-
-/**
-* @brief Defines the input file type is the ink file
-*/
-#define INK_FILE "ink"
-
-/**
-* @brief Defines the input file type is the feature file
-*/
-#define FEATURE_FILE "feature"
-
-/**
-* @brief Defines the DTW type of distance to be calculated
-*/
-#define DTW_DISTANCE "dtw"
-
-/**
-* @brief Defines the euclidean type of distance to be calculated
-*/
-#define EUCLIDEAN_DISTANCE "eu"
-
-/**
-* @brief Defines the delimiter for the feature extractor
-*/
-#define FEATURE_EXTRACTOR_DELIMITER "|"
-
-/**
-* @brief Define the delimiter for the hidden layer unit
-*/
-#define HIDDEN_LAYER_UNIT_DELIMITER ":"
-
-/**
-* @brief Defines the delimiter for the space (assuming only signle space between
-* class and the features in MDT file
-*/
-#define CLASSID_FEATURES_DELIMITER " "
-
-/**
-* @brief Defines the code for PointFloat Feature Extractor
-*/
-#define POINT_FLOAT_SHAPE_FEATURE_EXTRACTOR 101
-
-/**
-* @brief Define the code for Angle Feature Extractor
-*/
-#define SUBSTROKE_SHAPE_FEATURE_EXTRACTOR 103
-
-/**
-* @brief Define the code for spline Feature Extractor
-*/
-#define PARAMETRIC_CURVE_SHAPE_FEATURE_EXTRACTOR 104
-
-
-/**
-* @brief Uesd in computation of Feature Extraction (Angle)
-*/
-#define DIRECTION_CODE_EAST 1
-
-#define DIRECTION_CODE_NORTH_EAST 2
-
-#define DIRECTION_CODE_NORTH 3
-
-#define DIRECTION_CODE_NORTH_WEST 4
-
-#define DIRECTION_CODE_WEST 5
-
-#define DIRECTION_CODE_SOUTH_WEST 6
-
-#define DIRECTION_CODE_SOUTH 7
-
-#define DIRECTION_CODE_SOUTH_EAST 8
-
-#define OVERLAP_THRESHOLD 15.0
-
-
-/**
-* @brief Defines the code for L7 Feature Extractor
-*/
-#define L7_SHAPE_FEATURE_EXTRACTOR 102
-
-/**
-* @brief Defines the create preprocessor method name
-*/
-#define CREATE_SHAPE_FEATURE_EXTRACTOR "createShapeFeatureExtractor"
-
-/**
-* @brief Defines the delete preprocessor method name
-*/
-#define DELETE_SHAPE_FEATURE_EXTRACTOR "deleteShapeFeatureExtractor"
-
-#define LEARNING_RATE "LEARNING_RATE"
-
-#define HIDDEN_LAYER "HIDDEN_LAYER"
-
-#define NORMALISED_FACTOR "NORMALISED_FACTOR"
-
-#define MOMEMTUM_RATE "MOMEMTUM_RATE"
-
-#define FE_NAME "FE_NAME"
-
-#define FE_VER "FE_VER"
-
-#define PREPROC_SEQ "PREPROC_SEQ"
-
-#define DOT_SIZE_THRES "DOT_SIZE_THRES"
-
-#define ASP_RATIO_THRES "ASP_RATIO_THRES"
-
-#define DOT_THRES "DOT_THRES"
-
-#define PRESER_REL_Y_POS "PRESER_REL_Y_POS"
-
-#define PRESER_ASP_RATIO "PRESER_ASP_RATIO"
-
-#define NORM_LN_WID_THRES "NORM_LN_WID_THRES"
-
-#define RESAMP_POINT_ALLOC "RESAMP_POINT_ALLOC"
-
-#define SMOOTH_WIND_SIZE "SMOOTH_WIND_SIZE"
-
-#define TRACE_DIM "TRACE_DIM"
-
-#define PROTOTYPE_SELECTION_CLUSTERING "hier-clustering"
-
-#define PROTOTYPE_SELECTION_LVQ "lvq"
-
-#define PROTO_RED_FACTOR_AUTOMATIC "automatic"
-
-#define PROTO_RED_FACTOR_NONE "none"
-
-#define PROTO_RED_FACTOR_COMPLETE "complete"
-
-#define DTW_EU_FILTER_ALL "all"
-
-#define NAME_POINT_FLOAT_SHAPE_FEATURE_EXTRACTOR "PointFloatShapeFeatureExtractor"
-
-#define NAME_SUBSTROKE_SHAPE_FEATURE_EXTRACTOR "SubStrokeShapeFeatureExtractor"
-
-#define NAME_PARAMETRIC_CURVE_SHAPE_FEATURE_EXTRACTOR "ParametricCurveShapeFeatureExtractor"
-
-#define NAME_L7_SHAPE_FEATURE_EXTRACTOR "L7ShapeFeatureExtractor"
-
-#define NAME_NPEN_SHAPE_FEATURE_EXTRACTOR "NPenShapeFeatureExtractor"
-
-#define NAME_RELHANDPOSSC_SHAPE_FEATURE_EXTRACTOR "RelHandPosSCFeatureExtractor"
-
-#define NEW_LINE_DELIMITER '\n'
-
-#define DELTE_SHAPE_FTR_POINTER_FUNC "deleteShapeFeaturePtr"
-
-#define MDT_FOPEN_MODE "MDT_OPEN_MODE"
-
-/**
-@brief Defines the log file name
-*/
-#define LOG_FILE_NAME "LogFile"
-
-/**
-@brief Defines the log level
-*/
-#define LOG_LEVEL "LogLevel"
-
-#define DEFAULT_LOG_FILE "lipi.log"
-
-#define DEFAULT_LOG_LEVEL LTKLogger::LTK_LOGLEVEL_ERR
-
-#define LOG_LEVEL_DEBUG "DEBUG"
-
-#define LOG_LEVEL_ERROR "ERR"
-
-#define LOG_LEVEL_INFO "INFO"
-
-#define LOG_LEVEL_ALL "ALL"
-
-#define LOG_LEVEL_VERBOSE "VERBOSE"
-
-#define LOG_LEVEL_OFF "OFF"
-
-#define MDT_UPDATE_FREQUENCY "NNMDTFileUpdateFreq"
-/**
- @brief Used in computation of Confidence
-*/
-#define MIN_NEARESTNEIGHBORS 2
-
-#define EUCLIDEAN_FILTER_OFF -1
-
-#define CONF_THRESHOLD_FILTER_OFF 0
-
-#define NUM_CHOICES_FILTER_OFF -1
-
-#define LTK_START_SHAPEID 0
-
-#define ADAPT_SCHEME "AdaptScheme"
-
-#define NAME_ADD_LVQ_ADAPT_SCHEME "AddLVQ"
-
-#define MAX_PROTOTYPES "MaxNumPrototypes"
-
-#define ADAPT_CONF_LOWER_BOUND "ConfidenceLowerBound"
-
-#define ADAPT_CONF_UPPER_BOUND "ConfidenceUpperBound"
-
-#define ADAPT_MISMATCH_HIGH_CONF "MismatchHighConfidence"
-
-#define ADAPT_MISMATCH_LOW_CONF "MismatchLowConfidence"
-
-#define ADAPT_MATCH_HIGH_CONF "MatchHighConfidence"
-
-#define ADAPT_MATCH_LOW_CONF "MatchLowConfidence"
-
-#define ADAPT_MIN_NUMBER_SAMPLES_PER_CLASS "MinimumNumberOfSamplesPerClass"
-#define DEFAULT_PROFILE "default"
-
-#define DEFAULT_CHANNEL_NAME "X"
-
-#define DEFAULT_DATA_TYPE DT_FLOAT
-
-#define X_CHANNEL_NAME "X"
-
-#define Y_CHANNEL_NAME "Y"
-
-#define DEFAULT_SAMPLING_RATE 100
-
-#define DEFAULT_X_DPI 2000
-
-#define DEFAULT_Y_DPI 2000
-
-#define DEFAULT_LATENCY 0.0
-
-#define DEFAULT_ERROR_CODE -1
-
-#define LIPIENGINE_CFG_STRING "lipiengine.cfg"
-
-#define DEFAULT_SHAPE_RECO_CHOICES 5
-
-#define DEFAULT_SHAPE_RECO_MIN_CONFID 0.0
-
-#define EMPTY_STRING " "
-
-#define MDT_FILE_OPEN_MODE "NNMDTFileOpenMode"
-
-#define MIN_PERCENT_EIGEN_ENERGY 1
-
-#define MAX_PERCENT_EIGEN_ENERGY 100
-
-#define MIN_EIGENSPREADVALUE 1
-
-//neuralnet
-#define CONTINUE 0
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESSFULLY 2
-
-//for hmm clasifire
-
-#define FEATURE_DIMENTION 8
-
-#endif // #ifndef __COMMONMACORS_H
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h
deleted file mode 100644
index 88a56ac8..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtil.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-******************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-12 11:34:07 +0530 (Tue, 12 Aug 2008) $
- * $Revision: 604 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR:
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKOSUTIL_H
-#define __LTKOSUTIL_H
-
-#include "LTKTypes.h"
-
-class LTKOSUtil
-{
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKOSUtil(){};
-
- /**
- * Destructor
- */
-
- virtual ~LTKOSUtil(){};
-
- // @}
-
- /** @brief Given library name, this function loads it into the adress space.
- * @param lipiLibPath
- * @param sharedLibName : name of the library to be loaded
- * @param libHandle: pointer to the library handle
- */
- virtual int loadSharedLib(const string& lipiLibPath,
- const string& sharedLibName,
- void** libHandle)=0;
-
- /**
- */
- virtual int unloadSharedLib(void* libHandle)=0;
-
- virtual int getFunctionAddress(void * libHandle,
- const string& functionName,
- void** functionHandle)=0;
-
- virtual int getPlatformName(string& outStr)=0;
-
- virtual int getProcessorArchitechure(string& outStr)=0;
-
- virtual int getOSInfo(string& outStr)=0;
-
- virtual int recordStartTime()=0;
-
- virtual int recordEndTime()=0;
-
- virtual int diffTime(string& outStr)=0;
-
- virtual int getSystemTimeString(string& outStr)=0;
-
- virtual void* getLibraryHandle(const string& libName)=0;
-
- virtual string getEnvVariable(const string& envVariableName) =0;
-
-
-
-};
-
-#endif
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h
deleted file mode 100644
index 2427d80e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKOSUtilFactory.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-*****************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR:
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKOSUTILFACTORY_H
-#define __LTKOSUTILFACTORY_H
-
-class LTKOSUtil;
-
-class LTKOSUtilFactory
-{
-
-public:
-
- static LTKOSUtil* getInstance();
-
-};
-
-#endif
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h
deleted file mode 100644
index 36179a7c..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocDefaults.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-04-01 12:32:40 +0530 (Wed, 01 Apr 2009) $
- * $Revision: 751 $
- * $Author: royva $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of all factory preprocessor (default) settings
- *
- * CONTENTS:
- *
- * AUTHOR: Thanigai Murugan
- *
- * DATE: 11-AUG-2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __PREPROCDEFAULTS_H__
-#define __PREPROCDEFAULTS_H__
-
-#define PREPROC_DEF_NORMALIZEDSIZE 10.0f
-#define PREPROC_DEF_DOT_THRESHOLD 0.01f
-#define PREPROC_DEF_LOOP_THRESHOLD 0.25f
-#define PREPROC_DEF_HOOKLENGTH_THRESHOLD1 0.17f
-#define PREPROC_DEF_HOOKLENGTH_THRESHOLD2 0.33f
-#define PREPROC_DEF_HOOKANGLE_THRESHOLD 30
-#define PREPROC_DEF_QUANTIZATIONSTEP 5
-#define PREPROC_DEF_FILTER_LENGTH 3
-#define NN_NUM_CLUST_INITIAL -2
-
-#define PREPROC_DEF_INTERPOINT_DIST_FACTOR 15
-
-// LVQ parameters
-#define NN_DEF_LVQITERATIONSCALE 40
-#define NN_DEF_LVQINITIALALPHA 0.3
-#define NN_DEF_LVQDISTANCEMEASURE "eu"
-
-#define NN_DEF_MDT_UPDATE_FREQ 5
-#define NN_DEF_RECO_NUM_CHOICES 2
-
-#define NN_MDT_OPEN_MODE_BINARY "binary"
-#define NN_MDT_OPEN_MODE_ASCII "ascii"
-
-
-
-//ADAPT parameters
-#define ADAPT_DEF_MIN_NUMBER_SAMPLES_PER_CLASS 5
-#define ADAPT_DEF_MAX_NUMBER_SAMPLES_PER_CLASS 10
-#endif //#ifdef__PREPROCDEFAULTS_H__
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h
deleted file mode 100644
index 8ef68249..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessor.h
+++ /dev/null
@@ -1,632 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-07-01 16:41:37 +0530 (Wed, 01 Jul 2009) $
- * $Revision: 783 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definition of LTKPreprocessor which is a library of standard pre-processing functions
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKPREPROCESSOR_H
-#define __LTKPREPROCESSOR_H
-
-#define SUPPORTED_MIN_VERSION "3.0.0"
-
-#include "LTKCaptureDevice.h"
-
-#include "LTKScreenContext.h"
-
-#include "LTKMacros.h"
-
-#include "LTKInc.h"
-
-#include "LTKPreprocessorInterface.h"
-
-class LTKTrace;
-class LTKShapeRecoConfig;
-
-/**
- * @class LTKPreprocessor
- * <p> This class performs pre-processing on a trace group. </p>
- *
- * <p> Different functions performing steps in pre-processing are implemented in different
- * implementation files. Pre-processed trace group is the output of this class module </p>
- * <p> Paramaters used across all pre -processor modules of a shape recognizer will be obtained
- * from the shape recognizer's configuration file. The shape recognizer sets these paramaters in the pre-processor
- * by calling the suitable setter functions defined in LTKPreprocessor.h </p>
- */
-
-class LTKPreprocessor : public LTKPreprocessorInterface
-{
-private:
-
- float m_sizeThreshold; // threshold below which a trace will not be size normalized
-
- float m_loopThreshold; // threshold below which a trace will not be considered a loop
-
- float m_aspectRatioThreshold; // threshold above which the aspect ratio of a trace is maintained after size normalization
-
- float m_dotThreshold; // a threshold to detect shapes which are just dots
-
- float m_hookLengthThreshold1;
-
- float m_hookLengthThreshold2;
-
- float m_hookAngleThreshold;
-
- map<string, FN_PTR_PREPROCESSOR> m_preProcMap; // Holds the address of preprocessor functions.
-
- bool m_preserveAspectRatio;
-
- bool m_preserveRelativeYPosition;
-
- LTKCaptureDevice m_captureDevice;
-
- LTKScreenContext m_screenContext;
-
- int m_filterLength;
-
- int m_traceDimension;
-
- int m_quantizationStep; // quantization step for resampling
-
- string m_resamplingMethod; // type of resampling scheme to be used point based or length based
-
- float m_interPointDist; //distance between successive points
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
-
- LTKPreprocessor(const LTKControlInfo& controlInfo);
-
- /**
- * Copy Constructor
- */
-
- LTKPreprocessor(const LTKPreprocessor& preprocessor);
-
- /**
- * Destructor
- */
-
- virtual ~LTKPreprocessor();
-
-
- /**
- * @name Pre-processing Functions
- */
- // @{
-
- /**
- * This function normalizes the size for a trace group.
- * <p> If the width of the stroke set is more than the threshold,
- * they are normalised by width and scale; otherwise they are traslated to the
- * center if bounding box determined by scale. </p>
- *
- * @param traceGroup Object of LTKTraceGroup
- *
- * @return void
- */
-
- /**
- * @name Getter Functions
- */
- // @{
-
-
- /**
- * The function returns the scale(width or height) of the trace group assumed after normalization.
- * @param void
- *
- * @return The value of scale for coordinate axis.
- */
-
-
- bool getPreserveAspectRatio() const;
-
- /**
- * The function returns the scale(width or height) of the trace group assumed after normalization.
- * @param void
- *
- * @return The value of scale for coordinate axis.
- */
-
- bool getPreserveRealtiveYPosition() const;
-
- /**
- * The fucntion returns the size threshold that a trace group is required to have.
- * @param void
- *
- * @return The size threshold that is pre-determined.
- */
-
- float getSizeThreshold() const;
-
- /**
- * This function returns the loop threshold of a trace group.
- * @param void
- *
- * @return The value of loop threshold.
- */
-
- float getLoopThreshold() const;
-
- /**
- * This function returns the threshold below which aspect ratio will be maintained
- * @param void
- *
- * @return Threshold below which aspect ratio will be maintained
- */
- float getAspectRatioThreshold() const;
-
- /**
- * This function returns the threshold used to detect dots
- * @param void
- *
- * @return Threshold used to detect dots
- */
- float getDotThreshold() const;
-
- /**
- * This function returns the value of the m_quantizationStep variable of the preprocessor
- * @param void
- *
- * @return the m_quantizationStep of preprocessor
- */
- int getQuantizationStep() const;
-
- /**
- * This function returns the resampling method being used by the preprocessor
- * @param void
- *
- * @return the m_resamplingMethod value
- */
- string getResamplingMethod() const;
-
- /**
- * This function returns the value of the m_traceDimension variable of the preprocessor
- * @param void
- *
- * @return the m_traceDimension; of preprocessor
- */
- const int getTraceDimension() const;
-
-
- /**
- * This function returns the value of the m_filterLength variable of the preprocessor
- * @param void
- *
- * @return the m_filterLength of preprocessor
- */
- const int getFilterLength() const;
-
- /**
- * This function returns the max y coord of the tracegroup given to the findingBoundingBox function
- * @param void
- *
- * @return the max y coord of the tracegroup given to the findingBoundingBox function
- */
-
- const LTKCaptureDevice& getCaptureDevice() const;
-
- /**
- * This function returns the max y coord of the tracegroup given to the findingBoundingBox function
- * @param void
- *
- * @return the max y coord of the tracegroup given to the findingBoundingBox function
- */
-
- const LTKScreenContext& getScreenContext() const;
-
- /**
- * @name Setter Functions
- */
- // @{
-
-
- /**
- * This function sets member variable preserve aspect ratio with the flag specified.
- * @param flag can be true or false
- *
- * @return SUCCESS on successful set operation
- */
-
- void setPreserveAspectRatio(bool flag);
- /**
- * This function sets member variable preserve relative y position with the flag specified.
- * @param flag can be true or false
- *
- * @return SUCCESS on successful set operation
- */
-
- void setPreserveRelativeYPosition(bool flag);
-
- /**
- * This function sets the threshold value for a trace group.
- * @param sizeThreshold This threshold determines what normalization has to be done for a trace group.
- *
- * @return SUCCESS on successful set operation
- */
-
- int setSizeThreshold(float sizeThreshold);
-
- /**
- * This function sets the loop threshold if a trace group is curved.
- * @param loopThreshold Threshold to determine whether trace is a closed curve or not.
- *
- * @return SUCCESS on successful set operation
- */
-
- int setLoopThreshold(float loopThreshold);
-
- /**
- * This function sets threshold below which aspect ratio will be maintained after normalization
- * @param aspectRatioThreshold Threshold below which aspect ratio will be maintained
- *
- * @return SUCCESS on successful set operation
- */
-
- int setAspectRatioThreshold(float aspectRatioThreshold);
-
- /**
- * This function sets threshold to detect dots
- * @param dotThreshold Threshold to detect dots
- *
- * @return SUCCESS on successful set operation
- */
-
- int setDotThreshold(float dotThreshold);
-
- /**
- * This function sets filter length.
- * @param fileterLength
- *
- * @return SUCCESS on successful set operation
- */
- int setFilterLength (int filterLength);
-
- /**
- * This method sets the length threshold to detect hooks.
- *
- * @param hookLengthThreshold1 - length threshold to detect hooks.
- * @return SUCCESS on successful set operation
- */
- int setHookLengthThreshold1(float hookLengthThreshold1);
-
- /**
- * This method sets the length threshold to detect hooks
- *
- * @param hookLengthThreshold1 - length threshold to detect hooks.
- * @return SUCCESS on successful set operation
- */
- int setHookLengthThreshold2(float hookLengthThreshold2);
-
- /**
- * This method sets the angle threshold to detect hooks
- *
- * @param hookAngleThreshold - angle threshold to detect hooks
- * @return SUCCESS on successful set operation
- */
- int setHookAngleThreshold(float hookAngleThreshold);
-
- /**
- * This function returns the max y coord of the tracegroup given to the findingBoundingBox function
- * @param void
- *
- * @return the max y coord of the tracegroup given to the findingBoundingBox function
- */
-
- void setCaptureDevice(const LTKCaptureDevice& captureDevice);
-
- /**
- * This function returns the max y coord of the tracegroup given to the findingBoundingBox function
- * @param void
- *
- * @return the max y coord of the tracegroup given to the findingBoundingBox function
- */
-
- void setScreenContext(const LTKScreenContext& screenContext);
-
-
- /**
- * This function sets the value of the m_quantizationStep variable of the preprocessor
- * @param void
- *
- * @return SUCCESS on successful set operation
- */
- int setQuantizationStep(int quantizationStep) ;
-
- /**
- * This function sets the resampling method to be used by the preprocessor
- * @param void
- *
- * @return SUCCESS on successful set operation
- */
- int setResamplingMethod(const string& resamplingMethod);
-
- /**
- * This function adds the function name and the Address of the function into the
- * maping variable.
- * @param void
- *
- * @returns 0 on success.
- */
-
- void initFunAddrMap();
-
- /**
- * This function takes the function name as an argument and returns the
- * pointer to the function.
- * @param function name
- *
- * @return the pointer to the function.
- */
-
- FN_PTR_PREPROCESSOR getPreprocptr(const string &funName);
-
- /**
- * This function assigns the factory default values
- * for the preprocessor attributes
- * @param void
- *
- * @return 0 on success
- */
-
- void initPreprocFactoryDefaults();
- // @}
-
- /**
- * This function is called on a trace group to normalize it's size.
- *
- * @param inTraceGroup input trace group that must be normalized.
- * @param outTraceGroup The trace group whose traces are normalized.
- *
- * @return void
- *
- */
-
- int normalizeSize(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
-
- /**
- * This function is called on a trace group to normalize its orientation
- *
- * @param inTraceGroup input trace group that must be normalized.
- * @param outTraceGroup The trace group whose traces are normalized.
- *
- * @return void
- *
- */
-
- int normalizeOrientation(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
- /**
- * @param traceGroup Object of LTKTracegroup
- * @param traceDimension Average number of points expected in a trace
- *
- * @return void
- */
-
- int duplicatePoints(const LTKTraceGroup& traceGroup, int traceDimension);
-
- /**
- * This function shifts the origin of eack stroke to the centroid of the stroke
- *
- * @param inTraceGroup Trace group input, whose traces have to be centered.
- * @param outTraceGroup The output trace group that whose traces are centered.
- *
- * @return void
- */
-
- int centerTraces(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
- /**
- * This function dehooks the given tracegroup
- *
- * @param inTraceGroup Tracegroup which has to be dehooked
- * @param outTraceGroup The dehooked tracegroup
- *
- * @return void
- */
-
- int dehookTraces(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
- /**
- * This function removes consecutively repeating x, y coordinates (thinning)
- *
- * @param inTraceGroup trace group to be thinned
- * @param outTraceGroup thinned trace group
- *
- * @return SUCCESS on successful thinning operation
- */
-
- int removeDuplicatePoints(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
- /**
- * This function calculates the slopes of the strokes w.r.t maximum and minimum coordinates
- * and reorders the strokes.
- *
- * @param inTraceGroup Object of LTKTraceGroup, whose traces have to be ordered.
- * @param outTraceGroup The output trace group, whose traces are ordered.
- *
- * @return void
- */
-
- int orderTraces(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
- /**
- * This function reorients the given stroke
- *
- * @param inTrace Trace which has to be reversed
- * @param outTrace The reversed trace
- *
- * @return void
- */
-
- int reverseTrace(const LTKTrace& inTrace, LTKTrace& outTrace);
-
- /**
- * This function takes trace by trace from a trace group and resamples the points in them
- * according to the trace dimension.
- *
- * @param inTrace The input trace from trace group
- * @param resamplePoints The ideal number of points to which the trace must be resampled.
- * @param outTrace The output trace that has resampled points.
- *
- * @return void
- */
-
- int resampleTrace(const LTKTrace& inTrace,int resamplePoints, LTKTrace& outTrace);
-
-
-
- /**
- * This function smoothens the incoming tracegroup using moving average technique
- *
- * @param inTraceGroup The input trace group
- * @param filterLength is the number of points used for smoothening a single point
- * @param outTraceGrouo The output tracegroup that has smoothened points.
- *
- * @return SUCCESS
- */
-
- int smoothenTraceGroup(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
- /**
- * This method extracts the quantised Slope values from the input trace group.
- *
- * @param Input trace group, Quantised Slope Vector
- *
- * @return SUCCESS.
- */
-
- int getQuantisedSlope(const LTKTrace& trace, vector<int>& qSlopeVector);
-
- /**
- * This method identify the dominant points in the trace group based on the quantised
- * slope information.
- *
- * @param QSlopeVector,flexibility Index
- * @return Dominant Points
- */
-
- int determineDominantPoints(const vector<int>& qSlopeVector, int flexibilityIndex, vector<int>& dominantPts);
-
- /**
- * Computes the length of the given trace between two given point indices.
- *
- * @param trace - trace whose total/partial length is required.
- * @param fromPoint - point from which the trace length has to be computed.
- * @param toPoint - point to which the trace length has to be computed.
- *
- * @return total/partial length of the trace.
- */
-
-
- // May define TRACE_BEGIN_POINT TRACE_END_POINT macros and let fromPoint and toPoint
- //take these as default values
- int computeTraceLength(const LTKTrace& trace, int fromPoint, int toPoint, float& outLength);
-
- int resampleTraceGroup(const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup
- );
-
- int setTraceDimension(int traceDimension);
-
- // @}
-
-private:
-
- /**
- * This function calculates slope of 2 points.
- *
- * @param x1,x2,y1,y2 coordinates of 2 points
- *
- * @return Slope of two points.
- */
-
- float calculateSlope(float x1,float y1,float x2,float y2);
-
- /**
- * This function calculates Euclidian distance between 2 points.
- *
- * @param x1,x2,y1,y2 Coordinates of two points.
- *
- * @return Euclidian Distance between two points.
- */
-
- float calculateEuclidDist(float x1,float x2,float y1,float y2);
-
- /**
- * This method calculates the swept angle of the curve.
- *
- * @param Input trace
- * @return Swept angle of the trace.
- */
-
- int calculateSweptAngle(const LTKTrace& trace, float& outSweptAngle);
-
- int readConfig(const string& cfgFilePath);
-
- bool isDot(const LTKTraceGroup& inTraceGroup);
-
-};
-
-#endif //#ifndef __LTKPREPROCESSOR_H
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h
deleted file mode 100644
index fb913100..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKPreprocessorInterface.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-******************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-#ifndef __LTKPREPROCESSORINTERFACE_H
-#define __LTKPREPROCESSORINTERFACE_H
-
-#include "LTKTraceGroup.h"
-
-class LTKPreprocessorInterface;
-
-typedef int (LTKPreprocessorInterface::*FN_PTR_PREPROCESSOR)(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup);
-
-class LTKPreprocessorInterface
-{
-
-public:
-
- /**
- * This function normalizes the size for a trace group.
- * <p> If the width of the stroke set is more than the threshold,
- * they are normalised by width and scale; otherwise they are traslated to the
- * center if bounding box determined by scale. </p>
- *
- * @param traceGroup Object of LTKTraceGroup
- *
- * @return void
- */
-
- /**
- * @name Getter Functions
- */
- // @{
-
- /**
- * The function get the function name as the argument and return the address of the
- * function.
- * @param funName
- *
- * @return address of the function.
- */
-
- virtual FN_PTR_PREPROCESSOR getPreprocptr(const string &funName) = 0;
-
- /**
- * @name Setter Functions
- */
- // @{
-
-
- virtual int normalizeSize(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup) = 0;
-
- /**
- * This function is called on a trace group to normalize its orientation
- *
- * @param inTraceGroup input trace group that must be normalized.
- * @param outTraceGroup The trace group whose traces are normalized.
- *
- * @return void
- *
- */
-
- virtual int normalizeOrientation(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup) = 0;
-
- /**
- * @param traceGroup Object of LTKTracegroup
- * @param traceDimension Average number of points expected in a trace
- *
- * @return void
- */
-
- virtual int duplicatePoints(const LTKTraceGroup& traceGroup, int traceDimension) = 0;
-
- /**
- * This function shifts the origin of eack stroke to the centroid of the stroke
- *
- * @param inTraceGroup Trace group input, whose traces have to be centered.
- * @param outTraceGroup The output trace group that whose traces are centered.
- *
- * @return void
- */
-
- virtual int centerTraces(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup) = 0;
-
- /**
- * This function dehooks the given tracegroup
- *
- * @param inTraceGroup Tracegroup which has to be dehooked
- * @param outTraceGroup The dehooked tracegroup
- *
- * @return void
- */
-
- virtual int dehookTraces(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup) = 0;
-
- /**
- * This function removes consecutively repeating x, y coordinates (thinning)
- *
- * @param inTraceGroup trace group to be thinned
- * @param outTraceGroup thinned trace group
- *
- * @return SUCCESS on successful thinning operation
- */
-
- virtual int removeDuplicatePoints(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup) = 0;
-
- /**
- * This function calculates the slopes of the strokes w.r.t maximum and minimum coordinates
- * and reorders the strokes.
- *
- * @param inTraceGroup Object of LTKTraceGroup, whose traces have to be ordered.
- * @param outTraceGroup The output trace group, whose traces are ordered.
- *
- * @return void
- */
-
- virtual int orderTraces(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup) = 0;
-
- /**
- * This function reorients the given stroke
- *
- * @param inTrace Trace which has to be reversed
- * @param outTrace The reversed trace
- *
- * @return void
- */
-
- virtual int reverseTrace(const LTKTrace& inTrace, LTKTrace& outTrace) = 0;
-
- /**
- * This function takes trace by trace from a trace group and resamples the points in them
- * according to the trace dimension.
- *
- * @param inTrace The input trace from trace group
- * @param resamplePoints The ideal number of points to which the trace must be resampled.
- * @param outTrace The output trace that has resampled points.
- *
- * @return void
- */
-
- virtual int resampleTrace(const LTKTrace& inTrace, int resamplePoint, LTKTrace& outTrace) = 0;
-
-
- /**
- * This function smoothens the incoming tracegroup using moving average technique
- *
- * @param inTraceGroup The input trace group
- * @param filterLength is the number of points used for smoothening a single point
- * @param outTraceGrouo The output tracegroup that has smoothened points.
- *
- * @return SUCCESS
- */
-
- virtual int smoothenTraceGroup(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup) = 0;
-
- virtual int resampleTraceGroup(const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup)=0;
- virtual int getQuantisedSlope(const LTKTrace& trace, vector<int>& qSlopeVector) = 0;
-
- virtual int determineDominantPoints(const vector<int>& qSlopeVector, int flexibilityIndex, vector<int>& dominantPts) = 0;
-
- virtual void setCaptureDevice(const LTKCaptureDevice& captureDevice) = 0;
-
- virtual void setScreenContext(const LTKScreenContext& screenContext) = 0;
-
- virtual bool getPreserveAspectRatio()const = 0 ;
-
- virtual float getAspectRatioThreshold()const= 0 ;
-
- virtual bool getPreserveRealtiveYPosition()const = 0 ;
-
- virtual float getSizeThreshold()const =0 ;
-
- virtual float getDotThreshold()const = 0 ;
-
- virtual string getResamplingMethod()const = 0 ;
-
- virtual const int getTraceDimension()const = 0 ;
-
- virtual const int getFilterLength()const = 0 ;
-
- virtual ~LTKPreprocessorInterface(){};
-
-
-};
-
-#endif
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h
deleted file mode 100644
index cf1bcc62..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRecognitionContext.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for Recognition Context Module
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: February 21, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- * Thanigai 3-AUG-2005 Added default constructor and setWordRecoEngine
- * methods.
- *
- * Deepu 30-AUG-2005 Replaced LTKWordRecoEngine with LTKWordRecognizer
- * Changed the representation of m_recognitionFlags
- * since there was a problem with dlls
- ************************************************************************/
-#ifndef __LTKRECOGNITIONCONTEXT_H
-#define __LTKRECOGNITIONCONTEXT_H
-
-#include "LTKTypes.h"
-#include "LTKCaptureDevice.h"
-#include "LTKScreenContext.h"
-
-class LTKTrace;
-class LTKTraceGroup;
-class LTKWordPreprocessor;
-class LTKWordRecoResult;
-class LTKWordRecognizer;
-typedef vector<LTKTraceGroup> LTKTraceGroupVector;
-
-typedef vector<LTKWordRecoResult> LTKWordRecoResultVector;
-
-
-/**
- * @class LTKRecognitionContext This class holds the recognition context for a particular field.
- * <p>
- * LTKRecognitionContext specifies UI parameters (like Screen context, device context, segment info etc.)
- * , application specific parameters (lexicon to be used, other language models) and recognition
- * related configurations (number of results, confidence threshold etc)</p>
- *
- */
-
-
-class LTKRecognitionContext
-{
-private:
- float m_confidThreshold; //confidence threshold for the recognizer
-
- LTKCaptureDevice m_deviceContext; //the device context in which the ink is collected
-
- LTKTraceVector m_fieldInk; //the input ink to be recognized
-
- int m_numResults; //number of results that the recognizer will return
-
- vector< pair<string,int> > m_recognitionFlags; //recognition flags.
-
- stringStringMap m_languageModels; //the language models that contains dictionary name, grammar model etc.
-
- LTKScreenContext m_screenContext; //the screen context object
-
- LTKWordRecognizer* m_wordRecPtr; //the recognition engine
-
- LTKWordRecoResultVector m_results; //Results from the recognizer
-
- int m_nextBestResultIndex ; //this points to the next best result to be returned
-
-
-public:
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- LTKRecognitionContext();
-
-
- LTKRecognitionContext(LTKWordRecognizer *wordRecPtr );
-
-
- int setWordRecoEngine(LTKWordRecognizer *wordRecPtr);
-
- ~LTKRecognitionContext();
- // @}
-
- /**
- * @name Functions to add traces to the recognition context
- */
- // @{
-
- /**
- * This function adds a trace to the recognition context for recognition
- * @param trace is the trace to be added
- * @return SUCCESS/FAILURE
- */
- int addTrace (const LTKTrace& trace);
-
- /**
- * This function adds a vector of tracegroup for recognition in the recognition context
- * @param fieldInk is the ink to be added.
- * @return SUCCESS/FAILURE
- */
-
- int addTraceGroups (const LTKTraceGroupVector& fieldInk);
-
- /**
- * This function marks the beginning of a recognition unit of Ink.
- * The recognition unit is determined based on the flag set in recognition flags
- * @return SUCCESS/FAILURE
- */
-
- void beginRecoUnit ( );
-
- /**
- * This function clears all the recognition results
- * @param void
- * @return SUCCESS/FAILURE
- */
-
- //void clearRecognitionResult( );
- int clearRecognitionResult( );
-
- /**
- * This function marks the ending of a recognition unit of Ink.
- * The recognition unit is determined based on the flag set in recognition flags
- * @return SUCCESS/FAILURE
- */
-
- //void endRecoUnit ( );
- void endRecoUnit ( );
-
- // @}
-
- /**
- * @name get/set Functions
- */
- // @{
-
- /**
- * This function returns a reference to internal Ink data.
- * The recognition engine uses the reference to access the data
- * @return const reference to vector of LTKTrace
- */
- const LTKTraceVector& getAllInk () const;
-
- /**
- * Returns the value of confidence threshold
- * @return float confidence threshold value
- */
- float getConfidThreshold () const;
-
- /**
- * This function returns current device const.
- * The recognition engine uses the reference to access the data
- * @return const reference to device context object
- */
- const LTKCaptureDevice& getDeviceContext ( ) const;
-
- /**
- * This function retrieves flag indexed by string key from the map and returns the value
- * @param key index of map
- * @return value(integer) of the queried flag
- */
-
- //int getFlag (const string& key,int& value) const;
- int getFlag (const string& key,int& outValue) const;
-
- /**
- * This function returns the current language model indexed by the key
- * @param key : the index
- * @return value (string) of the queried language model
- */
- //int getLanguageModel (string& key,string& value) const;
- int getLanguageModel (const string& key,string& outValue) const;
-
- /**
- * This function returns the next best results
- * @param numResults : number of results to be retrieved.
- * @param results[out] :Result vector returned
- * @return SUCCESS/FAILURE
- */
- int getNextBestResults (int numResults,
- LTKWordRecoResultVector& outWordRecResults);
-
-
- /**
- * This function returns the number of results set in the recognition context.
- * @return number of results
- */
- int getNumResults () const;
-
- /**
- * This function returns the screen context
- * @return const reference to screen context
- */
- const LTKScreenContext& getScreenContext ( ) const;
-
-
- /**
- * This function gives top result of word recognition
- * @return const reference to screen context
- */
- int getTopResult (LTKWordRecoResult& outTopResult);
-
- /**
- * This function set the confidence threshold
- * @param thresh : the threshold value to be set
- * @return SUCCESS/FAILURE
- */
-
- //int setConfThreshold (float thresh);
- int setConfidThreshold (float thresh);
-
- /**
- * This function set the device context
- * @param dc: the reference to be LTKDeviceContext to be set
- * @return SUCCESS/FAILURE
- */
- void setDeviceContext (const LTKCaptureDevice& dc);
-
- /**
- * This function sets different flags
- * @param key : name of the flag to be set
- * @param value : value to be set
- * @return SUCCESS/FAILURE
- */
- //void setFlag (const string& key, int value);
- int setFlag (const string& key, int value);
-
- /**
- * This function sets language models
- * @param property : name of the flag to be set
- * @param value : value to be set
- * @return SUCCESS/FAILURE
- */
-
- //void setLanguageModel (const string& property, const string& value);
- int setLanguageModel (const string& property, const string& value) ;
-
- /**
- * This function sets number of results required from the recognizer
- * @param num : number of results
- * @param value : value to be set
- * @return SUCCESS/FAILURE
- */
- int setNumResults (int numResults);
-
- /**
- * This function sets the screen context object for the recognition
- * @param sc : the screen context object to be set
- * @return SUCCESS/FAILURE
- */
-
- //void setScreenContext (const LTKScreenContext& sc);
- void setScreenContext (const LTKScreenContext& sc);
-
- // @}
-
- /**
- * @name Recognition related functions
- */
-
- // @{
- /**
- * This function is used by the recognizer to set the results back in the recognition context
- * @param result : the LTKRecognitionResult object to be added
- * @return SUCCESS/FAILURE
- */
-
- //void addRecognitionResult (const LTKWordRecoResult& result);
- void addRecognitionResult (const LTKWordRecoResult& result);
-
- /**
- * This function is the recogniz call from the application
- * This calls the recognize method of the recognizer internally
- * @return SUCCESS/FAILURE
- */
- int recognize ();
- // @}
-
- /**
- * @name Misc
- */
-
- // @{
-
- /**
- * This function is used to reset the different components of recognition context
- * @param resetParam : parameter that identifies the component to be reset
- * @return SUCCESS/FAILURE
- */
- int reset (int resetParam);
-
-
- // @}
-
-};
-
-#endif // #ifndef __LTKRECOGNITIONCONTEXT_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h
deleted file mode 100644
index 3b67c9ee..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKRefCountedPtr.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definitions of Agglomerative Hierarchical Clustering module
- *
- * CONTENTS:
- *
- *
- * AUTHOR: Bharath A
- *
- * DATE: December 14, 2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKREFCOUNTEDPTR_H
-#define __LTKREFCOUNTEDPTR_H
-
-template <class TargetClass>
-class LTKRefCountedPtr
-{
-
-private:
-
-//instance of this counter is maintained for each object
-struct SharedCounter
-{
- TargetClass* objPtr; //target object
- int refCount; //count of current references to target object
-
- SharedCounter(TargetClass* ptr = NULL)
- {
- if(ptr!=NULL)
- {
- objPtr = ptr;
- refCount = 1;
- }
- else
- {
- objPtr = NULL;
- }
-
- }
-
-}* m_sharedCounterPtr; //pointer to common counter instance
-
-
-public:
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 14-DEC-2007
-* NAME : LTKRefCountedPtr
-* DESCRIPTION : Constructor to create a shared counter instance and point to a new object
-* ARGUMENTS : newObj - new object that needs to be tracked
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- //"explicit" keyword required to avoid construction from pointers of arbitrary type
- explicit LTKRefCountedPtr(TargetClass* newObj = NULL)
- {
- if(newObj!=NULL)
- {
- //creating the shared counter for the new object
- m_sharedCounterPtr = new SharedCounter(newObj);
-
- }
- else
- {
- m_sharedCounterPtr = NULL;
- }
- }
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 14-DEC-2007
-* NAME : LTKRefCountedPtr
-* DESCRIPTION : Copy constructor
-* ARGUMENTS : inObj - input object to get constructed from
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- LTKRefCountedPtr(const LTKRefCountedPtr& inObj)
- {
- m_sharedCounterPtr = inObj.m_sharedCounterPtr;
-
- if(m_sharedCounterPtr!=NULL)
- {
- //incrementing the number of current references to the input object
- m_sharedCounterPtr->refCount = m_sharedCounterPtr->refCount + 1;
- }
-
- }
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 14-DEC-2007
-* NAME : operator=
-* DESCRIPTION : Assignment operator overloading
-* ARGUMENTS : inObj - input object to get assigned
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- LTKRefCountedPtr& operator=(const LTKRefCountedPtr& inObj)
- {
- if (this != &inObj)
- {
- if(m_sharedCounterPtr!=NULL)
- {
- //decrementing the number of references to the object poninted to
- m_sharedCounterPtr->refCount = m_sharedCounterPtr->refCount - 1;
-
- //if there are no references to the object, delete the object
- //and the shared counter
- if(m_sharedCounterPtr->refCount == 0)
- {
- delete m_sharedCounterPtr->objPtr;
-
- delete m_sharedCounterPtr;
- }
-
- m_sharedCounterPtr = NULL;
- }
-
- //start pointing to the new object's shared counter
- m_sharedCounterPtr = inObj.m_sharedCounterPtr;
-
- if(m_sharedCounterPtr!=NULL)
- {
- //incrementing the number of current references to the new object
- m_sharedCounterPtr->refCount = m_sharedCounterPtr->refCount + 1;
- }
-
- }
- return *this;
- }
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 14-DEC-2007
-* NAME : operator*
-* DESCRIPTION : Dereferencing operator overloading
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- TargetClass& operator*() const
- {
- return *m_sharedCounterPtr->objPtr;
- }
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 14-DEC-2007
-* NAME : operator->
-* DESCRIPTION : Arrow operator overloading
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- inline TargetClass* operator->() const
- {
- return m_sharedCounterPtr->objPtr;
- }
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 14-DEC-2007
-* NAME : ~LTKRefCountedPtr
-* DESCRIPTION : Destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- ~LTKRefCountedPtr()
- {
- if(m_sharedCounterPtr!=NULL)
- {
- //decrementing the nubmer of current references to the pointed to
- m_sharedCounterPtr->refCount = m_sharedCounterPtr->refCount - 1;
-
- //if there are no references to the object, delete the object
- if(m_sharedCounterPtr->refCount == 0)
- {
- delete m_sharedCounterPtr->objPtr;
- delete m_sharedCounterPtr;
- }
-
- m_sharedCounterPtr = NULL;
- }
- }
-
- };
-
-#endif
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h
deleted file mode 100644
index 08374256..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKScreenContext.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definition of LTKScreenContext which holds the co-ordinates of
- * the writing area provided for the set of traces being sent for
- * recognition
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji Raghavan.
- *
- * DATE: Dec 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu 01-MAR-2005 Added hLines and vLines to the class
- * Also incorporated the accessor functions
- ************************************************************************/
-
-#ifndef __LTKSCREENCONTEXT_H
-#define __LTKSCREENCONTEXT_H
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-
-
- /**
- * @class LTKScreenContext
- * <p> This class contains the co-ordinates of the writing area. </p>
- */
-
-
-class LTKScreenContext
-{
-private:
-
- float m_bboxLeft; // leftmost x-coord of the writing area
-
- float m_bboxBottom; // bottommost y-coord of the writing area
-
- float m_bboxRight; // rightmost x-coord of the writing area
-
- float m_bboxTop; // topmost y-coord of the writing area
-
- floatVector m_hLines; // Vector of horizontal reference lines
-
- floatVector m_vLines; // Vector of vertical reference lines
-
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKScreenContext ();
-
- /**
- * This constrcutor takes various paramaters about a writing area.
- * @param bboxLeft Gets the left x co-ordinate of the writing area
- * @param bboxBotton Gets the bottom y co-ordinate of the writing area
- * @param bboxRight Gets the right x co-ordinate of the writing area
- * @param bboxTop Gets the top y co-ordinate of the writing area
- */
-
- LTKScreenContext(float bboxLeft, float bboxBotton, float bboxRight,
- float bboxTop);
-
- /** Destructor */
-
- ~LTKScreenContext ();
-
- // @}
-
- /**
- * @name Getter Functions
- */
- // @{
-
- /**
- * This function returns the bottom left x co-ordinate of the writing area
- * @param void
- *
- * @return Left x co-ordinate of the writing area.
- */
-
- float getBboxLeft() const;
-
- /**
- * This function returns the bottom left y co-ordinate of the writing area
- * @param void
- *
- * @return Bottom y co-ordinate of the writing area.
- */
-
- float getBboxBottom() const;
-
- /**
- * This function returns the top right x co-ordinate of the writing area
- * @param void
- *
- * @return Right x co-ordinate of the writing area.
- */
-
- float getBboxRight() const;
-
- /**
- * This function returns the top right y co-ordinate of the writing area
- * @param void
- *
- * @return Top y co-ordinate of the writing area.
- */
-
- float getBboxTop() const;
-
- /**
- * This function returns the horizontal lines
- * @param void
- *
- * @return const reference to vector of ordinates of horizontal lines
- */
-
- const floatVector& getAllHLines() const;
-
- /**
- * This function returns the vertical lines
- * @param void
- *
- * @return const reference to vector of abscissae of vertical lines
- */
-
- const floatVector& getAllVLines() const;
-
- // @}
-
- /**
- * @name Setter Functions
- */
- // @{
-
- /**
- * This function adds a horizontal line
- * in the screen context
- * @param ordinate of the horizontal line
- *
- * @return SUCCESS on successful set operation
- */
-
- int addHLine(float ordinate);
-
- /**
- * This function adds a vertical line
- * in the screen context
- * @param abscissa of the horizontal line
- *
- * @return SUCCESS on successful set operation
- */
-
- int addVLine(float abscissa);
-
- /**
- * This function sets the bottom left x co-ordinate of the writing area
- * @param bboxLeft Left x co-ordinate of the writing area
- *
- * @return SUCCESS on successful set operation
- */
-
- int setBboxLeft(float bboxLeft);
-
- /**
- * This function sets the bottom left y co-ordinate of the writing area
- * @param bboxBottom Bottom y co-ordinate of the writing area
- *
- * @return SUCCESS on successful set operation
- */
-
- int setBboxBottom(float bboxBottom);
-
- /**
- * This function sets the top right x co-ordinate of the writing area
- * @param bboxRight Right x co-ordinate of the writing area
- *
- * @return SUCCESS on successful set operation
- */
-
- int setBboxRight(float bboxRight);
-
- /**
- * This function sets the top right y co-ordinate of the writing area
- * @param bboxTop Top y co-ordinate of the writing area
- *
- * @return SUCCESS on successful set operation
- */
-
- int setBboxTop(float bboxTop);
-
- // @}
-
-};
-
-#endif
-
-//#ifndef __LTKSCREENCONTEXT_H
-//#define __LTKSCREENCONTEXT_H
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h
deleted file mode 100644
index 7d107dd1..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeFeatureMacros.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-#ifndef __LTKFEATUREEXTMACROS_H
-#define __LTKFEATUREEXTMACROS_H
-
-class LTKShapeFeature;
-#include "LTKRefCountedPtr.h"
-
-typedef LTKRefCountedPtr<LTKShapeFeature> LTKShapeFeaturePtr;
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h
deleted file mode 100644
index 1c9bc299..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoConfig.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of LTKShapeRecoConfig which holds the configuration information read
- * from the configuration files
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKSHAPERECOCONFIG_H
-#define __LTKSHAPERECOCONFIG_H
-
-#include "LTKTypes.h"
-
-/**
- * @class LTKShapeRecoConfig
- * <p> This class contains data about the location of the configuration files which are to be
- * loaded during the instanatiation of various shape recognizers. It is passed as an argument during
- * the instantiation of a shape recognizer</p>
- */
-
-class LTKShapeRecoConfig
-{
-
-private:
-
- string m_lipiRoot; // root path of the lipi tool kit
-
- string m_shapeSet; // shapeset of the recognition problem
-
- string m_profile; // profile of the recognition problem
-
- string m_shapeRecognizerName; // logical name of the shape recognizer
-
- int m_numShapes; // number of shapes in the recognition problem
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKShapeRecoConfig();
-
- /**
- * This constructor takes various arguments which are used to intialize the members of
- * this class during its instantiation.
- * @param lipiRoot Root path of Lipi Toolkit
- * @param shapeSet Shape set
- * @param profile Profile name
- * @param shapeRecongizerName Name of the shape recognizer
- * @param numShapes number of shapes in the recognition problem
- */
-
- LTKShapeRecoConfig(const string& lipiRoot, const string& shapeSet, const string& profile,
- const string& shapeRecognizerName, int numShapes);
-
- /**
- * Destructor
- */
-
- ~LTKShapeRecoConfig();
-
- // @}
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * This function reads the configuration information from the config files
- * @param configFile - full path of the main configuration file
- *
- * @return SUCCESS on successful read operation
- */
-
- int readConfigInfo(const string& configFile);
-
- // @}
-
- /**
- * @name Getter Functions
- */
- // @{
-
- /**
- * This function returns the Lipi Root
- * @param void
- *
- * @return Lipi Root.
- */
-
- const string& getLipiRoot();
-
- /**
- * This function returns the Shape Set Directory name
- * @param void
- *
- * @return Shape Set Directory name.
- */
-
- const string& getShapeSet();
-
- /**
- * This function returns the Profile Directory name
- * @param void
- *
- * @return Profile Directory name.
- */
-
- const string& getProfile();
-
- /**
- * This function returns the shape recognizer name
- * @param void
- *
- * @return shape recognizer name.
- */
-
- const string& getShapeRecognizerName();
-
- /**
- * This function returns the number of shapes in the recognition problem
- * @param void
- *
- * @return number of shapes in the recognition problem.
- */
-
- int getNumShapes();
-
- // @}
-
- /**
- * @name Setter Functions
- */
-
- // @{
-
- /**
- * This function sets the Lipi Root Path
- * @param lipiRootStr Lipi Root Path
- */
-
- int setLipiRoot(const string& lipiRootStr);
-
- /**
- * This function sets the Shape Set Directory name
- * @param shapeSetStr Shape Set Directory name
- */
-
- int setShapeSet(const string& shapeSetStr);
-
- /**
- * This function sets the Profile Directory name
- * @param profileStr Profile Directory name
- */
-
- int setProfile(const string& profileStr);
-
- /**
- * This function sets shape recognizer name
- * @param shapeRecognizerName shape recognizer name
- */
-
- int setShapeRecognizerName(const string& shapeRecognizerName);
-
- /**
- * This function sets number of shapes in the recognition problem
- * @param numShapes number of shapes in the recognition problem
- */
-
- int setNumShapes(int numShapes);
-
- // @}
-
-};
-
-#endif
-
-//#ifndef __LTKSHAPERECOCONFIG_H
-//#define __LTKSHAPERECOCONFIG_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h
deleted file mode 100644
index c33b727b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoEngine.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definition of LTKShapeRecoEngine which has the interface to the shape recognition engine
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKShapeRecoEngine_H
-#define __LTKShapeRecoEngine_H
-
-#include "LTKShapeRecognizer.h"
-
-#include "LTKTraceGroup.h"
-
-#include "LTKShapeRecoResult.h"
-
-#include "LTKScreenContext.h"
-
-#include "LTKCaptureDevice.h"
-
-/**
- * @class LTKShapeRecoEngine
- * <p> This class provides the interface to the Shape Recognition Engine.
- * The required shape recognizer is instantiated dynamically and its corresponding
- * recognize functions are called</p>
- */
-
-class LTKShapeRecoEngine
-{
-
-private:
-
- LTKShapeRecognizer* m_shapeRecognizer; // a pointer to a derived class of LTKShapeRecognizer
-
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKShapeRecoEngine();
-
- /**
- * Destructor
- */
-
- ~LTKShapeRecoEngine();
-
- // @}
-
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * This method loads a shape recognizer with a particular profile for a particular
- * recognition problem by using the information in the configuration file and the lipi tool
- * kit root path passed to it as arguments
- * @param configFileName The configuration file to load a shape recognizer
- * @param lipiRoot root path of the lipi tool kit
- */
-
- int initializeShapeRecoEngine(const string& configFileName, string lipiRoot = "");
-
- /**
- * This method calls the loadTrainingData method of the instantiated shape recognizer.
- */
-
- int loadTrainingData();
-
- /**
- * This method calls the recognize method of the instantiated shape recognizer.
- *
- * @param traceGroupObj The co-ordinates of the shape which is to be recognized
- * @param uiParams Contains information about the input field like whether it is boxed input
- * or continuous writing
- * @param deviceParams Contains information about the device like its sampling rate
- * @param shapeSubSet A subset of the entire set of shapes which is to be used for
- * recognizing the input shape.
- * @param confThreshold A threshold on confidence value of the recognized shape. This is
- * used as Rejection Criteria
- * @param numOfChoices Number of top choices to be returned in the result structure
- * @param results The result of recognition
- */
-
- int recognize(const LTKTraceGroup& traceGroup, const LTKScreenContext& screenContext,
- const LTKCaptureDevice& captureDevice, const vector<bool>& shapeSubSet, float confThreshold,
- int numChoices, vector<LTKShapeRecoResult>& results);
-
- /**
- * This method calls the recognize method of the derived shape recognizer.
- *
- * @param traceGroup The co-ordinates of the shape which is to be recognized
- * @param screenContext Contains information about the input field like whether it is boxed input
- * or continuous writing
- * @param captureDevice Contains information about the device like its sampling rate
- * @param shapeIds A subset of the entire shape space for which shape recongizer confidences
- * need to be computed
- * @param shapeRecoConfidences the confidence values calculated by the recognizer
- */
-
- int getShapeRecoConfidences(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,const LTKCaptureDevice& captureDevice,
- const vector<int>& shapeIds, vector<float>& shapeRecoConfidences);
-
- /**
- * This method calls the learn method of the instantiated shape recognizer.
- *
- * @param prototype The sample to be used for adaptation
- * @param shapeId The shape id of the added prototype
- * @param uiParams Contains information about the input field like whether it is boxed input
- * or continuous writing
- * @param deviceParams Contains information about the device like its sampling rate
- */
-
- int learn(const LTKTraceGroup& prototype, int shapeId, const LTKScreenContext& screenContext,
- const LTKCaptureDevice& captureDevice);
-
- /**
- * This method calls the train method of the instantiated shape recognizer.
- * @param trainingList The name of the file containing the listing of files to be used for
- * training each of the shapes.
- */
-
- int train(const string& trainingList);
-
- // @}
-
-};
-
-#endif
-
-//#ifndef __LTKShapeRecoEngine_H
-//#define __LTKShapeRecoEngine_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h
deleted file mode 100644
index 7dc74129..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoResult.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of LTKShapeRecoResult which holds the recognition results of the
- * shape recognition engine
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKSHAPERECORESULT_H
-#define __LTKSHAPERECORESULT_H
-
-
-/**
- * @class LTKShapeRecoResult
- * <p> This class is used to return recognition result back to the application program.
- * It contains a shapeId and the confidence that the shape with this Id is the true shape
- * of the input sample. </p>
- */
-class LTKShapeRecoResult
-{
-
-private:
-
- int m_shapeId; // shape id of the recognition result
-
- float m_confidence; // corresponding confidence of recognition
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKShapeRecoResult();
-
- /**
- * This constrcutor takes two paramaters.
- * @param shapeId shape Id of the shape
- * @param confidence Confidence that this shape is the true shape of input sample
- */
-
- LTKShapeRecoResult(int shapeId, float confidence);
-
- /** Destructor */
-
- ~LTKShapeRecoResult();
-
- // @}
-
- /**
- * @name Getter Functions
- */
- // @{
-
- /**
- * This function returns the shape Id of the result
- * @param void
- *
- * @return shape Id of the result.
- */
-
- int getShapeId() const;
-
- /**
- * This function returns the Confidence of the result
- * @param void
- *
- * @return Confidence of the result.
- */
-
- float getConfidence() const;
-
- // @}
-
- /**
- * @name Setter Functions
- */
-
- // @{
-
- /**
- * This function sets shape Id of the result
- * @param shapeId Identification tag of the shape
- */
-
- int setShapeId(int shapeId);
-
- /**
- * This function sets confidence of the recognized shape
- * @param confidence Confidence value that the recognized shape is the true shape
- */
-
- int setConfidence(float confidence);
-
- // @}
-
-};
-
-#endif
-
-//#ifndef __LTKSHAPERECORESULT_H
-//#define __LTKSHAPERECORESULT_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h
deleted file mode 100644
index 9a4c3776..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecoUtil.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-#ifndef __LTKSHAPERECOUTIL_H
-#define __LTKSHAPERECOUTIL_H
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-
-
-class LTKShapeFeature;
-class LTKTraceGroup;
-class LTKCaptureDevice;
-class LTKScreenContext;
-class LTKPreprocessorInterface;
-
-#include "LTKShapeFeatureMacros.h"
-
-/**
-* @class LTKShapeRecoUtil
-* <p> A utility class that offer some common functionalities to all the classifiers <p>
-*/
-class LTKShapeRecoUtil
-{
-
-public:
-// static FN_PTR_DELETE_SHAPE_FTR_PTR m_deleteShapeFeatureFunc;
-
- /**
- * @name Constructors and Destructor
- */
- //@{
-
- /**
- * Default Constructor
- */
- LTKShapeRecoUtil();
-
- /**
- * Destructor
- */
- ~LTKShapeRecoUtil();
-
- // @}
-
- /**
- * @name Utility Methods
- */
- // @{
-
- /**
- *
- * This method is used to convert the relative path to the absolute path
- *
- * Semantics
- *
- * - Split the line into tokens with delimiters \ and / using LTKStringUtil::tokenizeString
- *
- * - If first token is not relative path then return SUCCESS
- *
- * - Change the relative path to Absolute path ($LIPI_ROOT -> C:\Lipitk)
- *
- * @param pathName : string : Holds the path of the training file
- * @param lipiRootPath : string : Holds the lipiroot path
- * @return SUCCESS
- * @exception none
- */
- int getAbsolutePath (const string& inputPath,
- const string& lipiRootPath,
- string& outPath);
-
- /**
- * This method reads the project.cfg to find whether the project is dynamic or not
- *
- * Semantics
- *
- * - Read the key value pairs defined in project.cfg into a stringStringMap
- * projectCfgAttrs = new LTKConfigFileReader(configFilePath.c_str());
- *
- * - Read the value for the key PROJECT_CFG_ATTR_NUMSHAPES_STR
- * numShapesCfgAttr = projectCfgAttrs[PROJECT_CFG_ATTR_NUMSHAPES_STR];
- *
- * - If numShapesCfgAttr == "Dynamic"
- * - returnBool = true; and
- * - numShapes = 0
- *
- * - If numShapesCfgAttr != "Dynamic"
- * - Read the value and convert string to an integer
- * returnBool = false;
- * valueFromCFG = numShapesCfgAttr;
- * tempNumShapes = atoi(valueFromCFG.c_str());
- *
- * - If tempNumShapes == 0, Project is treated as dynamic
- *
- * @param configFilePath : string : Holds the path of the project.cfg
- * @param numShapes : unsigned short : Holds the NumShapes value from config file
- * @param returnStauts : int : Holds SUCCESS or ErrorValues
- * @param strNumShapes : string : Holds the NumShapes value from config file
- *
- * @return True : If project is dynamic
- * @return " If the value for key PROJECT_CFG_ATTR_NUMSHAPES_STR is "dynamic"
- * @return " If value for key PROJECT_CFG_ATTR_NUMSHAPES_STR is 0
- * @return False: otherwise
- *
- * @exception ECONFIG_FILE_OPEN Could not open project.cfg
- * @exception EINVALID_NUM_OF_SHAPES Negative value for number of shapes
- */
- int isProjectDynamic(const string& configFilePath,
- unsigned short& numShapes,
- string& strNumShapes,
- bool& outIsDynamic );
-
-
- /** This method reads the Ink file and check for empty traces
- *
- * <pre>
- * Semantics
- *
- * - Call getAbsolutePath to convert the relative path to absolute path
- *
- * - Call the readUnipenInkFile to read the ink file from the disk
- *
- * - Call the checkEmptyTraces to check for empty traces
- *
- * @param path : string : Holds the ink file path
- * @param lipiRootPath: string : Holds the path of Lipi Root
- * @param inTraceGroup: LTKTraceGroup :
- * @param captureDevice: LTKCaptureDevice :
- * @param screenContext: LTKScreenContext :
- * @return 0 if not have empty traces
- * @return 1 if it having empty traces
- * @exception none
- */
- int readInkFromFile(const string& path, const string& lipiRootPath,
- LTKTraceGroup& inTraceGroup,
- LTKCaptureDevice& captureDevice,
- LTKScreenContext& screenContext);
-
-
- /** This method is used to check the empty traces
- *
- * <pre>
- * Semantics
- *
- * - Iterate all the traces in inTraceGroup
- *
- * - Check for number of points for each traces to 0
- *
- * @param inTraceGroup: LTKTraceGroup :
- * @return 1 if it contains empty trace group,
- * @return 0 otherwise
- * @exception none
- */
-
- int convertHeaderToStringStringMap(const string& header, stringStringMap& headerSequence);
-
- int shapeFeatureVectorToFloatVector(const vector<LTKShapeFeaturePtr>& shapeFeature,
- floatVector& outFloatVector);
-
-
- // @}
-};
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h
deleted file mode 100644
index 7938b1f4..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKShapeRecognizer.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-11-14 17:34:35 +0530 (Fri, 14 Nov 2008) $
- * $Revision: 702 $
- * $Author: royva $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of LTKShapeRecognizer which would be used as a place holder in LTKShapeRecognizer
- * for anyone of the implemented shape recognizer like PCAShapeRecognizer which is derived from this class
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKShapeRecognizer_H
-#define __LTKShapeRecognizer_H
-
-#include "LTKInc.h"
-
-#include "LTKTraceGroup.h"
-
-#include "LTKShapeRecoResult.h"
-
-#include "LTKScreenContext.h"
-
-#include "LTKCaptureDevice.h"
-
-#include "LTKShapeRecoConfig.h"
-
-#include "LTKMacros.h"
-
-
-#include "LTKShapeFeatureMacros.h"
-/**
- * @class LTKShapeRecognizer
- * <p> This is an abstract class. This class will have to be derived by each of the shape recognizers
- * which are to be used for recognition. This class has some pure virtual functions which are
- * to be implemented by the derived class.</p>
- */
-
-class LTKShapeRecognizer
-{
-
-protected:
-
- const string m_shapeRecognizerName; // name of the shape recognizer class deriving from the LTKShapeRecognizer class
- bool m_cancelRecognition;
-
-public:
-
- /** @name Constructors and Destructor */
- //@{
-
-
- /**
- * Default Constructor.
- */
-
- LTKShapeRecognizer();
-
- /**
- * Initialization Constructor. Initialzes the member m_shapeRecognizerName
- */
-
- LTKShapeRecognizer(const string& shapeRecognizerName);
-
- /**
- * Pure Virtual Destructor
- */
-
- virtual ~LTKShapeRecognizer() = 0;
-
- //@}
-
- /**
- * @name Methods
- */
-
- //@{
-
-
- /**
- * This is a pure virtual method to be implemented by the derived class.This method loads the
- * the Training Data of the derived class.
- */
-
- virtual int loadModelData() = 0;
-
- /**
- * This is a pure virtual method to be implemented by the derived class.This method calls
- * the recognize method of the derived shape recognizer.
- *
- * @param traceGroupObj The co-ordinates of the shape which is to be recognized
- * @param screenContext Contains information about the input field like whether it is boxed input
- * or continuous writing
- * @param captureDevice Contains information about the device like its sampling rate
- * @param shapeSubSet A subset of the entire shape space which is to be used for
- * recognizing the input shape.
- * @param confThreshold A threshold on confidence value of the recognized shape. This is
- * used as Rejection Criteria
- * @param numOfChoices Number of top choices to be returned in the result structure
- * @param results The result of recognition
- */
-
- virtual int recognize(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& resultVector) = 0;
-
- virtual int recognize(const vector<LTKShapeFeaturePtr>& shapeFeatureVector,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& resultVector) = 0;
-
- void requestCancelRecognition() { m_cancelRecognition = true; }
-
- /**
- * This is a pure virtual method to be implemented by the derived class.This method calls
- * the recognize method of the derived shape recognizer.
- *
- * @param traceGroup The co-ordinates of the shape which is to be recognized
- * @param screenContext Contains information about the input field like whether it is boxed input
- * or continuous writing
- * @param captureDevice Contains information about the device like its sampling rate
- * @param shapeIds A subset of the entire shape space for which shape recongizer confidences
- * need to be computed
- * @param shapeRecoConfidences the confidence values calculated by the recognizer
- */
-
- virtual int getShapeRecoConfidences(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& shapeIds, vector<float>& shapeRecoConfidences){(void)traceGroup;(void)screenContext;(void)shapeIds;(void)shapeRecoConfidences;return FAILURE;}
-
-
- /**
- * This is a virtual method to be implemented by the derived class. This method calls the
- * train method of the derived shape recognizer.
- *
- * @param trainingList The name of the file containing the listing of files to be used for
- * training each of the shapes.
- */
-
- virtual int train(const string& trainingList,
- const string& strModelDataHeaderInfoFile,
- const string &comment,
- const string &dataset,
- const string &inFileType=INK_FILE) = 0;
-
- /**
- * This method unloads all the training data
- */
- virtual int unloadModelData() = 0;
-
- /**
- * This method sets the device context for the recognition
- *
- * @param deviceInfo The parameter to be set
- */
-
- virtual int setDeviceContext(const LTKCaptureDevice& deviceinfo) = 0;
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This method will Add a new shape class
- * shapeID contains classID of new class added
- * Returns Sucess/Failure
- */
-
- virtual int addClass(const LTKTraceGroup& sampleTraceGroup,int& shapeID);
-
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This method will Add a new shape class for adapt
- * shapeID contains classID of new class added
- * Returns Sucess/Failure
- */
-
- virtual int addSample(const LTKTraceGroup& sampleTraceGroup,int shapeID);
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This method will delete shape
- * Returns Sucess/Failure
- */
- virtual int deleteClass(int shapeID );
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This method will adapt the recent sample recognized
- * True ShapeID is passed as argument
- * Returns Sucess/Failure
- */
- virtual int adapt(int shapeID );
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This method will adapt the sample provided
- * True ShapeID is also passed as argument
- * Returns Sucess/Failure
- */
-
- virtual int adapt(const LTKTraceGroup& sampleTraceGroup, int shapeID );
-
-
-};
-
-#endif
-
-//#ifndef __LTKShapeRecognizer_H
-//#define __LTKShapeRecognizer_H
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h
deleted file mode 100644
index f114cd7a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTrace.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of LTKTrace which holds series of points from a pen down event to the next
- * immediate pen up event
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- * Thanigai 09-AUG-2005 Added emptyTrace function to empty the trace
- ************************************************************************/
-
-#ifndef __LTKTRACE_H
-#define __LTKTRACE_H
-
-#include "LTKTypes.h"
-#include "LTKTraceFormat.h"
-
-class LTKTraceFormat;
-
-/** @defgroup Common_Classes Common classes
-*/
-
-/**
-* @ingroup Common_Classes
-*/
-
-/** @brief Stores contiguous series of coordinates for one stroke.
- * @class LTKTrace
- * This class contains contiguous series of coordinates for one stroke.
- * All channel values are stored internally as float. Hence the coordinates to be
- * passed to LTKTrace should be first converted to "float" type.
- */
-
-class LTKTrace
-{
-
-private:
-
- vector<floatVector> m_traceChannels;//values of channels which make up the trace
-
- LTKTraceFormat m_traceFormat;
-
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
- //@{
-
- /**
- * Default Constructor
- */
-
- LTKTrace();
-
- /**
- * This constructor initialises a vector of channel values with a vector of float.
- *
- * @param allChannelValues A vector of float that contains contiguous channel values
- * @param channelFormat An object of LTKTraceFormat that provides information about
- * the channel positions.
- */
-
- LTKTrace(const floatVector& allChannelsVec, const LTKTraceFormat& channelformat);
-
- /**
- * This constructor initialises a trace according to the specified trace format
- *
- * @param channelFormat An object of LTKTraceFormat that provides information about
- * the channel positions
- */
-
- LTKTrace(const LTKTraceFormat& channelformat);
-
- /**
- * Copy Constructor
- */
-
- LTKTrace(const LTKTrace& trace);
-
- /**
- * Destructor
- */
-
- virtual ~LTKTrace();
- //@}
-
- /**
- * @name Assignment operator
- */
- //@{
-
- /**
- * Assignment operator
- * @param traceObj The object to be copied by assignment
- *
- * @return LTKTrace object
- */
-
- LTKTrace& operator=(const LTKTrace& trace);
- //@}
-
- /**
- * @name Getter Functions
- */
- //@{
-
- /**
- * This function returns the number of points that a stroke contains.
- * Number of points is obtained by dividing the total number of contiguous channel values
- * with the number of channels in trace format.
- *
- * @param void
- *
- * @return number of points in trace are returned.
- *
- */
-
- int getNumberOfPoints() const;
-
- /**
- * This method returns a specific point in a stroke.
- * @param pointIndex The point index at which channel values are desired.
- *
- * @return A vector of float that contains channel values of a desired point.
- *
- */
-
- int getPointAt(int pointIndex, floatVector& outPointCoordinates) const;
-
- /**
- * This method returns vector of float that contains all values
- * of a specific channel in the stroke.
- *
- * @param channelName The name of the channel, whose coordinates are required.
- *
- * @return A vector of float that contains all values of a desired channel.
- */
-
- int getChannelValues(const string& channelName, floatVector& outChannelValues) const;
-
- /**
- * This method returns vector of float that contains all values
- * a channel at a specific position.
- *
- * @param channelIndex Index of the channel,at which all coordinates are required.
- *
- * @return A vector of float that contains all values of a desired channel
- */
-
- int getChannelValues(int channelIndex, floatVector& outChannelValues) const;
-
- /**
- * This method returns a channel value at a specific point.
- *
- * @param Name of the channel whose value is required.
- * @param the point number at which a channel's value is required.
- *
- * @return channel value at the specified point. This is a float.
- *
- */
-
- int getChannelValueAt(const string& channelName, int pointIndex,
- float& outValue) const;
-
-
-
- //@}
-
- /**
- * @name SetFunctions
- */
- // @{
-
- /**
- * This method reassigns the values of the channel specified. The size of the
- * vector is expected to be same as that of the current channel size.
- *
- * @param channelName Name of the channel
- * @param channelValues Vector that holds the new channel values
- *
- *
- * @return errorCode
- *
- */
-
- int reassignChannelValues(const string& channelName,
- const floatVector& channelValues);
-
- /**
- * This method reassigns the values of all the channels. The number of rows
- * in the input 2D vector must be equal to the current number of channels with
- * each row having the same length. And this assumes one-to-one correspondence
- * with the channel vector.
- *
- * @param allChannelValues new values of all the channels
- *
- * @return errorCode
- *
- */
- int setAllChannelValues(const float2DVector& allChannelValues);
-
-
- /**
- * This method adds a point of coordinates to the existing set of points,
- * of a trace.
- *
- * @param pointVec vector of coordinates of a point.
- *
- * @return void
- *
- */
- int addPoint(const floatVector& pointVec);
-
-
- /**
- * This function adds channel values of a new channel.
- *
- * @param channelValuesVec The channel values of the new channel.
- * @param channelName The new channel to be added.
- *
- * @return void
- */
-
- int addChannel(const floatVector &channelValuesVec,const LTKChannel& channel);
-
- /**
- * This function empties the trace
- *
- * @param
- *
- * @return int
- */
-
- void emptyTrace();
-
- /**
- * Returns true if the data vector is empty
- *
- * @param
- *
- * @return bool
- */
-
- bool isEmpty() const;
-
-
- /**
- * Getter on the current trace format
- *
- * @param
- *
- * @return const LTKTraceFormat&
- */
-
- const LTKTraceFormat& getTraceFormat() const;
-
-
- int setChannelValues(const string& channelName,
- const floatVector &inputChannelValuesVec);
- //@}
-
-
-
-};
-
-#endif
-
-//#ifndef __LTKTRACE_H
-//#define __LTKTRACE_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h
deleted file mode 100644
index 26901b05..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceFormat.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definition of LTKTraceFormat which holds the information about the type and number of
- * channel data available at each pen point
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKTRACEFORMAT_H
-#define __LTKTRACEFORMAT_H
-
-#include "LTKTypes.h"
-
-class LTKChannel;
-
-/**
-* @ingroup Common_Classes
-*/
-
-/** @brief Contains the format of channels in which ink coordinates are stored.
- * @class LTKTraceFormat
- * This class contains the format of channels in which ink coordinates are stored.
- * Contains a vector of LTKChannel objects.
- */
-
-class LTKTraceFormat
-{
-private:
-
- LTKChannelVector m_channelVector; //group of channels defining the trace format
-
-public:
-
- /**
- * @name Constructor and Destructors
- */
- //@{
-
- /**
- * Default Constructor.
- * Default channels are X and Y.
- * Therfore contains LTKChannle objects for X and Y channels.
- */
-
- LTKTraceFormat();
-
- /**
- * Takes a vector of LTKChannel objects. vector of these objects
- * have to be first constructed outside and then passed to constructor.
- */
-
- LTKTraceFormat(const LTKChannelVector& channelsVec);
-
- /**
- * Copy Constructor
- */
-
- LTKTraceFormat(const LTKTraceFormat& traceFormat);
-
- /**
- * Destructor
- */
-
- ~LTKTraceFormat();
-
- //@}
-
- /**
- * @name Assignment operator
- */
- //@{
-
- /**
- * Assignment operator
- * @param traceFormatObj The object to be copied by assignment
- *
- * @return LTKTraceFormat object
- */
-
- LTKTraceFormat& operator=(const LTKTraceFormat& traceFormat);
- //@}
-
- /**
- * @name Getter Functions
- */
- //@{
-
- /**
- * This method returns the position at which a channel coordinate is stored
- * in a point.
- *
- * @param channelName
- *
- * @param returnIndex
- *
- * @return SUCCESS or FAILURE
- *
- */
-
- int getChannelIndex(const string& channelName, int& outReturnIndex) const ;
-
- /**
- * This method returns the number of channels for which positions of
- * electronic pen are captured.
- *
- * @param void
- *
- * @return number of channels
- */
-
- int getNumChannels() const ;
-
- /**
- * This method returns the name of a channel at a particular Index.
- *
- * @param index The index at which a channel name is required
- *
- * @param channelName A string passed by reference that holds the name of the
- * channel at the specified index
- *
- * @return SUCCESS or ECHANNEL_INDEX_OUT_OF_BOUND.
- */
-
- int getChannelName(int index, string& outChannelName) const ;
-
- /**
- * This method is used to know the regular channels that are present in
- * trace format.
- *
- * @param void
- *
- * @return A vector of channel names that are regular
- */
-
- stringVector getRegularChannelNames() const ;
-
- /**
- * This method is used to know all channels that are present in trace format
- *
- * @param void
- *
- * @return A vector of all channel names
- */
-
- stringVector getAllChannelNames() const ;
- //@}
-
- /**
- * @name Setter Functions
- */
- //@{
-
- /**
- * This method sets channel format if a different ordering of channels is required.
- * @param A vector of LTKChannel objects
- *
- * @return The channels of the previous format used.
- */
-
- void setChannelFormat(const LTKChannelVector& channelFormatVec);
-
- /**
- * This method is used to add a channel to the trace format
- * @param LTKChannel object that contains details of the channel to be added
- *
- * @return ERROR
- */
-
- int addChannel(const LTKChannel& channel);
-
- //@}
-
-};
-
-#endif
-
-//#ifndef __LTKTRACEFORMAT_H
-//#define __LTKTRACEFORMAT_H
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h
deleted file mode 100644
index e96b4a63..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTraceGroup.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/******************************************************************************
- * FILE DESCR: Definition of LTKTraceGroup which holds a sequence of LTKTrace
- * type objects
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu V. March 7,2005 Added new assignment operator
- * LTKTraceGroup (const LTKTrace& trace)
- * and copy constructor
- * LTKTraceGroup& operator = (const LTKTrace& trace)
- * Thanigai 09-AUG-2005 Added a function to empty the trace group
- *****************************************************************************/
-
-#ifndef __LTKTRACEGROUP_H
-#define __LTKTRACEGROUP_H
-
-#include "LTKTypes.h"
-
-class LTKTrace;
-
-/**
-* @ingroup Common_Classes
-*/
-
-/** @brief Contains set of traces that have similar characteristic.
- * @class LTKTraceGroup
- * This class contains set of traces that have similar characteristic.
- * Trace objects should be constructed and a vector that contains trace objects
- * should be passed to the constructor of the class.
- *
- */
-
-class LTKTraceGroup
-{
-
-private:
-
- float m_xScaleFactor; //scale factor of the x channel
-
- float m_yScaleFactor; //scale factor of the y channel
-
- LTKTraceVector m_traceVector; //traces forming the trace group
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default constructor.
- */
-
-
- LTKTraceGroup ();
-
- /**
- * This constructor takes a vector of LTKTrace objects.
- */
-
- LTKTraceGroup(const LTKTraceVector& inTraceVector,
- float xScaleFactor=1.0, float yScaleFactor=1.0);
-
- /**
- * Copy Constructor.
- */
-
- LTKTraceGroup (const LTKTraceGroup& traceGroup);
-
- /**
- * Constructor makes a Trace group with a single trace
- */
-
- LTKTraceGroup (const LTKTrace& trace, float xScaleFactor=1.0,
- float yScaleFactor=1.0);
-
- /**
- * Destructor
- */
-
- ~LTKTraceGroup ();
- //@}
-
- /**
- * @name Assignment operartor.
- */
- //@{
-
- /**
- * Assignment operator
- * @param traceGroupObj The object to be copied by assignment
- *
- * @return LTKTraceGroup object
- */
-
- LTKTraceGroup& operator = (const LTKTraceGroup& traceGroup);
-
- /**
- * Assignment operator
- * @param trace The trace object to be copied by assignment
- *
- * @return LTKTraceGroup object
- */
-
- LTKTraceGroup& operator = (const LTKTrace& trace);
-
- //@}
-
- /**
- * @name Getter Functions
- */
- //@{
-
- /**
- * This function returns all traces that are present in the trace group.
- *
- * @param void
- *
- * @return Returns reference to vector of LTKTrace objects, that form a trace group.
- *
- */
-
- const LTKTraceVector& getAllTraces () const;
-
-
- /**
- * This function gives a trace at a specified index in a trace group.
- *
- * @param traceIndex index of a trace in trace group
- *
- * @return Reference to LTKTrace object
- */
-
- int getTraceAt (int traceIndex, LTKTrace& outTrace) const;
-
- /**
- * This fucntion returns the number of traces present in trace group.
- *
- * @param void
- *
- * @return Number of traces present in trace group.
- *
- */
-
- int getNumTraces () const;
-
- float getXScaleFactor() const;
- float getYScaleFactor() const;
-
- //@}
-
- /**
- * Setter Fucntions
- */
- //@{
-
- /**
- * This function is used to add traces to a trace group object.
- *
- * @param traceObj trace object that has to be added to trace group.
- *
- * @return void
- *
- */
-
- int addTrace (const LTKTrace& trace);
-
- /**
- * This function replaces vector of all traces in a trace group with the
- * new traces vector.
- *
- * @param tracesVector The new traces which to have accessed.
- *
- * @return void
- */
-
- int setAllTraces (const LTKTraceVector& tracesVec, float xScaleFactor=1.0,
- float yScaleFactor=1.0);
-
- /**
- * This function empties the tracevector
- *
- * @param void
- *
- * @return int
- */
-
- void emptyAllTraces();
- /**
- * This function calculates the maximum and minimum of coordinates in a trace group.
- *
- * @param xMin reference to minimum value of x channel
- *
- * @param yMin reference to minimum value of y channel
- *
- * @param xMax reference to maximum value of x channel
- *
- * @param yMax reference to maximum value of y channel
- *
- * @return int error code
- */
-
- int getBoundingBox(float& outXMin,float& outYMin,float& outXMax,float& outYMax) const;
-
-
-
- /**
- * Scales the tracegroup according to the x and y scale factors taking into account the current scale factors.
- * After scaling, the tracegroup is translated in order to preserve the "cornerToPreserve".
- *
- * @param xScaleFactor factor by which x dimension has to be scaled
- * @param yScaleFactor factor by which y dimension has to be scaled
- * @param cornerToPreserve corner to be retained after scaling
- * @return int error code
- */
-
- int scale(float xScaleFactor,float yScaleFactor,TGCORNER cornerToPreserve);
-
-
-
- /**
- * Translates the tracegroup so that the "referenceCorner" is moved to (x,y)
- *
- *
- * @param x x value of the point to which referenceCorner has to be moved
- * @param y y value of the point to which referenceCorner has to be moved
- * @param referenceCorner - the reference corner in the tracegroup that has to be moved to (x,y)
- * @return int error code
- */
-
- int translateTo(float x,float y,TGCORNER referenceCorner);
-
-
- /**
- * Scales the tracegroup according to the x and y scale factors.
- * After scaling, the "referenceCorner" of the tracegroup is translated to
- *(translateToX,translateToY)
- *
- * @param xScaleFactor factor by which x dimension has to be scaled
- * @param yScaleFactor factor by which y dimension has to be scaled
- * @param referenceCorner corner to be retained after scaling and moved to (translateToX,translateToY)
- * @return int error code
- */
-
- int affineTransform(float xScaleFactor,float yScaleFactor,float translateToX,
- float translateToY,TGCORNER referenceCorner);
-
- bool containsAnyEmptyTrace() const;
-
-
- //@}
-
-};
-
-#endif
-
-//#ifndef __LTKTRACEGROUP_H
-//#define __LTKTRACEGROUP_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTypes.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTypes.h
deleted file mode 100644
index 6c10ccc2..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKTypes.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:33:34 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 564 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Contains list of standard type definitions
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKTYPES_H
-#define __LTKTYPES_H
-
-#include "LTKInc.h"
-//class LTKShapeFeature;
-class LTKChannel;
-class LTKTrace;
-
-typedef vector<bool> boolVector;
-typedef vector<int> intVector;
-typedef vector<float> floatVector;
-typedef vector<double> doubleVector;
-typedef vector<string> stringVector;
-typedef vector<intVector> int2DVector;
-typedef vector< floatVector> float2DVector;
-typedef vector<doubleVector> double2DVector;
-typedef vector<float2DVector > float3DVector;
-typedef map<string, string> stringStringMap;
-typedef float (*distPointer)(const vector<float>&,const vector<float>&);
-typedef int (*reduceFunctionPointer)(const vector<vector<float> >&,vector<vector<float> >&);
-typedef vector <float> Features;
-typedef vector <Features> Character;
-typedef map<string,int> stringIntMap;
-//typedef double (*FN_PTR_DELETE_SHAPE_FTR_PTR)(LTKShapeFeature*);
-typedef vector<LTKChannel> LTKChannelVector;
-typedef vector<LTKTrace> LTKTraceVector;
-typedef pair<string,string> stringStringPair;
-typedef map<int,int> intIntMap;
-
-typedef struct ModuleRefCount
-{
- vector<void*> vecRecoHandles;
- void* modHandle;
- int iRefCount;
-} MODULEREFCOUNT;
-
-
-/* @enum ELTKDataType This enumerator stores the data type of a channel.
- * All channel values are stored in memory as float.
- */
-
-enum ELTKDataType
-{
- DT_BOOL, DT_SHORT, DT_INT, DT_LONG, DT_FLOAT, DT_DOUBLE, DT_NULL
-};
-
-enum ELTKTraceGroupStatistics
-{
- TG_MAX, TG_MIN, TG_AVG
-};
-
-struct LTKControlInfo
-{
- string projectName;
- string profileName;
- string cfgFileName;
- string cfgFilePath;
- string lipiRoot;
- string lipiLib;
- string toolkitVersion;
-
- // constructor
- LTKControlInfo():
- projectName(""),
- profileName(""),
- cfgFileName(""),
- cfgFilePath(""),
- lipiRoot(""),
- lipiLib(""),
- toolkitVersion("")
- {
- }
-
-};
-
-//Enumerator to indicate corner point of a tracegroup
- enum TGCORNER
- {
- XMIN_YMIN,
- XMIN_YMAX,
- XMAX_YMIN,
- XMAX_YMAX
-};
-
-#endif //#ifndef __LTKTYPES_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h
deleted file mode 100644
index 535b4c2a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoConfig.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definition of LTKWordRecoConfig holds the config data for
- * the recognizer at the time of loading.
- *
- * CONTENTS:
- *
- * AUTHOR: Mudit Agrawal
- *
- * DATE: Mar 2, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu 24-MAR-2005 Added getGrammarPath
- *
- ************************************************************************/
-
-#ifndef __LTKWORDRECOCONFIG_H
-#define __LTKWORDRECOCONFIG_H
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-
-/**
-* @class LTKWordRecoConfig
-* <p> This class contains the config data for the recognizer at the time of loading </p>
-*/
-
-class LTKWordRecoConfig
-{
-private:
- string m_classifierName; //name of the classifier to be loaded
-
- string m_dictionaryPath; //path where dictionaries are present
-
- string m_grammarPath; //path where grammar is present
-
- string m_lipiRoot; //specifies the lipi root directory
-
- string m_problemName; //specifies the logical name for the problem of recognition. e.g. devanagari-word-recognition
-
- string m_profile; //refers to main.cfg. This in turn refers to word.cfg and profile.cfg
-
- string m_script; //script that is to be recognized
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKWordRecoConfig();
-
- /**
- * This constrcutor takes one paramater about the recognizer
- * @param lipiRoot
- */
-
- LTKWordRecoConfig(const string& lipiRoot);
-
-
- /** Destructor */
-
- ~LTKWordRecoConfig();
-
- // @}
-
- /**
- * @name Getter Functions
- */
- // @{
-
- /**
- * This function returns the classifier name
- * @param void
- *
- * @return classifier name
- */
-
- string getClassifierName() const;
-
- /**
- * This function returns the Dictionary Path
- * @param void
- *
- * @return Dictionary Path
- */
-
- string getDictionaryPath() const;
-
- /**
- * This function returns the Grammar Path
- * @param void
- *
- * @return Grammar Path
- */
-
- string getGrammarPath() const;
-
- /**
- * This function returns the lipi root
- * @param void
- *
- * @return lipi root
- */
-
- string getLipiRoot() const;
-
- /**
- * This function returns the profile
- * @param void
- *
- * @return profile
- */
-
- string getProfile() const;
-
- /**
- * This function returns the script
- * @param void
- *
- * @return script name
- */
-
- string getScript() const;
-
- /**
- * This function returns the problem Name
- * @param void
- *
- * @return problem Name
- */
-
- string getProblemName() const;
-
- /**
- * @name Setter Functions
- */
- // @{
-
- /**
- * This function reads the main config file and inturn other config files also (defined in main.cfg)
- *
- * @param path of the main config file
- *
- * @return SUCCESS on successful read operation of all config files
- */
-
- int readConfigFile(const string& configFileName);
-
- /**
- * @name Setter Functions
- */
- // @{
-
- /**
- * This function sets the lipi root
- *
- * @param lipi root
- *
- * @return SUCCESS on successful set operation
- */
-
- int setLipiRoot(const string& lipiRoot);
-
-
-
-};
-
-
-#endif
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h
deleted file mode 100644
index 3d54d6c2..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecoResult.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: The word recognition result class
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: March 10, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu V. 23-Aug-05 Added update word recognition result method
- ************************************************************************/
-#ifndef __LTKWORDRECORESULT_H
-#define __LTKWORDRECORESULT_H
-
-#include "LTKTypes.h"
-
-/**
-* @class LTKWordFeatureExtractor
-* <p> This is an abstract class. This contains the interface definitions of a wordrecognizer</p>
-*/
-
-class LTKWordRecoResult
-{
-private:
-
- vector<unsigned short> m_word; //The result word as unicode string
-
- float m_confidence; //confidence returned by the recognizer for this
-
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
- LTKWordRecoResult();
-
- /**
- * Constructor that takes two arguements
- */
-
- //LTKWordRecoResult(const vector< unsigned short >& word, float confidence);
- LTKWordRecoResult(const vector< unsigned short >& word, float confidence);
-
- /**
- * Destructor
- */
- virtual ~LTKWordRecoResult();
- // @}
-
- /**
- * This method adds to the existing word recognition result
- * with a new symbol
- * @param newSymbol - This will be appended to the existing word
- * @param confidence - confidence of the new symbol, will be added to existing confidence
- * @return SUCCESS/FAILURE
- */
- int updateWordRecoResult( unsigned short newSymbol, float confidence);
-
- /**
- * This method sets the word recognition result
- * @param word The result
- * @param confidence The result
- * @return SUCCESS/FAILURE
- */
-
- //int setWordRecoResult(const vector< unsigned short >& word, float confidence);
- int setWordRecoResult(const vector< unsigned short >& word, float confidence);
-
- /**
- * This method gets the word recognition result
- * @param void
- * @return the unicode string
- */
- const vector<unsigned short>& getResultWord() const;
-
- /**
- * This method gets the confidence of the result
- * @param void
- * @return confidence value
- */
- float getResultConfidence() const;
-
- /**
- * This method sets the confidence of the result
- * @param float value of confidence
- * @return SUCCESS if completed successfully
- */
- int setResultConfidence(float confidence);
-
-};
-
-#endif //#ifndef __LTKWORDRECORESULT_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h
deleted file mode 100644
index 0322b79c..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/LTKWordRecognizer.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: The abstract class for a word recognizer
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: March 10, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKWORDRECOGNIZER_H
-#define __LTKWORDRECOGNIZER_H
-
-#include "LTKTypes.h"
-
-#include "LTKInc.h"
-
-#include "LTKTraceGroup.h"
-
-class LTKRecognitionContext;
-/**
-* @class LTKWordFeatureExtractor
-* <p> This is an abstract class. This contains the interface definitions of a wordrecognizer</p>
-*/
-
-class LTKWordRecognizer
-{
-protected:
- const string m_wordRecognizerName; // name of the word recognizer class deriving from the LTKShapeRecognizer class
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
- LTKWordRecognizer()
- {
-
- }
-
- /**
- * Initialization Constructor. Initialzes the member m_shapeRecognizerName
- */
-
- LTKWordRecognizer(const string& wordRecognizerName):
- m_wordRecognizerName(wordRecognizerName)
- {
-
- }
-
- /**
- * Virtual Destructor
- */
- virtual ~LTKWordRecognizer()
- {
-
- }
-
- // @}
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This method is called from recognition context whenever new traces
- * are added to it. The Recognizer need to process the new traces
- * in this methods and updates the internal state.
- * @param rc The recognition context for the current recognition
- */
-
- //virtual int processInk (const LTKRecognitionContext& rc) = 0;
- virtual int processInk (LTKRecognitionContext& rc) = 0;
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This function notifies the recognizer that end of current ink is
- * the end of a logic segment. This information could be used in
- * constraining the recognizer choices
- */
- virtual void endRecoUnit () = 0;
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This is the recognize call. In case of trace by trace recognition
- * The results of the recognition is set on the Recognition context
- * object.
- * @param rc The recognition context for the current recognition
- */
-
- // virtual int recognize (const LTKRecognitionContext& rc) = 0;
- virtual int recognize (LTKRecognitionContext& rc) = 0;
-
- /**
- * This is a pure virtual method to be implemented by the derived class.
- * This method reset the recognizer.
- * @param resetParam This parameter could specify what to reset
- */
- virtual int reset (int resetParam = 0) = 0;
-
- /**
- * This method unloads all the training data
- * To re-initialize the recognizer call the
- * API initialize again
- */
- virtual int unloadModelData() =0;
-
-};
-
-#endif // #ifndef __LTKWORDRECOGNIZER_H
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/headers.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/headers.pri
deleted file mode 100644
index cae80bd7..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/include/headers.pri
+++ /dev/null
@@ -1,32 +0,0 @@
-HEADERS += \
- $$PWD/LTKCaptureDevice.h \
- $$PWD/LTKChannel.h \
- $$PWD/LTKClassifierDefaults.h \
- $$PWD/LTKErrorsList.h \
- $$PWD/LTKException.h \
- $$PWD/LTKInc.h \
- $$PWD/LTKLipiEngineInterface.h \
- $$PWD/LTKLogger.h \
- $$PWD/LTKLoggerInterface.h \
- $$PWD/LTKMacros.h \
- $$PWD/LTKOSUtil.h \
- $$PWD/LTKOSUtilFactory.h \
- $$PWD/LTKPreprocDefaults.h \
- $$PWD/LTKPreprocessor.h \
- $$PWD/LTKPreprocessorInterface.h \
- $$PWD/LTKRecognitionContext.h \
- $$PWD/LTKRefCountedPtr.h \
- $$PWD/LTKScreenContext.h \
- $$PWD/LTKShapeFeatureMacros.h \
- $$PWD/LTKShapeRecoConfig.h \
- $$PWD/LTKShapeRecoEngine.h \
- $$PWD/LTKShapeRecoResult.h \
- $$PWD/LTKShapeRecoUtil.h \
- $$PWD/LTKShapeRecognizer.h \
- $$PWD/LTKTrace.h \
- $$PWD/LTKTraceFormat.h \
- $$PWD/LTKTraceGroup.h \
- $$PWD/LTKTypes.h \
- $$PWD/LTKWordRecoConfig.h \
- $$PWD/LTKWordRecoResult.h \
- $$PWD/LTKWordRecognizer.h
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri
deleted file mode 100644
index 6dbb63a9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipicommon.pri
+++ /dev/null
@@ -1,21 +0,0 @@
-TEMPLATE = lib
-
-CONFIG -= qt
-CONFIG += exceptions
-CONFIG += warn_off
-
-contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
-contains(QT_CONFIG, build_all): CONFIG += build_all
-
-INCLUDEPATH += $$PWD/include
-
-load(qt_build_paths)
-
-!isEmpty(LIPILIBS) {
- LIBS += -L$$MODULE_BASE_OUTDIR/lib
- for (lib, LIPILIBS) {
- LIBS += -l$$lib$$qtPlatformTargetSuffix()
- }
-}
-
-TARGET = $$BASE_TARGET_NAME$$qtPlatformTargetSuffix()
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/.prev_CMakeLists.txt
deleted file mode 100644
index b7bd318f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from lipiengine.pro.
-
-#####################################################################
-## lipiengine Generic Library:
-#####################################################################
-
-qt_add_cmake_library(lipiengine
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- LipiEngineModule.cpp LipiEngineModule.h
- lipiengine.cpp lipiengine.h
- INCLUDE_DIRECTORIES
- ../include
- ../util/lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(lipiengine)
-
-#### Keys ignored in scope 1:.:.:lipiengine.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "wordreccommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(lipiengine CONDITION WIN32
- DEFINES
- LIPIENGINE_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(lipiengine CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(lipiengine)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/CMakeLists.txt
deleted file mode 100644
index 307be9f6..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from lipiengine.pro.
-
-#####################################################################
-## lipiengine Generic Library:
-#####################################################################
-
-qt_add_cmake_library(lipiengine
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- LipiEngineModule.cpp LipiEngineModule.h
- lipiengine.cpp lipiengine.h
- INCLUDE_DIRECTORIES
- ../include
- ../util/lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(lipiengine)
-
-#### Keys ignored in scope 1:.:.:lipiengine.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "wordreccommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(lipiengine CONDITION WIN32
- DEFINES
- LIPIENGINE_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(lipiengine CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(lipiengine)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp
deleted file mode 100644
index f5a69788..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.cpp
+++ /dev/null
@@ -1,1371 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-*******************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 11:00:11 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 832 $
- * $Author: dineshm $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation for PCA Shape Recognition module
- *
- * CONTENTS:
- * initializeLipiEngine
- * createShapeRecognizer
- * createWordRecognizer
- * deleteShapeRecognizer
- * deleteWordRecognizer
- * createRecognitionContext
- * deleteRecognitionContext
- * getcurrentversion
- * getLipiRootPath
- * mapShapeAlgoModuleFunctions
- * mapWordAlgoModuleFunctions
- * resolveLogicalNameToProjectProfile
- *
- * AUTHOR: Thanigai Murugan K
- *
- * DATE: July 29, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LipiEngineModule.h"
-#include "LTKConfigFileReader.h"
-#include "LTKStringUtil.h"
-#include "lipiengine.h"
-#include "LTKException.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKOSUtil.h"
-#include "LTKLoggerUtil.h"
-
-extern int unloadAllModules();
-extern int deleteModule(void* RecoHandle);
-extern void addModule(void* RecoHandle, void* handle);
-
-LTKLipiEngineModule* LTKLipiEngineModule::lipiEngineModuleInstance= NULL;
-
-/******************************************************************************
-* AUTHOR : Nidhi
-* DATE : 06-Dec-2006
-* NAME : LTKLipiEngineModule
-* DESCRIPTION : constructor
-* ARGUMENTS : None
-* RETURNS : None
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-LTKLipiEngineModule::LTKLipiEngineModule():
-m_LipiEngineConfigEntries(NULL),
-m_logFileName(DEFAULT_LOG_FILE),
-m_logLevel(DEFAULT_LOG_LEVEL),
-m_OSUtilPtr(LTKOSUtilFactory::getInstance())
-{
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : ~LTKLipiEngineModule
-* DESCRIPTION : Destructor
-* ARGUMENTS : None
-* RETURNS : None
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-LTKLipiEngineModule::~LTKLipiEngineModule()
-{
- delete m_LipiEngineConfigEntries;
- delete m_OSUtilPtr;
-
- LTKLoggerUtil::destroyLogger();
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : initializeLipiEngine
-* DESCRIPTION : Reads the lipiengine.cfg and store the AVP map into
-* the map variable "m_LipiEngineConfigEntries"
-* ARGUMENTS :
-* RETURNS : 0 on success other values error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::initializeLipiEngine()
-{
- //Log messages after call to configureLogger()
-
- string temp;
- int errorCode;
-
- if(m_strLipiRootPath == "")
- {
- LTKReturnError(ELIPI_ROOT_PATH_NOT_SET); // PATH not set
- }
- if(m_strLipiLibPath == "")
- {
- m_strLipiLibPath = m_strLipiRootPath + SEPARATOR + "lib";
- }
-
- temp = m_strLipiRootPath + SEPARATOR + "projects" + SEPARATOR +
- LIPIENGINE_CFG_STRING;
-
- //Read the logical name mapping file from lipiengine.cfg file;
- try
- {
- m_LipiEngineConfigEntries = new LTKConfigFileReader(temp);
-
- }
- catch(LTKException e)
- {
- // display warning to the user and continue with default values
- cout << " Could not open file : " << temp << endl <<
- "proceeding with defaults" << endl;
- }
-
- errorCode = configureLogger(); // Configure the logger
-
- if(errorCode !=SUCCESS)
- {
- LTKReturnError(errorCode);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "LTKLipiEngineModule::initializeLipiEngine()"<<endl;
- }
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 11-Jan-2007
-* NAME : LTKLipiEngineModule::getInstance
-* DESCRIPTION : Returns a pointer to the LTKLipiEngineModule instance
-* ARGUMENTS :
-* RETURNS : Address of the LTKLipiEngineModule instance.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*
-******************************************************************************/
-LTKLipiEngineModule* LTKLipiEngineModule::getInstance()
-{
- if(lipiEngineModuleInstance == NULL)
- {
- lipiEngineModuleInstance = new LTKLipiEngineModule();
- }
-
- return lipiEngineModuleInstance;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 02-Jul-2008
-* NAME : destroyLipiEngineInstance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*
-******************************************************************************/
-void LTKLipiEngineModule::destroyLipiEngineInstance()
-{
- if(lipiEngineModuleInstance != NULL)
- {
- delete lipiEngineModuleInstance;
- lipiEngineModuleInstance = NULL;
- }
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : createShapeRecognizer
-* DESCRIPTION : create an instance of shape recognizer object and call
-* initialize function. Also loads the model data.
-* ARGUMENTS : strProjectName - project name; strProfileName - profile name
-* outShapeRecognizerPtr - return shape recognizer object
-* RETURNS : if success returns 0 or if fails returns error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::createShapeRecognizer(const string& strProjName,
- const string& strProfName,
- LTKShapeRecognizer** outShapeRecoObj)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- int errorCode;
- int iResult = 0;
- void *dllHandler = NULL;
- string recognizerName = "";
- string strProjectName = strProjName;
- string strProfileName = strProfName;
-
- //Validating Project names and profile names
- errorCode = validateProjectAndProfileNames(strProjectName, strProfileName,
- "SHAPEREC", recognizerName);
- if (errorCode != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- // Load the dlaal of the shape recognizer
- errorCode = loadRecognizerDLL(recognizerName, &dllHandler);
-
- if( errorCode!= SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- // Map Algo DLL functions...
- errorCode = mapShapeAlgoModuleFunctions(dllHandler);
-
- if( errorCode!= SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- // Create control Info object
- char currentVersion[VERSION_STR_LEN];
- int iMajor, iMinor, iBugfix;
-
- getToolkitVersion(iMajor, iMinor, iBugfix);
- sprintf(currentVersion, "%d.%d.%d", iMajor, iMinor, iBugfix);
-
- LTKControlInfo controlInfo;
- controlInfo.lipiRoot = m_strLipiRootPath;
- controlInfo.lipiLib = m_strLipiLibPath;
- controlInfo.projectName = strProjectName;
- controlInfo.profileName = strProfileName;
- controlInfo.toolkitVersion = currentVersion;
-
- // Call recognition module's createShapeRecognizer();
- errorCode = module_createShapeRecognizer(controlInfo,outShapeRecoObj);
-
- if(errorCode !=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(ECREATE_SHAPEREC) << " "<< recognizerName <<
- "LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- m_OSUtilPtr->unloadSharedLib(dllHandler);
-
- LTKReturnError(ECREATE_SHAPEREC);
- }
-
- addModule(*outShapeRecoObj, dllHandler);
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- return SUCCESS;
-
-}
-/******************************************************************************
-* AUTHOR : Balaji MNA
-* DATE : 14-JUN-2009
-* NAME : createShapeRecognizer
-* DESCRIPTION : resolves logical project name and call createWordRecognizer
-* function.
-* ARGUMENTS : strLogicalProjectName - logical project name;
-* outShapeRecognizerPtr - return shape recognizer object
-* RETURNS : if success returns 0 or if fails returns error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::createShapeRecognizer(string &strLogicalProjectName, LTKShapeRecognizer** outShapeRecognizerPtr)
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- if(strLogicalProjectName.empty())
- {
- return EINVALID_PROJECT_NAME;
- }
-
- string strProjectName = "";
- string strProfileName = "";
-
- // Resolve the logical name into project name and profile name
- errorCode = resolveLogicalNameToProjectProfile(strLogicalProjectName,
- strProjectName,
- strProfileName);
-
- if(errorCode !=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- errorCode = createShapeRecognizer(strProjectName,strProfileName,outShapeRecognizerPtr);
-
- if(errorCode !=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::createShapeRecognizer()"<<endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : createWordRecognizer
-* DESCRIPTION : create an instance of word recognizer object and call initialize
-* function. Also loads the model data.
-* ARGUMENTS : strProjectName - project name; strProfileName - profile name
-* outShapeRecognizerPtr - return shape recognizer object
-* RETURNS : if success returns 0 or if fails returns error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::createWordRecognizer(const string& strProjName,
- const string& strProfName,
- LTKWordRecognizer** outWordRecoObj)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
- string recognizerName = "";
- int iResult = 0;
- void *dllHandler = NULL;
- string strProjectName = strProjName;
- string strProfileName = strProfName;
-
- int errorCode;
-
- errorCode = validateProjectAndProfileNames(strProjectName,strProfileName,
- "WORDREC", recognizerName);
- if (errorCode != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
-
- LTKReturnError(errorCode);
- }
-
- // Load the dll of the word recognizer
-
- errorCode = loadRecognizerDLL(recognizerName, &dllHandler);
-
- if( errorCode!= SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
-
- LTKReturnError(errorCode);
- }
-
- // Get version information
- char currentVersion[VERSION_STR_LEN];
- int iMajor, iMinor, iBugFix;
- getToolkitVersion(iMajor, iMinor, iBugFix);
- sprintf(currentVersion, "%d.%d.%d", iMajor, iMinor, iBugFix);
-
- // Create controlInfo object
- LTKControlInfo controlInfo;
-
- controlInfo.lipiRoot = m_strLipiRootPath;
- controlInfo.lipiLib = m_strLipiLibPath;
- controlInfo.projectName = strProjectName;
- controlInfo.profileName = strProfileName;
- controlInfo.toolkitVersion = currentVersion;
-
- // Map Algo DLL functions...
- errorCode = mapWordAlgoModuleFunctions(dllHandler);
- if(errorCode!= SUCCESS)
- {
- // Unable to map the functions
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
-
- LTKReturnError(errorCode);
- }
-
- // Call recognition module's createWordRecognizer();
- errorCode = module_createWordRecognizer(controlInfo,outWordRecoObj );
- if(errorCode != SUCCESS)
- {
- /* Error, unable to create word recognizer instance */
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(ECREATE_WORDREC) << " "<<recognizerName<<
- "LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
- m_OSUtilPtr->unloadSharedLib(dllHandler);
-
- LTKReturnError(ECREATE_WORDREC);
- }
-
- addModule(*outWordRecoObj, dllHandler);
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
- return SUCCESS;
-}
-/******************************************************************************
-* AUTHOR : Balaji MNA
-* DATE : 14-JUN-2009
-* NAME : createWordRecognizer
-* DESCRIPTION : resolves logical project name and call createWordRecognizer
-* function.
-* ARGUMENTS : strLogicalProjectName - logical project name;
-* outShapeRecognizerPtr - return shape recognizer object
-* RETURNS : if success returns 0 or if fails returns error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::createWordRecognizer(const string& strlogicalProjectName,
- LTKWordRecognizer** outWordRecPtr)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
- int errorCode;
- string strProjectName;
- string strProfileName;
-
- errorCode = resolveLogicalNameToProjectProfile(strlogicalProjectName,
- strProjectName,
- strProfileName);
-
- if(errorCode !=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- errorCode = createWordRecognizer(strProjectName,strProfileName,
- outWordRecPtr);
- if (errorCode != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::createWordRecognizer()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : deleteShapeRecognizer
-* DESCRIPTION : To delete the recognizer object which is created
-* using "createShapeRecognizer" call
-* ARGUMENTS : obj - handle the previously created recognizer object
-* RETURNS : 0 on success other values error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Balaji MNA 18th Jan 2010 Receiving LTKShapeRecognizer as single pointer
-* instead of double pointer in deleteShapeRecognizer
-******************************************************************************/
-int LTKLipiEngineModule::deleteShapeRecognizer(LTKShapeRecognizer* obj)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::deleteShapeRecognizer()"<<endl;
-
- int errorCode;
-
- //Call recognition module's deleteShapeRecognizer(obj)
- if(obj)
- {
- deleteModule(obj);
- errorCode = module_deleteShapeRecognizer(obj);
- if(errorCode !=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::deleteShapeRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
- obj = NULL;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::deleteShapeRecognizer()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : deleteWordRecognizer
-* DESCRIPTION : To delete the recognizer object which is created
-* using "createWordRecognizer" call
-* ARGUMENTS : obj - handle the previously created recognizer object
-* RETURNS : 0 on success other values error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::deleteWordRecognizer(LTKWordRecognizer* obj)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::deleteWordRecognizer()"<<endl;
-
- int errorCode;
-
- // Call recognition module's deleteWordRecognizer(obj)
- if(obj)
- {
- deleteModule(obj);
- errorCode = module_deleteWordRecognizer(obj);
- if(errorCode !=SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << getErrorMessage(errorCode) <<
- "LTKLipiEngineModule::deleteShapeRecognizer()"<<endl;
-
- LTKReturnError(errorCode);
- }
- obj = NULL;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::deleteWordRecognizer()"<<endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : getLipiRootPath
-* DESCRIPTION : To fetch the value for the environment variable LIPI_ROOT
-* ARGUMENTS : None
-* RETURNS : environment string on success & NULL on error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-string LTKLipiEngineModule::getLipiRootPath() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::getLipiRootPath()"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::getLipiRootPath()"<<endl;
-
- return m_strLipiRootPath;
-}
-
-/******************************************************************************
-* AUTHOR :
-* DATE :
-* NAME : getLipiLibPath
-* DESCRIPTION : To fetch the value for the environment variable LIPI_LIB
-* ARGUMENTS : None
-* RETURNS : environment string on success & NULL on error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-string LTKLipiEngineModule::getLipiLibPath() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Entering: LTKLipiEngineModule::getLipiLibPath()"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Exiting: LTKLipiEngineModule::getLipiLibPath()"<<endl;
-
- return m_strLipiLibPath;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 10-JAN-2007
-* NAME : setLipiRootPath
-* DESCRIPTION : To set the value of LIPI_ROOT
-* ARGUMENTS : String
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void LTKLipiEngineModule::setLipiRootPath(const string& appLipiPath)
-{
-
- //Dont LOG messages as this may be called before configureLogger()
-
- if ( appLipiPath.empty())
- {
- m_strLipiRootPath = m_OSUtilPtr->getEnvVariable(LIPIROOT_ENV_STRING);
- }
- else
- {
- m_strLipiRootPath = appLipiPath;
- }
-}
-
-/******************************************************************************
-* AUTHOR :
-* DATE :
-* NAME : setLipiLibPath
-* DESCRIPTION : To set the value of LIPI_LIB
-* ARGUMENTS : String
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void LTKLipiEngineModule::setLipiLibPath(const string& appLipiLibPath)
-{
-
- //Dont LOG messages as this may be called before configureLogger()
-
- if ( appLipiLibPath.empty())
- {
- m_strLipiLibPath = m_OSUtilPtr->getEnvVariable(LIPILIB_ENV_STRING);
- }
- else
- {
- m_strLipiLibPath = appLipiLibPath;
- }
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : mapShapeAlgoModuleFunctions
-* DESCRIPTION : To map function addresses of the methods exposed by
-* the shape recognition modules
-* ARGUMENTS : None
-* RETURNS : 0 on success and other values on error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::mapShapeAlgoModuleFunctions(void *dllHandle)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;
-
-
- module_createShapeRecognizer = NULL;
- module_deleteShapeRecognizer = NULL;
-
- void* functionHandle = NULL;
-
- int returnVal = m_OSUtilPtr->getFunctionAddress(dllHandle,
- CREATESHAPERECOGNIZER_FUNC_NAME,
- &functionHandle);
-
- // Could not map the function from the DLL
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<<
- getErrorMessage(EDLL_FUNC_ADDRESS) <<" "<<CREATESHAPERECOGNIZER_FUNC_NAME
- <<" "<<"LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;
-
-
- m_OSUtilPtr->unloadSharedLib(dllHandle);
-
- LTKReturnError(EDLL_FUNC_ADDRESS);
- }
-
- module_createShapeRecognizer = (FN_PTR_CREATESHAPERECOGNIZER)functionHandle;
-
- functionHandle = NULL;
-
- returnVal = m_OSUtilPtr->getFunctionAddress(dllHandle,
- DELETESHAPERECOGNIZER_FUNC_NAME,
- &functionHandle);
-
- // Could not map the function from the DLL
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<<
- getErrorMessage(EDLL_FUNC_ADDRESS) <<" "<<DELETESHAPERECOGNIZER_FUNC_NAME
- <<" "<<"LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;
-
- m_OSUtilPtr->unloadSharedLib(dllHandle);
-
- LTKReturnError(EDLL_FUNC_ADDRESS);
- }
-
- module_deleteShapeRecognizer = (FN_PTR_DELETESHAPERECOGNIZER)functionHandle;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : mapWordAlgoModuleFunctions
-* DESCRIPTION : To map function addresses of the methods exposed by
-* the word recognition modules
-* ARGUMENTS : None
-* RETURNS : 0 on success and other values on error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::mapWordAlgoModuleFunctions(void *dllHandle)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: LTKLipiEngineModule::mapWordAlgoModuleFunctions()"<<endl;
-
- module_createWordRecognizer = NULL;
- module_deleteWordRecognizer = NULL;
-
- void* functionHandle = NULL;
-
- int returnVal = m_OSUtilPtr->getFunctionAddress(dllHandle,
- CREATEWORDRECOGNIZER_FUNC_NAME,
- &functionHandle);
-
- // Could not map the function from the DLL
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<<
- getErrorMessage(EDLL_FUNC_ADDRESS) <<" "<<CREATEWORDRECOGNIZER_FUNC_NAME
- <<" "<<"LTKLipiEngineModule::mapWordAlgoModuleFunctions()"<<endl;
-
- m_OSUtilPtr->unloadSharedLib(dllHandle);
-
- LTKReturnError(EDLL_FUNC_ADDRESS);
- }
-
- module_createWordRecognizer = (FN_PTR_CREATEWORDRECOGNIZER)functionHandle;
-
- functionHandle = NULL;
-
- returnVal = m_OSUtilPtr->getFunctionAddress(dllHandle,
- DELETEWORDRECOGNIZER_FUNC_NAME,
- &functionHandle);
-
- // Could not map the function from the DLL
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<<
- getErrorMessage(EDLL_FUNC_ADDRESS) <<" "<<DELETEWORDRECOGNIZER_FUNC_NAME
- <<" "<<"LTKLipiEngineModule::mapWordAlgoModuleFunctions()"<<endl;
-
- m_OSUtilPtr->unloadSharedLib(dllHandle);
-
- LTKReturnError(EDLL_FUNC_ADDRESS);
- }
-
- module_deleteWordRecognizer = (FN_PTR_DELETEWORDRECOGNIZER)functionHandle;
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: LTKLipiEngineModule::mapWordAlgoModuleFunctions()"<<endl;
-
- return SUCCESS;
-}
-
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : resolveLogicalNameToProjectProfile
-* DESCRIPTION : Resolves logical project name into project and profile name
-* ARGUMENTS : strLogicalProjectName - logical project name
-* RETURNS : 0 on success and -1 on error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::resolveLogicalNameToProjectProfile(
- const string &strLogicalName,
- string &outProjectName,
- string &outProfileName)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKLipiEngineModule::resolveLogicalNameToProjectProfile()"<<endl;
-
- char strSep[] = " ()\r";
- char *strToken;
-
- if (m_LipiEngineConfigEntries == NULL )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << EFILE_OPEN_ERROR << getErrorMessage(EFILE_OPEN_ERROR) <<
- " lipiengine.cfg " <<
- "LTKLipiEngineModule::resolveLogicalNameToProjectProfile()"<<endl;
-
- LTKReturnError(EFILE_OPEN_ERROR);
- }
-
- if(m_LipiEngineConfigEntries->isConfigMapEmpty())
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<<
- getErrorMessage(ENOMAPFOUND_LIPIENGINECFG) <<
- "LTKLipiEngineModule::resolveLogicalNameToProjectProfile()"<<endl;
-
- LTKReturnError(ENOMAPFOUND_LIPIENGINECFG);
- }
-
- string strLogicalProjectName ;
- m_LipiEngineConfigEntries->getConfigValue(strLogicalName,
- strLogicalProjectName);
-
- char *strSearch = (char *)strLogicalProjectName.c_str();
-
- strToken = strtok(strSearch, strSep);
- if(strToken)
- {
- strToken[strlen(strToken)] = '\0';
- outProjectName = strToken;
- }
- else
- {
- // No token found, invalid entry for project name...
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(ENO_TOKEN_FOUND) <<
- "LTKLipiEngineModule::resolveLogicalNameToProjectProfile()"<<endl;
-
- LTKReturnError(ENOMAPFOUND_LIPIENGINECFG);
- }
-
- strToken = strtok(NULL, strSep);
- if(strToken)
- {
- strToken[strlen(strToken)] = '\0';
- outProfileName = strToken;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKLipiEngineModule::resolveLogicalNameToProjectProfile()"<<endl;
-
- return SUCCESS;
- }
- else
- {
- // No token found, invalid entry for profile name...
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(ENO_TOKEN_FOUND) <<
- "LTKLipiEngineModule::resolveLogicalNameToProjectProfile()"<<endl;
-
- LTKReturnError(ENOMAPFOUND_LIPIENGINECFG);
- }
-
-
- // No value found, invalid logical name
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(EINVALID_LOGICAL_NAME) <<
- "LTKLipiEngineModule::resolveLogicalNameToProjectProfile()"<<endl;
-
- LTKReturnError(EINVALID_LOGICAL_NAME);
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 08-Feb-2007
-* NAME : LTKLipiEngineModule::validateProject
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*
-*******************************************************************************/
-int LTKLipiEngineModule::validateProject(const string& strProjectName,
- const string& projectType)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Enterng: LTKLipiEngineModule::validateProject()"<<endl;
-
- LTKConfigFileReader* projectConfigReader = NULL;
-
- string projectTypeCfgEntry = "";
-
- if(strProjectName == "")
- {
- /* invalid or no entry for project name */
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(EINVALID_PROJECT_NAME) <<
- "LTKLipiEngineModule::validateProject()"<<endl;
-
- LTKReturnError(EINVALID_PROJECT_NAME);
- }
-
- string projectCfgPath = m_strLipiRootPath + PROJECTS_PATH_STRING +
- strProjectName + PROFILE_PATH_STRING + PROJECT_CFG_STRING;
-
- try
- {
- projectConfigReader = new LTKConfigFileReader(projectCfgPath);
- }
- catch(LTKException e)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(e.getErrorCode()) << projectCfgPath <<
- " LTKLipiEngineModule::validateProject()"<<endl;
-
- LTKReturnError(EINVALID_PROJECT_NAME);
- }
-
- int errorCode = projectConfigReader->getConfigValue(PROJECT_TYPE_STRING,
- projectTypeCfgEntry);
-
- if( errorCode != SUCCESS || projectTypeCfgEntry != projectType)
- {
- /* Invalid configuration entry for ProjectType */
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(EINVALID_PROJECT_TYPE) <<
- " LTKLipiEngineModule::validateProject()"<<endl;
-
- delete projectConfigReader;
- //Project type in CFG is missing or an invalid value
- LTKReturnError(EINVALID_PROJECT_TYPE);
- }
-
- delete projectConfigReader;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKLipiEngineModule::validateProject()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 08-Feb-2007
-* NAME : LTKLipiEngineModule::validateProfile
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*
-******************************************************************************/
-int LTKLipiEngineModule::validateProfile(const string& strProjectName,
- const string& strProfileName,
- const string& projectType,
- string& outRecognizerString)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKLipiEngineModule::validateProfile()"<<endl;
-
- int errorCode;
- string profileCfgPath = m_strLipiRootPath + PROJECTS_PATH_STRING +
- strProjectName + PROFILE_PATH_STRING + strProfileName
- + SEPARATOR + PROFILE_CFG_STRING;
-
- LTKConfigFileReader* profileConfigReader = NULL;
-
- try
- {
- profileConfigReader = new LTKConfigFileReader(profileCfgPath);
- }
- catch(LTKException e)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(e.getErrorCode()) << profileCfgPath <<
- " LTKLipiEngineModule::validateProfile()"<<endl;
-
- LTKReturnError(e.getErrorCode());
- }
-
- errorCode = profileConfigReader->getConfigValue(projectType,
- outRecognizerString);
-
- if(errorCode != SUCCESS)
- {
- /* No recognizer specified. */
- if (projectType == SHAPE_RECOGNIZER_STRING )
- {
- errorCode = ENO_SHAPE_RECOGNIZER;
- }
- else
- {
- errorCode = ENO_WORD_RECOGNIZER;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< getErrorMessage(errorCode) << profileCfgPath <<
- " LTKLipiEngineModule::validateProfile()"<<endl;
-
- delete profileConfigReader;
-
- LTKReturnError(errorCode);
- }
-
- delete profileConfigReader;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKLipiEngineModule::validateProfile()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 09-Feb-2007
-* NAME : LTKLipiEngineModule::validateProjectAndProfileNames
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::validateProjectAndProfileNames(
- const string& strProjectName,
- const string& strProfileName,
- const string& projectType,
- string& outRecognizerString)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: LTKLipiEngineModule::validateProjectAndProfileNames()"<<endl;
-
- int errorCode;
- string recognizerType = "";
- string profileName(strProfileName);
-
- // Validate Project
- errorCode = validateProject(strProjectName, projectType);
- if ( errorCode!= SUCCESS )
- {
- LTKReturnError(errorCode);
- }
-
-
- if(projectType == "SHAPEREC")
- {
- recognizerType = SHAPE_RECOGNIZER_STRING;
- }
- else
- {
- recognizerType = WORD_RECOGNIZER_STRING;
- }
-
- // Validate Profile
- if(strProfileName == "")
- {
- //Assume the "default" profile
- profileName = DEFAULT_PROFILE;
- }
-
- errorCode = validateProfile(strProjectName, profileName,
- recognizerType, outRecognizerString);
- if ( errorCode!= SUCCESS)
- {
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: LTKLipiEngineModule::validateProjectAndProfileNames()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 09-Feb-2007
-* NAME :
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*
-******************************************************************************/
-int LTKLipiEngineModule::loadRecognizerDLL(const string& recognizerName,
- void **dllHandler)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: LTKLipiEngineModule::loadRecognizerDLL()"<<endl;
-
- string recognizerDLLPath = "";
- int returnVal = SUCCESS;
-
- returnVal = m_OSUtilPtr->loadSharedLib(m_strLipiLibPath, recognizerName, dllHandler);
-
-
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< getErrorMessage(ELOAD_SHAPEREC_DLL) <<" "<<recognizerDLLPath <<
- "LTKLipiEngineModule::loadRecognizerDLL()"<<endl;
-
- LTKReturnError(ELOAD_SHAPEREC_DLL);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: LTKLipiEngineModule::loadRecognizerDLL()"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 07-May-2007
-* NAME : getLogFileName
-* DESCRIPTION : To fetch the value for m_logFileName
-* ARGUMENTS : None
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-string LTKLipiEngineModule::getLogFileName() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: LTKLipiEngineModule::getLogFileName()"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: LTKLipiEngineModule::getLogFileName()"<<endl;
-
- return m_logFileName;
-}
-
-
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 07-May-2007
-* NAME : getLogLevel
-* DESCRIPTION : To fetch the value for m_logFileName
-* ARGUMENTS : None
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-LTKLogger::EDebugLevel LTKLipiEngineModule::getLogLevel() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: LTKLipiEngineModule::getLogLevel()"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: LTKLipiEngineModule::getLogLevel()"<<endl;
-
- return m_logLevel;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 07-May-2007
-* NAME : setLogFileName
-* DESCRIPTION : To set the value of m_logFileName
-* ARGUMENTS : String
-* RETURNS : Nothing
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::setLipiLogFileName(const string& appLogFile)
-{
- // No log messages as this function is used to configure logger
- if ( appLogFile.length() != 0 )
- {
- m_logFileName = appLogFile;
- }
- else
- {
- LTKReturnError(EINVALID_LOG_FILENAME);
- }
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 07-May-2007
-* NAME : setLipiLogLevel
-* DESCRIPTION : To set the value of m_logLevel
-* ARGUMENTS : String
-* RETURNS : Nothing
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::setLipiLogLevel(const string& appLogLevel)
-{
-
- // No log messages as this function is used to configure logger
- string strLogLevel = "";
-
- if ( appLogLevel.length() != 0 )
- {
- strLogLevel= appLogLevel;
- }
- else
- {
- LTKReturnError(EINVALID_LOG_LEVEL);
- }
-
- const char * strLogLevelPtr = strLogLevel.c_str();
- // mapping m_LogLevel to Logger log levels
-
- if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_DEBUG) == 0)
- {
- m_logLevel = LTKLogger::LTK_LOGLEVEL_DEBUG;
- }
- else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_ALL) == 0)
- {
- m_logLevel = LTKLogger::LTK_LOGLEVEL_ALL;
- }
- else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_VERBOSE) == 0)
- {
- m_logLevel = LTKLogger::LTK_LOGLEVEL_VERBOSE;
- }
- else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_ERROR) == 0)
- {
- m_logLevel = LTKLogger::LTK_LOGLEVEL_ERR;
- }
- else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_OFF) == 0)
- {
- m_logLevel = LTKLogger::LTK_LOGLEVEL_OFF;
- }
- else if(LTKSTRCMP(strLogLevelPtr, LOG_LEVEL_INFO) == 0)
- {
- m_logLevel = LTKLogger::LTK_LOGLEVEL_INFO;
- }
- else
- {
- LTKReturnError(EINVALID_LOG_LEVEL);
- }
-
- return SUCCESS;
-}
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 07-May-2007
-* NAME : configureLogger
-* DESCRIPTION : Configures the logger
-* ARGUMENTS : None
-* RETURNS : Nothing
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int LTKLipiEngineModule::configureLogger()
-{
- // No log messages as this function is used to configure logger
- string valueFromCFG = "";
- int errorCode ;
-
- if ( m_LipiEngineConfigEntries != NULL )
- {
- // Read the log file name from lipiengine.cfg
- errorCode = m_LipiEngineConfigEntries->getConfigValue(LOG_FILE_NAME,
- valueFromCFG);
-
- if(errorCode ==SUCCESS)
- {
- setLipiLogFileName(valueFromCFG);
- }
- else if (errorCode == EKEY_NOT_FOUND )
- {
- // Set default log file
- }
- else
- {
- LTKReturnError(ECREATE_LOGGER);
- }
-
- // Read the log level
- valueFromCFG = "";
-
- errorCode = m_LipiEngineConfigEntries->getConfigValue(LOG_LEVEL, valueFromCFG);
-
- if(errorCode == SUCCESS)
- {
- setLipiLogLevel(valueFromCFG);
- }
- else if (errorCode == EKEY_NOT_FOUND )
- {
- // Set default log file
- }
- else
- {
- LTKReturnError(ECREATE_LOGGER);
- }
- }
-
- LTKLoggerUtil::createLogger(m_strLipiLibPath);
- LTKLoggerUtil::configureLogger(m_logFileName, m_logLevel);
-
- return SUCCESS;
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h
deleted file mode 100644
index 9ccffac3..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/LipiEngineModule.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-18 15:41:43 +0530 (Tue, 18 Jan 2011) $
- * $Revision: 829 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: LTKLipiEngineModule implementation header derives from LipiEngineModule
- *
- * CONTENTS:
- *
- *
- * AUTHOR: Thanigai Murugan K
- *
- * DATE: July 29 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LIPIENGINEMODULE_H_
-#define __LIPIENGINEMODULE_H_
-
-
-#ifndef _WIN32
-#include <dlfcn.h>
-#else
-#include <windows.h>
-#endif
-
-#include "LTKLipiEngineInterface.h"
-#include "LTKMacros.h"
-#include "LTKErrorsList.h"
-#include "LTKErrors.h"
-#include "LTKLoggerUtil.h"
-
-class LTKConfigFileReader;
-class LTKOSUtil;
-
-/** @defgroup LipiEngineModule LipiEngineModule
-*@brief The LipiEngineModule
-*/
-
-/** @ingroup LipiEngineModule
-* @brief Controlling class responsible for creating,
- initializing and deleting the shape/word recognizers.
-* @class LTKLipiEngineModule
-*/
-class LTKLipiEngineModule : public LTKLipiEngineInterface
-{
-private:
- /** @brief
- * Pointer to the createShapeRecognizer method in the respective shape recognizers
- */
- typedef int (*FN_PTR_CREATESHAPERECOGNIZER)(const LTKControlInfo&,
- LTKShapeRecognizer**);
- FN_PTR_CREATESHAPERECOGNIZER module_createShapeRecognizer;
-
- /** @brief
- * Pointer to the deleteShapeRecognizer method in the respective shape recognizers
- */
- typedef int (*FN_PTR_DELETESHAPERECOGNIZER)(LTKShapeRecognizer*);
- FN_PTR_DELETESHAPERECOGNIZER module_deleteShapeRecognizer;
-
- /** @brief
- * Pointer to the createWordRecognizer method in the respective shape recognizers
- */
- typedef int (*FN_PTR_CREATEWORDRECOGNIZER)(const LTKControlInfo&,
- LTKWordRecognizer**);
- FN_PTR_CREATEWORDRECOGNIZER module_createWordRecognizer;
-
- /** @brief
- * Pointer to the deleteWordRecognizer method in the respective shape recognizers
- */
- typedef int (*FN_PTR_DELETEWORDRECOGNIZER)(LTKWordRecognizer*);
- FN_PTR_DELETEWORDRECOGNIZER module_deleteWordRecognizer;
-
-
- string m_strLipiRootPath; // LIPI_ROOT environment path
- string m_strLipiLibPath; // LIPI_LIB environment path
-
- string m_logFileName;
-
- LTKLogger::EDebugLevel m_logLevel;
-
- LTKOSUtil* m_OSUtilPtr;
-
- static LTKLipiEngineModule* lipiEngineModuleInstance;
-
-
-public:
-
- /** @brief Stores the key-value pairs defined in lipiengine.cfg
- */
- LTKConfigFileReader* m_LipiEngineConfigEntries;
-
-
-public:
-
- static LTKLipiEngineModule* getInstance();
-
- static void destroyLipiEngineInstance();
-
-
- /** @brief Returns LTKLipiEngineModule::m_strLipiRootPath
- */
- string getLipiRootPath() const;
-
- /** @brief Returns LTKLipiEngineModule::m_strLipiLibPath
- */
- string getLipiLibPath() const;
-
- /** @brief Sets the data member LTKLipiEngineModule::m_strLipiRootPath
- */
- void setLipiRootPath(const string& appLipiPath="");
-
- /** @brief Sets the data member LTKLipiEngineModule::m_strLipiLibPath
- */
- void setLipiLibPath(const string& appLipiLibPath="");
-
- /** @brief Returns LTKLipiEngineModule::m_logFileName
- */
- string getLogFileName() const;
-
- /** @brief Sets the data member LTKLipiEngineModule::m_logFileName
- */
-
- int setLipiLogFileName(const string& appLogFile);
-
- /** @brief Returns LTKLipiEngineModule::m_logLevel
- */
- LTKLogger::EDebugLevel getLogLevel() const;
-
- /** @brief Sets the data member LTKLipiEngineModule::m_logLevel
- */
- int setLipiLogLevel(const string& appLogLevel);
-
- /** @brief Initializes the lipiengine.
- * <p>
- * Reads the lipiengine.cfg and intializes the data member
- * LTKLipiEngineModule::m_LipiEngineConfigEntries
- *
- * Semantics
- * - Return error LTKErrorsList::ELIPI_ROOT_PATH_NOT_SET if
- * LTKLipiEngineModule::m_strLipiRootPath is empty
- *
- * - Read the contents of lipiengine.cfg to
- * LTKLipiEngineModule::m_LipiEngineConfigEntries
- *<pre> m_LipiEngineConfigEntries = new LTKConfigFileReader(temp) </pre>
- *
- * </p>
- * @return SUCCESS/Error
- * @error LTKErrorsList::ELIPI_ROOT_PATH_NOT_SET
- */
- int initializeLipiEngine();
-
- /* destructor */
- virtual ~LTKLipiEngineModule();
-
- /**
- * @brief Returns the current version of the lipiengine module
- * @param iMajor, iMinor, iBugFix - integers to receive the version
- * @return 0 on success
- */
- int getcurrentversion(int& iMajor, int& iMinor, int& iBugFix);
-
-
- /**
- * @brief Given project and profile, returns an instance of shape recognizers
- *
- * Semantics
- *
- * - Validate project using LTKLipiEngineModule::validateProject
- *
- * - Validate profile using LTKLipiEngineModule::validateProfile
- *
- * - Load the recognizer DLL
- *
- * - Map the DLL functions using LTKLipiEngineModule::mapShapeAlgoModuleFunctions
- *
- * - Create the shape recognizers
- *
- * - Add the recognizer to the list of active modules using
- * LTKLipiEngineModule::AddModule
- * - Initialize the shape recognizers calling the recognizers initialize function
- *
- * @param strProjectName Type : string Project Name
- *
- * @param strProfileName Type : string Profile Name
- *
- * @return handle on success, NULL on failure
- * @return NULL in following scenarios
- * - Project not valid
- * - Project name empty : LTKErrorsList::EINVALID_PROJECT_NAME
- * - Could not open project.cfg : LTKErrorsList::ECONFIG_FILE_OPEN
- * - ProjectType is not SHAPEREC : LTKErrorsList::EINVALID_CONFIG_ENTRY
- *
- * - Profile not valid
- * - Could not open profile.cfg : LTKErrorsList::ECONFIG_FILE_OPEN
- * - For shape recognizers
- * - profile.cfg does not contain key ShapeRecMethod:
- * LTKErrorsList::ENO_SHAPE_RECOGNIZER
- *
- * - Fail to load recognizer DLL
- * - could not load DLL : LTKErrorsList::ELOAD_SHAPEREC_DLL
- *
- * - Fail to map recognizer DLL functions: LTKErrorsList::EDLL_FUNC_ADDRESS
- * - Recogniser createShapeRecognizer failed
- * - Recognizers initialize function failed
- */
- int createShapeRecognizer(const string& strProjName, const string& strProfName,
- LTKShapeRecognizer** outShapeRecoObj);
-
- /**
- * @brief Given project and profile, returns an instance of shape recognizers
- *
- * Semantics
- * - resolve the Logical name passed into logical
- * project and profile name using
- * LTKLipiEngineModule::resolveLogicalNameToProjectProfile <pre>
- *
- * - Calls createShapeRecognizer method by passed project name
- * and profile name.
- *
- * @return handle on success, NULL on failure
- * @return NULL in following scenarios
- * - Project not valid
- * - Project name empty : LTKErrorsList::EINVALID_PROJECT_NAME
- * - Could not open project.cfg : LTKErrorsList::ECONFIG_FILE_OPEN
- * - ProjectType is not SHAPEREC : LTKErrorsList::EINVALID_CONFIG_ENTRY
- *
- * - Profile not valid
- * - Could not open profile.cfg : LTKErrorsList::ECONFIG_FILE_OPEN
- * - For shape recognizers
- * - profile.cfg does not contain key ShapeRecMethod:
- * LTKErrorsList::ENO_SHAPE_RECOGNIZER
- *
- */
- int createShapeRecognizer(string &strLogicalProjectName, LTKShapeRecognizer** outShapeRecognizerPtr) ;
-
- /**
- * Use this to delete the shape recognizer object created using
- * createShapeRecognizer call
- * @param handle to the recognizer object to delete
- * @return 0 on success
- */
- int deleteShapeRecognizer(LTKShapeRecognizer* obj);
-
- /**
- * Use this to create word recognizer object, by passing the project name
- * and profile name
- * @param projectname + profile name
- *
- * @return 0 on success
- */
- int createWordRecognizer(const string& strProjectName,
- const string& strProfileName,
- LTKWordRecognizer** outWordRecPtr);
-
- /**
- * Use this to create word recognizer object, by passing the logical project name
- *
- * @return 0 on success
- */
- int createWordRecognizer(const string& strlogicalProjectName,
- LTKWordRecognizer** outWordRecPtr);
-
- /**
- * Use this to delete the word recognizer object created using createWordRecognizer call
- * @param handle to the recognizer object to delete
- * @return 0 on success
- */
- int deleteWordRecognizer(LTKWordRecognizer* obj);
-
-
-
-private :
-
- LTKLipiEngineModule();
-
- int validateProject(const string& strProjectName, const string& projectType);
-
- int validateProfile(const string& strProjectName, const string& strProfileName,
- const string& projectType, string& outRecognizerString);
-
- int validateProjectAndProfileNames(const string& strProjectName,
- const string& strProfileName,
- const string& projectType,
- string& outRecognizerString );
-
-
- int loadRecognizerDLL(const string& recognizerName, void **dllHandler);
-
- /**
- * This map functions get the function address from the DLL/SO module
- * Maps the following functions
- * - createShapeRecognizer
- * - deleteShapeRecognizer
- *
- * @param DLLHandle - handle to the DLL/SO module
- * @return 0 on success
- * @error EDLL_FUNC_ADDRESS : Returned if the function could not be maped
- */
- int mapShapeAlgoModuleFunctions(void *DLLHandle);
-
- /**
- * This map functions get the function address from the DLL/SO module
- * Maps the following functions
- * - createWordRecognizer
- * - deleteWordRecognizer
- *
- * @param DLLHandle - handle to the DLL/SO module
- * @return 0 on success
- * @error EDLL_FUNC_ADDRESS : Returned if the function could not be maped
- */
- int mapWordAlgoModuleFunctions(void *DLLHandle);
-
- /* To resolve the logical name into Project + Profile name */
- int resolveLogicalNameToProjectProfile(const string& strLogicalProjectName,
- string &outProjectName, string &outProfileName);
-
- int configureLogger();
-
-
-};
-
-#endif //#ifndef __LIPIENGINEMODULE_H_
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp
deleted file mode 100644
index eb55ddb4..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-01 09:48:58 +0530 (Fri, 01 Aug 2008) $
- * $Revision: 583 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/***************************************************************************
- * FILE DESCR: DLL Implementation file for LipiEngine module
- *
- * CONTENTS:
- * DllMain
- * createLTKLipiEngine
- *
- * AUTHOR: Thanigai Murugan K
- *
- * DATE: July 29, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-// lipiengine.cpp : Defines the entry point for the DLL application.
-
-
-#include "version.h"
-#include "lipiengine.h"
-#include "LipiEngineModule.h"
-#include "LTKErrorsList.h"
-#include "LTKErrors.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKOSUtil.h"
-#include "LTKLoggerUtil.h"
-
-vector<MODULEREFCOUNT> gLipiRefCount;
-LTKLipiEngineModule* lipiEngineModule = LTKLipiEngineModule::getInstance();
-
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : DllMain
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-#ifdef _WIN32
-BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- break;
- case DLL_THREAD_ATTACH:
- break;
-
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- unloadAllModules();
- break;
- }
- return TRUE;
-}
-#endif // #ifdef _WIN32
-/******************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : createLTKLipiEngine
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-LTKLipiEngineInterface* createLTKLipiEngine()
-{
- return lipiEngineModule;
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 2-JUL-2008
-* NAME : deleteLTKLipiEngine
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void deleteLTKLipiEngine()
-{
- LTKLipiEngineModule::destroyLipiEngineInstance();
- lipiEngineModule = NULL;
-}
-/******************************************************************************
-* AUTHOR : Thanigai Murugan K
-* DATE : 23-SEP-2005
-* NAME : addModule
-* DESCRIPTION : For each module that is getting loaded, vector lipiRefCount
-* will have an entry. For each recognizer object that is getting
-* created under every module, vector "vecRecoHandles" will have
-* an entry.
-* If the recognizer object belongs to the existing module handle,
-* then only the reference count incremented and the recognizer
-* handle is added to the module's "vecRecoHandles" vector.
-* ARGUMENTS : RecoHandle - handle to the recognizer object
-* handle - handle to the module
-* RETURNS : 0 on success, -1 on Failure.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void addModule(void* RecoHandle, void* handle)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: addModule()"<<endl;
-
- int iModIndex = -1;
-
- iModIndex = findIndexIfModuleInMemory(handle);
-
- if(iModIndex == EMODULE_NOT_IN_MEMORY) // New module
- {
- MODULEREFCOUNT mModule;
-
- mModule.iRefCount = 1;
- mModule.modHandle = handle;
- mModule.vecRecoHandles.push_back(RecoHandle);
- gLipiRefCount.push_back(mModule);
- }
- else // Module in memory, increment the count
- {
- gLipiRefCount[iModIndex].iRefCount++;
- gLipiRefCount[iModIndex].vecRecoHandles.push_back(RecoHandle);
- }
-
- for(int i = 0; i < gLipiRefCount.size(); i++)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Details of module :"<< i
- << "[" << gLipiRefCount[i].modHandle << "]"
- << "No.of.recognizers in this module = "
- << gLipiRefCount[i].vecRecoHandles.size() << endl;
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: addModule()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai Murugan K
-* DATE : 23-SEP-2005
-* NAME : deleteModule
-* DESCRIPTION : Given a recognizer handle, this function look at the module to
-* which this handle belongs to and decrement the reference count
-* for that module. Also this recognizer object is deleted from
-* the module's recognizer object vectors.
-* ARGUMENTS : RecoHandle - handle to the recognizer object
-* handle - handle to the module
-* RETURNS : 0 on success, -1 on Failure.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int deleteModule(void* RecoHandle)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: deleteModule()"<<endl;
-
- int iModIndex = -1;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "No.of.modules = "<< gLipiRefCount.size()<<endl;
-
- for(int i = 0; i < gLipiRefCount.size(); i++)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Details of module :"<< i
- << "[" << gLipiRefCount[i].modHandle << "]"
- << "No.of.recognizers in this module = "
- << gLipiRefCount[i].vecRecoHandles.size() << endl;
- }
-
- iModIndex = getAlgoModuleIndex(RecoHandle);
-
- if(iModIndex == EMODULE_NOT_IN_MEMORY)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: " << getErrorMessage(EMODULE_NOT_IN_MEMORY) <<
- " deleteModule"<<endl;
-
- return EMODULE_NOT_IN_MEMORY;
- }
- else // Module in memory, decrement the count
- {
- vector<void*>::iterator RecoIter;
-
- for(RecoIter = gLipiRefCount[iModIndex].vecRecoHandles.begin();
- RecoIter < gLipiRefCount[iModIndex].vecRecoHandles.end(); RecoIter++)
- {
- if((*RecoIter) == RecoHandle)
- {
- gLipiRefCount[iModIndex].vecRecoHandles.erase(RecoIter);
- break;
- }
- }
-
- if(gLipiRefCount[iModIndex].iRefCount > 1)
- {
- gLipiRefCount[iModIndex].iRefCount--;
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: deleteModule()"<<endl;
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai Murugan K
-* DATE : 23-SEP-2005
-* NAME : findIndexIfModuleInMemory
-* DESCRIPTION : Looks into gLipiRefCount vector for handle, if exists returns
-* its index or returns -1
-* ARGUMENTS : handle - handle to the module
-* RETURNS : 0 on success, -1 on Failure.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int findIndexIfModuleInMemory(void* handle)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: findIndexIfModuleInMemory()"<<endl;
-
- for(int i = 0; i < gLipiRefCount.size(); i++)
- {
- if(handle == gLipiRefCount[i].modHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: findIndexIfModuleInMemory()"<<endl;
-
- return i;
- }
- }
-
- return EMODULE_NOT_IN_MEMORY;
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai Murugan K
-* DATE : 23-SEP-2005
-* NAME : unloadAllModules
-* DESCRIPTION : Unload all the modules that are loaded into memory
-* ARGUMENTS : None
-* RETURNS : 0 on success, -1 on Failure.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int unloadAllModules()
-{
- LTKOSUtil* utilPtr = LTKOSUtilFactory::getInstance();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: unloadAllModules()"<<endl;
-
- for(int i = 0; i < gLipiRefCount.size(); i++)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Unloading module, handle = " << gLipiRefCount[i].modHandle << endl;
-
- if(gLipiRefCount[i].vecRecoHandles.size() > 1)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"WARNING: Not all "<<
- gLipiRefCount[i].vecRecoHandles.size()<<
- "recognizers are deleted"<< endl;
- }
-
- utilPtr->unloadSharedLib(gLipiRefCount[i].modHandle);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: unloadAllModules()"<<endl;
-
- delete utilPtr;
- return 0;
-}
-
-/******************************************************************************
-* AUTHOR : Thanigai Murugan K
-* DATE : 23-SEP-2005
-* NAME : getAlgoModuleIndex
-* DESCRIPTION : returns index in the modules vector for the recoHandle passed
-* ARGUMENTS : RecoHandle - handle to the recognizer object
-* RETURNS : 0 on success, -1 on Failure.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-int getAlgoModuleIndex(void* RecoHandle)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: getAlgoModuleIndex()"<<endl;
-
- for(int i = 0; i < gLipiRefCount.size(); i++)
- {
- for (int j = 0; j < gLipiRefCount[i].vecRecoHandles.size(); j++)
- {
- if( gLipiRefCount[i].vecRecoHandles[j] == RecoHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "index : "<< i <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: getAlgoModuleIndex()"<<endl;
-
- return i;
- }
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Error: "<<EMODULE_NOT_IN_MEMORY<<": "<<
- getErrorMessage(EMODULE_NOT_IN_MEMORY) <<
- "getAlgoModuleIndex()"<<endl;
-
- return EMODULE_NOT_IN_MEMORY;
-}
-
-/******************************************************************************
-* AUTHOR :
-* DATE :
-* NAME :
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void setLipiRootPath(const string& appLipiPath)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: setLipiRootPath()"<<endl;
-
- lipiEngineModule->setLipiRootPath(appLipiPath);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: setLipiRootPath()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR :
-* DATE :
-* NAME :
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void setLTKLogFileName(const string& appLogFile)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: setLTKLogFileName()"<<endl;
-
- lipiEngineModule->setLipiLogFileName(appLogFile);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: setLTKLogFileName()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR :
-* DATE :
-* NAME :
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void setLTKLogLevel(const string& appLogLevel)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: setLTKLogLevel()"<<endl;
-
- lipiEngineModule->setLipiLogLevel(appLogLevel);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: setLTKLogLevel()"<<endl;
-}
-
-/******************************************************************************
-* AUTHOR :
-* DATE :
-* NAME :
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-void getToolkitVersion(int& iMajor, int& iMinor, int& iBugFix)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering: getToolkitVersion()"<<endl;
-
- getVersion(iMajor, iMinor, iBugFix);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting: getToolkitVersion()"<<endl;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def
deleted file mode 100644
index 96f73e12..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.def
+++ /dev/null
@@ -1,7 +0,0 @@
-EXPORTS
- createLTKLipiEngine @1
- setLipiRootPath @2
- setLTKLogFileName @3
- setLTKLogLevel @4
- getToolkitVersion @5
- deleteLTKLipiEngine @6 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h
deleted file mode 100644
index bc1aa408..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-******************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- *****************************************************************************/
-/*****************************************************************************
- * FILE DESCR: DLL header for LipiEngine DLL module
- *
- * CONTENTS:
- *
- *
- * AUTHOR: Thanigai Murugan K
- *
- * DATE: July 29 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LIPIENGINE_H_
-#define __LIPIENGINE_H_
-
-#include "LipiEngineModule.h"
-
-/* The following ifdef block is the standard way of creating macros which make
- exporting from a DLL simpler. All files within this DLL are compiled with
- the LIPIENGINE_EXPORTS symbol defined on the command line.This symbol should
- not be defined on any project that uses this DLL. This way any other project
- whose source files include this file see LIPIENGINE_API functions as being
- imported from a DLL, wheras this DLL sees symbols defined with this macro
- as being exported.
-*/
-
-#ifdef _WIN32
-#ifdef LIPIENGINE_EXPORTS
-#define LIPIENGINE_API __declspec(dllexport)
-#else
-#define LIPIENGINE_API __declspec(dllimport)
-#endif
-#else
-#define LIPIENGINE_API
-#endif // #ifdef _WIN32
-
-extern "C" LIPIENGINE_API LTKLipiEngineInterface* createLTKLipiEngine();
-
-extern "C" LIPIENGINE_API void setLipiRootPath(const string& appLipiPath);
-
-extern "C" LIPIENGINE_API void setLTKLogFileName(const string& appLogFile);
-
-extern "C" LIPIENGINE_API void setLTKLogLevel(const string& appLogLevel);
-
-extern "C" LIPIENGINE_API void getToolkitVersion(int& iMajor, int& iMinor,
- int& iBugFix);
-
-extern "C" LIPIENGINE_API void deleteLTKLipiEngine();
-
-/**
-* This function Unload all the modules that are loaded into memory
-* @param none
-* @return 0 on success
-*/
-int unloadAllModules();
-
-/**
-* This function Looks into m_lipiRefCount vector for handle, if exists
-* returns its index or returns -1
-* @param handle to the module
-* @return 0 on success
-*/
-int findIndexIfModuleInMemory(void* handle);
-
-/**
-* Given a recognizer handle, this function look at the module to
-* which this handle belongs to and decrement the reference count
-* for that module. Also this recognizer object is deleted from
-* the module's recognizer object vectors.
-* @param recoHandle - handle to the recognizer object to delete
-* @return 0 on success
-*/
-int deleteModule(void* RecoHandle);
-
-/**
-* For each module that is getting loaded, vector m_lipiRefCount
-* will have an entry. For each recognizer object that is getting
-* created under every module, vector "vecRecoHandles" will have
-* an entry.
-* If the recognizer object belongs to the existing module handle,
-* then only the reference count incremented and the recognizer handle
-* is added to the module's "vecRecoHandles" vector.
-* @param Handle - handle to the module,
-* RecoHandle - handle to the recognizer object
-*/
-void addModule(void* RecoHandle, void* handle);
-
-/**
-* This function returns the index in the modules vector for the
- recoHandle passed
-* @param RecoHandle - handle to the recognizer object
-* @return 0 on success
-*/
-int getAlgoModuleIndex(void* RecoHandle);
-
-
-#endif //#ifndef __LIPIENGINE_H_
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro
deleted file mode 100644
index bfcc0bcd..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/lipiengine.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-LIPILIBS = shaperecommon ltkcommon ltkutil wordreccommon
-include(../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../util/lib
-
-HEADERS += \
- lipiengine.h \
- LipiEngineModule.h
-
-SOURCES += \
- lipiengine.cpp \
- LipiEngineModule.cpp
-
-win32 {
- DEFINES += LIPIENGINE_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = lipiengine.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/version.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/version.h
deleted file mode 100644
index a31c2503..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiengine/version.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definitions for Version Info module.
- *
- * CONTENTS:
- *
- * AUTHOR: VijayaKumara M.
- *
- * DATE: Aug 02, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef _VERSION_H_
-#define _VERSION_H_
-
-#define MAJOR_VERSION 4
-#define MINOR_VERSION 0
-#define BUGFIX_VERSION 0
-
-
-/**
- * This method get the version numbers for the variable which are passed to the
- * function as its arguments.
- *
- * @param iMajor - An integer variable for Major number.
- * @param iMinor - An integer variable for Minor number.
- * @param iBugFix - An integer variable for BugFix number.
- *
- */
-
-void getVersion(int& iMajor, int& iMinor, int& iBugFix)
-{
- iMajor=MAJOR_VERSION;
- iMinor=MINOR_VERSION;
- iBugFix=BUGFIX_VERSION;
-}
-
-#endif //#ifndef _VERSION_H_
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipilib.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipilib.pri
deleted file mode 100644
index c28eb85d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipilib.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-include(lipicommon.pri)
-
-CONFIG += static
-
-DESTDIR = $$MODULE_BASE_OUTDIR/lib
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiplugin.pri b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiplugin.pri
deleted file mode 100644
index 3dd51a22..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/lipiplugin.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-include(lipicommon.pri)
-
-CONFIG -= static
-CONFIG += plugin
-
-DESTDIR = $$MODULE_BASE_OUTDIR/plugins/lipi_toolkit
-
-target.path = $$[QT_INSTALL_PLUGINS]/lipi_toolkit
-INSTALLS += target
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/CMakeLists.txt
deleted file mode 100644
index 54401cfc..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from reco.pro.
-
-add_subdirectory(shaperec)
-add_subdirectory(wordrec)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/reco.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/reco.pro
deleted file mode 100644
index 72efcc7f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/reco.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- shaperec \
- wordrec
-
-wordrec.depends = shaperec
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/CMakeLists.txt
deleted file mode 100644
index ff2b0d10..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Generated from shaperec.pro.
-
-add_subdirectory(common)
-add_subdirectory(featureextractor)
-add_subdirectory(activedtw)
-add_subdirectory(neuralnet)
-add_subdirectory(nn)
-add_subdirectory(preprocessing)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/.prev_CMakeLists.txt
deleted file mode 100644
index 7a305e43..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# Generated from activedtw.pro.
-
-#####################################################################
-## activedtw Generic Library:
-#####################################################################
-
-qt_add_cmake_library(activedtw
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- ActiveDTW.cpp ActiveDTW.h
- ActiveDTWAdapt.cpp ActiveDTWAdapt.h
- ActiveDTWClusterModel.cpp ActiveDTWClusterModel.h
- ActiveDTWShapeModel.cpp ActiveDTWShapeModel.h
- ActiveDTWShapeRecognizer.cpp ActiveDTWShapeRecognizer.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- ../featureextractor/common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(activedtw)
-
-#### Keys ignored in scope 1:.:.:activedtw.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(activedtw CONDITION WIN32
- DEFINES
- ACTIVEDTW_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(activedtw CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(activedtw)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp
deleted file mode 100644
index bdbec8c2..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2011-01-18 15:41:43 +0530 (Tue, 18 Jan 2011) $
-* $Revision: 829 $
-* $Author: mnab $
-*
-************************************************************************/
-/************************************************************************
-* FILE DESCR: Defines the entry for ActiveDTW dll application
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-w
-* DATE: 3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-* Balaji MNA 18th Jan 2010 Receiving LTKShapeRecognizer as single pointer
-* instead of double pointer in deleteShapeRecognizer
-************************************************************************/
-
-
-#include "ActiveDTW.h"
-#include "LTKShapeRecognizer.h"
-#include "ActiveDTWShapeRecognizer.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKOSUtil.h"
-
-#ifdef _WIN32
-#include <windows.h>
-
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif
-
-/** createShapeRecognizer **/
-
-int createShapeRecognizer(const LTKControlInfo& controlInfo,
- LTKShapeRecognizer** ptrObj )
-{
- try
- {
- *ptrObj = new ActiveDTWShapeRecognizer(controlInfo);
- return SUCCESS;
- }
- catch(LTKException e)
- {
- LTKReturnError(e.getErrorCode());
- }
-}
-
-
-/**deleteShapeRecognizer **/
-int deleteShapeRecognizer(LTKShapeRecognizer *obj)
-{
- try
- {
- if (obj != NULL )
- {
- delete obj;
- obj = NULL;
-
- //unloadDLLs();
- }
- }
- catch(LTKException e)
- {
- LTKReturnError(e.getErrorCode());
- }
-
-
- return SUCCESS;
-}
-
-/** unloadDLLs **/
-/*
-void unloadDLLs()
-{
-// Unload feature extractor DLL
-if(m_libHandlerFE != NULL)
-{
-//Unload the DLL
-LTKUnloadDLL(m_libHandlerFE);
-m_libHandlerFE = NULL;
-}
-}*/
-
-/** getTraceGroups **/
-int getTraceGroups(LTKShapeRecognizer *obj, int shapeId,
- int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups)
-{
- int errorCode = ((ActiveDTWShapeRecognizer*)obj)->getTraceGroups(shapeId,
- numberOfTraceGroups, outTraceGroups);
-
- if ( errorCode != SUCCESS )
- {
- LTKReturnError(errorCode);
- }
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def
deleted file mode 100644
index 0a4f75c9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.def
+++ /dev/null
@@ -1,4 +0,0 @@
-EXPORTS
- createShapeRecognizer @1
- deleteShapeRecognizer @2
- getTraceGroups @3 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h
deleted file mode 100644
index 854dc6da..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTW.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2011-01-18 15:41:43 +0530 (Tue, 18 Jan 2011) $
-* $Revision: 829 $
-* $Author: mnab $
-*
-************************************************************************/
-/************************************************************************
-* FILE DESCR: Declarations for ActiveDTW dll exporting functions.
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-w
-* DATE: 3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-* Balaji MNA 18th Jan 2010 Receiving LTKShapeRecognizer as single pointer
-* instead of double pointer in deleteShapeRecognizer
-************************************************************************/
-
-#ifndef __ACTIVEDTW_H__
-#define __ACTIVEDTW_H__
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-
-#ifdef _WIN32
-#ifdef ACTIVEDTW_EXPORTS
-#define ACTIVEDTW_API __declspec(dllexport)
-#else
-#define ACTIVEDTW_API __declspec(dllimport)
-#endif //#ifdef ACTIVEDTW_EXPORTS
-#else
-#define ACTIVEDTW_API
-#endif //#ifdef _WIN32
-
-class LTKTraceGroup;
-class LTKShapeRecognizer;
-
-
-/** @defgroup ActiveDTWShapeRecognizer ActiveDTWShapeRecognizer
-*@brief The ActiveDTWShapeRecognizer
-*/
-
-/**
-* @ingroup ActiveDTWShapeRecognizer
-* @file ActiveDTW.cpp
-*/
-
-/**
-* Crates instance of type ActiveDTWShapeRecognizer and returns of type
-* LTKShpeRecognizer. (Acts as a Factory Method).
-*
-* @param none
-*
-* @return LTKShapeRecognizer - an instance of type LTKShapeRecognizer.
-*/
-extern "C" ACTIVEDTW_API int createShapeRecognizer(const LTKControlInfo& controlInfo,
- LTKShapeRecognizer** pReco );
- /**
- * Destroy the instance by taking the address as its argument.
- *
- * @param obj - Address of LTKShapeRecognizer instance.
- *
- * @return 0 on Success
-*/
-extern "C" ACTIVEDTW_API int deleteShapeRecognizer(LTKShapeRecognizer *obj);
-
-extern "C" ACTIVEDTW_API int getTraceGroups(LTKShapeRecognizer *obj, int shapeID, int numberOfTraceGroups,vector<LTKTraceGroup> &outTraceGroups);
-
-void unloadDLLs();
-
-#endif //#ifndef __NN_H__
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp
deleted file mode 100644
index e0c36e6b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.cpp
+++ /dev/null
@@ -1,1186 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2009-04-06 11:55:15 +0530 (Mon, 06 Apr 2009) $
-* $Revision: 758 $
-* $Author: royva $
-*
-************************************************************************/
-/*********************************************************************************************
-* FILE DESCR: Definitions for ActiveDTW Adaptation module
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-w
-* DATE:3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-***********************************************************************************************/
-
-#include "ActiveDTWShapeRecognizer.h"
-#include "ActiveDTWAdapt.h"
-#include "LTKLoggerUtil.h"
-#include "LTKConfigFileReader.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKPreprocDefaults.h"
-
-LTKAdapt* LTKAdapt::adaptInstance = NULL;
-int LTKAdapt::m_count = 0;
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : Constructor
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-LTKAdapt::LTKAdapt(ActiveDTWShapeRecognizer* ptrActiveDTWShapeReco)
-{
- m_activedtwShapeRecognizer = ptrActiveDTWShapeReco;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- << "Exit LTKAdapt::LTKAdapt()"<<endl;
-
- //Assign Default Values
-
- m_maxClusterSize = ADAPT_DEF_MAX_NUMBER_SAMPLES_PER_CLASS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : Destructor
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-LTKAdapt::~LTKAdapt()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : deleteInstance
-* DESCRIPTION : delete AdaptInstance
-* ARGUMENTS :
-* RETURNS : None
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void LTKAdapt::deleteInstance()
-{
- m_count = 0;
- if(adaptInstance)
- {
- delete adaptInstance;
- adaptInstance = NULL;
- }
-}
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getInstance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-LTKAdapt* LTKAdapt::getInstance(ActiveDTWShapeRecognizer* ptrActiveDTWShapeReco)
-{
- if(adaptInstance == NULL)
- {
- adaptInstance = new LTKAdapt(ptrActiveDTWShapeReco);
- }
-
- return adaptInstance;
-
-}
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : Process
-* DESCRIPTION : Performs adaptation
-* ARGUMENTS :
-* RETURNS : Success : If completed successfully
-* Failure : Error Code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int LTKAdapt::adapt(int shapeId)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- << "Enter LTKAdapt::adapt()"<<endl;
-
- int iErrorCode;
-
- //read config file values when first adapt sample is encountered
- if(m_count==0)
- {
- m_count = 1;
-
- iErrorCode = readAdaptConfig();
- if(iErrorCode !=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during LTKAdapt::readAdaptConfig()"<<endl;
- LTKReturnError(FAILURE);
- }
- }
-
-
- //Check if Cached variables are valid
- if(m_activedtwShapeRecognizer->m_neighborInfoVec.size()==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"DistanceIndexPair is empty"<<endl;
-
- LTKReturnError(ENEIGHBOR_INFO_VECTOR_EMPTY );
- }
-
- //check if test featureVector is empty
- if(m_activedtwShapeRecognizer->m_cachedShapeFeature.size() <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Features of input TraceGroup is empty"<<endl;
-
- LTKReturnError(ESHAPE_SAMPLE_FEATURES_EMPTY);
- }
-
- //find out whether the test sample is close to a singleton or cluster
-
- //case of incorrect classification
- if(m_activedtwShapeRecognizer->m_vecRecoResult.size() == 0 ||
- m_activedtwShapeRecognizer->m_vecRecoResult.at(0).getShapeId() != shapeId)
- {
-
- int index = 0;
- //iterating through neighborInfoVec to retrieve information about the true
- //shape model of class
- while(shapeId != m_activedtwShapeRecognizer->m_neighborInfoVec[index].classId )
- index++;
-
- if(m_activedtwShapeRecognizer->m_neighborInfoVec[index].typeId == CLUSTER)
- {
- int clusterId = m_activedtwShapeRecognizer->m_neighborInfoVec[index].sampleId;
-
- //adapting the cluster
- iErrorCode = adaptCluster(m_activedtwShapeRecognizer->m_cachedShapeFeature,clusterId,shapeId);
-
- if(iErrorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<iErrorCode<<
- " LTKAdapt::adapt" << endl;
- LTKReturnError(iErrorCode);
- }
- }
- else
- {
- //adapting the singleton set
- iErrorCode = adaptSingleton(m_activedtwShapeRecognizer->m_cachedShapeFeature,shapeId);
- if(iErrorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<iErrorCode<<
- " LTKAdapt::adapt" << endl;
- LTKReturnError(iErrorCode);
- }
- }
- }
- else
- {
- //case of correct classification
- if(m_activedtwShapeRecognizer->m_neighborInfoVec[0].typeId == CLUSTER)
- {
- int clusterId = m_activedtwShapeRecognizer->m_neighborInfoVec[0].sampleId;
- int iterator = 0;
- while(m_activedtwShapeRecognizer->m_prototypeShapes[iterator].getShapeId() != shapeId)
- iterator++;
-
- ActiveDTWShapeModel shapeModelToAdapt = m_activedtwShapeRecognizer->m_prototypeShapes[iterator];
-
- vector<ActiveDTWClusterModel> currentClusterModelVector = shapeModelToAdapt.getClusterModelVector();
-
- //adapt the model only if number of samples seen by the model is less than the threshold m_maxClustersize
- if(currentClusterModelVector[clusterId].getNumSamples() < m_maxClusterSize)
- {
- iErrorCode = adaptCluster(m_activedtwShapeRecognizer->m_cachedShapeFeature,clusterId,shapeId);
-
- if(iErrorCode != SUCCESS)
- {
- currentClusterModelVector.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<iErrorCode<<
- " LTKAdapt::adapt" << endl;
- LTKReturnError(iErrorCode);
- }
- }
- currentClusterModelVector.clear();
- }
- else
- {
- //adapt singleton set
- iErrorCode = adaptSingleton(m_activedtwShapeRecognizer->m_cachedShapeFeature,shapeId);
- if(iErrorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<iErrorCode<<
- " LTKAdapt::adapt" << endl;
- LTKReturnError(iErrorCode);
- }
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- << "Exit LTKAdapt::adapt()"<<endl;
-
- return(SUCCESS);
-}
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : readAdaptConfig
-* DESCRIPTION : Reads configuration info for adaptation
-* ARGUMENTS : NONE
-* RETURNS : NONE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int LTKAdapt::readAdaptConfig()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Enter Adapt::readAdaptConfig"
- <<endl;
-
-
- LTKConfigFileReader *adaptConfigReader = NULL;
-
- adaptConfigReader = new LTKConfigFileReader(m_activedtwShapeRecognizer->m_activedtwCfgFilePath);
-
-
- //Don't throw Error as ShapeRecognizer might not support ADAPT
- string tempStringVar = "";
- int tempIntegerVar;
-
- int errorCode = adaptConfigReader->getConfigValue(MAXCLUSTERSIZE,tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if(LTKStringUtil::isInteger(tempStringVar))
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
-
- if(tempIntegerVar > 1)
- {
- if(tempIntegerVar < m_activedtwShapeRecognizer->m_minClusterSize)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << m_maxClusterSize <<
- " is out of permitted range MAXCUSTERSIZE < MINCLUSTERSIZE" <<
- " LTKAdapt::readAdaptConfig"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- else
- {
- m_maxClusterSize = tempIntegerVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- MAXCLUSTERSIZE << " = " <<m_maxClusterSize<<endl;
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << m_maxClusterSize <<
- " is out of permitted range" <<
- " LTKAdapt::readAdaptConfig"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << MAXCLUSTERSIZE <<
- " is out of permitted range" <<
- " LTKAdapt::readAdaptConfig"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << MAXCLUSTERSIZE << " : " << m_maxClusterSize << endl;
- }
-
-
- if(adaptConfigReader)
- delete adaptConfigReader;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exit LTKAdapt::readAdaptConfig"
- <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : adaptCluster
-* DESCRIPTION : This method adapts the cluster with the new featureVector. Implementation of method described in paper:
-"Incremental eigenanalysis for classifiation, published in British Machine Vision Conference-2008"
-*
-* ARGUMENTS : INPUT
-featureVecToAdapt shapeFeature
-clusterId int
-shapeId int
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int LTKAdapt::adaptCluster(shapeFeature& featureVecToAdapt,int clusterId,int shapeId)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "LTKAdapt::adaptCluster()" << endl;
-
- int errorCode;
-
- //validating input arguments
- if(m_activedtwShapeRecognizer->m_shapeIDNumPrototypesMap.find(shapeId) == m_activedtwShapeRecognizer->m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_SHAPEID << " " <<
- " LTKAdapt::adaptCluster()" << endl;
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- //finding the prototypeShape
- int index = 0;
-
- int i = 0;
- int j = 0;
-
- while(m_activedtwShapeRecognizer->m_prototypeShapes[index].getShapeId() != shapeId)
- index++;
-
- ActiveDTWShapeModel shapeModelToAdapt = m_activedtwShapeRecognizer->m_prototypeShapes[index];
-
- vector<ActiveDTWClusterModel> currentClusterModelVector = shapeModelToAdapt.getClusterModelVector();
-
- if(clusterId < 0 || clusterId >= currentClusterModelVector.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_CLUSTER_ID << " " <<
- " LTKAdapt::adaptCluster()" << endl;
-
- LTKReturnError(EINVALID_CLUSTER_ID);
- }
-
-
- ActiveDTWClusterModel clusterToAdapt = currentClusterModelVector[clusterId];
-
- //obtaining data of cluster
- doubleVector oldEigenValues = clusterToAdapt.getEigenValues();
-
- double2DVector oldEigenVectors = clusterToAdapt.getEigenVectors();
-
- doubleVector oldClusterMean = clusterToAdapt.getClusterMean();
-
- int numClusterSamples = clusterToAdapt.getNumSamples();
-
- //convert the shapefeature to double vector
- floatVector floatFeatureVector;
-
- doubleVector doubleFeatureVector;
-
- errorCode = m_activedtwShapeRecognizer->m_shapeRecUtil.shapeFeatureVectorToFloatVector(featureVecToAdapt,floatFeatureVector);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "LTKAdapt::adaptCluster" <<endl;
- LTKReturnError(errorCode);
- }
-
- int featureSize = floatFeatureVector.size();
-
- for(i = 0; i < featureSize; i++)
- doubleFeatureVector.push_back(floatFeatureVector[i]);
-
- floatFeatureVector.clear();
-
- //the difference vector
- //refers to y - x(mean)
- doubleVector diffVector;
-
- //refers to g in the paper (Eqn 2)
- //g = unp*(y - x(mean))
- doubleVector projectedTestSample;
-
- //refers to h in the paper (Eqn 3)
- //h = (y - x(mean)) - (unp * g)
- doubleVector residueVector;
-
- //refers to unp*g
- doubleVector reverseProjection;
-
- int numEigenVectors = oldEigenVectors.size();
-
- //calculating diffVector
- for(i = 0; i < featureSize; i++)
- diffVector.push_back(doubleFeatureVector[i] - oldClusterMean[i]);
-
- //constructing the projected test sample i.e g
- for(i = 0; i < numEigenVectors; i++)
- {
- double tempValue = 0;
- for(j = 0; j < featureSize; j++)
- {
- tempValue += (oldEigenVectors[i][j] * diffVector[j]);
- }
- projectedTestSample.push_back(tempValue);
- }
-
- //constructing reverse projection
- for(i = 0; i < featureSize; i++)
- {
- double tempValue = 0;
- for(j = 0; j < numEigenVectors;j++)
- {
- tempValue += oldEigenVectors[j][i] * projectedTestSample[j];
- }
- reverseProjection.push_back(tempValue);
- }
-
- //construct residue vector
- for(i = 0; i < featureSize; i++)
- residueVector.push_back(diffVector[i] - reverseProjection[i]);
-
- //magnitude of residue vector
- double residueMagnitude = 0;
-
- for(i = 0; i < featureSize; i++)
- residueMagnitude = residueMagnitude + (residueVector[i] * residueVector[i]);
-
- residueMagnitude = sqrt(residueMagnitude);
-
- //determining the recomputed eigenValues and eigenVectors
- //case 1 residueMagnitude is 0
- if(residueMagnitude == 0)
- {
- //construct the matrix whose eigen values and eigen vectors are to be calculated
- doubleVector tempVector;
-
- //corresponds to matrix in eqn 10
- double2DVector coeff1;
-
- tempVector.assign(numEigenVectors,0.0);
-
- coeff1.assign(numEigenVectors,tempVector);
-
- for(i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- {
- if(i == j)
- coeff1[i][j] = oldEigenValues[j];
- }
- }
-
- for(i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- coeff1[i][j] = (coeff1[i][j] * numClusterSamples)/(numClusterSamples + 1);
- }
-
- //refers to eqn 11 in paper
- double2DVector coeff2;
-
- coeff2.assign(numEigenVectors,tempVector);
-
- //constructing g*g(transpose)
- for(i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- coeff2[i][j] = projectedTestSample[i] * projectedTestSample[j];
- }
-
- for(i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- coeff2[i][j] = (coeff2[i][j] * numClusterSamples) / ((numClusterSamples + 1) * (numClusterSamples + 1));
- }
-
- //final matrix
- for(i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- coeff1[i][j] += coeff2[i][j];
- }
-
- //solving the intermediate eigen value problem
- //refers to eigenValue problem in eqn 12
- double2DVector intermediateEigenVectors;
- doubleVector eigenValues;
- int nrot = 0;
-
- intermediateEigenVectors.assign(numEigenVectors,tempVector);
-
- errorCode = m_activedtwShapeRecognizer->computeEigenVectors(coeff1,coeff1.size(),eigenValues,intermediateEigenVectors,nrot);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::adaptCluster()" << endl;
- LTKReturnError(errorCode);
- }
-
- //the new eigen vectors
- double2DVector eigenVectors;
-
- eigenVectors.assign(featureSize,tempVector);
-
- tempVector.clear();
-
- //calculating the new eigen vectors from the intermediateEigenVectors and oldEigenVectors
- //refers to eqn 8
- for( i = 0; i < featureSize; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- {
- for(int k = 0; k < numEigenVectors;k++)
- {
- eigenVectors[i][j] += (oldEigenVectors[k][i] * intermediateEigenVectors[k][j]);
- }
- }
- }
-
- //now converting the eigen vectors to row format
- //this makes it easy to write the eigen vectors to the mdt file and read from it
- double2DVector newEigenVectors;
-
- tempVector.assign(featureSize,0.0);
-
- newEigenVectors.assign(numEigenVectors,tempVector);
-
- for(i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < featureSize; j++)
- newEigenVectors[i][j] = eigenVectors[j][i];
- }
-
- numEigenVectors = 0;
- double eigenEnergy = 0;
- for( i = 0; i < eigenValues.size(); i++)
- {
- eigenEnergy += eigenValues[i];
- }
-
- double tempEigenEnergy = 0;
-
- while(tempEigenEnergy <= ((m_activedtwShapeRecognizer->m_percentEigenEnergy * eigenEnergy)/100))
- tempEigenEnergy += eigenValues[numEigenVectors++];
-
- doubleVector selectedEigenValues;
- double2DVector selectedEigenVectors;
- for( i = 0; i < numEigenVectors; i++)
- {
- selectedEigenValues.push_back(eigenValues[i]);
- selectedEigenVectors.push_back(newEigenVectors[i]);
- }
-
- doubleVector newClusterMean;
-
- for( i = 0; i < featureSize; i++)
- {
- double tempValue = ((numClusterSamples * oldClusterMean[i]) + doubleFeatureVector[i])/(numClusterSamples + 1);
- newClusterMean.push_back(tempValue);
- }
-
- //updating the cluster model
- errorCode = clusterToAdapt.setNumSamples(numClusterSamples + 1);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::adaptCluster()" << endl;
-
- LTKReturnError(errorCode);
- }
-
-
- clusterToAdapt.setEigenValues(selectedEigenValues);
- selectedEigenValues.clear();
-
- clusterToAdapt.setEigenVectors(selectedEigenVectors);
- selectedEigenVectors.clear();
-
- clusterToAdapt.setClusterMean(newClusterMean);
-
- currentClusterModelVector[clusterId] = clusterToAdapt;
-
- shapeModelToAdapt.setClusterModelVector(currentClusterModelVector);
-
- m_activedtwShapeRecognizer->m_prototypeShapes[index] = shapeModelToAdapt;
-
- //clearing vectors
- tempVector.clear();
- coeff1.clear();
- coeff2.clear();
- eigenValues.clear();
- newEigenVectors.clear();
- intermediateEigenVectors.clear();
- newClusterMean.clear();
- eigenVectors.clear();
- }
- else
- {
- //case residueMagnitude is not 0;
- doubleVector unitResidueVector;
-
- for(i = 0; i < featureSize; i++)
- unitResidueVector.push_back(residueVector[i]/residueMagnitude);
-
- //construct the matrix whose eigen values and eigen vectors are to be calculated
- doubleVector tempVector;
-
- //refer to eqn 10
- double2DVector coeff1;
-
- tempVector.assign(numEigenVectors + 1,0.0);
-
- coeff1.assign(numEigenVectors + 1,tempVector);
-
- for( i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- {
- if(i == j)
- {
- coeff1[i][j] = oldEigenValues[j];
- }
- }
- }
-
- for( i = 0; i < (numEigenVectors + 1 ); i++)
- {
- for(j = 0; j < (numEigenVectors + 1); j++)
- coeff1[i][j] = (coeff1[i][j] * numClusterSamples)/(numClusterSamples + 1);
- }
-
- //refers to unith(transpose)*diffVector
- double gamma = 0;
-
- for( i = 0; i < featureSize; i++)
- gamma = gamma + (unitResidueVector[i] * diffVector[i]);
-
- //refers to eqn 11
- double2DVector coeff2;
-
- coeff2.assign(numEigenVectors + 1,tempVector);
-
- //constructing g*g(transpose)
- for( i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < numEigenVectors; j++)
- coeff2[i][j] = projectedTestSample[i] * projectedTestSample[j];
- }
-
- //calculating gamma * projectedTestSample i.e gamma * g
- doubleVector gammaProjTestSample;
-
- for( i = 0; i < numEigenVectors; i++)
- gammaProjTestSample.push_back(projectedTestSample[i]*gamma);
-
- for( i = 0; i < numEigenVectors; i++)
- {
- coeff2[i][numEigenVectors] = gammaProjTestSample[i];
- coeff2[numEigenVectors][i] = gammaProjTestSample[i];
- }
-
- coeff2[numEigenVectors][numEigenVectors] = gamma * gamma;
-
- for( i = 0; i < numEigenVectors + 1; i++)
- {
- for(j = 0; j < numEigenVectors + 1; j++)
- coeff2[i][j] = (coeff2[i][j] * numClusterSamples) / ((numClusterSamples + 1) * (numClusterSamples + 1));
- }
-
- //final matrix
- for( i = 0; i < numEigenVectors + 1; i++)
- {
- for(j = 0; j < numEigenVectors + 1; j++)
- coeff1[i][j] = coeff1[i][j] + coeff2[i][j];
- }
-
- //solving the intermediate eigen value problem
- //refers to eqn 12
- double2DVector intermediateEigenVectors;
- doubleVector eigenValues;
- int nrot = 0;
-
- intermediateEigenVectors.assign(numEigenVectors + 1,tempVector);
-
- errorCode = m_activedtwShapeRecognizer->computeEigenVectors(coeff1,coeff1.size(),eigenValues,intermediateEigenVectors,nrot);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::adaptCluster()" << endl;
- LTKReturnError(errorCode);
- }
-
- //the new eigen vectors
- double2DVector eigenVectors;
-
- //adding unith to the old set of eigen vectors
- oldEigenVectors.push_back(unitResidueVector);
-
- eigenVectors.assign(featureSize,tempVector);
-
- tempVector.clear();
-
- //calculating the new eigen vectors from the oldEigenVectors
- //refers to eqn 8
- for( i = 0; i < featureSize; i++)
- {
- for(j = 0; j < (numEigenVectors + 1); j++)
- {
- for(int k = 0; k < (numEigenVectors + 1);k++)
- {
- eigenVectors[i][j] = eigenVectors[i][j] + (oldEigenVectors[k][i] * intermediateEigenVectors[k][j]);
- }
- }
- }
-
- //now converting the eigen vectors to row format
- //this makes it easy to write the eigen vectors to the mdt file and read from it
- double2DVector newEigenVectors;
-
- tempVector.assign(featureSize,0.0);
-
- newEigenVectors.assign(numEigenVectors + 1,tempVector);
-
- for( i = 0; i < numEigenVectors + 1; i++)
- {
- for(j = 0; j < featureSize; j++)
- newEigenVectors[i][j] = eigenVectors[j][i];
- }
-
- doubleVector newClusterMean;
-
- for( i = 0; i < featureSize; i++)
- {
- double tempValue = ((numClusterSamples * oldClusterMean[i]) + doubleFeatureVector[i])/(numClusterSamples + 1);
- newClusterMean.push_back(tempValue);
- }
-
- numEigenVectors = 0;
- double eigenEnergy = 0;
- for( i = 0; i < eigenValues.size(); i++)
- {
- eigenEnergy += eigenValues[i];
- }
-
- double tempEigenEnergy = 0;
-
- while(tempEigenEnergy <= ((m_activedtwShapeRecognizer->m_percentEigenEnergy * eigenEnergy)/100))
- tempEigenEnergy += eigenValues[numEigenVectors++];
-
-
- doubleVector selectedEigenValues;
- double2DVector selectedEigenVectors;
- for( i = 0; i < numEigenVectors; i++)
- {
- selectedEigenValues.push_back(eigenValues[i]);
- selectedEigenVectors.push_back(newEigenVectors[i]);
- }
-
- //updating the cluster model
-
- errorCode = clusterToAdapt.setNumSamples(numClusterSamples + 1);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::adaptCluster()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- clusterToAdapt.setEigenValues(selectedEigenValues);
- selectedEigenValues.clear();
- clusterToAdapt.setEigenVectors(selectedEigenVectors);
- selectedEigenVectors.clear();
-
- clusterToAdapt.setClusterMean(newClusterMean);
-
- currentClusterModelVector[clusterId] = clusterToAdapt;
-
- shapeModelToAdapt.setClusterModelVector(currentClusterModelVector);
-
- m_activedtwShapeRecognizer->m_prototypeShapes[index] = shapeModelToAdapt;
-
- //clearing vectors
- tempVector.clear();
- coeff1.clear();
- coeff2.clear();
- gammaProjTestSample.clear();
- eigenValues.clear();
- newEigenVectors.clear();
- intermediateEigenVectors.clear();
- newClusterMean.clear();
- eigenVectors.clear();
- unitResidueVector.clear();
- }
-
- //clearing vectors
- oldEigenValues.clear();
- oldEigenVectors.clear();
- oldClusterMean.clear();
- doubleFeatureVector.clear();
- projectedTestSample.clear();
- residueVector.clear();
- reverseProjection.clear();
- diffVector.clear();
- currentClusterModelVector.clear();
-
- errorCode = m_activedtwShapeRecognizer->writePrototypeShapesToMDTFile();
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::adaptCluster()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "LTKAdapt::adaptCluster()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : adaptSingleton
-* DESCRIPTION : This method adapts the singleton sey with the
-new featureVector and trains the singleton set if the
-number of singletons exceeds a certain number
-* ARGUMENTS : INPUT
-featureVecToAdapt shapeFeature
-shapeId int
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int LTKAdapt::adaptSingleton(shapeFeature& featureVecToAdapt,int shapeId)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "LTKAdapt::adaptSingleton()" << endl;
-
- //validating input parameters
- if(m_activedtwShapeRecognizer->m_shapeIDNumPrototypesMap.find(shapeId) == m_activedtwShapeRecognizer->m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_SHAPEID << " " <<
- " LTKAdapt::adaptCluster()" << endl;
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- int errorCode;
-
- int index = 0;
-
- //iterating prototypeShapes to find the shapeModel To Adapt
- while(m_activedtwShapeRecognizer->m_prototypeShapes[index].getShapeId() != shapeId)
- index++;
-
- shapeMatrix currentSingletonVectors = m_activedtwShapeRecognizer->m_prototypeShapes[index].getSingletonVector();
-
- currentSingletonVectors.push_back(featureVecToAdapt);
-
- m_activedtwShapeRecognizer->m_prototypeShapes[index].setSingletonVector(currentSingletonVectors);
-
- int singletonSize = currentSingletonVectors.size();
-
- //train the singletons only if their number is above some threshold
- if(singletonSize > (TRAINSINGLETONFACTOR * m_activedtwShapeRecognizer->m_minClusterSize) )
- {
- errorCode = trainSingletons(currentSingletonVectors,shapeId,index);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::adaptSingleton()" << endl;
- LTKReturnError(errorCode);
- }
- }
-
- currentSingletonVectors.clear();
-
- //updating the mdt file
- errorCode = m_activedtwShapeRecognizer->writePrototypeShapesToMDTFile();
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::adaptCluster()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "LTKAdapt::adaptSingleton()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : trainSingletons
-* DESCRIPTION : This method trains the featureVectors in the singleton set
-* ARGUMENTS : INPUT
-singletons shapeMatrix
-shapeId int
-index int
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int LTKAdapt::trainSingletons(const shapeMatrix &singletons,int shapeId,int index)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "LTKAdapt::trainSingletons()" << endl;
-
- //validating input arguments
- if(m_activedtwShapeRecognizer->m_shapeIDNumPrototypesMap.find(shapeId) == m_activedtwShapeRecognizer->m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_SHAPEID << " " <<
- " LTKAdapt::adaptCluster()" << endl;
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- if(index < 0 || index >= m_activedtwShapeRecognizer->m_prototypeShapes.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROTOYPESHAPE_INDEX_OUT_OF_BOUND << " " <<
- " LTKAdapt::adaptSingleton()" << endl;
-
- LTKReturnError(EPROTOYPESHAPE_INDEX_OUT_OF_BOUND);
- }
-
- int errorCode;
-
- LTKShapeSample tempShape;
-
- vector<LTKShapeSample> shapesToTrain;
-
- int singletonSize = singletons.size();
-
- int2DVector clusterOutput;
-
- shapeMatrix newSingletons;
-
- vector<ActiveDTWClusterModel> currentClusterModelVector = m_activedtwShapeRecognizer->m_prototypeShapes[index].getClusterModelVector();
-
- int i = 0;
-
- for(i = 0; i < singletonSize; i++)
- {
- tempShape.setFeatureVector(singletons[i]);
- shapesToTrain.push_back(tempShape);
- }
-
- //perform clustering
- errorCode = m_activedtwShapeRecognizer->performClustering(shapesToTrain,clusterOutput);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainSingletons()" << endl;
- LTKReturnError(errorCode);
- }
-
- int2DVector::iterator iter = clusterOutput.begin();
- int2DVector::iterator iEnd = clusterOutput.end();
- intVector cluster;
-
- /**ITERATING THROUGH THE VARIOUS CLUSTERS **/
- for(;iter != iEnd; ++iter)
- {
- cluster = (*iter);
-
- /** SINGLETON VECTORS **/
- if(cluster.size() < m_activedtwShapeRecognizer->m_minClusterSize)
- {
- for(i = 0; i < cluster.size(); i++)
- newSingletons.push_back(shapesToTrain[cluster[i]].getFeatureVector());
- }
-
- /** CLUSTER PROCESSING **/
- else
- {
- //creating new clusters
- doubleVector tempFeature;
-
- double2DVector featureMatrix;
-
- double2DVector covarianceMatrix;
-
- doubleVector clusterMean;
-
- double2DVector intermediateEigenVectors;
-
- double2DVector eigenVectors;
-
- doubleVector eigenValues;
-
- ActiveDTWClusterModel clusterModel;
-
- //gather all the shape samples pertaining to a particular cluster
- int clusterSize = cluster.size();
- for(i = 0; i < clusterSize; i++)
- {
- floatVector floatFeatureVector;
-
- errorCode = m_activedtwShapeRecognizer->m_shapeRecUtil.shapeFeatureVectorToFloatVector(shapesToTrain[cluster[i]].getFeatureVector(),
- floatFeatureVector);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::trainSingletons()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- int floatFeatureVectorSize = floatFeatureVector.size();
- for(int i = 0; i < floatFeatureVectorSize; i++)
- tempFeature.push_back(floatFeatureVector[i]);
-
- featureMatrix.push_back(tempFeature);
- tempFeature.clear();
- floatFeatureVector.clear();
- }
-
- /** COMPUTING COVARIANCE MATRIX **/
- errorCode = m_activedtwShapeRecognizer->computeCovarianceMatrix(featureMatrix,covarianceMatrix,clusterMean);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::trainSingletons()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- clusterModel.setClusterMean(clusterMean);
-
- errorCode = m_activedtwShapeRecognizer->computeEigenVectorsForLargeDimension(featureMatrix,covarianceMatrix,intermediateEigenVectors,eigenValues);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::trainSingletons()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- doubleVector tempEigenVector;
- int eigenVectorDimension = intermediateEigenVectors.size();
- if(eigenVectorDimension <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EEMPTY_EIGENVECTORS << " " <<
- " LTKAdapt::trainSingletons()" << endl;
-
- LTKReturnError(EEMPTY_EIGENVECTORS);
- }
-
- int numEigenVectors = intermediateEigenVectors[0].size();
-
- if(numEigenVectors <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_NUM_OF_EIGENVECTORS << " " <<
- " LTKAdapt::trainSingletons()" << endl;
-
- LTKReturnError(EINVALID_NUM_OF_EIGENVECTORS);
- }
-
- for(i = 0; i < numEigenVectors; i++)
- {
- for(int j = 0; j < eigenVectorDimension; j++)
- tempEigenVector.push_back(intermediateEigenVectors[j][i]);
-
- eigenVectors.push_back(tempEigenVector);
- tempEigenVector.clear();
- }
-
- /**CONSTRUCTING CLUSTER MODEL **/
-
- errorCode = clusterModel.setNumSamples(cluster.size());
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " LTKAdapt::trainSingletons()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- clusterModel.setEigenValues(eigenValues);
-
- clusterModel.setEigenVectors(eigenVectors);
-
- currentClusterModelVector.push_back(clusterModel);
-
- //clearing vectors
- featureMatrix.clear();
- covarianceMatrix.clear();
- clusterMean.clear();
- intermediateEigenVectors.clear();
- eigenVectors.clear();
- eigenValues.clear();
-
- }
- }
-
- //updating the shape model
- (m_activedtwShapeRecognizer->m_prototypeShapes[index]).setClusterModelVector(currentClusterModelVector);
- m_activedtwShapeRecognizer->m_prototypeShapes[index].setSingletonVector(newSingletons);
-
- //clearing vectors
- currentClusterModelVector.clear();
- clusterOutput.clear();
- shapesToTrain.clear();
- newSingletons.clear();
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "LTKAdapt::trainSingletons()" << endl;
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h
deleted file mode 100644
index 276eeb24..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWAdapt.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2009-04-06 11:55:15 +0530 (Mon, 06 Apr 2009) $
-* $Revision: 758 $
-* $Author: royva $
-*
-************************************************************************/
-
-/************************************************************************
-* FILE DESCR: Implements ActiveDTWShapeRecognizer::Adapt
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-* DATE: 3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description
-************************************************************************/
-#pragma once
-
-#include "ActiveDTWShapeRecognizer.h"
-#include "LTKLoggerUtil.h"
-#include "LTKConfigFileReader.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKPreprocDefaults.h"
-
-#define TRAINSINGLETONFACTOR 2
-
-class ActiveDTWShapeRecognizer;
-
-class LTKAdapt
-{
-private:
- /** @name Constructor */
- LTKAdapt(ActiveDTWShapeRecognizer* ptrActiveDTWShapeReco);
-
-
- static LTKAdapt* adaptInstance;
-
- static int m_count;
- /**< @brief
- * <p>
- * Initially m_count = 0, when adapt is called on first sample
- * it checks if m_count = 0, if yes it calls readAdaptConfig and then increments m_count to 1
- * Thus readAdaptConfig is called only once
- * </p>
- */
-
-public:
- static LTKAdapt* getInstance(ActiveDTWShapeRecognizer* ptrActiveDTWShapeReco);
-
- /**
- * Adapts the shapeId
- *
- * Semantics
- *
- * - Reads the internal classifier config information incase of first sample to be adapted
-
- - Checks if the sample to be adapted was correctly classified or incorrectly classified
-
- - Incase of correct classification
- --Check if the shape was closest to the cluster or singletons
- --If sample to be adapted was closest to the clusters, and cluster size does not exceed
- m_maxClusterSize, then call adaptCluster
- --It sample to be adapted was closest to the singleton, call adaptSingleton
-
- -Incase of incorrect classification
- --If the sample to be adapted was closest to a cluster, call adaptCluster
- --If the sample to be adapted was closest to a singleton, call adaptSingleton
- *
- * @param shapeId : shape to be adapted
- * @return SUCCESS : if the shapeId was adapted successfully
- * ErrorCode: if some error occurs
- * @exception ENEIGHBOR_INFO_VECTOR_EMPTY : ActiveDTWShapeRecognizer::m_neighbofInfoVec is empty
- * @exception ESHAPE_SAMPLE_FEATURES_EMPTY : ActiveDTWShapeRecognizer::m_cachedShapeFeature is empty
- */
- int adapt(int shapeId);
-
- /** @name Destructor */
- ~LTKAdapt();
-
- void deleteInstance();
-
-private:
-
-/**< @brief Pointer to ActiveDTWShapeRecognizer
-* <p>
-*
-* </p>
- */
- ActiveDTWShapeRecognizer* m_activedtwShapeRecognizer;
-
- //the maximum number of samples in a cluster
- int m_maxClusterSize;
- /**< @brief Maximum Cluster Size
- * <p>
- * Specifies the maximum number of samples that can be present in a cluster
- * It must be >= the ActiveDTWShapeRecognizer::m_minClusterSize
- * </p>
- */
-
-
- /**
- * This method reads Config variables related to Adapt from CFG
- *
- * Semantics
- *
- *
- * @param none
- *
- * @return SUCCESS:
- * FAILURE: return ErrorCode
- * @exception none
- */
- int readAdaptConfig();
-
- /**
- * Adapts the cluster with the new shapeFeature
- *
- * Semantics
- *
- * - Recomputes the eigen values, eigen vectors and cluster mean,
- * using the old values and the new shape feature
- *
- * @param featureVecToAdapt : shapeFeature
- * @param clusterId : cluster to be adapted
- * @param shapeId : shape to be adapted
- * @return SUCCESS : if the shapeId was adapted successfully
- * ErrorCode: if some error occurs
- * @exception EINVALID_SHAPEID
- * @exception EINVALID_CLUSTER_ID
- */
- int adaptCluster(shapeFeature& featureVecToAdapt,int clusterId,int shapeId);
-
- /**
- * Adapts the set of singletons with the new shapeFeature
- *
- * Semantics
- *
- * - Adds the new shapeFeature to the current set of singletons
- *
- * - If the number of singletons exceeds a certain threshold train the singletons
- *
- * @param featureVecToAdapt : shapeFeature
- * @param shapeId : shape to be adapted
- * @return SUCCESS : if the shapeId was adapted successfully
- * ErrorCode: if some error occurs
- * @exception EINVALID_SHAPEID
- */
- int adaptSingleton(shapeFeature& featureVecToAdapt,int shapeId);
-
- /**
- * Performs training on the set of singletons
- *
- * Semantics
- *
- * - performs clustering on the singletons, resulting in new clusters and singleton set
- *
- * - cluster and singleton information are added to the shape model
- *
- * @param singletons : shapeMatrix
- * @param shapeId : shape to be adapted
- * @param index : index in ActiveDTWShapeRecognizer::m_prototypeShapes which holds the shapeModel information
- * @return SUCCESS : if the shapeId was adapted successfully
- * ErrorCode: if some error occurs
- * @exception EINVALID_SHAPEID : shapeId specified is Invalid
- * @exception EPROTOYPESHAPE_INDEX_OUT_OF_BOUND ; index value specified is Invalid
- * @exception EEMPTY_EIGENVECTORS ; eigen vector dimension is < 0
- * @exception EINVALID_NUM_OF_EIGENVECTORS : number of eigen vectors < 0
- */
- int trainSingletons(const shapeMatrix &singletons,int shapeId,int index);
-};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp
deleted file mode 100644
index 34886d32..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2009-04-06 11:55:15 +0530 (Mon, 06 Apr 2009) $
-* $Revision: 758 $
-* $Author: royva $
-*
-************************************************************************/
-/*********************************************************************************************
-* FILE DESCR: Implementation for ActiveDTW Cluster Model. Used to store cluster model information
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-w
-* DATE:3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-***********************************************************************************************/
-
-#include "ActiveDTWClusterModel.h"
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : ActiveDTWClusterModel
-* DESCRIPTION : Default Constructor
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-ActiveDTWClusterModel::ActiveDTWClusterModel()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setNumSamples
-* DESCRIPTION : sets the number of samples in the cluster
-* ARGUMENTS : INPUT: numSamples
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWClusterModel::setNumSamples(int numSamples)
-{
- if(numSamples > 0)
- {
- m_numberOfSamples = numSamples;
- }
- else
- {
- LTKReturnError(EINVALID_NUM_SAMPLES);
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getNumSamples
-* DESCRIPTION : returns the number of samples in a cluster
-* ARGUMENTS : none
-* RETURNS : number of samples
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWClusterModel::getNumSamples() const
-{
- return m_numberOfSamples;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setEigenValues
-* DESCRIPTION : sets the eigen values of the cluster
-* ARGUMENTS : INPUT: eigen values
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void ActiveDTWClusterModel::setEigenValues(const doubleVector& eigVal)
-{
- m_eigenValues = eigVal;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setClusterMean
-* DESCRIPTION : sets the cluster mean of the cluster
-* ARGUMENTS : INPUT: clusterMean
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void ActiveDTWClusterModel::setClusterMean(const doubleVector& clusterMean)
-{
- m_clusterMean = clusterMean;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getEigenValues
-* DESCRIPTION : returns the eigen values of the cluster
-* ARGUMENTS : none
-* RETURNS : eigen values
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-const doubleVector& ActiveDTWClusterModel::getEigenValues() const
-{
- return m_eigenValues;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setEigenVectors
-* DESCRIPTION : sets the eigen vectors of the cluster
-* ARGUMENTS : eigen vectors
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void ActiveDTWClusterModel::setEigenVectors(const double2DVector& eigVec)
-{
- m_eigenVectors = eigVec;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getEigenVectors
-* DESCRIPTION : returns the eigen vectors of the cluster
-* ARGUMENTS : none
-* RETURNS : eigen vectors
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-const double2DVector& ActiveDTWClusterModel::getEigenVectors() const
-{
- return m_eigenVectors;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getClusterMean
-* DESCRIPTION : returns the cluster mean of the cluster
-* ARGUMENTS : none
-* RETURNS : cluster mean
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-const doubleVector& ActiveDTWClusterModel::getClusterMean() const
-{
- return m_clusterMean;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : ~ActiveDTWClusterModel
-* DESCRIPTION : Default Destructor
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-ActiveDTWClusterModel::~ActiveDTWClusterModel()
-{
-
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h
deleted file mode 100644
index 4d183487..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWClusterModel.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
-* $Revision: 827 $
-* $Author: mnab $
-*
-************************************************************************/
-/*********************************************************************************************
-* FILE DESCR: Definitions for ActiveDTWClusterModel Class
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-* DATE:3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-***********************************************************************************************/
-
-
-#ifndef ACTIVEDTWCLUSTERMODEL_H
-#define ACTIVEDTWCLUSTERMODEL_H
-
-#include <iostream>
-#include "LTKTypes.h"
-#include "LTKInc.h"
-#include "LTKMacros.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-
-using namespace std;
-
-typedef vector<double> doubleVector;
-typedef vector<doubleVector> double2DVector;
-
-/**
-* @ingroup ActiveDTWShapeModel.h
-* @brief The Header file for the ActiveDTWShapeModel
-* @class ActiveDTWShapeModel
-*<p> <p>
-*/
-class ActiveDTWClusterModel
-{
-private:
- int m_numberOfSamples;
- /** @brief Number of samples in the cluster
- * <p>
- * Specifies the number of samples in the cluster
- * </p>
- */
-
- doubleVector m_eigenValues;
- /** @brief Eigen Values
- * <p>
- * Eigen values of the cluster covariance matrix
- * </p>
- */
-
- double2DVector m_eigenVectors;
- /** @brief Eigen Vectors
- * <p>
- * Eigen vectors of the cluster covariance matrix
- * </p>
- */
-
- doubleVector m_clusterMean;
- /** @brief Cluster mean
- * <p>
- * Mean of all the samples forming the cluster
- * </p>
- */
-
-public:
-
- /** @name Constructors and Destructor */
- ActiveDTWClusterModel();
-
- ~ActiveDTWClusterModel();
-
- /**
- * Sets the number of samples in the cluster
- * @param numSamples
- * @return SUCCESS : if the number of samples was set successfully
- * @exception EINVALID_SHAPEID
- */
- int setNumSamples(int numSamples);
-
- /**
- * Sets the eigen values of the cluser
- * @param eigVal
- * @return SUCCESS : if the number of samples was set successfully
- * @exception EINVALID_SHAPEID
- */
- void setEigenValues(const doubleVector& eigVal);
-
- /**
- * Sets the eigen vectors of the cluster
- * @param eigVec
- * @return SUCCESS : if the number of samples was set successfully
- * @exception EINVALID_SHAPEID
- */
- void setEigenVectors(const double2DVector& eigVec);
-
- /**
- * Sets the mean of the cluster
- * @param clusterMean
- * @return SUCCESS : if the number of samples was set successfully
- * @exception EINVALID_SHAPEID
- */
- void setClusterMean(const doubleVector& clusterMean);
-
- /**
- * Returns the number of samples in the cluster
- * @return number of samples
- * @exception EINVALID_SHAPEID
- */
- int getNumSamples() const;
-
- /**
- * Returns the eigen values of the cluster
- * @return eigen values
- * @exception EINVALID_SHAPEID
- */
- const doubleVector& getEigenValues() const;
-
- /**
- * Returns the eigen vectors of the cluster
- * @return eigen vectors
- * @exception EINVALID_SHAPEID
- */
- const double2DVector& getEigenVectors() const;
-
- /**
- * Returns the mean of the cluster
- * @return cluster mean
- * @exception EINVALID_SHAPEID
- */
- const doubleVector& getClusterMean() const;
-
-
-};
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp
deleted file mode 100644
index 2514a626..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2009-04-06 11:55:15 +0530 (Mon, 06 Apr 2009) $
-* $Revision: 758 $
-* $Author: royva $
-*
-************************************************************************/
-/*********************************************************************************************
-* FILE DESCR: Implementation for ActiveDTW Shape Model. Used to store shape model information
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-* DATE:3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-***********************************************************************************************/
-
-#include "ActiveDTWShapeModel.h"
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : ActiveDTWShapeModel
-* DESCRIPTION : Default Constructor
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-ActiveDTWShapeModel::ActiveDTWShapeModel()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setShapeId
-* DESCRIPTION : sets the shape id for the shape model
-* ARGUMENTS : INPUT: shapeId
-* RETURNS : SUCCESS - on successfully setting the shape id
-: ErrorCode - otherwise
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeModel::setShapeId(const int shapeId)
-{
- if(shapeId >= 0)
- {
- m_shapeId = shapeId;
- }
- else
- {
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setClusterModelVector
-* DESCRIPTION : sets the vector of clusters for the ActiveDTWShapeModel
-* ARGUMENTS : INPUT: clusterModelVector
-* RETURNS : NONE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void ActiveDTWShapeModel::setClusterModelVector(const vector<ActiveDTWClusterModel>& clusterModelVector)
-{
- m_clusterModelVector = clusterModelVector;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setSingletonVector
-* DESCRIPTION : sets the vector of singletons for the shape model
-* ARGUMENTS : INPUT: shapeId
-* RETURNS : NONE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void ActiveDTWShapeModel::setSingletonVector(const shapeMatrix& singletonVector)
-{
- m_singletonVector = singletonVector;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getShapeId
-* DESCRIPTION : returns the shapeId of the model
-* ARGUMENTS : INPUT: NULL
-* RETURNS : shapeId
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeModel::getShapeId() const
-{
- return m_shapeId;
-}
-
-/*************************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getClusterModelVector
-* DESCRIPTION : returns the clusters model vector
-* ARGUMENTS : INPUT: NULL
-* RETURNS : clusterModelVector
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-const vector<ActiveDTWClusterModel>& ActiveDTWShapeModel::getClusterModelVector() const
-{
- return m_clusterModelVector;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getSingletonVector
-* DESCRIPTION : returns the set of singleton vectors
-* ARGUMENTS : INPUT: NULL
-* RETURNS : shapeMatrix
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-const shapeMatrix& ActiveDTWShapeModel::getSingletonVector() const
-{
- return m_singletonVector;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : ~ActiveDTWShapeModel
-* DESCRIPTION : Destructor
-* ARGUMENTS : NONE
-* RETURNS : NONE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-ActiveDTWShapeModel::~ActiveDTWShapeModel()
-{
-
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h
deleted file mode 100644
index f79182ea..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeModel.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2009-04-06 11:55:15 +0530 (Mon, 06 Apr 2009) $
-* $Revision: 758 $
-* $Author: royva $
-*
-************************************************************************/
-/************************************************************************
-* FILE DESCR: Definitions for ActiveDTW Shape Recognition module
-*
-* CONTENTS:
-*
-* AUTHOR:
-*
-* DATE:
-* CHANGE HISTORY:
-* Author Date Description of change
-************************************************************************/
-#ifndef ACTIVEDTWSHAPEMODEL_H
-#define ACTIVEDTWSHAPEMODEL_H
-#include <iostream>
-#include "LTKTypes.h"
-#include "ActiveDTWClusterModel.h"
-#include "LTKShapeFeatureMacros.h"
-#include "LTKShapeFeature.h"
-#include "LTKInc.h"
-
-using namespace std;
-
-typedef vector<LTKShapeFeaturePtr> shapeFeature;
-typedef vector<shapeFeature> shapeMatrix;
-
-/**
-* @ingroup ActiveDTWShapeModel.h
-* @brief The Header file for the ActiveDTWShapeModel
-* @class ActiveDTWShapeModel
-*<p> <p>
-*/
-class ActiveDTWShapeModel
-{
-private:
- int m_shapeId;
- /** @brief shape id of the class
- * <p>
- * It specifies a specific shape id to each shape model
- * </p>
- */
-
- vector<ActiveDTWClusterModel> m_clusterModelVector;
- /**< @brief vector of cluster models
- * <p>
- * Contains the information of all the clusters of the class
- * </p>
- */
-
- shapeMatrix m_singletonVector;
- /**< @brief singletons /free samples of the class
- * <p>
- * Contains all the singleton vectors of the class
- * </p>
- */
-
-public:
-
- /** @name Constructors and Destructor */
- ActiveDTWShapeModel();
-
- ~ActiveDTWShapeModel();
-
- /**
- * Sets the shapeId of the class
- * @param shapeId
- * @return SUCCESS : if the shapeId was set successfully
- * @exception EINVALID_SHAPEID
- */
- int setShapeId(const int shapeId);
-
- /**
- * Sets the clusterModelVector of the class
- * @param clusterModelVector : vector<ActiveDTWClusterModel>
- * @return NULL
- * @exception None
- */
- void setClusterModelVector(const vector<ActiveDTWClusterModel>& clusterModelVector);
-
- /**
- * Sets the singleton vector of the class
- * @param singletonVector : shapeMatrix
- * @return NULL
- * @exception None
- */
- void setSingletonVector(const shapeMatrix& singletonVector);
-
- /**
- * Returns the shapeId of the class
- * @param None
- * @return shapeId
- * @exception None
- */
- int getShapeId() const;
-
- /**
- * Returns the clusterModelVector of the class
- * @param None
- * @return vector<ActiveDTWClusterModel>
- * @exception None
- */
- const vector<ActiveDTWClusterModel>& getClusterModelVector() const;
-
- /**
- * Returns the singletonVector of the class
- * @param None
- * @return shapeMatrix
- * @exception None
- */
- const shapeMatrix& getSingletonVector() const ;
-};
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp
deleted file mode 100644
index 247f5f98..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp
+++ /dev/null
@@ -1,6257 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2011-02-08 16:57:52 +0530 (Tue, 08 Feb 2011) $
-* $Revision: 834 $
-* $Author: mnab $
-*
-************************************************************************/
-/************************************************************************
-* FILE DESCR: Implementation for ActiveDTW Shape Recognition module
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-w
-* DATE: 3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-************************************************************************/
-
-#include "LTKConfigFileReader.h"
-
-#include "ActiveDTWShapeRecognizer.h"
-
-#include "LTKPreprocDefaults.h"
-
-#include "LTKHierarchicalClustering.h"
-
-#include "LTKPreprocessorInterface.h"
-
-#include "LTKShapeFeatureExtractorFactory.h"
-
-#include "LTKShapeFeatureExtractor.h"
-
-#include "LTKShapeFeature.h"
-
-#include "LTKVersionCompatibilityCheck.h"
-
-#include "LTKInkFileWriter.h"
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKClassifierDefaults.h"
-
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : ActiveDTWShapeRecognizer
-* DESCRIPTION : Default Constructor that initializes all data members
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-
-void ActiveDTWShapeRecognizer::assignDefaultValues()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::assignDefaultValues()" << endl;
-
- m_numShapes = 0;
- m_activedtwCfgFilePath = "";
- m_activedtwMDTFilePath = "";
- m_ptrPreproc = NULL;
- m_projectTypeDynamic=false;
- m_prototypeSelection=NN_DEF_PROTOTYPESELECTION;
- m_prototypeReductionFactor=NN_DEF_PROTOTYPEREDUCTIONFACTOR;
- m_nearestNeighbors=NN_DEF_NEARESTNEIGHBORS;
- m_dtwBanding=NN_DEF_BANDING;
- m_dtwEuclideanFilter= ACTIVEDTW_DEF_DTWEUCLIDEANFILTER;
- m_preProcSeqn=NN_DEF_PREPROC_SEQ;
- m_ptrFeatureExtractor=NULL;
- m_featureExtractorName=NN_DEF_FEATURE_EXTRACTOR;
- m_numClusters=NN_NUM_CLUST_INITIAL;
- m_MDTUpdateFreq=NN_DEF_MDT_UPDATE_FREQ;
- m_prototypeSetModifyCount=0;
- m_rejectThreshold=NN_DEF_REJECT_THRESHOLD;
- m_adaptivekNN=false;
- m_deleteLTKLipiPreProcessor=NULL;
- m_minClusterSize = ADAPT_DEF_MIN_NUMBER_SAMPLES_PER_CLASS;
- m_percentEigenEnergy = ACTIVEDTW_DEF_PERCENTEIGENENERGY;
- m_eigenSpreadValue = ACTIVEDTW_DEF_EIGENSPREADVALUE;
- m_useSingleton = ACTIVEDTW_DEF_USESINGLETON;
- m_MDTFileOpenMode = NN_MDT_OPEN_MODE_ASCII;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::assignDefaultValues()" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : initialize
-* DESCRIPTION : This method initializes the ActiveDTW shape recognizer
-* ARGUMENTS : string Holds the Project Name
-* string Holds the Profile Name
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no erros
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-ActiveDTWShapeRecognizer::ActiveDTWShapeRecognizer(const LTKControlInfo& controlInfo):
-m_OSUtilPtr(LTKOSUtilFactory::getInstance()),
-m_libHandler(NULL),
-m_libHandlerFE(NULL)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::ActiveDTWShapeRecognizer()" << endl;
-
- try
- {
- LTKControlInfo tmpControlInfo=controlInfo;
-
- string strProjectName = "";
- string strProfileName = "";
-
-
- if( (tmpControlInfo.projectName).empty() )
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
- if( (tmpControlInfo.lipiRoot).empty() )
- {
- throw LTKException(ELIPI_ROOT_PATH_NOT_SET);
- }
-
- if( (tmpControlInfo.profileName).empty() )
- {
- strProfileName = DEFAULT_PROFILE;
- tmpControlInfo.profileName = strProfileName;
- }
-
- if ( tmpControlInfo.toolkitVersion.empty() )
- {
- throw LTKException(ENO_TOOLKIT_VERSION);
- }
-
- assignDefaultValues();
-
- m_lipiRootPath = tmpControlInfo.lipiRoot;
- m_lipiLibPath = tmpControlInfo.lipiLib;
- m_currentVersion = tmpControlInfo.toolkitVersion;
- strProjectName = tmpControlInfo.projectName;
- strProfileName = tmpControlInfo.profileName;
-
-
- //Model Data file Header Information
- m_headerInfo[PROJNAME] = strProjectName;
-
- //Holds the value of Number of Shapes in string format
- string strNumShapes = "";
-
- string strProfileDirectory = m_lipiRootPath + PROJECTS_PATH_STRING +
- strProjectName + PROFILE_PATH_STRING;
-
- //Holds the path of the Preproc.dll
-
- //Holds the path of the Project.cfg
- string projectCFGPath = strProfileDirectory + PROJECT_CFG_STRING;
-
- // Config file
-
- m_activedtwCfgFilePath = m_lipiRootPath + PROJECTS_PATH_STRING +
- (tmpControlInfo.projectName) + PROFILE_PATH_STRING +
- (tmpControlInfo.profileName) + SEPARATOR +
- ACTIVEDTW + CONFIGFILEEXT;
-
-
- //Set the path for activedtw.mdt
- m_activedtwMDTFilePath = strProfileDirectory + strProfileName + SEPARATOR + ACTIVEDTW + DATFILEEXT;
-
-
- //To find whether the project was dynamic or not andto read read number of shapes from project.cfg
- int errorCode = m_shapeRecUtil.isProjectDynamic(projectCFGPath,
- m_numShapes, strNumShapes, m_projectTypeDynamic);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "ActiveDTWShapeRecognizer::ActiveDTWShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- //Set the NumShapes to the m_headerInfo
- m_headerInfo[NUMSHAPES] = strNumShapes;
-
- //Currently preproc cfg also present in ActiveDTW
- tmpControlInfo.cfgFileName = ACTIVEDTW;
- errorCode = initializePreprocessor(tmpControlInfo,&m_ptrPreproc);
-
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "ActiveDTWShapeRecognizer::ActiveDTWShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- //Reading ActiveDTW configuration file
- errorCode = readClassifierConfig();
-
-
- if( errorCode != SUCCESS)
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "ActiveDTWShapeRecognizer::ActiveDTWShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- //Writing Feature extractor name and version into the header
- m_headerInfo[FE_NAME] = m_featureExtractorName;
- //FE version
- m_headerInfo[FE_VER] = SUPPORTED_MIN_VERSION;
-
- //Writing mdt file open mode to the mdt header
- m_headerInfo[MDT_FOPEN_MODE] = m_MDTFileOpenMode;
-
- errorCode = initializeFeatureExtractorInstance(tmpControlInfo);
-
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "ActiveDTWShapeRecognizer::ActiveDTWShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
- }
- catch(LTKException e)
- {
- deletePreprocessor();
- m_prototypeShapes.clear();
-
- m_cachedShapeFeature.clear();
-
- //Unloading the feature Extractor instance
- deleteFeatureExtractorInstance();
-
- delete m_OSUtilPtr;
- throw e;
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::ActiveDTWShapeRecognizer()" << endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : readClassifierConfig
-* DESCRIPTION : Reads the ActiveDTW.cfg and initializes the data members of the class
-* ARGUMENTS : none
-* RETURNS : SUCCESS - If config file read successfully
-* errorCode - If failure
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::readClassifierConfig()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::readClassifierConfig()" << endl;
- string tempStringVar = "";
- int tempIntegerVar = 0;
- float tempFloatVar = 0.0;
- LTKConfigFileReader *shapeRecognizerProperties = NULL;
- int errorCode = FAILURE;
-
- try
- {
- shapeRecognizerProperties = new LTKConfigFileReader(m_activedtwCfgFilePath);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<< "Info: " <<
- "Config file not found, using default values of the parameters" <<
- "ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- return FAILURE;
- }
-
- //Pre-processing sequence
- errorCode = shapeRecognizerProperties->getConfigValue(PREPROCSEQUENCE, m_preProcSeqn);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO) << "Info: " <<
- "Using default value of prerocessing sequence: "<< m_preProcSeqn <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- m_preProcSeqn = NN_DEF_PREPROC_SEQ;
- }
- else
- {
- m_headerInfo[PREPROC_SEQ] = m_preProcSeqn;
- }
-
-
- if((errorCode = mapPreprocFunctions()) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<" Error: " << errorCode << " " <<
- "ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(errorCode);
- }
-
- //reading percent of eigen energy
- tempStringVar = "";
-
- errorCode = shapeRecognizerProperties->getConfigValue(RETAINPERCENTEIGENENERGY,
- tempStringVar);
- if(errorCode == SUCCESS )
- {
- if (LTKStringUtil::isFloat(tempStringVar))
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar >= MIN_PERCENT_EIGEN_ENERGY && tempFloatVar <= MAX_PERCENT_EIGEN_ENERGY)
- {
- m_percentEigenEnergy = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- RETAINPERCENTEIGENENERGY " = " << m_percentEigenEnergy<< endl;
-
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE << " " << RETAINPERCENTEIGENENERGY
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE << " " << RETAINPERCENTEIGENENERGY
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()" << endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Using default value for " << RETAINPERCENTEIGENENERGY << ": " <<
- m_percentEigenEnergy << " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- }
-
- //reading method of prototype selection
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PROTOTYPESELECTION,
- tempStringVar);
-
- if (errorCode == SUCCESS)
- {
- if( (LTKSTRCMP(tempStringVar.c_str(), PROTOTYPE_SELECTION_CLUSTERING) == 0))
- {
- m_prototypeSelection = tempStringVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- PROTOTYPESELECTION << " = " << tempStringVar <<
- "ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE << " " <<
- PROTOTYPESELECTION << " : " << tempStringVar
- << " method is not supported" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << PROTOTYPESELECTION << " : " << m_prototypeSelection <<
- " ActiveDTwShapeRecognizer::readClassifierConfig()"<<endl;
- }
-
- //reading prototype reduction factor
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PROTOREDFACTOR,
- tempStringVar);
-
- string tempStringVar1 = "";
- int errorCode1 = shapeRecognizerProperties->getConfigValue(NUMCLUSTERS,
- tempStringVar1);
-
- //prototype reduction factor
- if(errorCode1 == SUCCESS && errorCode == SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE
- << " Cannot use both config parameters " <<
- PROTOREDFACTOR << " and " << NUMCLUSTERS << " at the same time "<<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- if(tempStringVar != "")
- {
- if(LTKSTRCMP(tempStringVar.c_str(), PROTO_RED_FACTOR_AUTOMATIC)==0)
- {
- //DEFINE MACRO DEF_PROTO_RED_FACTOR
- m_prototypeReductionFactor = -1;
- }
- else if(LTKSTRCMP(tempStringVar.c_str(), PROTO_RED_FACTOR_NONE)==0)
- {
- m_prototypeReductionFactor = 0;
- }
- else if(LTKSTRCMP(tempStringVar.c_str(), PROTO_RED_FACTOR_COMPLETE) == 0)
- {
- m_prototypeReductionFactor = 100;
- }
- else
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
- if(tempIntegerVar >= 0 && tempIntegerVar <=100)
- {
- m_prototypeReductionFactor = tempIntegerVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- << PROTOREDFACTOR << " is =" << tempStringVar<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- PROTOREDFACTOR << " is out of permitted range " <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- PROTOREDFACTOR << " is out of permitted range"<<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- }
- }
- else if(tempStringVar1 != "")
- {
- if(LTKSTRCMP(tempStringVar1.c_str(), PROTO_RED_FACTOR_AUTOMATIC) == 0)
- {
- m_prototypeReductionFactor = -1;
- }
- else
- {
- if ( LTKStringUtil::isInteger(tempStringVar1) )
- {
- tempIntegerVar = atoi((tempStringVar1).c_str());
- if(tempIntegerVar > 0)
- {
- m_numClusters = tempIntegerVar;
-
- // m_numClusters is used in this case
- m_prototypeReductionFactor = NN_NUM_CLUST_INITIAL;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NUMCLUSTERS << " is = " << tempStringVar << endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE <<
- NUMCLUSTERS << " is out of permitted range "<<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- " Error: " << ECONFIG_FILE_RANGE <<
- NUMCLUSTERS << " is out of permitted range"<<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Assuming default value of " NUMCLUSTERS << " : " << m_numClusters << endl;
- }
-
- //reading adaptive kNN
- tempStringVar = "";
- shapeRecognizerProperties->getConfigValue(ADAPTIVE_kNN, tempStringVar);
- if(LTKSTRCMP(tempStringVar.c_str(), "true") ==0)
- {
- m_adaptivekNN = true;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Confidence computation method: " << ADAPTIVE_kNN << endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << ADAPTIVE_kNN << " : " <<
- m_adaptivekNN << endl;
- }
-
- //reading nearest neighbors
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEARESTNEIGHBORS,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
-
- //Valid values of nearest neighbors: 1 or greater than MIN_NEARESTNEIGHBORS
- if(tempIntegerVar > 0)
- {
- // If the value of NearestNeighbors = 1, ActiveDTW recognizer is used
- if(tempIntegerVar == 1)
- {
- m_adaptivekNN = false;
- }
-
- // If AdaptivekNN is set to false, simply assign the value to m_nearestNeighbors
- // If AdaptivekNN is set, NearestNeighbors should be greater than than the
- // minimum no.of nearest neighbors allowed (MIN_NEARESTNEIGHBORS defined as macro)
- if(!m_adaptivekNN || (m_adaptivekNN && tempIntegerVar >= MIN_NEARESTNEIGHBORS))
- {
- m_nearestNeighbors = tempIntegerVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NEARESTNEIGHBORS << " = " <<m_nearestNeighbors<<endl;
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEARESTNEIGHBORS <<
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEARESTNEIGHBORS <<
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Debug: " << "Using default value for " << NEARESTNEIGHBORS <<
- " : " << m_nearestNeighbors << endl;
- }
-
- //reading reject threshold
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(REJECT_THRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 && tempFloatVar < 1)
- {
- m_rejectThreshold = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- REJECT_THRESHOLD << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << REJECT_THRESHOLD <<
- " should be in the range (0-1)" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << REJECT_THRESHOLD <<
- " should be in the range (0-1)" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << REJECT_THRESHOLD <<
- " : " << m_rejectThreshold << endl;
- }
-
- //reading min cluster Size
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(MINCLUSTERSIZE,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if(LTKStringUtil::isInteger(tempStringVar))
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
-
- if(tempIntegerVar > 1)
- {
- m_minClusterSize = tempIntegerVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- MINCLUSTERSIZE << " = " <<m_minClusterSize<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << m_minClusterSize <<
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << MINCLUSTERSIZE <<
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << MINCLUSTERSIZE << " : " << m_minClusterSize << endl;
- }
-
- //reading eigen spread value
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(EIGENSPREADVALUE,
- tempStringVar);
-
-
-
- if(errorCode == SUCCESS)
- {
- if(LTKStringUtil::isInteger(tempStringVar))
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
-
- if(tempIntegerVar > 0)
- {
- m_eigenSpreadValue = tempIntegerVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- EIGENSPREADVALUE << " = " <<m_eigenSpreadValue<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << EIGENSPREADVALUE <<
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << EIGENSPREADVALUE <<
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << EIGENSPREADVALUE << " : " << m_eigenSpreadValue << endl;
- }
-
- //reading use singleton
- tempStringVar = "";
- shapeRecognizerProperties->getConfigValue(USESINGLETON, tempStringVar);
- if(LTKSTRCMP(tempStringVar.c_str(), "false") ==0)
- {
- m_useSingleton = false;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Use Singleton: " << USESINGLETON << endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << USESINGLETON << " : " <<
- m_useSingleton << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(DTWBANDING,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 && tempFloatVar <= 1)
- {
- m_dtwBanding = tempFloatVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- DTWBANDING << " = " <<m_dtwBanding<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << DTWBANDING <<
- " is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE <<
- " DTWBANDING is out of permitted range" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << DTWBANDING << " : " << m_dtwBanding << endl;
- }
-
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(DTWEUCLIDEANFILTER,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if(LTKSTRCMP(tempStringVar.c_str(), DTW_EU_FILTER_ALL) == 0)
- {
- m_dtwEuclideanFilter = EUCLIDEAN_FILTER_OFF;
- }
-
- else
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
-
- if(tempIntegerVar > 0 && tempIntegerVar <= 100)
- {
- if(tempIntegerVar == 100 )
- m_dtwEuclideanFilter = EUCLIDEAN_FILTER_OFF;
- else
- m_dtwEuclideanFilter = tempIntegerVar;
-
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- DTWEUCLIDEANFILTER << " is = "<<
- m_dtwEuclideanFilter<<endl;
- }
- else
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE <<
- DTWEUCLIDEANFILTER << " is out of permitted range " <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << DTWEUCLIDEANFILTER <<
- " is out of permitted range"<<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << DTWEUCLIDEANFILTER <<
- " : " << m_dtwEuclideanFilter << endl;
- }
-
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(FEATUREEXTRACTOR,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_featureExtractorName = tempStringVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- FEATUREEXTRACTOR << " = "<<tempStringVar<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << FEATUREEXTRACTOR << " : " <<
- m_featureExtractorName << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(MDTFILEUPDATEFREQ,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- m_MDTUpdateFreq = atoi(tempStringVar.c_str());
- if(m_MDTUpdateFreq <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << MDTFILEUPDATEFREQ <<
- " should be zero or a positive integer" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << MDTFILEUPDATEFREQ <<
- " should be zero or a positive integer" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << MDT_UPDATE_FREQUENCY <<
- " : " << m_MDTUpdateFreq << endl;
- }
-
-
-
- //reading mdt file open mode
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(MDT_FILE_OPEN_MODE,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( tempStringVar == NN_MDT_OPEN_MODE_ASCII ||
- tempStringVar == NN_MDT_OPEN_MODE_BINARY )
- {
- m_MDTFileOpenMode = tempStringVar;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << MDT_FILE_OPEN_MODE <<
- " should be ascii or binary" <<
- " ActiveDTWShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << MDT_FILE_OPEN_MODE <<
- " : " << m_MDTFileOpenMode << endl;
- }
-
-
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SIZETHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[DOT_SIZE_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(ASPECTRATIOTHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[ASP_RATIO_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(DOTTHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[DOT_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PRESERVERELATIVEYPOSITION,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[PRESER_REL_Y_POS] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PRESERVEASPECTRATIO,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[PRESER_ASP_RATIO] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SIZETHRESHOLD,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[NORM_LN_WID_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(RESAMPLINGMETHOD,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[RESAMP_POINT_ALLOC] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SMOOTHFILTERLENGTH,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[SMOOTH_WIND_SIZE] = tempStringVar;
- }
-
- tempStringVar = "";
- LTKStringUtil::convertIntegerToString(m_ptrPreproc->getTraceDimension(),
- tempStringVar);
-
-
- m_headerInfo[TRACE_DIM] = tempStringVar;
-
- delete shapeRecognizerProperties;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::readClassifierConfig()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : mapPreprocFunctions
-* DESCRIPTION : Maps the module name and its function names in the preprocessing
-sequence.
-* ARGUMENTS : none
-* RETURNS : SUCCESS on successful,
-* errorNumbers on Failure.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::mapPreprocFunctions()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::mapPreprocFunctions()" << endl;
-
- stringStringMap preProcSequence;
-
- stringStringPair tmpPair;
-
- stringVector moduleFuncNames;
- stringVector modFuncs;
- stringVector funcNameTokens;
-
- string module = "", funName = "", sequence = "";
- string::size_type indx;
-
- LTKTraceGroup local_inTraceGroup;
-
- LTKStringUtil::tokenizeString(m_preProcSeqn, DELEMITER_SEQUENCE, funcNameTokens);
-
- int numFunctions = funcNameTokens.size();
-
- if(numFunctions == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- "Wrong preprocessor sequence in cfg file : " + m_preProcSeqn <<
- " ActiveDTWShapeRecognizer::mapPreprocFunctions()"<<endl;
-
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
-
- for (indx = 0; indx < numFunctions ; indx++)
- {
- moduleFuncNames.push_back(funcNameTokens[indx]);
- }
-
- int numModuleFunctions = moduleFuncNames.size();
-
- for(indx=0; indx < numModuleFunctions ; indx++)
- {
- sequence = moduleFuncNames[indx];
-
- LTKStringUtil::tokenizeString(sequence, DELEMITER_FUNC, modFuncs);
-
- if(modFuncs.size() >= 2)
- {
- module = modFuncs.at(0);
-
- funName = modFuncs.at(1);
-
- if(!module.compare("CommonPreProc"))
- {
- FN_PTR_PREPROCESSOR pPreprocFunc = NULL;
- pPreprocFunc = m_ptrPreproc->getPreprocptr(funName);
- if(pPreprocFunc!= NULL)
- {
- tmpPair.first = module;
- tmpPair.second = funName;
- m_preprocSequence.push_back(tmpPair);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : " <<funName<<
- " ActiveDTWShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : " << module<<
- " ActiveDTWShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : "<<module<<
- " ActiveDTWShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::mapPreprocFunctions()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : ~ActiveDTWShapeRecognizer
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-ActiveDTWShapeRecognizer::~ActiveDTWShapeRecognizer()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::~ActiveDTWShapeRecognizer()" << endl;
-
- int returnStatus = SUCCESS;
-
- if(LTKAdapt::getInstance(this))
- deleteAdaptInstance();
-
- if(m_prototypeSetModifyCount >0)
- {
- m_prototypeSetModifyCount = m_MDTUpdateFreq-1;
-
- returnStatus = writePrototypeShapesToMDTFile();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " ActiveDTWShapeRecognizer::~ActiveDTWShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
- }
- }
-
- m_neighborInfoVec.clear();
-
- returnStatus = deletePreprocessor();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " ActiveDTWShapeRecognizer::~ActiveDTWShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
- }
-
- m_prototypeShapes.clear();
- m_cachedShapeFeature.clear();
-
- //Unloading the feature Extractor instance
- returnStatus = deleteFeatureExtractorInstance();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " ActiveDTWShapeRecognizer::~ActiveDTWShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
- }
-
- delete m_OSUtilPtr;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::~ActiveDTWShapeRecognizer()" << endl;
-}
-
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : train
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::train(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string &comment,const string &dataset,
- const string &trainFileType)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::train()" << endl;
-
-
-
- int returnStatus = SUCCESS;
-
-
- if(comment.empty() != true)
- {
- m_headerInfo[COMMENT] = comment;
- }
-
- if(dataset.empty() != true)
- {
- m_headerInfo[DATASET] = dataset;
- }
-
-
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_CLUSTERING) == 0)
- {
- returnStatus = trainClustering(trainingInputFilePath,
- mdtHeaderFilePath,
- trainFileType);
-
- if(returnStatus != SUCCESS)
- {
- LTKReturnError(returnStatus);
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::train()" << endl;
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : trainClustering
-* DESCRIPTION : This function is the train method using Clustering prototype
-* selection technique.
-* ARGUMENTS :
-* RETURNS : SUCCESS : if training done successfully
-* errorCode : if traininhas some errors
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::trainClustering(const string& trainingInputFilePath,
- const string &mdtHeaderFilePath,
- const string& inFileType)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::trainClustering()" << endl;
-
-
- //Time at the beginning of Train Clustering
- m_OSUtilPtr->recordStartTime();
-
- int returnStatus = SUCCESS;
-
- if(LTKSTRCMP(inFileType.c_str(), INK_FILE) == 0)
- {
- //If the Input file is UNIPEN Ink file
- returnStatus = trainFromListFile(trainingInputFilePath);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " ActiveDTWShapeRecognizer::trainClustering()" << endl;
- LTKReturnError(returnStatus);
- }
- }
-
-
- //Updating the Header Information
- updateHeaderWithAlgoInfo();
-
- //Adding header information and checksum generation
- LTKCheckSumGenerate cheSumGen;
-
- returnStatus = cheSumGen.addHeaderInfo(mdtHeaderFilePath,
- m_activedtwMDTFilePath,
- m_headerInfo);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " ActiveDTWShapeRecognizer::trainClustering()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- //Time at the end of Train Clustering
- m_OSUtilPtr->recordEndTime();
-
- string timeTaken = "";
- m_OSUtilPtr->diffTime(timeTaken);
-
- cout << "Time Taken = " << timeTaken << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::trainClustering()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : appendShapeModelToMDTFile
-* DESCRIPTION : This method is called after performing clustering on each class
-It writes the class information to the activedtw.mdt file
-* ARGUMENTS : INPUT
-shapeModel struct ActiveDTWShapeModel (class training data)
-mdtFileHandle ofstream (mdt File handle)
-
- * RETURNS : integer Holds error value if occurs
- * Holds SUCCESS if no erros
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::appendShapeModelToMDTFile(const ActiveDTWShapeModel& shapeModel,ofstream& mdtFileHandle)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::appendShapeModelToMDTFile()" << endl;
-
-
- //used to temporarily store the size of a vector
- int vecSize;
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_FILE_HANDLE << " " <<
- "Invalid file handle for MDT file"<<
- " ActiveDTWShapeRecognizer::appendShapeModelToMDTFile()" << endl;
- LTKReturnError(EINVALID_FILE_HANDLE);
- }
-
- string strFeature;
-
- vector<ActiveDTWClusterModel> clusterModelVector = shapeModel.getClusterModelVector();
- vector<ActiveDTWClusterModel>::iterator iStart = clusterModelVector.begin();
- vector<ActiveDTWClusterModel>::iterator iEnd = clusterModelVector.end();
- double2DVector eigenVectors;
- doubleVector eigenValues;
- doubleVector clusterMean;
- shapeMatrix singletonVector = shapeModel.getSingletonVector();
- ActiveDTWClusterModel clusterModel;
-
- /**APPENDING CLASS INFORMATION**/
- //APPENDING CLASSID NUMCLUSTERS NUMSINGLETONS
- if(m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII)
- {
- mdtFileHandle<<shapeModel.getShapeId()<<" "<<clusterModelVector.size()<<" "<<singletonVector.size()<<endl;
- }
- else
- {
- int clusterSize = clusterModelVector.size();
- int singletonSize = singletonVector.size();
- int shapeId = shapeModel.getShapeId();
- int numFeatures;
- int featureDimension;
- int clusterMeanDimension;
- mdtFileHandle.write((char*) &shapeId,sizeof(int));
- mdtFileHandle.write((char*) &clusterSize,sizeof(int));
- mdtFileHandle.write((char*) &singletonSize,sizeof(int));
-
- if(clusterSize != 0)
- {
- clusterMean = clusterModelVector[0].getClusterMean();
- clusterMeanDimension = clusterMean.size();
- mdtFileHandle.write((char*) &clusterMeanDimension,sizeof(int));
- }
- else
- {
- clusterMeanDimension = 0;
- mdtFileHandle.write((char*) &clusterMeanDimension,sizeof(int));
- }
-
- //writing number of features and feature dimension
- if(singletonSize != 0)
- {
- numFeatures = singletonVector[0].size();
- mdtFileHandle.write((char*) &numFeatures,sizeof(int));
- featureDimension = singletonVector[0][0]->getFeatureDimension();
- mdtFileHandle.write((char*) &featureDimension,sizeof(int));
- }
- else
- {
- numFeatures = 0;
- mdtFileHandle.write((char*) &numFeatures,sizeof(int));
- featureDimension = 0;
- mdtFileHandle.write((char*) &featureDimension,sizeof(int));
- }
-
- }
-
- /**APPENDING CLUSTER DATA**/
- //iterating through the cluster models
-
- for(;iStart != iEnd; ++iStart)
- {
-
- clusterModel = *iStart;
-
-
- //appending number of clusters in each sample
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle<<clusterModel.getNumSamples()<<" ";
- }
- else
- {
- int numSamples = clusterModel.getNumSamples();
- mdtFileHandle.write((char*) &numSamples,sizeof(int));
- }
-
-
- eigenValues = clusterModel.getEigenValues();
- vecSize = eigenValues.size();
-
- /**WRITING EIGEN VALUES**/
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- for(int i = 0; i < vecSize; i++)
- {
- mdtFileHandle<<eigenValues[i];
- if(i != (vecSize - 1))
- {
- mdtFileHandle<<",";
- }
- }
- mdtFileHandle<<FEATURE_EXTRACTOR_DELIMITER;
- }
- else
- {
- //writing number of eigen values
- mdtFileHandle.write((char*) &vecSize,sizeof(int));
-
- //writing eigenValues
- for(int i = 0; i < vecSize; i++)
- {
- mdtFileHandle.write((char*) &(eigenValues[i]),sizeof(double));
- }
- }
-
- /**WRITING EIGEN VECTORS**/
-
- eigenVectors = clusterModel.getEigenVectors();
- vecSize = eigenVectors[0].size();
- int eigVecSize = eigenVectors.size();
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- for(int i = 0; i < eigVecSize; i++)
- {
- for(int j = 0; j < vecSize; j++)
- {
- mdtFileHandle<<eigenVectors[i][j];
- if(j != (vecSize - 1))
- {
- mdtFileHandle<<",";
- }
- }
- mdtFileHandle<<FEATURE_EXTRACTOR_DELIMITER;
- }
- }
- else
- {
- for(int i = 0; i < eigVecSize; i++)
- {
- for(int j = 0; j < vecSize; j++)
- {
- mdtFileHandle.write((char*) &(eigenVectors[i][j]),sizeof(double));
- }
- }
- }
-
- /**APPENDING CLUSTER MEAN**/
-
- clusterMean = clusterModel.getClusterMean();
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- for(int i = 0; i < vecSize; i++)
- {
- mdtFileHandle<<clusterMean[i];
- if(i != (vecSize - 1))
- {
- mdtFileHandle<<",";
- }
-
- }
- mdtFileHandle<<FEATURE_EXTRACTOR_DELIMITER<<endl;
- }
- else
- {
- for(int i = 0; i < vecSize; i++)
- {
- mdtFileHandle.write((char*) &(clusterMean[i]),sizeof(double));
- }
- }
-
- eigenVectors.clear();
- eigenValues.clear();
- clusterMean.clear();
-
- }
- clusterModelVector.clear();
-
- /**WRITING SINGLETON VECTORS**/
- shapeMatrix::iterator iterStart = singletonVector.begin();
- shapeMatrix::iterator iterEnd = singletonVector.end();
- shapeFeature singleton;
-
- for(; iterStart != iterEnd; ++iterStart )
- {
-
- singleton = *iterStart;
-
- vecSize = singleton.size();
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIter = singleton.begin();
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIterEnd = singleton.end();
-
- for(; shapeFeatureIter != shapeFeatureIterEnd; ++shapeFeatureIter)
- {
- (*shapeFeatureIter)->toString(strFeature);
- mdtFileHandle << strFeature << FEATURE_EXTRACTOR_DELIMITER;
- }
- mdtFileHandle<<endl;
-
- }
- else
- {
-
- //converting the singleton vector to float and writing it
- floatVector floatFeatureVector;
- int errorCode = m_shapeRecUtil.shapeFeatureVectorToFloatVector(singleton,
- floatFeatureVector);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<errorCode<<
- " ActiveDTWShapeRecognizer::appendShapeModelToMDTFile" << endl;
- LTKReturnError(errorCode);
- }
-
- vecSize = floatFeatureVector.size();
-
-
- for (int i=0; i< vecSize; i++)
- {
- float floatValue = floatFeatureVector[i];
- mdtFileHandle.write((char *)(&floatValue), sizeof(float));
- }
- }
- }
-
- singletonVector.clear();
-
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::appendShapeModelToMDTFile()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : preprocess
-* DESCRIPTION : calls the required pre-processing functions from the LTKPreprocessor library
-* ARGUMENTS : inTraceGroup - reference to the input trace group
-* outPreprocessedTraceGroup - pre-processed inTraceGroup
-* RETURNS : SUCCESS on successful pre-processing operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::preprocess (const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outPreprocessedTraceGroup)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::preprocess()" << endl;
-
- int indx = 0;
- int errorCode = -1;
-
- string module = "";
- string funName = "" ;
-
- LTKTraceGroup local_inTraceGroup;
-
- local_inTraceGroup = inTraceGroup;
-
- if(m_preprocSequence.size() != 0)
- {
- while(indx < m_preprocSequence.size())
- {
- module = m_preprocSequence.at(indx).first;
- funName = m_preprocSequence.at(indx).second;
-
- FN_PTR_PREPROCESSOR pPreprocFunc = NULL;
- pPreprocFunc = m_ptrPreproc->getPreprocptr(funName);
-
- if(pPreprocFunc!= NULL)
- {
- outPreprocessedTraceGroup.emptyAllTraces();
-
-
- if((errorCode = (m_ptrPreproc->*(pPreprocFunc))
- (local_inTraceGroup,outPreprocessedTraceGroup)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::preprocess()" << endl;
- LTKReturnError(errorCode);
- }
- local_inTraceGroup = outPreprocessedTraceGroup;
- }
- indx++;
- }
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting ActiveDTWShapeRecognizer::preprocess()"<<endl;
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : computerDTWDistanceClusteringWrapper
-* DESCRIPTION : Wrapper function to the function whichcomputes DTW distance between
-two characters
-* ARGUMENTS : train character, test character
-* RETURNS : DTWDistance
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::computeDTWDistance(
- const LTKShapeSample& inFirstShapeSampleFeatures,
- const LTKShapeSample& inSecondShapeSampleFeatures,
- float& outDTWDistance)
-
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::computeDTWDistance()" << endl;
-
- const vector<LTKShapeFeaturePtr>& firstFeatureVec = inFirstShapeSampleFeatures.getFeatureVector();
- const vector<LTKShapeFeaturePtr>& secondFeatureVec = inSecondShapeSampleFeatures.getFeatureVector();
-
- int errorCode = m_dtwObj.computeDTW(firstFeatureVec, secondFeatureVec, getDistance,outDTWDistance,
- m_dtwBanding, FLT_MAX, FLT_MAX);
-
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "DTWDistance: " <<
- outDTWDistance << endl;
-
- if (errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Error: "<<
- getErrorMessage(errorCode) <<
- " ActiveDTWShapeRecognizer::computeDTWDistance()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::computeDTWDistance()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : computeDTWDistance
-* DESCRIPTION : This method computes the dtw distance between two shape features
-* ARGUMENTS : INPUT
-inFirstFeatureVector vector<LTKShapeFeaturePtr>
-inSecondFeatureVector vector<LTKShapeFeaturePtr>
-: OUTPUT
-outDTWDistance float
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::computeDTWDistance(
- const vector<LTKShapeFeaturePtr>& inFirstFeatureVector,
- const vector<LTKShapeFeaturePtr>& inSecondFeatureVector,
- float& outDTWDistance)
-
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::computeDTWDistance()" << endl;
-
- int errorCode = m_dtwObj.computeDTW(inFirstFeatureVector, inSecondFeatureVector, getDistance,outDTWDistance,
- m_dtwBanding, FLT_MAX, FLT_MAX);
-
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "DTWDistance: " <<
- outDTWDistance << endl;
-
- if (errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Error: "<<
- getErrorMessage(errorCode) <<
- " ActiveDTWShapeRecognizer::computeDTWDistance()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::computeDTWDistance()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : computeEuclideanDistance
-* DESCRIPTION : This computes the euclideanDistance between two shapeFeatures
-* ARGUMENTS : INPUT
-inFirstFeature shapeFeature
-inSecondFeature shapeFeature
-:OUTPUT
-outEuclideanDistance floats
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::computeEuclideanDistance(
- const shapeFeature& inFirstFeature,
- const shapeFeature& inSecondFeature,
- float& outEuclideanDistance)
-{
- int firstFeatureVectorSize = inFirstFeature.size();
- int secondFeatureVectorSize = inSecondFeature.size();
-
- if(firstFeatureVectorSize != secondFeatureVectorSize)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EUNEQUAL_LENGTH_VECTORS << " " <<
- getErrorMessage(EUNEQUAL_LENGTH_VECTORS) <<
- " ActiveDTWShapeRecognizer::computeEuclideanDistance()" << endl;
-
- LTKReturnError(EUNEQUAL_LENGTH_VECTORS);
- }
-
- for(int i = 0; i < firstFeatureVectorSize; ++i)
- {
- float tempDistance = 0.0;
- getDistance(inFirstFeature[i],
- inSecondFeature[i],
- tempDistance);
-
- outEuclideanDistance += tempDistance;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::computeEuclideanDistance()" << endl;
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : loadModelData
-* DESCRIPTION : loads the reference model file into memory
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful loading of the reference model file
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::loadModelData()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::loadModelData()" << endl;
-
- int errorCode = -1;
-
- int numofShapes = 0;
-
- // variable for shape Id
- int classId = -1;
- int i = 0;
-
- //Algorithm version
- string algoVersionReadFromMDT = "";
-
- stringStringMap headerSequence;
- LTKCheckSumGenerate cheSumGen;
-
- if(errorCode = cheSumGen.readMDTHeader(m_activedtwMDTFilePath,headerSequence))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(errorCode);
- }
-
- // printing the headerseqn
- stringStringMap::const_iterator iter = headerSequence.begin();
- stringStringMap::const_iterator endIter = headerSequence.end();
-
- for(; iter != endIter; iter++)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Debug: header seqn"<<
- iter->first << " : " <<
- iter->second << endl;
- }
-
- string featureExtractor = headerSequence[FE_NAME];
-
- if(LTKSTRCMP(m_featureExtractorName.c_str(), featureExtractor.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of FeatureExtractor parameter in config file ("<<
- m_featureExtractorName<<") does not match with the value in MDT file ("<<
- featureExtractor<<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- string feVersion = headerSequence[FE_VER];
-
- // comparing the mdt open mode read from cfg file with value in the mdt header
- string mdtOpenMode = headerSequence[MDT_FOPEN_MODE];
-
- if (LTKSTRCMP(m_MDTFileOpenMode.c_str(), mdtOpenMode.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of ActiveDTWMDTFileOpenMode parameter in config file ("<<
- m_MDTFileOpenMode <<") does not match with the value in MDT file ("<<
- mdtOpenMode<<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- // validating preproc parameters
- int iErrorCode = validatePreprocParameters(headerSequence);
- if (iErrorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Values of ActiveMDTMDTFileOpenMode parameter in config file does not match with "
- <<"the values in MDT file " << "ActiveDTWShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- // Version comparison START
- algoVersionReadFromMDT = headerSequence[RECVERSION].c_str();
-
- LTKVersionCompatibilityCheck verTempObj;
- string supportedMinVersion(SUPPORTED_MIN_VERSION);
- string currentVersionStr(m_currentVersion);
-
- bool compatibilityResults = verTempObj.checkCompatibility(supportedMinVersion,
- currentVersionStr,
- algoVersionReadFromMDT);
-
- if(compatibilityResults == false)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINCOMPATIBLE_VERSION << " " <<
- " Incompatible version"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(EINCOMPATIBLE_VERSION);
- }
-
- // Version comparison END
-
- //Input Stream for Model Data file
- ifstream mdtFileHandle;
-
- if (m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_activedtwMDTFilePath.c_str(), ios::in);
- }
- else
- {
- mdtFileHandle.open(m_activedtwMDTFilePath.c_str(), ios::in | ios::binary);
- }
-
- //If error while opening, return an error
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- " Unable to open model data file : " <<m_activedtwMDTFilePath<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- mdtFileHandle.seekg(atoi(headerSequence[HEADERLEN].c_str()),ios::beg);
-
- //Read the number of shapes
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle >> numofShapes;
- }
- else
- {
- mdtFileHandle.read((char*) &numofShapes,
- atoi(headerSequence[SIZEOFSHORTINT].c_str()));
- }
-
- if(!m_projectTypeDynamic && m_numShapes != numofShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of NumShapes parameter in config file ("<<m_numShapes<<
- ") does not match with the value in MDT file ("<<numofShapes<<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- if(m_projectTypeDynamic)
- {
- m_numShapes = numofShapes;
- }
-
- stringVector tokens;
-
- stringVector subTokens;
-
- string strFeatureVector = "";
-
- //number of samples in each cluster
- int numSamples;
-
- //keeps count of number of clusters
- // and singletons while reading from
- //mdt file
- int tempCount;
-
- //number of clusters in a class
- int numClusters;
-
- //number of singletons in a class
- int numSingletons;
-
- //dimension of cluster mean
- int clusterMeanDimension;
-
- //number of features in a feature vector
- int numFeatures;
-
- //dimension of the featureVector
- int featureDimension;
-
-
- shapeMatrix singletonVector;
- shapeFeature singleton;
- doubleVector eigenValues;
- double2DVector eigenVectors;
- doubleVector clusterMean;
- ActiveDTWClusterModel clusterModel;
- ActiveDTWShapeModel shapeModel;
- vector<ActiveDTWClusterModel> clusterModelVector;
- doubleVector tempVector;
-
- int floatSize = atoi(headerSequence[SIZEOFFLOAT].c_str());
-
- int intSize = atoi(headerSequence[SIZEOFINT].c_str());
-
- int doubleSize = sizeof(double);
-
- //Each pass over the loop reads data corresponding to one class
- //includes reading all the cluster data
- //all singleton vectors
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle >> classId;
- }
- else
- {
- mdtFileHandle.read((char*) &classId, intSize);
-
- }
-
- while(!mdtFileHandle.eof())
- {
-
- /**READING CLASS INFORMATION**/
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle >> numClusters;
-
- mdtFileHandle >> numSingletons;
- }
- else
- {
- //reading number of clusters, singletons, clusterMeanDimension,
- //number of Features, and featureDimension
- mdtFileHandle.read((char*) &numClusters,intSize);
-
- mdtFileHandle.read((char*) &numSingletons,intSize);
-
- mdtFileHandle.read((char*) &clusterMeanDimension,intSize);
-
- mdtFileHandle.read((char*) &numFeatures,intSize);
-
-
- mdtFileHandle.read((char*) &featureDimension,intSize);
-
-
-
- }
-
- tempCount = 0;
-
- /**READING CLUSTER DATA**/
-
- for(int clustersCount = 0 ; clustersCount < numClusters; clustersCount++)
- {
- //reading number of samples in a cluster
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle >> numSamples;
- }
- else
- {
- mdtFileHandle.read((char*) &numSamples,intSize);
- }
-
- iErrorCode = clusterModel.setNumSamples(numSamples);
- if(iErrorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< iErrorCode << " " <<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(iErrorCode);
- }
-
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- strFeatureVector = "";
- mdtFileHandle >> strFeatureVector;
-
- LTKStringUtil::tokenizeString(strFeatureVector,FEATURE_EXTRACTOR_DELIMITER,tokens);
-
-
- //first token contains eigen values
- LTKStringUtil::tokenizeString(tokens[0],",",subTokens);
-
- //extracting eigen values
- int i = 0;
- for(i = 0; i < subTokens.size(); i++)
- {
-
- eigenValues.push_back(LTKStringUtil::convertStringToFloat(subTokens[i]));
-
- }
-
- clusterModel.setEigenValues(eigenValues);
-
- subTokens.clear();
-
- //extracting eigen vectors
-
- for( i = 1; i < (eigenValues.size() + 1); i++)
- {
- LTKStringUtil::tokenizeString(tokens[i],",",subTokens);
-
- for(int j = 0; j < subTokens.size(); j++)
- {
- tempVector.push_back(LTKStringUtil::convertStringToFloat(subTokens[j]));
- }
-
-
- eigenVectors.push_back(tempVector);
- tempVector.clear();
- subTokens.clear();
- }
-
- clusterModel.setEigenVectors(eigenVectors);
-
-
- //extracting cluster mean
-
- LTKStringUtil::tokenizeString(tokens[(eigenValues.size() + 1)],",",subTokens);
-
- for( i = 0; i < subTokens.size(); i++)
- {
-
- clusterMean.push_back(LTKStringUtil::convertStringToFloat(subTokens[i]));
- }
-
- clusterModel.setClusterMean(clusterMean);
-
- subTokens.clear();
-
- clusterModelVector.push_back(clusterModel);
- }
- else
- {
- //reading number of eigenValues
- int numEigenValues;
- mdtFileHandle.read((char*) &numEigenValues,intSize);
-
- //reading eigen values
- int i = 0;
- for(i = 0; i < numEigenValues; i++)
- {
- double eigenValue;
- mdtFileHandle.read((char*) &eigenValue,doubleSize );
-
- eigenValues.push_back(eigenValue);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
- }
-
- clusterModel.setEigenValues(eigenValues);
-
-
- //reading eigenVectors
- for( i = 0; i < numEigenValues; i++)
- {
- for(int j = 0; j < clusterMeanDimension; j++)
- {
- double eigenVectorValue;
- mdtFileHandle.read((char*) &eigenVectorValue,doubleSize);
- tempVector.push_back(eigenVectorValue);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
- }
-
- eigenVectors.push_back(tempVector);
- tempVector.clear();
- }
-
- clusterModel.setEigenVectors(eigenVectors);
-
-
- //reading cluster mean
- for( i = 0; i < clusterMeanDimension; i++)
- {
- double clusterMeanValue;
- mdtFileHandle.read((char*) &clusterMeanValue,doubleSize);
-
- clusterMean.push_back(clusterMeanValue);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
- }
-
- clusterModel.setClusterMean(clusterMean);
-
-
- clusterModelVector.push_back(clusterModel);
- }
-
- //clearing vectors
-
- eigenValues.clear();
-
- eigenVectors.clear();
-
- clusterMean.clear();
-
- tempVector.clear();
- tokens.clear();
-
- }
-
- /**READING SINGLETON VECTORS**/
- tempCount = 0;
-
- for(int singletonCount = 0; singletonCount < numSingletons; singletonCount++)
- {
- LTKShapeFeaturePtr feature;
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- strFeatureVector = "";
- mdtFileHandle >> strFeatureVector;
-
- //parsing the singleton vector
- LTKStringUtil::tokenizeString(strFeatureVector, FEATURE_EXTRACTOR_DELIMITER, tokens);
-
- for(int i = 0; i < tokens.size(); ++i)
- {
- feature = m_ptrFeatureExtractor->getShapeFeatureInstance();
-
- if (feature->initialize(tokens[i]) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_INPUT_FORMAT << " " <<
- "Number of features extracted from a trace is not correct"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
-
- singleton.push_back(feature);
- }
-
- singletonVector.push_back(singleton);
-
- singleton.clear();
- tokens.clear();
- }
- else
- {
- int featureIndex = 0;
-
- for ( ; featureIndex < numFeatures ; featureIndex++)
- {
- floatVector floatFeatureVector;
- int featureValueIndex = 0;
-
- feature = m_ptrFeatureExtractor->getShapeFeatureInstance();
-
- for(; featureValueIndex < featureDimension ; featureValueIndex++)
- {
- float featureValue = 0.0f;
-
- mdtFileHandle.read((char*) &featureValue, floatSize);
-
- floatFeatureVector.push_back(featureValue);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
- }
-
- if (feature->initialize(floatFeatureVector) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- EINVALID_INPUT_FORMAT << " " <<
- "Number of features extracted from a trace is not correct"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
-
-
- singleton.push_back(feature);
-
- }
-
- singletonVector.push_back(singleton);
-
- singleton.clear();
- }
- }
-
- /**CONSTRUCTING SHAPE MODEL**/
-
-
- iErrorCode = shapeModel.setShapeId(classId);
- if(iErrorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< iErrorCode << " "<< endl;
- LTKReturnError(iErrorCode);
- }
-
- shapeModel.setClusterModelVector(clusterModelVector);
-
- shapeModel.setSingletonVector(singletonVector);
-
-
-
-
- /**APPENDING THE SHAPE MODEL TO PROTOTYPE VECTOR**/
-
- m_prototypeShapes.push_back(shapeModel);
-
-
- m_shapeIDNumPrototypesMap[classId] = clusterModelVector.size();
-
-
- if(m_useSingleton == true || clusterModelVector.size() == 0)
- m_shapeIDNumPrototypesMap[classId] += singletonVector.size();
-
-
-
-
-
- clusterModelVector.clear();
-
- singletonVector.clear();
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle >> classId;
- }
- else
- {
- mdtFileHandle.read((char*) &classId, intSize);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
- }
-
-
- }
-
-
-
- mdtFileHandle.close();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::loadModelData()" << endl;
-
- return SUCCESS;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : recognize
-* DESCRIsPTION : recognizes the incoming tracegroup
-* ARGUMENTS : inTraceGroup - trace group to be recognized
-* screenContext - screen context
-* subSetOfClasses - subset of classes whose samples will be compared with traceGroup
-* confThreshold - classes with confidence below this threshold are not returned, valid range of confThreshold: (0,1)
-* numChoices - maximum number of choices to be returned
-* outResultVector - result of recognition
-* RETURNS : SUCCESS on successful running of the code
-* NOTES :
-* CHANGE HISTROY
-* Author : Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::recognize(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::recognize()" << endl;
-
-
- //Check for empty traces in traceGroup
-
- if(traceGroup.containsAnyEmptyTrace())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<EEMPTY_TRACE << " " <<
- " Input trace is empty"<<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
- LTKReturnError(EEMPTY_TRACE);
- }
-
-
- //Contains TraceGroup after Preprocessing is done
- LTKTraceGroup preprocessedTraceGroup;
-
-
- //Preprocess the traceGroup
- int errorCode = preprocess(traceGroup, preprocessedTraceGroup);
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- getErrorMessage(errorCode)<<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
- }
-
- //Extract the shapeSample from preprocessedTraceGroup
- if(!m_ptrFeatureExtractor)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ENULL_POINTER << " " <<
- " m_ptrFeatureExtractor is NULL"<<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
- LTKReturnError(ENULL_POINTER);
- }
-
- vector<LTKShapeFeaturePtr> shapeFeatureVec;
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- shapeFeatureVec);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- // call recognize with featureVector
-
- if(recognize( shapeFeatureVec, subSetOfClasses, confThreshold,
- numChoices, outResultVector) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- getErrorMessage(errorCode)<<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
-
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::recognize()" << endl;
-
- return SUCCESS;
-
-}
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : recognize
-* DESCRIsPTION : recognizes the incoming tracegroup
-* ARGUMENTS : shapeFeatureVec - feature vector to be recognized
-* screenContext - screen context
-* subSetOfClasses - subset of classes whose samples will be compared with traceGroup
-* confThreshold - classes with confidence below this threshold are not returned, valid range of confThreshold: (0,1)
-* numChoices - maximum number of choices to be returned
-* outResultVector - result of recognition
-* RETURNS : SUCCESS on successful running of the code
-* NOTES :
-* CHANGE HISTROY
-* Author : Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::recognize(const vector<LTKShapeFeaturePtr>& shapeFeatureVec,
- const vector<int>& inSubSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::recognize()" << endl;
-
- m_cachedShapeFeature = shapeFeatureVec;
-
- //Creating a local copy of input inSubSetOfClasses, as it is const, STL's unique function modifies it
- vector<int> subSetOfClasses = inSubSetOfClasses;
-
- int numPrototypeShapes = m_prototypeShapes.size();
-
- /*********Validation for m_prototypeShapes ***************************/
- if ( numPrototypeShapes == 0 )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROTOTYPE_SET_EMPTY << " " <<
- " getErrorMessage(EPROTOTYPE_SET_EMPTY) "<<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
- LTKReturnError(EPROTOTYPE_SET_EMPTY);
- }
-
- /******************************************************************/
- /*******************VALIDATING INPUT ARGUMENTS*********************/
- /******************************************************************/
-
- // Validating numChoices: valid values: {-1, (0,m_numShapes]}
- if(numChoices <= 0 && numChoices != NUM_CHOICES_FILTER_OFF)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "numChoices ("<<numChoices<<")<=0, setting it to off (-1)"<<endl;
- numChoices = -1;
- }
-
- if(!m_projectTypeDynamic && numChoices > m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "numChoices ("<<numChoices<<") > numShapes ("<<
- m_numShapes<<"), using numShapes "<<m_numShapes<<" instead"<<endl;
- numChoices = m_numShapes;
- }
-
-
- //Validating confThreshold: valid values: [0,1]
- if(confThreshold > 1 || confThreshold < 0)
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Invalid value of confThreshold, valid values are: [0,1]"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- // Clearing cached Variables
- m_vecRecoResult.clear();
- m_neighborInfoVec.clear();
-
- //Temporary variable to be used to populate distIndexPairVector
- struct NeighborInfo tempPair;
-
- struct NeighborInfo tempDist;
-
- int i = 0;
- int j = 0;
-
- //Variable to store the DTW distance.
- float dtwDistance = 0.0f;
-
- //Variable to store the Euclidean distance.
- float euclideanDistance = 0.0f;
-
-
- /***************End of declarations and initializations of variables**************/
-
-
-
- /**CONVERTING THE FEATURE VECTOR TO DOUBLE***/
-
- doubleVector featureVector;
- floatVector floatFeatureVector;
- int errorCode = m_shapeRecUtil.shapeFeatureVectorToFloatVector(shapeFeatureVec,floatFeatureVector);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- int floatFeatureVectorSize = floatFeatureVector.size();
-
-
- for(i = 0; i < floatFeatureVectorSize; i++)
- featureVector.push_back(floatFeatureVector[i]);
- floatFeatureVector.clear();
-
-
-
-
- ActiveDTWShapeModel evalShapeModel;
- //current shape model evaluated against test Sample
-
-
- ActiveDTWClusterModel evalClusterModel;
- //currently evaluated cluster model
-
-
- vector<ActiveDTWClusterModel> clusterVector;
- //vector of cluster models of current shape model
-
-
- shapeMatrix evalSingletonVector;
- //vector of all singletonVectors of current shape model
-
- doubleVector eigenValues;
- //eigen values of cluster model
-
- double2DVector eigenVector;
- //eigen vectors of cluster model
-
- doubleVector clusterMean;
- //cluster mean of cluster model
-
- doubleVector deformationParameters;
- //paramters required to construct optimal Deformation
-
- doubleVector reconstructedSample;
- //double vector form of optima lDeformation
-
- shapeMatrix optimalDeformations;
- //vector of all optimalDeformations of a class
-
- vector<bool> clusterFilter;
- //indicates which cluster are to be considered for computing DTW DISTANCE
-
- vector<bool> singletonFilter;
- //indicates which singletons are to be considered for computing DTW DISTANCE
-
- vector<struct NeighborInfo> distInfo;
- //used in dtwEuclidean filter
-
- vector<LTKShapeFeaturePtr> shapeFeatureVector;
-
-
- /*****************COMPUTING DISTANCE******************************/
- if(subSetOfClasses.size() == 0)
- {
- for(i = 0; i < m_prototypeShapes.size(); i++)
- {
- evalShapeModel = m_prototypeShapes[i];
- clusterVector = evalShapeModel.getClusterModelVector();
-
-
- evalSingletonVector = evalShapeModel.getSingletonVector();
-
-
- int singletonSize = evalSingletonVector.size();
- int clusterVectorSize = clusterVector.size();
-
-
-
- //computing the optimalDeformations
- for(j = 0; j < clusterVectorSize; j++)
- {
- evalClusterModel = clusterVector[j];
-
- eigenVector = evalClusterModel.getEigenVectors();
-
- eigenValues = evalClusterModel.getEigenValues();
-
- clusterMean = evalClusterModel.getClusterMean();
-
- deformationParameters.assign(eigenVector.size(),0.0);
-
-
- int errorCode = findOptimalDeformation(deformationParameters,eigenValues,eigenVector,
- clusterMean,featureVector);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- //reconstruct the sample
- double tempCoordinate = 0.0;
- int clusterMeanSize = clusterMean.size();
- int deformationParametersSize = deformationParameters.size();
-
- for(int k = 0; k < clusterMeanSize; k++)
- {
- tempCoordinate = clusterMean[k];
-
- for(int l = 0; l < deformationParametersSize; l++)
- tempCoordinate += deformationParameters[l]*eigenVector[l][k];
-
- reconstructedSample.push_back(tempCoordinate);
- }
-
- //converting the reconstructed Sample to a featureVector
- errorCode = convertDoubleToFeatureVector(shapeFeatureVector,reconstructedSample);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- optimalDeformations.push_back(shapeFeatureVector);
-
- //clearing vectors
- eigenValues.clear();
- eigenVector.clear();
- clusterMean.clear();
- reconstructedSample.clear();
- shapeFeatureVector.clear();
- deformationParameters.clear();
- }
-
-
- //setting up dtweuclidean filter for the class
- if(m_dtwEuclideanFilter != EUCLIDEAN_FILTER_OFF)
- {
- //calculating euclidean distance to clusters
- for( j = 0; j < clusterVectorSize; j++)
- {
-
- euclideanDistance = 0.0;
-
- errorCode = computeEuclideanDistance(shapeFeatureVec,optimalDeformations[j],euclideanDistance);
-
-
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- tempDist.typeId = CLUSTER;
- tempDist.sampleId = j;
- tempDist.distance = euclideanDistance;
-
- distInfo.push_back(tempDist);
- }
-
- //calcualting euclidean distances to singletons
- if(m_useSingleton == true || clusterVectorSize == 0)
- {
-
- for(j = 0; j < singletonSize; j++)
- {
-
- euclideanDistance = 0.0;
- //computing euclidean distance between test sample
- //and singleton vectors
-
- errorCode = computeEuclideanDistance(shapeFeatureVec,evalSingletonVector[j],
- euclideanDistance);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- tempDist.typeId = SINGLETON;
- tempDist.sampleId = j;
- tempDist.distance = euclideanDistance;
-
- distInfo.push_back(tempDist);
-
-
- }
- }
-
-
- //sorting the euclidean distances in ascending order
- sort(distInfo.begin(), distInfo.end(), sortDist);
-
-
- //choose the top n
- int numTopChoices = (int)(distInfo.size() * m_dtwEuclideanFilter)/100;
- if(numTopChoices == 0)
- {
- numTopChoices = distInfo.size();
- }
-
- //setting the filter
- clusterFilter.assign(clusterVectorSize,false);
-
- if(m_useSingleton == true || clusterVectorSize == 0)
- singletonFilter.assign(singletonSize,false);
-
-
- for( j = 0; j < numTopChoices; j++)
- {
- if(distInfo[j].typeId == 0)
- clusterFilter[distInfo[j].sampleId] = true;
-
- if(distInfo[j].typeId == 1)
- singletonFilter[distInfo[j].sampleId] = true;
- }
-
- //clearing distInfo
- distInfo.clear();
- }
- else
- {
- clusterFilter.assign(clusterVectorSize,true);
-
- if(m_useSingleton == true || clusterVectorSize == 0)
- singletonFilter.assign(singletonSize,true);
- }
-
-
- /*****DETERMINING THE MINIMUM CLUSTER DISTANCE***************/
- float minDistance = FLT_MAX;
- float minClusterDistance;
- float minSingletonDistance;
-
- int clusterId;
- int singletonId;
-
- for( j = 0; j < clusterVectorSize; j++)
- {
-
- if(clusterFilter[j])
- {
- float tempDistance = 0.0;
- errorCode = computeDTWDistance(shapeFeatureVec,optimalDeformations[j],tempDistance);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- if(tempDistance < minDistance)
- {
- minDistance = tempDistance;
- clusterId = j;
- }
-
-
-
- }
-
- }
-
- clusterVector.clear();
- clusterFilter.clear();
- optimalDeformations.clear();
-
- minClusterDistance = minDistance;
-
- /***DETERMINE THE MINIMUM DISTANCE FROM CLUSTERS ONLY IF THE
- USE SINGLETON SWITCH IS TURNED ON. IF THE NUMBER OF CLUSTERS
- IN A CLASS IS 0 THEN AUTOMATICALLY TURN ON THE SINGLETON SWITCH
- FOR THAT CLASS ALONE ***/
-
- if(m_useSingleton == false && clusterVectorSize == 0)
- m_useSingleton = true;
-
- /***************DETERMINING MINIMUM DISTANCE FROM SINGLETON VECTORS*********/
- if(m_useSingleton == true)
- {
- evalSingletonVector = evalShapeModel.getSingletonVector();
-
- int evalSingletonVectorSize = evalSingletonVector.size();
-
- for(int j = 0; j < evalSingletonVectorSize; j++)
- {
- if(singletonFilter[j])
- {
-
- //calculate the dtw distance between testsamples and every singleton vector
- float tempDistance = 0.0;
-
- errorCode = computeDTWDistance(shapeFeatureVec,evalSingletonVector[j],tempDistance);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- if(tempDistance < minDistance)
- {
- minDistance = tempDistance;
- singletonId = j;
- }
-
- }
- }
- singletonFilter.clear();
- }
-
- //clearing vectors
- evalSingletonVector.clear();
-
- minSingletonDistance = minDistance;
-
- //choosing the minimum distance
- if(m_useSingleton == false)
- {
- tempPair.distance = minClusterDistance;
- tempPair.typeId = CLUSTER;
- tempPair.sampleId = clusterId;
- }
- else
- {
- if(clusterVectorSize == 0)
- {
- tempPair.distance = minSingletonDistance;
- tempPair.typeId = SINGLETON;
- tempPair.sampleId = singletonId;
- }
- else
- {
- if(minClusterDistance < minSingletonDistance)
- {
- tempPair.distance = minClusterDistance;
- tempPair.typeId = CLUSTER;
- tempPair.sampleId = clusterId;
- }
- else
- {
- tempPair.distance = minSingletonDistance;
- tempPair.typeId = SINGLETON;
- tempPair.sampleId = singletonId;
- }
- }
- }
-
- //turning off the singleton switch in case it was turned on automatically
- if(m_useSingleton == true && clusterVectorSize == 0)
- m_useSingleton = false;
-
-
- tempPair.classId = evalShapeModel.getShapeId();
- m_neighborInfoVec.push_back(tempPair);
- }
- }
- else
- {
- /*****EVALUATE TEST SAMPLES ONLY AGAINST CLASSES SPECIFIED BY SUBSETOFCLASSES***/
- intVector::iterator subSetStart = subSetOfClasses.begin();
- intVector::iterator subSetEnd = subSetOfClasses.end();
-
- for(;subSetStart != subSetEnd; ++subSetStart)
- {
- evalShapeModel = m_prototypeShapes[(*subSetStart)];
-
- clusterVector = evalShapeModel.getClusterModelVector();
-
- evalSingletonVector = evalShapeModel.getSingletonVector();
-
- int clusterVectorSize = clusterVector.size();
- int singletonSize = evalSingletonVector.size();
-
- //computing the optimalDeformations
- for( j = 0; j < clusterVectorSize; j++)
- {
- evalClusterModel = clusterVector[j];
-
- eigenVector = evalClusterModel.getEigenVectors();
-
- eigenValues = evalClusterModel.getEigenValues();
-
- clusterMean = evalClusterModel.getClusterMean();
-
- deformationParameters.assign(eigenVector.size(),0.0);
-
- int errorCode = findOptimalDeformation(deformationParameters,eigenValues,eigenVector,
- clusterMean,featureVector);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- //reconstruct the sample
- double tempCoordinate = 0.0;
- int clusterMeanSize = clusterMean.size();
- int deformationParametersSize = deformationParameters.size();
-
- for(int k = 0; k < clusterMeanSize; k++)
- {
- tempCoordinate = clusterMean[k];
-
- for(int l = 0; l < deformationParametersSize; l++)
- tempCoordinate += deformationParameters[l]*eigenVector[l][k];
-
- reconstructedSample.push_back(tempCoordinate);
- }
-
- //converting the reconstructed Sample to a featureVector
- errorCode = convertDoubleToFeatureVector(shapeFeatureVector,reconstructedSample);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- optimalDeformations.push_back(shapeFeatureVector);
-
- //clearing vectors
- eigenValues.clear();
- eigenVector.clear();
- clusterMean.clear();
- reconstructedSample.clear();
- shapeFeatureVector.clear();
- deformationParameters.clear();
- }
-
- //setting up dtweuclidean filter for the class
- if(m_dtwEuclideanFilter != EUCLIDEAN_FILTER_OFF)
- {
- //calculating euclidean distance to clusters
- for(j = 0; j < clusterVectorSize; j++)
- {
- euclideanDistance = 0.0;
-
- errorCode = computeEuclideanDistance(shapeFeatureVec,optimalDeformations[j],euclideanDistance);
-
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- tempDist.typeId = CLUSTER;
- tempDist.sampleId = j;
- tempDist.distance = euclideanDistance;
-
- distInfo.push_back(tempDist);
- }
-
- //calcualting euclidean distances to singletons
- if(m_useSingleton == true || clusterVectorSize == 0)
- {
- for(j = 0; j < singletonSize; j++)
- {
- euclideanDistance = 0.0;
- //computing euclidean distance between test sample
- //and singleton vectors
-
- errorCode = computeEuclideanDistance(shapeFeatureVec,evalSingletonVector[j],
- euclideanDistance);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- tempDist.typeId = SINGLETON;
- tempDist.sampleId = j;
- tempDist.distance = euclideanDistance;
-
- distInfo.push_back(tempDist);
- }
- }
-
- //sorting the euclidean distances in ascending order
-
- sort(distInfo.begin(), distInfo.end(), sortDist);
-
-
- //choose the top n
- int numTopChoices = (int)(distInfo.size() * m_dtwEuclideanFilter)/100;
-
- if(numTopChoices == 0)
- {
- numTopChoices = distInfo.size();
- }
-
- //setting the filter
- clusterFilter.assign(clusterVectorSize,false);
-
- if(m_useSingleton == true || clusterVectorSize == 0)
- singletonFilter.assign(singletonSize,false);
-
- for( j = 0; j < numTopChoices; j++)
- {
- if(distInfo[j].typeId == 0)
- clusterFilter[distInfo[j].sampleId] = true;
-
- if(distInfo[j].typeId == 1)
- singletonFilter[distInfo[j].sampleId] = true;
- }
-
- //clearing distInfo
- distInfo.clear();
- }
-
- /*****DETERMINING THE MINIMUM CLUSTER DISTANCE***************/
- float minDistance = FLT_MAX;
- float minClusterDistance;
- float minSingletonDistance;
-
- int clusterId;
- int singletonId;
-
- for( j = 0; j < clusterVectorSize; j++)
- {
- if(clusterFilter[j])
- {
- float tempDistance = 0.0;
- errorCode = computeDTWDistance(shapeFeatureVec,optimalDeformations[j],tempDistance);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- if(tempDistance < minDistance)
- {
- minDistance = tempDistance;
- clusterId = j;
- }
- }
- }
-
- clusterVector.clear();
- clusterFilter.clear();
- optimalDeformations.clear();
-
- minClusterDistance = minDistance;
-
- /***DETERMINE THE MINIMUM DISTANCE FROM CLUSTERS ONLY IF THE
- USE SINGLETON SWITCH IS TURNED ON. IF THE NUMBER OF CLUSTERS
- IN A CLASS IS 0 THEN AUTOMATICALLY TURN ON THE SINGLETON SWITCH
- FOR THAT CLASS ALONE ***/
-
- if(m_useSingleton == false && clusterVectorSize == 0)
- m_useSingleton = true;
-
- /***************DETERMINING MINIMUM DISTANCE FROM SINGLETON VECTORS*********/
- if(m_useSingleton == true)
- {
-
- evalSingletonVector = evalShapeModel.getSingletonVector();
- int evalSingletonVectorSize = evalSingletonVector.size();
-
- for(j = 0; j < evalSingletonVectorSize; j++)
- {
- if(singletonFilter[j])
- {
- //calculate the dtw distance between testsamples and every singleton vector
- float tempDistance = 0.0;
-
- errorCode = computeDTWDistance(shapeFeatureVec,evalSingletonVector[j],tempDistance);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
-
- if(tempDistance < minDistance)
- {
- minDistance = tempDistance;
- singletonId = j;
- }
-
-
- }
- }
-
- singletonFilter.clear();
- }
-
- //clearing vectors
- evalSingletonVector.clear();
-
- minSingletonDistance = minDistance;
-
- //choosing the minimum distance
- if(m_useSingleton == false)
- {
- tempPair.distance = minClusterDistance;
- tempPair.typeId = CLUSTER;
- tempPair.sampleId = clusterId;
- }
- else
- {
- if(clusterVectorSize == 0)
- {
- tempPair.distance = minSingletonDistance;
- tempPair.typeId = SINGLETON;
- tempPair.sampleId = singletonId;
- }
- else
- {
- if(minClusterDistance < minSingletonDistance)
- {
- tempPair.distance = minClusterDistance;
- tempPair.typeId = CLUSTER;
- tempPair.sampleId = clusterId;
- }
- else
- {
- tempPair.distance = minSingletonDistance;
- tempPair.typeId = SINGLETON;
- tempPair.sampleId = singletonId;
- }
- }
- }
-
- //turning off the singleton switch in case it was turned on automatically
- if(m_useSingleton == true && clusterVectorSize == 0)
- m_useSingleton = false;
-
-
- tempPair.classId = evalShapeModel.getShapeId();
-
-
- m_neighborInfoVec.push_back(tempPair);
- }
- }
-
- featureVector.clear();
-
-
- //Sort the distIndexPairVector based on distances, in ascending order.
- sort(m_neighborInfoVec.begin(), m_neighborInfoVec.end(), sortDist);
-
- //Reject the sample if the similarity of the nearest sample is lower than m_rejectThreshold specified by the user.
- if(SIMILARITY(m_neighborInfoVec[0].distance) <= m_rejectThreshold)
- {
- m_vecRecoResult.clear();
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<"Test sample too distinct, rejecting the sample"<<endl;
- return SUCCESS;
- }
-
- //compute confidence
- if((errorCode = computeConfidence()) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
- }
-
- // Temporary result vector to store the results based on confThreshold and numChoices specified by the user.
- vector<LTKShapeRecoResult> tempResultVector;
-
- //If confThreshold is specified, get the entries from resultVector with confidence >= confThreshold
- if(confThreshold != CONF_THRESHOLD_FILTER_OFF)
- {
- for(i = 0 ; i < m_vecRecoResult.size() ; i++)
- {
- if( m_vecRecoResult[i].getConfidence() >= confThreshold)
- {
- tempResultVector.push_back(m_vecRecoResult[i]);
- }
- }
- m_vecRecoResult.clear();
- m_vecRecoResult = tempResultVector;
- tempResultVector.clear();
- }
- //Check if outResultVector is empty, if so, log
- if(m_vecRecoResult.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO) <<
- "Size of the result vector is empty, could not satisfy confThreshold criteria"<<endl;
- }
-
- //If numChoices is specified, get the top numChoices entries from outResultVector
- if(numChoices != NUM_CHOICES_FILTER_OFF)
- {
- //Get the entries from outResultVector only if size of resultVector > numChoices
- if(m_vecRecoResult.size() > numChoices)
- {
- for( i = 0 ; i < numChoices ; ++i)
- tempResultVector.push_back(m_vecRecoResult[i]);
- m_vecRecoResult.clear();
- m_vecRecoResult = tempResultVector;
- tempResultVector.clear();
- }
-
- }
-
- outResultVector = m_vecRecoResult;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::recognize()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : sortDist
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-bool ActiveDTWShapeRecognizer::sortDist(const NeighborInfo& x, const NeighborInfo& y)
-{
- return (x.distance) < (y.distance);
-}
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : computeConfidence
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int ActiveDTWShapeRecognizer::computeConfidence()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::computeConfidence()" << endl;
-
- /******************************************************************/
- /*******************VALIDATING INPUT ARGUMENTS*********************/
- /******************************************************************/
- if(m_neighborInfoVec.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ENEIGHBOR_INFO_VECTOR_EMPTY << " " <<
- getErrorMessage(ENEIGHBOR_INFO_VECTOR_EMPTY) <<
- " ActiveDTWShapeRecognizer::computeConfidence()" << endl;
-
- LTKReturnError(ENEIGHBOR_INFO_VECTOR_EMPTY);
- }
- // Temporary vector to store the recognition results
- LTKShapeRecoResult outResult;
- vector<pair<int,float> > classIdSimilarityPairVec;
- pair<int, float> classIdSimilarityPair;
-
- // Temporary vector to store the distinct classes appearing in distIndexPairVector
- intVector distinctClassVector;
- intVector::iterator distinctClassVectorIter;
-
- vector <LTKShapeRecoResult>::iterator resultVectorIter = m_vecRecoResult.begin();
- vector <LTKShapeRecoResult>::iterator resultVectorIterEnd = m_vecRecoResult.end();
-
- // Variable to store sum of distances to all the prototypes in distIndexPairVector
- float similaritySum = 0.0f;
- // Temporary variable to store the confidence value.
- float confidence = 0.0f;
-
-
-
- // Confidence computation for the ActiveDTW (1-NN) Classifier
- if(m_nearestNeighbors == 1)
- {
- vector <struct NeighborInfo>::iterator distIndexPairIter = m_neighborInfoVec.begin();
- vector <struct NeighborInfo>::iterator distIndexPairIterEnd = m_neighborInfoVec.end();
-
-
-
- for(; distIndexPairIter != distIndexPairIterEnd; ++distIndexPairIter)
- {
- //Check if the class is already present in distinctClassVector
- //The complexity of STL's find() is linear, with atmost last-first comparisons for equality
- distinctClassVectorIter = find(distinctClassVector.begin(), distinctClassVector.end(), (*distIndexPairIter).classId);
-
- //The distinctClassVectorIter will point to distinctClassVector.end() if the class is not present in distinctClassVector
- if(distinctClassVectorIter == distinctClassVector.end())
- {
- classIdSimilarityPair.first = (*distIndexPairIter).classId ;
- float similarityValue = SIMILARITY((*distIndexPairIter).distance);
-
- classIdSimilarityPair.second = similarityValue;
- similaritySum += similarityValue;
-
- classIdSimilarityPairVec.push_back(classIdSimilarityPair);
- distinctClassVector.push_back((*distIndexPairIter).classId);
- }
- }
-
- /************COMPUTING CONFIDENCE VALUES FOR EACH CLASS************/
- int classIdSimilarityPairVecSize = classIdSimilarityPairVec.size();
- for( int i = 0 ; i < classIdSimilarityPairVecSize ; ++i)
- {
- int classID = classIdSimilarityPairVec[i].first;
- confidence = classIdSimilarityPairVec[i].second;
- confidence /= similaritySum;
- outResult.setConfidence(confidence);
- outResult.setShapeId(classID);
-
- if(confidence > 0)
- m_vecRecoResult.push_back(outResult);
- }
- classIdSimilarityPairVec.clear();
- }
- // Computing confidence for k-NN classifier, implementation of the confidence measure described in paper (cite)
- else
- {
- if(m_nearestNeighbors >= m_neighborInfoVec.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_nearestNeighbors >= m_prototypeSet.size(), using distIndexPairVector.size() for m_nearestNeighbors instead" << endl;
- m_nearestNeighbors = m_neighborInfoVec.size();
- }
-
- // Variable to store the maximum of the number of samples per class.
- int maxClassSize = (max_element(m_shapeIDNumPrototypesMap.begin(), m_shapeIDNumPrototypesMap.end(), &compareMap))->second;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "maxClassSize: " <<maxClassSize<< endl;
-
- // Vector to store the cumulative similarity values
- vector<float> cumulativeSimilaritySum;
-
- // Populate the values in cumulativeSimilaritySum vector for the top m_nearestNeighbors prototypes
- // Assumption is m_nearestNeighbors >= MIN_NEARESTNEIGHBORS and m_nearestNeighbors < m_dtwEuclideanFilter, validation done in readClassifierConfig()
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Displaying cumulativeSimilaritySum..." << endl;
- int i = 0;
- for( i = 0 ; i < m_nearestNeighbors ; ++i)
- {
-
- classIdSimilarityPair.first = m_neighborInfoVec[i].classId;
- float similarityValue = SIMILARITY((m_neighborInfoVec[i]).distance);
-
- classIdSimilarityPair.second = similarityValue;
-
- classIdSimilarityPairVec.push_back(classIdSimilarityPair);
- similaritySum += similarityValue;
- cumulativeSimilaritySum.push_back(similaritySum);
-
- // Logging the cumulative similarity values for debugging
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "classID:" <<
- m_neighborInfoVec[i].classId << " confidence:" <<
- similarityValue << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << i << ": " << similaritySum << endl;
- }
-
-
- for(i = 0 ; i < classIdSimilarityPairVec.size() ; ++i)
- {
-
- int classID = classIdSimilarityPairVec[i].first;
-
- int finalNearestNeighbors = 0;
-
- //Check if the class is already present in distinctClassVector
- distinctClassVectorIter = find(distinctClassVector.begin(), distinctClassVector.end(), classID);
-
- //The distinctClassVectorIter will point to distinctClassVector.end() if the class is not present in distinctClassVector
- if(distinctClassVectorIter == distinctClassVector.end())
- {
- distinctClassVector.push_back(classID);
- confidence = 0.0f;
-
- //If the confidence is based on Adaptive k-NN scheme,
- //Computing number of nearest neighbours for the class to be used for computation of confidence
- if(m_adaptivekNN == true )
- {
-
- int sizeProportion = (int)ceil(1.0*m_nearestNeighbors*m_shapeIDNumPrototypesMap[classID]/maxClassSize);
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"sizeProportion of class " <<classID<<" is "<<sizeProportion<<endl;
-
- // Computing min(sizeProportion, m_shapeIDNumPrototypesMap[classID])
- int upperBound = (sizeProportion < m_shapeIDNumPrototypesMap[classID]) ? sizeProportion:m_shapeIDNumPrototypesMap[classID];
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"upperBound: " <<upperBound<<endl;
-
- // Computing max(upperBound, MIN_NEARESTNEIGHBORS)
- finalNearestNeighbors = (MIN_NEARESTNEIGHBORS > upperBound) ? MIN_NEARESTNEIGHBORS:upperBound;
- }
- //Else, compute kNN based confidence
- else if(m_adaptivekNN == false)
- {
- finalNearestNeighbors = m_nearestNeighbors;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: " << ECONFIG_FILE_RANGE << " " <<
- "m_adaptivekNN should be true or false" <<
- " ActiveDTWShapeRecognizer::computeConfidence()" << endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"finalNearestNeighbors: " <<finalNearestNeighbors<<endl;
-
- for( int j = 0 ; j < finalNearestNeighbors ; ++j)
- {
- if(classID == classIdSimilarityPairVec[j].first)
- {
- confidence += classIdSimilarityPairVec[j].second;
- }
- }
- confidence /= cumulativeSimilaritySum[finalNearestNeighbors-1];
-
- outResult.setShapeId(classID);
- outResult.setConfidence(confidence);
-
- if(confidence > 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"classId: " <<classID<<" confidence: "<<confidence<<endl;
-
- m_vecRecoResult.push_back(outResult);
- }
- }
- }
- classIdSimilarityPairVec.clear();
- }
-
- //Sort the result vector in descending order of confidence
- sort(m_vecRecoResult.begin(), m_vecRecoResult.end(), sortResultByConfidence);
-
- distinctClassVector.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::computeConfidence()" << endl;
-
- return SUCCESS;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : sortResultByConfidence
-* DESCRIPTION : Sort the LTKShapeRecoResult vector based on the Confidence value
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-bool ActiveDTWShapeRecognizer::sortResultByConfidence(const LTKShapeRecoResult& x, const LTKShapeRecoResult& y)
-{
- return (x.getConfidence()) > (y.getConfidence());
-}
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : compareMap
-* DESCRIPTION : Sort the STL's map based on the 'value'(second) field
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-
-bool ActiveDTWShapeRecognizer::compareMap( const map<int, int>::value_type& lhs, const map<int, int>::value_type& rhs )
-{
- return lhs.second < rhs.second;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : unloadModelData
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS : SUCCESS
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::unloadModelData()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::unloadModelData()" << endl;
-
- int returnStatus = SUCCESS;
-
- //Update MDT file with any modification, if available in memory
- if(m_prototypeSetModifyCount >0)
- {
- m_prototypeSetModifyCount = m_MDTUpdateFreq-1;
-
- returnStatus = writePrototypeShapesToMDTFile();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " ActiveDTWShapeRecognizer::unloadModelData()" << endl;
- }
- m_prototypeSetModifyCount = 0;
- }
-
- //Clearing the prototypSet
- m_prototypeShapes.clear();
- m_shapeIDNumPrototypesMap.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::unloadModelData()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : setDeviceContext
-* DESCRIPTION : New Function - Not yet added
-* ARGUMENTS :
-* RETURNS : SUCCESS
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::setDeviceContext(const LTKCaptureDevice& deviceInfo)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::setDeviceContext()" << endl;
-
- m_captureDevice = deviceInfo;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::setDeviceContext()" << endl;
-
- return SUCCESS;
-}
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : performClustering
-* DESCRIPTION : This method performs clustering on each class data
-and returns a vector specifying which samples
-belong to which cluster
-* ARGUMENTS : INPUT
-shapeSamplesVec vector<LTKShapeSample> Class Data to be clustered
-: OUTPUT
-outputVector int2DVector
-(Here each row of the outputVector denotes a cluster
-in turn each row holds the indices of the samples
-belonging to that cluster)
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::performClustering(const vector<LTKShapeSample>& shapeSamplesVec,
- int2DVector& outputVector)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::performClustering()" << endl;
-
- intVector tempVec;
-
- float2DVector distanceMatrix;
- int sampleCount=shapeSamplesVec.size();
- int returnStatus = SUCCESS;
-
-
-
- if(m_prototypeReductionFactor == -1)
- {
- //find number of clusters automatically
- //this is done when either of NumClusters or PrototypeReducrion factor is set
- //to automatic
- LTKHierarchicalClustering<LTKShapeSample,ActiveDTWShapeRecognizer> hc(shapeSamplesVec,AVERAGE_LINKAGE,AVG_SIL);
-
- returnStatus = hc.cluster(this,&ActiveDTWShapeRecognizer::computeDTWDistance);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " ActiveDTWShapeRecognizer::performClustering()" << endl;
- LTKReturnError(returnStatus);
- }
-
- //Cluster results are populated in an outputVector
- hc.getClusterResult(outputVector);
-
- }
- else if(m_prototypeReductionFactor == 0|| m_numClusters >= sampleCount)
- {
- intVector clusterIndices;
- //case where clustering is not required every sample is a cluster by itself
- for(int i = 0; i < sampleCount; i++)
- clusterIndices.push_back(i);
-
- outputVector.push_back(clusterIndices);
- clusterIndices.clear();
-
- }
- else
- {
- //clustering has to be performed
-
- int numClusters;
- if(m_numClusters == NN_NUM_CLUST_INITIAL)
- {
- numClusters = (100-m_prototypeReductionFactor)*sampleCount/100;
- if(numClusters == 0)
- {
- numClusters = 1;
- }
- }
-
- else if(m_prototypeReductionFactor == NN_NUM_CLUST_INITIAL)
- {
- numClusters = m_numClusters;
- }
-
- try
- {
-
- LTKHierarchicalClustering<LTKShapeSample,ActiveDTWShapeRecognizer>
- hc(shapeSamplesVec,numClusters, AVERAGE_LINKAGE);
-
- if(numClusters == 1)
- {
- int tempVar;
- hc.computeProximityMatrix(this, &ActiveDTWShapeRecognizer::computeDTWDistance);
-
-
- for(tempVar=0;tempVar<shapeSamplesVec.size();tempVar++)
- {
- tempVec.push_back(tempVar);
- }
-
- outputVector.push_back(tempVec);
- tempVec.clear();
- }
- else
- {
- returnStatus = hc.cluster(this,&ActiveDTWShapeRecognizer::computeDTWDistance);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " ActiveDTWShapeRecognizer::performClustering()" << endl;
- LTKReturnError(returnStatus);
- }
-
- //Cluster results are populated in an outputVector
- hc.getClusterResult(outputVector);
- }
-
- }
- catch(LTKException e)
- {
- int errorCode = e.getErrorCode();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " ActiveDTWShapeRecognizer::performClustering()" << endl;
- LTKReturnError(errorCode);
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::performClustering()" << endl;
-
-
-
- return SUCCESS;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getShapeSampleFromInkFile
-* DESCRIPTION : This method will get the ShapeSample by giving the ink
-* file path as input
-* ARGUMENTS :
-* RETURNS : SUCCESS
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int ActiveDTWShapeRecognizer::getShapeFeatureFromInkFile(const string& inkFilePath,
- vector<LTKShapeFeaturePtr>& shapeFeatureVec)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
-
- if ( inkFilePath.empty() )
- return FAILURE;
-
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
-
-
- LTKTraceGroup inTraceGroup, preprocessedTraceGroup;
-
-
- inTraceGroup.emptyAllTraces();
-
- int returnVal = m_shapeRecUtil.readInkFromFile(inkFilePath,
- m_lipiRootPath, inTraceGroup,
- captureDevice, screenContext);
-
- if (returnVal!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<returnVal<<
- " ActiveDTWShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(returnVal);
- }
-
- m_ptrPreproc->setCaptureDevice(captureDevice);
- m_ptrPreproc->setScreenContext(screenContext);
-
- preprocessedTraceGroup.emptyAllTraces();
-
- //Preprocessing to be done for the trace group that was read
- int errorCode = preprocess(inTraceGroup, preprocessedTraceGroup);
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(errorCode);
- }
-
-
-
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- shapeFeatureVec);
-
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : trainFromListFile
-* DESCRIPTION : This method will do the training by giving the Train List
-* file as input
-* ARGUMENTS :
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int ActiveDTWShapeRecognizer::trainFromListFile(const string& listFilePath)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
-
- //Count for the no. of samples read for a shape
- int sampleCount = 0;
-
- //Count of the no. of shapes read so far
- int shapeCount = 0;
-
- //Flag to skip reading a newline in the list file, when a new class starts
- bool lastshapeIdFlag = false;
-
- //Ink File Path
- string path = "";
-
- //Line from the list file
- string line = "";
-
- //Line is split into tokens
- stringVector tokens;
-
- //Flag is set when EOF is reached
- bool eofFlag = false;
-
- //ID for each shapes
- int shapeId = -1;
-
- //classId of the character
- int prevClassId = -1;
-
- //Indicates the first class
- bool initClassFlag = false;
-
- /**vectors for cluster indices
- *each vector corresponds to a cluster in a class
- *each vector has the indices of the shapesamples belonging to the cluster
- **/
- int2DVector clusterIndices;
-
- /**
- * this will hold a vector of indices pertaining to a certain cluster
- **/
- intVector cluster;
-
- /**
- * this will hold a temporary float feature vector
- **/
- doubleVector tempFeature;
-
- /**
- * Feature Matrix
- **/
- double2DVector featureMatrix;
-
- /**
- * Covariance Matrix
- **/
- double2DVector covarianceMatrix;
-
- /**
- * Eigen Vector Matrix
- **/
- double2DVector eigenVectors;
-
- /**
- * Eigen Values
- **/
- doubleVector eigenValues;
-
- /**
- * nrot --> number of iterations for eigen vector computation
- **/
- int nrot = 0;
-
- /**
- * clusterModel
- **/
-
- ActiveDTWClusterModel clusterModel;
-
-
-
- /**
- * vector of cluster models
- **/
- vector<ActiveDTWClusterModel> clusterModelVector;
-
-
- /**
- * shape Model
- **/
-
- ActiveDTWShapeModel shapeModel;
-
- /**
- * vector of singleton clusters
- **/
-
- shapeMatrix singletonVector;
-
- /**
- * selected eigen vectors
- **/
- double2DVector selectedEigenVectors;
-
- /**
- * cluster mean
- **/
- doubleVector clusterMean;
-
-
-
- LTKShapeSample shapeSampleFeatures;
-
-
- vector<LTKShapeSample> shapeSamplesVec;
-
- vector<LTKShapeSample> clusteredShapeSampleVec;
-
- ofstream mdtFileHandle;
- ifstream listFileHandle;
-
- vector<LTKShapeFeaturePtr> shapeFeature;
-
- //Opening the train list file for reading mode
- listFileHandle.open(listFilePath.c_str(), ios::in);
-
- //Return error if unable to open the training list file
- if(!listFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ETRAINLIST_FILE_OPEN << " " <<
- getErrorMessage(ETRAINLIST_FILE_OPEN)<<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(ETRAINLIST_FILE_OPEN);
- }
-
- //Open the Model data file for writing mode
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_activedtwMDTFilePath.c_str(), ios::out);
- }
- else
- {
- mdtFileHandle.open(m_activedtwMDTFilePath.c_str(),ios::out|ios::binary);
- }
-
- //Return error if unable to open the Model data file
- if(!mdtFileHandle)
- {
- listFileHandle.close();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- getErrorMessage(EMODEL_DATA_FILE_OPEN)<<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- //Write the number of Shapes
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle << m_numShapes << endl;
- }
- else
- {
- mdtFileHandle.write((char*) &m_numShapes, sizeof(unsigned short));
- }
-
- int errorCode = SUCCESS;
- while(!listFileHandle.eof())
- {
- // Not a sample of a new class
- if( lastshapeIdFlag == false )
- {
- //Get the line from the list file
- getline(listFileHandle, line, NEW_LINE_DELIMITER);
-
- path = "";
-
- //Check if EOF is reached
- if( listFileHandle.eof() )
- {
- eofFlag = true;
- }
-
- //Skip commented line
- if ( line[0] == COMMENTCHAR )
- {
- continue;
- }
-
- if (eofFlag == false)
- {
- //Tokenize the string
- errorCode = LTKStringUtil::tokenizeString(line, LIST_FILE_DELIMITER, tokens);
-
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- listFileHandle.close();
- mdtFileHandle.close();
- LTKReturnError(errorCode);
- }
-
-
- //Tokens must be of size 2, one is pathname and other is shapeId
- //If the end of file not reached then continue the looping
- if( tokens.size() != 2 && eofFlag == false )
- continue;
-
- //Tokens[0] indicates the path name
- path = tokens[0];
-
- //Tokens[1] indicates the shapeId
- shapeId = atoi( tokens[1].c_str() );
-
- if(shapeId < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "The ActiveDTWShapeRecognizer requires training file class Ids to be positive integers and listed in the increasing order"<<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- errorCode = EINVALID_SHAPEID;
- break;
- }
- else if(shapeId < prevClassId)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "Shape IDs in the train list file should be in the increasing order. Please use scripts/validateListFile.pl to generate list files." <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- errorCode = EINVALID_ORDER_LISTFILE;
- break;
- }
-
-
- //This condition is used to check the first shape must be start from 0
- if( initClassFlag == false )
- {
- initClassFlag = true;
- prevClassId=shapeId;
- }
- }
- }
- else //Sample of a new class; do not read the next line during this iteration
- {
- //flag unset to read next line during the next iteration
- lastshapeIdFlag = false;
- }
-
- // Sample from the same class, extract features, and push the extracted features to shapeSamplesVec
- if( shapeId == prevClassId && ! path.empty())
- {
- if( getShapeFeatureFromInkFile(path, shapeFeature) != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- "Error extracting features from the ink file: " <<
- path << ", extracting features from the next sample."<<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- continue;
- }
-
- shapeSampleFeatures.setFeatureVector(shapeFeature);
- shapeSampleFeatures.setClassID(shapeId);
-
- ++sampleCount;
- shapeSamplesVec.push_back(shapeSampleFeatures);
-
- shapeFeature.clear();
-
- }
-
- // Sample of new class seen, or end of list file reached; train all the samples of previous class ID
- if( shapeId != prevClassId || eofFlag == true )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Training for class : " << prevClassId << endl;
-
- //Increase shape count only if there are atleast one sample per class
- if( sampleCount > 0 )
- shapeCount++;
-
- //check that shapecount must not be greater than specified number
- //of shapes, if projecttype was not dynamic
- if( !m_projectTypeDynamic && shapeCount > m_numShapes )
- {
- errorCode = EINVALID_NUM_OF_SHAPES;
- break;
- }
-
- if( shapeCount > 0 && sampleCount > 0 )
- {
-
- /** PERFORM CLUSTERING **/
-
-
-
- errorCode = performClustering(shapeSamplesVec,clusterIndices);
-
-
-
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- listFileHandle.close();
- mdtFileHandle.close();
- LTKReturnError(errorCode);
- }
-
-
-
-
- int2DVector::iterator iter = clusterIndices.begin();
- int2DVector::iterator iEnd = clusterIndices.end();
-
-
-
- /**ITERATING THROUGH THE VARIOUS CLUSTERS **/
- for(;iter != iEnd; ++iter)
- {
- cluster = (*iter);
-
-
-
- /** SINGLETON VECTORS **/
- if(cluster.size() < m_minClusterSize)
- {
- /**CONSTRUCTING THE SINGLETON VECTOR**/
- for(int i = 0; i < cluster.size(); i++)
- singletonVector.push_back(shapeSamplesVec[cluster[i]].getFeatureVector());
- }
-
- /** CLUSTER PROCESSING **/
- else
- {
- //gather all the shape samples pertaining to a particular cluster
- int clusterSize = cluster.size();
- int i = 0;
- for( i = 0; i < clusterSize; i++)
- {
- //CONVERT ALL THE SHAPE SAMPLES TO FLOAT FEATURE VECTORS
- floatVector floatFeatureVector;
- errorCode = m_shapeRecUtil.shapeFeatureVectorToFloatVector(shapeSamplesVec[cluster[i]].getFeatureVector(),
- floatFeatureVector);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- int floatFeatureVectorSize = floatFeatureVector.size();
- for(int i = 0; i < floatFeatureVectorSize; i++)
- tempFeature.push_back(floatFeatureVector[i]);
-
- featureMatrix.push_back(tempFeature);
- tempFeature.clear();
- floatFeatureVector.clear();
-
- }
-
-
- /** COMPUTING COVARIANCE MATRIX **/
- errorCode = computeCovarianceMatrix(featureMatrix,covarianceMatrix,clusterMean);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- //setting cluster mean for cluster model
-
- clusterModel.setClusterMean(clusterMean);
-
-
- /** COMPUTING EIGEN VECTORS **/
- //computes the eigen vector for the larger covarianceMatrix
- //from the smaller covarianceMatrix
- errorCode = computeEigenVectorsForLargeDimension(featureMatrix,covarianceMatrix,eigenVectors,eigenValues);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- LTKReturnError(errorCode);
- }
-
-
- doubleVector tempEigenVector;
- int eigenVectorDimension = eigenVectors.size();
-
- if(eigenVectorDimension <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EEMPTY_EIGENVECTORS << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- LTKReturnError(EEMPTY_EIGENVECTORS);
- }
-
- int numEigenVectors = eigenVectors[0].size();
-
- if(numEigenVectors <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_NUM_OF_EIGENVECTORS << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- LTKReturnError(EINVALID_NUM_OF_EIGENVECTORS );
- }
-
- for( i = 0; i < numEigenVectors; i++)
- {
- for(int j = 0; j < eigenVectorDimension; j++)
- tempEigenVector.push_back(eigenVectors[j][i]);
-
- selectedEigenVectors.push_back(tempEigenVector);
- tempEigenVector.clear();
- }
-
-
-
- /**CONSTRUCTING CLUSTER MODEL **/
- errorCode = clusterModel.setNumSamples(cluster.size());
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- LTKReturnError(errorCode);
- }
-
-
- clusterModel.setEigenValues(eigenValues);
-
- clusterModel.setEigenVectors(selectedEigenVectors);
-
-
- /**APPENDING THE CLUSTER MODEL VECTOR**/
- clusterModelVector.push_back(clusterModel);
-
- featureMatrix.clear();
- covarianceMatrix.clear();
- selectedEigenVectors.clear();
- clusterMean.clear();
- eigenValues.clear();
- eigenVectors.clear();
- }
- }
-
-
- clusterIndices.clear();
-
-
-
- /**CONSTRUCTING SHAPE MODEL**/
-
- errorCode = shapeModel.setShapeId(shapeCount - 1);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " "<< endl;
- LTKReturnError(errorCode);
- }
-
- shapeModel.setClusterModelVector(clusterModelVector);
-
- shapeModel.setSingletonVector(singletonVector);
-
-
- clusterModelVector.clear();
- singletonVector.clear();
-
-
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_CLUSTERING) == 0)
- {
-
- //Writing results to the MDT file
-
- errorCode = appendShapeModelToMDTFile(shapeModel, mdtFileHandle);
-
-
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
-
- listFileHandle.close();
- mdtFileHandle.close();
- LTKReturnError(errorCode);
- }
-
-
- }
-
- //Clearing the shapeSampleVector and clusteredShapeSampleVector
-
-
- shapeSamplesVec.clear();
-
- //Resetting sampleCount for the next class
- sampleCount = 0;
-
- //Set the flag so that the already read line of next class in the list file is not lost
- lastshapeIdFlag = true;
-
- prevClassId = shapeId;
-
- }
- }
- }//End of while
-
- //Closing the Train List file and Model Data file
- listFileHandle.close();
- mdtFileHandle.close();
-
- if(!m_projectTypeDynamic && shapeCount != m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NUM_OF_SHAPES << " " <<
- getErrorMessage(EINVALID_NUM_OF_SHAPES)<<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(EINVALID_NUM_OF_SHAPES);
- }
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(errorCode);
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
-
- return SUCCESS;
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : computeCovarianceMatrix
-* DESCRIPTION : This method computes the covariance matrix and mean of
-a feature matrix
-* ARGUMENTS : INPUT
-featureMatrix double2DVector Feature matrix whose covarianceMatrix
-is to be computed
-;OUTPUT
-covarianceMatrix double2DVector covarianceMatrix of feature matrix
-meanFeature doubleVector mean of feature matrix
-
- * RETURNS : integer Holds error value if occurs
- * Holds SUCCESS if no errors
- *************************************************************************************/
- int ActiveDTWShapeRecognizer::computeCovarianceMatrix(double2DVector& featureMatrix,
- double2DVector& covarianceMatrix,doubleVector& meanFeature)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::computeCovarianceMatrix()" << endl;
-
- if(featureMatrix.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_FEATUREMATRIX << " " <<
- getErrorMessage(EEMPTY_FEATUREMATRIX) <<
- " ActiveDTWShapeRecognizer::computeCovarianceMatrix()" << endl;
-
- LTKReturnError(EEMPTY_FEATUREMATRIX);
- }
-
-
- doubleVector tempVector;
- double mean;
-
- int numberOfRows;
- int numberOfColumns;
-
- //rows
- numberOfRows = featureMatrix.size();
- //cols
- numberOfColumns = featureMatrix[0].size();
-
-
- int i = 0;
- int j = 0;
- /***********CALCULATING MEAN*********/
- for(i = 0; i < numberOfColumns;i++)
- {
- mean = 0.0;
- for(j = 0;j < numberOfRows;j++)
- {
- mean = mean + featureMatrix[j][i];
- }
- mean = mean /numberOfRows;
- meanFeature.push_back(mean);
- }
-
- /**********MEAN CORRECTED DATA************/
- for( i = 0; i < numberOfRows; i++)
- {
- for(j = 0; j < numberOfColumns; j++)
- {
- featureMatrix[i][j] = featureMatrix[i][j] - meanFeature[j];
- }
- }
-
- /** COMPUTING COVARIANCE MATRIX**/
- tempVector.assign(numberOfColumns,0.0);
- covarianceMatrix.assign(numberOfColumns,tempVector);
- tempVector.clear();
-
- bool bcovarianceMatrixFlag = false;
- for( i = 0; i < numberOfColumns; i++)
- {
- for(j = 0;j < numberOfColumns; j++)
- {
- if(i <= j)
- {
- for(int k = 0; k < numberOfRows; k++)
- {
-
- covarianceMatrix[i][j] += featureMatrix[k][i]*featureMatrix[k][j];
-
- }
- covarianceMatrix[i][j] = covarianceMatrix[i][j] /(numberOfRows - 1);
- }
- else
- {
- covarianceMatrix[i][j] = covarianceMatrix[j][i];
- }
- if(covarianceMatrix[i][j] != 0.0)
- bcovarianceMatrixFlag = true;
- }
- }
-
- if(!bcovarianceMatrixFlag)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_COVARIANCEMATRIX << " " <<
- getErrorMessage(EEMPTY_COVARIANCEMATRIX) <<
- " ActiveDTWShapeRecognizer::computeCovarianceMatrix()" << endl;
-
- LTKReturnError(EEMPTY_COVARIANCEMATRIX);
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::computeCovarianceMatrix()" << endl;
-
- return SUCCESS;
- }
-
-
- /**********************************************************************************
- * AUTHOR : S Anand
- * DATE : 3-MAR-2009
- * NAME : computeEigenVectors
- * DESCRIPTION : This method computes the eigenValues and eigenVectors of
- a covarianceMatrix
- * ARGUMENTS : INPUT
- covarianceMatrix double2DVector (matrix whose eigenValues and eigenVectors are to be computed)
- rank int (rank of covarianceMatrix)
- nrot int (number of rotations) This a parameter used by the algorithm
- OUTPUT
- eigenValueVec doubleVector Eigen values of covarianceMatrix
- eigenVectorMatrix double2DVector Eigen vectors of covarianceMatrix
-
- * RETURNS : integer Holds error value if occurs
- * Holds SUCCESS if no erros
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
- int ActiveDTWShapeRecognizer::computeEigenVectors(double2DVector &covarianceMatrix,const int rank,
- doubleVector &eigenValueVec, double2DVector &eigenVectorMatrix, int& nrot)
- {
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::computeEigenVectors()" << endl;
-
- if(covarianceMatrix.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_COVARIANCEMATRIX << " " <<
- getErrorMessage(EEMPTY_COVARIANCEMATRIX) <<
- " ActiveDTWShapeRecognizer::computeEigenVectors()" << endl;
-
- LTKReturnError(EEMPTY_COVARIANCEMATRIX);
- }
-
- if(rank <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_RANK << " " <<
- getErrorMessage(EINVALID_RANK) <<
- " ActiveDTWShapeRecognizer::computeEigenVectors()" << endl;
-
- LTKReturnError(EINVALID_RANK);
- }
-
- int MAX_ITER = 1000;
-
- int ip,count,p,q,r;
-
- double theta, tau, t,sm,s,h,g,c;
-
- double app,aqq,apq,vpp,vqq,vpq;
-
- double2DVector::iterator itrRow,itrRowEnd;
-
- doubleVector::iterator itrCol,itrColEnd;
-
- itrRowEnd = eigenVectorMatrix.end();
-
- for(ip = 0,itrRow = eigenVectorMatrix.begin(); itrRow <itrRowEnd;++ip, ++itrRow)
- {
- itrColEnd = (*itrRow).end();
-
- for(itrCol = (*itrRow).begin(); itrCol < itrColEnd; ++itrCol)
- {
- *itrCol = 0;
- }
-
- *((*itrRow).begin() + ip) = 1;
-
- eigenValueVec.push_back(0.0);
- }
-
- nrot = 0;
-
- for(count = 0; count < MAX_ITER; count++)
- {
- nrot++;
-
- sm = 0.0;
-
- itrRowEnd = covarianceMatrix.end();
-
- for(p = 0,itrRow = covarianceMatrix.begin(); itrRow <itrRowEnd;++p, ++itrRow)
- {
- itrColEnd = (*itrRow).end();
-
- for(itrCol = (*itrRow).begin()+p+1; itrCol < itrColEnd; ++itrCol)
- {
- sm += fabs(*itrCol);
- }
- }
-
- if(sm < EPS)
- {
- for(r=0;r<rank;r++)
- {
- eigenValueVec[r] = covarianceMatrix[r][r];
- }
-
- }
-
- for(p=0; p<(rank-1) ; p++)
- {
- for(q=(p+1); q<rank; q++)
- {
- if(fabs(covarianceMatrix[p][q])>EPS1)
- {
- theta = (covarianceMatrix[q][q] - covarianceMatrix[p][p])/
- (2*covarianceMatrix[p][q]);
-
- t = sqrt(1+theta * theta) - theta;
-
- c = 1/(sqrt(1+t*t));
-
- s = t*c;
-
- tau = s/(1+c);
-
- apq = covarianceMatrix[p][q];
-
- app = covarianceMatrix[p][p];
-
- aqq = covarianceMatrix[q][q];
-
- vpp = eigenVectorMatrix[p][p];
-
- vpq = eigenVectorMatrix[p][q];
-
- vqq = eigenVectorMatrix[q][q];
-
- for(r=0;r<p;r++)
- {
- h = covarianceMatrix[r][p];
-
- g = covarianceMatrix[r][q];
-
- covarianceMatrix[r][p] = (double)(c*h - s*g);
-
- covarianceMatrix[r][q] = (double)(c*g + s*h);
- }
- covarianceMatrix[p][p] -= (double)(t*apq);
-
- covarianceMatrix[p][q] = (double)(0.0);
-
- for(r=p+1; r<q; r++)
- {
- h = covarianceMatrix[p][r];
-
- g = covarianceMatrix[r][q];
-
- covarianceMatrix[p][r] = (double)(c*h - s*g);
-
- covarianceMatrix[r][q] = (double)(c*g + s*h);
- }
-
- covarianceMatrix[q][q] += (double)(t*apq);
-
- for(r = q+1; r<rank; r++)
- {
- h = covarianceMatrix[p][r];
-
- g = covarianceMatrix[q][r];
-
- covarianceMatrix[p][r] = (double)(c*h - s*g);
-
- covarianceMatrix[q][r] = (double)(c*g + s*h);
- }
-
- for(r = 0; r<rank ; r++)
- {
- h = eigenVectorMatrix[r][p];
-
- g = eigenVectorMatrix[r][q];
-
- eigenVectorMatrix[r][p] = (double)(c*h - s*g);
-
- eigenVectorMatrix[r][q] = (double)(c*g + s*h);
- }
- }
- else
- {
- covarianceMatrix[p][q] = 0;
- }
- }
- }
-
- }
-
-
-
- for(r=0;r<rank;r++)
- {
- eigenValueVec[r] = covarianceMatrix[r][r];
- }
-
- double temp;
-
- for(p = 0; p<rank-1; p++)
- {
- for(q = p+1; q<rank; q++)
- {
- if(fabs(eigenValueVec[p]) < fabs(eigenValueVec[q]))
- {
- for(r = 0; r<rank; r++)
- {
- temp = eigenVectorMatrix[r][p];
-
- eigenVectorMatrix[r][p] = eigenVectorMatrix[r][q];
-
- eigenVectorMatrix[r][q] = temp;
-
- }
-
- temp = eigenValueVec[p];
-
- eigenValueVec[p] = eigenValueVec[q];
-
- eigenValueVec[q] = temp;
-
- }
- }
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::computeEigenVectors()" << endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : initializeFeatureExtractorInstance
-* DESCRIPTION : This method get the Instance of the Feature Extractor
-* from LTKShapeFeatureExtractorFactory
-* ARGUMENTS :
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int ActiveDTWShapeRecognizer::initializeFeatureExtractorInstance(const LTKControlInfo& controlInfo)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
-
-
- LTKShapeFeatureExtractorFactory factory;
- int errorCode = factory.createFeatureExtractor(m_featureExtractorName,
- m_lipiRootPath,
- m_lipiLibPath,
- &m_libHandlerFE,
- controlInfo,
- &m_ptrFeatureExtractor);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EFTR_EXTR_NOT_EXIST << " " <<
- " ActiveDTWShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
- LTKReturnError(errorCode);
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : deleteFeatureExtractorInstance
-* DESCRIPTION : This method unloads the Feature extractor instance
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int ActiveDTWShapeRecognizer::deleteFeatureExtractorInstance()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- if (m_ptrFeatureExtractor != NULL)
- {
- typedef int (*FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR)(LTKShapeFeatureExtractor *obj);
- FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR deleteFeatureExtractor;
- void * functionHandle = NULL;
-
- // Map createpreprocessor and deletePreprocessor functions
- int returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandlerFE,
- DELETE_SHAPE_FEATURE_EXTRACTOR,
- &functionHandle);
-
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< EDLL_FUNC_ADDRESS_DELETE_FEATEXT << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_DELETE_FEATEXT) <<
- " ActiveDTWShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS_DELETE_FEATEXT);
- }
-
- deleteFeatureExtractor = (FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR)functionHandle;
-
- deleteFeatureExtractor(m_ptrFeatureExtractor);
-
- m_ptrFeatureExtractor = NULL;
-
- // unload feature extractor dll
- if(m_libHandlerFE != NULL)
- {
- //Unload the DLL
- m_OSUtilPtr->unloadSharedLib(m_libHandlerFE);
- m_libHandlerFE = NULL;
-
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : updateHeaderWithAlgoInfo
-* DESCRIPTION : This method will Update the Header information for the MDT file
-* ARGUMENTS :
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-void ActiveDTWShapeRecognizer::updateHeaderWithAlgoInfo()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::updateHeaderWithAlgoInfo()" << endl;
-
- m_headerInfo[RECVERSION] = m_currentVersion;
- string algoName = ACTIVEDTW;
- m_headerInfo[RECNAME] = algoName;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::updateHeaderWithAlgoInfo()" << endl;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getDistance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-void ActiveDTWShapeRecognizer::getDistance(const LTKShapeFeaturePtr& f1,
- const LTKShapeFeaturePtr& f2,
- float& distance)
-{
- f1->getDistance(f2, distance);
-}
-
-
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getFeaturesFromTraceGroup
-* DESCRIPTION : 1. PreProcess 2. Extract Features 3.Add to PrototypeSet
-* 4. Add to MDT
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-
-int ActiveDTWShapeRecognizer::extractFeatVecFromTraceGroup(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& featureVec)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
-
- //TraceGroup after Preprocessing
- LTKTraceGroup preprocessedTraceGroup;
-
- //Check for empty traces in inTraceGroup
- if(inTraceGroup.containsAnyEmptyTrace())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_TRACE << " " <<
- getErrorMessage(EEMPTY_TRACE) <<
- " ActiveDTWShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- LTKReturnError(EEMPTY_TRACE);
- }
-
- //Preprocess the inTraceGroup
- int errorCode = preprocess(inTraceGroup, preprocessedTraceGroup);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- LTKReturnError(errorCode);
- }
-
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- featureVec);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting ActiveDTWShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : getTraceGroup
-* DESCRIPTION : Returns the tracegroups of the shape
-* For singletons it returns the tracegroups from the feature vector
-* For clusters it returns the tracegroup of the cluster mean
-* ARGUMENTS : INPUT:
-shapeID - class whose trace groups are to be returned
-numberOfTraceGroups - maximum number of trace groups to be returned
-: OUTPUT
-outTraceGroups - tracegroups of the class
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-
-int ActiveDTWShapeRecognizer::getTraceGroups(int shapeID, int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering ActiveDTWShapeRecognizer::getTraceGroups"
- <<endl;
-
- if(m_shapeIDNumPrototypesMap.find(shapeID) == m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_SHAPEID << " " <<
- getErrorMessage(EINVALID_SHAPEID) <<
- " ActiveDTWShapeRecognizer::getTraceGroups()" << endl;
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- if(m_shapeIDNumPrototypesMap[shapeID] < numberOfTraceGroups)
- {
- numberOfTraceGroups = m_shapeIDNumPrototypesMap[shapeID];
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Number of TraceGroup in PrototypeShapes is less than specified."
- << "Returning all TraceGroups :"
- << numberOfTraceGroups <<endl;
- }
-
- vector<ActiveDTWShapeModel>::iterator prototypeShapesIter = m_prototypeShapes.begin();
- int counter =0;
- vector<ActiveDTWClusterModel> clusterModelVector;
- shapeMatrix singletonVector;
-
- for(;prototypeShapesIter!=m_prototypeShapes.end();)
- {
- int currentShapeId = (*prototypeShapesIter).getShapeId();
-
- if(currentShapeId == shapeID)
- {
- LTKTraceGroup traceGroup;
-
- clusterModelVector = (*prototypeShapesIter).getClusterModelVector();
- singletonVector = (*prototypeShapesIter).getSingletonVector();
-
- int clusterModelVectorSize = clusterModelVector.size();
- int singletonVectorSize = singletonVector.size();
-
- if(singletonVectorSize > 0)
- {
- //convert singletons into tracegroups
- for(int i = 0; i < singletonVectorSize; i++)
- {
- //converting the featureVector to traceGroup
- int errorCode = m_ptrFeatureExtractor->convertFeatVecToTraceGroup(
- singletonVector[i],traceGroup);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::getTraceGroups()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- outTraceGroups.push_back(traceGroup);
- counter++;
- if(counter==numberOfTraceGroups)
- break;
- }
- }
-
-
- if(clusterModelVectorSize > 0)
- {
- //converting all the cluster means into traceGroups
- for(int i = 0; i < clusterModelVectorSize; i++)
- {
- doubleVector clusterMean = clusterModelVector[i].getClusterMean();
-
- //converting the doubleVector to featureVector
- vector<LTKShapeFeaturePtr> shapeFeatureVec;
-
- int errorCode = convertDoubleToFeatureVector(shapeFeatureVec,clusterMean);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::getTraceGroups()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- //converting the featureVector to traceGroup
- errorCode = m_ptrFeatureExtractor->convertFeatVecToTraceGroup(
- shapeFeatureVec,traceGroup);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::getTraceGroups()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- outTraceGroups.push_back(traceGroup);
- clusterMean.clear();
- counter++;
- if(counter==numberOfTraceGroups)
- break;
- }
- }
- }
- prototypeShapesIter++;
- }
-
- //clearing vectors
- clusterModelVector.clear();
- singletonVector.clear();
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting ActiveDTWShapeRecognizer::getTraceGroups"
- <<endl;
- return SUCCESS;
-}
-
-/***********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : initializePreprocessor
-* DESCRIPTION : This method is used to initialize the PreProcessor
-* ARGUMENTS : preprocDLLPath : string : Holds the Path of the Preprocessor DLL,
-* returnStatus : int : Holds SUCCESS or Error Values, if occurs
-* RETURNS : preprocessor instance
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::initializePreprocessor(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocInstance)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::initializePreprocessor()" << endl;
-
- FN_PTR_CREATELTKLIPIPREPROCESSOR createLTKLipiPreProcessor = NULL;
-
- int errorCode;
-
- // Load the DLL with path=preprocDLLPath
- void* functionHandle = NULL;
-
- int returnVal = m_OSUtilPtr->loadSharedLib(controlInfo.lipiLib, PREPROC, &m_libHandler);
-
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ELOAD_PREPROC_DLL << " " <<
- getErrorMessage(ELOAD_PREPROC_DLL) <<
- " ActiveDTWShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(ELOAD_PREPROC_DLL);
- }
-
- // Map createpreprocessor and deletePreprocessor functions
- returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandler,
- CREATEPREPROCINST,
- &functionHandle);
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- //Unload the dll
- unloadPreprocessorDLL();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EDLL_FUNC_ADDRESS_CREATE << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_CREATE) <<
- " ActiveDTWShapeRecognizer::initializePreprocessor()" << endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS_CREATE);
- }
-
- createLTKLipiPreProcessor = (FN_PTR_CREATELTKLIPIPREPROCESSOR)functionHandle;
-
- functionHandle = NULL;
-
- // Map createpreprocessor and deletePreprocessor functions
- returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandler,
- DESTROYPREPROCINST,
- &functionHandle);
-
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- //Unload the dll
- unloadPreprocessorDLL();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EDLL_FUNC_ADDRESS_CREATE << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_CREATE) <<
- " ActiveDTWShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(EDLL_FUNC_ADDRESS_CREATE);
- }
-
- m_deleteLTKLipiPreProcessor = (FN_PTR_DELETELTKLIPIPREPROCESSOR)functionHandle;
-
- // Create preprocessor instance
- errorCode = createLTKLipiPreProcessor(controlInfo, preprocInstance);
-
- if(errorCode!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(errorCode);
- }
-
- // Could not create a LTKLipiPreProcessor
- if(*preprocInstance == NULL)
- {
- // Unload the DLL
- unloadPreprocessorDLL();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ECREATE_PREPROC << " " <<
- getErrorMessage(ECREATE_PREPROC) <<
- " ActiveDTWShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(ECREATE_PREPROC);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::initializePreprocessor()" << endl;
-
- return SUCCESS;
-
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : deletePreprocessor
-* DESCRIPTION : This method is used to deletes the PreProcessor instance
-* ARGUMENTS : ptrPreprocInstance : Holds the pointer to the LTKPreprocessorInterface
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-
-//int ActiveDTWShapeRecognizer::deletePreprocessor(LTKPreprocessorInterface *ptrPreprocInstance)
-int ActiveDTWShapeRecognizer::deletePreprocessor()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::deletePreprocessor()" << endl;
-
- //deleting the preprocessor instance
- if(m_ptrPreproc != NULL)
- {
- m_deleteLTKLipiPreProcessor(m_ptrPreproc);
- m_ptrPreproc = NULL;
- }
-
- //Unload the dll
- int returnStatus = unloadPreprocessorDLL();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " ActiveDTWShapeRecognizer::deletePreprocessor()" << endl;
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::deletePreprocessor()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : unloadPreprocessorDLL
-* DESCRIPTION : This method is used to Unloads the preprocessor DLL.
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::unloadPreprocessorDLL()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::unloadPreprocessorDLL()" << endl;
-
- //Check the preprocessor DLL was loaded already
- if(m_libHandler != NULL)
- {
- //Unload the DLL
- m_OSUtilPtr->unloadSharedLib(m_libHandler);
- m_libHandler = NULL;
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::unloadPreprocessorDLL()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : findOptimalDeformation
-* DESCRIPTION : This method computes the parameters required to construct the optimal
-deformation of each cluster that is closest to the test sample
-* ARGUMENTS : INPUT
-eigenValues doubleVector (eigenValues of cluster)
-eigenVector double2DVector (eigenVectors of cluster)
-clusterMean doubleVector (mean of cluster)
-testSample doubleVector (test sample)
-:OUTPUT
-deformationParameters doubleVector (deformation parameters)
-*
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::findOptimalDeformation(doubleVector& deformationParameters,doubleVector& eigenValues, double2DVector& eigenVector,
- doubleVector& clusterMean, doubleVector& testSample)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::findOptimalDeformation()" << endl;
-
- if(eigenValues.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_EIGENVALUES << " " <<
- getErrorMessage(EEMPTY_EIGENVALUES) <<
- " ActiveDTWShapeRecognizer::findOptimalDeformation()" << endl;
-
- LTKReturnError(EEMPTY_EIGENVALUES);
- }
-
- if(eigenVector.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_EIGENVECTORS << " " <<
- getErrorMessage(EEMPTY_EIGENVECTORS) <<
- " ActiveDTWShapeRecognizer::findOptimalDeformation()" << endl;
-
- LTKReturnError(EEMPTY_EIGENVECTORS);
- }
-
- if(clusterMean.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_CLUSTERMEAN << " " <<
- getErrorMessage(EEMPTY_CLUSTERMEAN) <<
- " ActiveDTWShapeRecognizer::findOptimalDeformation()" << endl;
-
- LTKReturnError(EEMPTY_CLUSTERMEAN);
- }
-
- if(eigenValues.size() != eigenVector.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ENUM_EIGVALUES_NOTEQUALTO_NUM_EIGVECTORS << " " <<
- getErrorMessage(ENUM_EIGVALUES_NOTEQUALTO_NUM_EIGVECTORS) <<
- " ActiveDTWShapeRecognizer::findOptimalDeformation()" << endl;
-
- LTKReturnError(ENUM_EIGVALUES_NOTEQUALTO_NUM_EIGVECTORS);
- }
-
-
- doubleVector diffVec;
- doubleVector linearConstant;
- doubleVector tempDoubleVec;
- doubleVector lowerBounds;
- doubleVector upperBounds;
- double tempSum;
-
- int n ;
-
- int i = 0;
-
-
-
- /***************CALCULATING PARAMETERS***********************/
- /**CALCULATING THE DIFFERENCE VECTOR**/
- diffVec.assign(clusterMean.size(),0.0);
-
- for(i = 0; i < diffVec.size(); i++)
- diffVec[i] = testSample[i] - clusterMean[i];
-
-
- /**CALCULATING THE LINEAR CONSTANT TERM**/
- //linearConstant is calculated as:
- //linearConstant = eigVec*diffVec
- double2DVector::iterator iStart = eigenVector.begin();
- double2DVector::iterator iEnd = eigenVector.end();
-
- for(;iStart != iEnd;++iStart)
- {
- tempDoubleVec = (*iStart);
-
- tempSum = 0.0;
- for(i = 0; i < tempDoubleVec.size(); i++ )
- {
-
- tempSum += (tempDoubleVec[i] * diffVec[i]);
- }
-
- linearConstant.push_back(tempSum);
- }
-
- //problem dimension
- n = eigenVector.size();
-
-
-
- double tempBounds;
-
- for( i = 0; i < n; i++)
- {
-
- tempBounds = sqrt(eigenValues[i] * m_eigenSpreadValue);
- lowerBounds.push_back((-1) * tempBounds);
- upperBounds.push_back(tempBounds);
- }
-
- /**OPTIMIZATION PROCEDURE**/
- for( i = 0; i < n; i++)
- {
- if(linearConstant[i] >= lowerBounds[i] && linearConstant[i] <= upperBounds[i])
- deformationParameters[i] = linearConstant[i];
- else
- {
- if(linearConstant[i] < lowerBounds[i])
- deformationParameters[i] = lowerBounds[i];
- else
- deformationParameters[i] = upperBounds[i];
- }
- }
-
- //clearing vectors
- linearConstant.clear();
- lowerBounds.clear();
- upperBounds.clear();
- diffVec.clear();
- tempDoubleVec.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::findOptimalDeformation()" << endl;
- return SUCCESS;
-};
-
-/**************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : validatePreprocParameters
-* DESCRIPTION : This method is used to validate the preproc parameters with
-* mdt header values
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-****************************************************************************/
-int ActiveDTWShapeRecognizer::validatePreprocParameters(stringStringMap& headerSequence)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::validatePreprocParameters()" << endl;
-
-
- string tempStrVar = "";
- string headerValue = "";
- int headerValueInt = 0;
- float headerValueFloat = 0.0f;
- int tempIntegerValue = 0;
- float tempFloatValue = 0.0f;
-
- //preproc sequence
- string mdtPreprocSeqn = headerSequence[PREPROC_SEQ];
- if(LTKSTRCMP(m_preProcSeqn.c_str(), mdtPreprocSeqn.c_str()) != 0 &&
- LTKSTRCMP("NA", mdtPreprocSeqn.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preprocSeqn in config file ("<<
- m_preProcSeqn <<") does not match with the value in MDT file ("<<
- mdtPreprocSeqn <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
-
- //ResampTraceDimension
- headerValue = "";
- if(LTKSTRCMP("NA", headerSequence[TRACE_DIM].c_str()) != 0)
- {
- headerValueInt = atoi(headerSequence[TRACE_DIM].c_str());
- tempIntegerValue = m_ptrPreproc->getTraceDimension();
-
- if(headerValueInt != tempIntegerValue )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of TraceDimension in config file ("<<
- tempIntegerValue<<") does not match with the value in MDT file ("<<
- headerValueInt <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
-
- // preserve aspect ratio
- bool preProcPreserveAspectRatio = m_ptrPreproc->getPreserveAspectRatio();
- tempStrVar = "false";
- if (preProcPreserveAspectRatio == true)
- {
- tempStrVar = "true";
- }
-
- if(LTKSTRCMP((headerSequence[PRESER_ASP_RATIO]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[PRESER_ASP_RATIO]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcPreserveAspectRatio in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[PRESER_ASP_RATIO] <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
- //NormPreserveRelativeYPosition
- bool preProcNormPreserveRelativeYPosition = m_ptrPreproc->getPreserveRealtiveYPosition();
- tempStrVar = "false";
- if (preProcNormPreserveRelativeYPosition == true)
- {
- tempStrVar = "true";
- }
-
- if(LTKSTRCMP((headerSequence[PRESER_REL_Y_POS]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[PRESER_REL_Y_POS]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormPreserveRelativeYPosition in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[PRESER_REL_Y_POS] <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
-
- // NormPreserveAspectRatioThreshold
- tempFloatValue = m_ptrPreproc->getAspectRatioThreshold();
- if(LTKSTRCMP((headerSequence[ASP_RATIO_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[ASP_RATIO_THRES]);
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcPreserveAspectRatioThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
-
-
- // NormLineWidthThreshold
- if(LTKSTRCMP((headerSequence[DOT_SIZE_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[DOT_SIZE_THRES]);
- tempFloatValue = m_ptrPreproc->getSizeThreshold();
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormLineWidthThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
-
- // NormDotSizeThreshold
- if(LTKSTRCMP((headerSequence[DOT_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[DOT_THRES]);
- tempFloatValue = m_ptrPreproc->getDotThreshold();
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormDotSizeThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
-
-
- //ResampPointAllocation
- tempStrVar = "";
- tempStrVar = m_ptrPreproc->getResamplingMethod();
- if(LTKSTRCMP((headerSequence[RESAMP_POINT_ALLOC]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[RESAMP_POINT_ALLOC]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcResampPointAllocation in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[RESAMP_POINT_ALLOC] <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
- //SmoothWindowSize
- if(LTKSTRCMP((headerSequence[SMOOTH_WIND_SIZE]).c_str(), "NA") != 0)
- {
- headerValueInt = atoi(headerSequence[SMOOTH_WIND_SIZE].c_str());
- tempIntegerValue = m_ptrPreproc->getFilterLength();
-
- if(headerValueInt != tempIntegerValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcSmoothWindowSize in config file ("<<
- tempIntegerValue<<") does not match with the value in MDT file ("<<
- headerValueInt <<")"<<
- " ActiveDTWShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::validatePreprocParameters()" << endl;
- return SUCCESS;
-
-}
-
-
-/*********************************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : computeEigenVectorsForLargeDimension
-* DESCRIPTION : This method computes the eigen values and eigen vectors for larger
-covariance matrices of large dimension using the eigen value and
-eigen vectors of the smaller covariance matrix
-* ARGUMENTS :INPUT
-meanCorrectedData double2DVector
--- used for constructing the smaller covariance matrix
-covarianceMatrix double2DVector
--- this is the larger covariance matrix whose eigen values and
-eigen vectors are to be computed
-:OUTPUT
-eigenValues doubleVector
--- eigenValues of the larger covarianceMatrix
-eigenVectors double2DVector
--- eigenVectors of the larger covarianceMatrix
-*
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-* NOTES : This based on a paper implementation
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::computeEigenVectorsForLargeDimension(double2DVector& meanCorrectedData,double2DVector& covarianceMatrix,
- double2DVector& eigenVector,doubleVector& eigenValues)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::computeEigenVectorsForLargeDimension()" << endl;
-
- if(meanCorrectedData.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_MEANCORRECTEDDATA << " " <<
- getErrorMessage(EEMPTY_MEANCORRECTEDDATA) <<
- " ActiveDTWShapeRecognizer::computeEigenVectorsForLargeDimension()" << endl;
-
- LTKReturnError(EEMPTY_MEANCORRECTEDDATA);
- }
-
- if(covarianceMatrix.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_COVARIANCEMATRIX << " " <<
- getErrorMessage(EEMPTY_COVARIANCEMATRIX) <<
- " ActiveDTWShapeRecognizer::computeEigenVectorsForLargeDimension()" << endl;
-
- LTKReturnError(EEMPTY_COVARIANCEMATRIX);
- }
-
-
- //covarianceSmall = A(transpose) * A
- double2DVector covarianceSmall;
-
- doubleVector tempVector;
-
- //eigen values and eigen vectors of A(transpose) * A
- double2DVector eigVecMat;
- doubleVector eigValVec;
-
- //number of iterations for computing eigen vectors
- int nrot = 0;
-
- int meanCorrectedDataSize = meanCorrectedData.size();
- int rowSize = meanCorrectedData[0].size();
-
- tempVector.assign(meanCorrectedDataSize,0.0);
- covarianceSmall.assign(meanCorrectedDataSize,tempVector);
- tempVector.clear();
-
- int i = 0;
- int j = 0;
-
- //calculating A(transpose)* A
- for(i = 0; i < meanCorrectedDataSize; i++)
- {
- for(j = 0;j < meanCorrectedDataSize; j++)
- {
- if(i <= j)
- {
- for(int k = 0; k < rowSize; k++)
- {
- covarianceSmall[i][j] += meanCorrectedData[i][k]*meanCorrectedData[j][k];
- }
- covarianceSmall[i][j] = covarianceSmall[i][j] /(meanCorrectedDataSize -1);
- }
- else
- {
- covarianceSmall[i][j] = covarianceSmall[j][i];
- }
- }
- }
-
-
- //allocating memory for eigVecMat
- tempVector.assign(meanCorrectedDataSize,0.0);
- eigVecMat.assign(meanCorrectedDataSize,tempVector);
- tempVector.clear();
-
-
- //computing the eigen vectors of A(transpose)*A
-
-
- int errorCode = computeEigenVectors(covarianceSmall,covarianceSmall.size(),
- eigValVec,eigVecMat,nrot);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(errorCode);
- }
-
-
-
-
-
- /**CALCULATING EIGEN ENERGY **/
- double totalEigenEnergy = 0.0;
- double currentEigenEnergy = 0.0;
- int numEigenVectors = 0;
-
- int eigenValSize = eigValVec.size();
- for( i = 0; i < eigenValSize; i++)
- totalEigenEnergy += eigValVec[i];
-
- /**DETERMINING NUMBER OF EIGEN VECTORS**/
- while(currentEigenEnergy <= ((m_percentEigenEnergy*totalEigenEnergy)/100) && numEigenVectors < eigenValSize)
- currentEigenEnergy += eigValVec[numEigenVectors++];
-
- /**COMPUTING THE EIGEN VECTORS OF THE LARGER COVARIANCE MATRIX AS (A * EIGENVECTOR) **/
-
- tempVector.assign(numEigenVectors,0.0);
- eigenVector.assign(rowSize,tempVector);
- tempVector.clear();
-
- for( i = 0; i < rowSize; i++)
- {
- for(int j = 0; j < numEigenVectors; j++)
- {
- for(int k = 0; k < meanCorrectedDataSize; k++)
- {
- eigenVector[i][j] += meanCorrectedData[k][i] * eigVecMat[k][j];
- }
- }
- }
-
- //calculating the magnitude of each eigenVectors
- doubleVector magnitudeVector;
- for( i = 0; i < numEigenVectors; i++)
- {
- double tempMagnitude = 0;
- for(j = 0; j < rowSize; j++)
- tempMagnitude += (eigenVector[j][i] * eigenVector[j][i]);
- double sqrtMagnitude = sqrt(tempMagnitude);
- magnitudeVector.push_back(sqrtMagnitude);
- }
-
-
- //normalizing eigenVectors
- for( i = 0; i < numEigenVectors; i++)
- {
- for(j = 0; j < rowSize; j++)
- eigenVector[j][i] = (eigenVector[j][i]/magnitudeVector[i]);
- }
- magnitudeVector.clear();
-
- //selecting the corresponding eigen values
- for( i = 0; i < numEigenVectors; i++)
- eigenValues.push_back(eigValVec[i]);
-
- eigVecMat.clear();
- eigValVec.clear();
- covarianceSmall.clear();
-
-
- return SUCCESS;
-
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : convertDoubleToFeatureVector
-* DESCRIPTION : This method converts the double Vector (flatenned version of the feature vector)
-to the vector<LTKShapeFeaturePtr> form
-* ARGUMENTS : INPUT
-* featureVec doubleVector
-:OUTPUT
-shapeFeatureVec vector<LTKShapeFeaturePtr>
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no erros
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::convertDoubleToFeatureVector(vector<LTKShapeFeaturePtr>& shapeFeatureVec,doubleVector& featureVec)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::convertDoubleToFeatureVector" << endl;
-
- LTKShapeFeaturePtr shapeFeature;
- int featureVectorSize = featureVec.size();
- int featureDimension;
- floatVector tempFeature;
-
- for(int i = 0; i < featureVectorSize;)
- {
- shapeFeature = m_ptrFeatureExtractor->getShapeFeatureInstance();
- featureDimension = shapeFeature->getFeatureDimension();
-
-
- for(int j = 0; j < featureDimension; j++)
- {
- tempFeature.push_back((float)featureVec[i]);
- i++;
- }
-
-
- if (shapeFeature->initialize(tempFeature) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_INPUT_FORMAT << " " <<
- "Number of features extracted from a trace is not correct"<<
- " ActiveDTWShapeRecognizer::convertDoubleToFeatureVector" << endl;
-
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
- shapeFeatureVec.push_back(shapeFeature);
-
- tempFeature.clear();
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::convertDoubleToFeatureVector" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : adapt
-* DESCRIPTION : adapt recent recognized sample
-* ARGUMENTS : shapeID : True shapeID of sample
-* RETURNS : Success : If sample was adapted successfully
-* Failure : Returns Error Code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::adapt(int shapeId)
-{
- try{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Enter ActiveDTWShapeRecognizer::adapt()"<<endl;
-
- //check if shapeId has already seen by classifier else add shapeId
- if(m_shapeIDNumPrototypesMap.find(shapeId) == m_shapeIDNumPrototypesMap.end())
- {
-
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- //Adaptation Code
- LTKAdapt* adaptObj = LTKAdapt::getInstance(this);
-
- int nErrorCode;
- nErrorCode = adaptObj->adapt(shapeId);
- if(nErrorCode !=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during ActiveDTWShapeRecognizer::adapt()"<<endl;
- LTKReturnError(nErrorCode);
- }
-
- //Clear Variables cached
- m_neighborInfoVec.clear();
- m_vecRecoResult.clear();
-
- }
- catch(...)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during ActiveDTWShapeRecognizer::adapt()"<<endl;
- return FAILURE;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Exit ActiveDTWShapeRecognizer::adapt()"<<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : adapt
-* DESCRIPTION : adapt sample passed as argument
-* ARGUMENTS : sampleTraceGroup : TraceGroup of sample to be adapted
-* shapeID : True shapeID of sample
-* RETURNS : Success : If sample was adapted successfully
-* Failure : Returns Error Code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::adapt(const LTKTraceGroup& sampleTraceGroup, int shapeId )
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Enter ActiveDTWShapeRecognizer::Adapt()"<<endl;
-
- int errorCode;
-
- if(shapeId < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "ActiveDTWShapeRecognizer::Adapt(): Invalid shapeId"<< endl;
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- //check if shapeId has already seen by classifier else add shapeId
- if(m_shapeIDNumPrototypesMap.find(shapeId) == m_shapeIDNumPrototypesMap.end())
- {
- //add class
- errorCode = addClass(sampleTraceGroup, shapeId);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during call to recognize in ActiveDTWShapeRecognizer::Adapt()"<<endl;
- LTKReturnError(errorCode);
- }
- }
- else
- {
- //recognize and adapt
- vector<int> vecSubSet;
- vector<LTKShapeRecoResult> vecRecoResult;
- LTKScreenContext objScreenContext;
-
- errorCode = recognize(sampleTraceGroup,objScreenContext,
- vecSubSet,CONF_THRESHOLD_FILTER_OFF,
- NN_DEF_RECO_NUM_CHOICES,vecRecoResult);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during call to recognize in ActiveDTWShapeRecognizer::Adapt()"<<endl;
- LTKReturnError(errorCode);
- }
-
- errorCode = adapt(shapeId);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during call to recognize in ActiveDTWShapeRecognizer::Adapt()"<<endl;
- LTKReturnError(errorCode);
- }
-
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Exit ActiveDTWShapeRecognizer::Adapt()"<<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : deleteAdaptInstance
-* DESCRIPTION : delete AdaptInstance
-* ARGUMENTS :
-* RETURNS : None
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::deleteAdaptInstance()
-{
- //Implemented as deleteAdaptInstance is called by ~NNShapeRecognizer
- //and adaptObj object is not available in NN.cpp
-
- LTKAdapt *adaptInstance = LTKAdapt::getInstance(this);
- if(adaptInstance)
- {
- adaptInstance->deleteInstance();
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR ; S Anand
-* DATE : 3-MAR-2009
-* NAME : writePrototypeShapesToMDTFile
-* DESCRIPTION : Flushes the prototype shapes data to activedtw.mdt file
-* ARGUMENTS :
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-
-int ActiveDTWShapeRecognizer::writePrototypeShapesToMDTFile()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::writePrototypeShapesToMDTFile()" << endl;
-
- int errorCode = SUCCESS;
-
- //Flush to MDT only after m_MDTUpdateFreq modifications
- m_prototypeSetModifyCount++;
-
- if(m_prototypeSetModifyCount == m_MDTUpdateFreq)
- {
- m_prototypeSetModifyCount = 0;
-
- ofstream mdtFileHandle;
-
- //Open the Model data file for writing mode
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_activedtwMDTFilePath.c_str(), ios::out);
- }
- else
- {
- mdtFileHandle.open(m_activedtwMDTFilePath.c_str(),ios::out|ios::binary);
- }
-
- //Return error if unable to open the Model data file
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- getErrorMessage(EMODEL_DATA_FILE_OPEN) <<
- " ActiveDTWShapeRecognizer::writePrototypeShapesToMDTFile()" << endl;
-
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- //write the number of shapes to MDT file
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- // 0 represents dynamic
- mdtFileHandle << 0 << endl;
- }
- else
- {
- int numShapes = 0;
- mdtFileHandle.write((char*) &numShapes, sizeof(unsigned short));
- }
-
- int prototypeShapesSize = m_prototypeShapes.size();
-
- for(int i = 0; i < prototypeShapesSize; i++)
- {
- errorCode = appendShapeModelToMDTFile(m_prototypeShapes[i],mdtFileHandle);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::writePrototypeShapesToMDTFile()" << endl;
- LTKReturnError(errorCode);
- }
- }
-
- mdtFileHandle.close();
-
- //Updating the Header Information
- updateHeaderWithAlgoInfo();
-
- //Adding header information and checksum generation
- string strModelDataHeaderInfoFile = "";
- LTKCheckSumGenerate cheSumGen;
-
- errorCode = cheSumGen.addHeaderInfo(
- strModelDataHeaderInfoFile,
- m_activedtwMDTFilePath,
- m_headerInfo);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::writePrototypeSetToMDTFile()" << endl;
-
- LTKReturnError(errorCode);
- }
- }
-
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::writePrototypeShapesToMDTFile()" << endl;
-
- return SUCCESS;
-}
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : addClass
-* DESCRIPTION : Adds a new trace group as a class
-* ARGUMENTS : INPUT
-sampleTraceGroup LTKTraceGroup
-shapeID int
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::addClass(const LTKTraceGroup& sampleTraceGroup, int& shapeID)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::addClass()" << endl;
-
- int errorCode;
-
- //unless projecttype is dynamic we cannot add classes
- if(!m_projectTypeDynamic)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROJ_NOT_DYNAMIC << " " <<
- "Not allowed to ADD shapes to a project with fixed number of shapes"<<
- " ActiveDTWShapeRecognizer::addClass()" << endl;
-
- LTKReturnError(EPROJ_NOT_DYNAMIC);
- }
-
-
- //if the sample does not have a shape id, we assign it NEW_SHAPEID = -2 in runshaperecInternal
- //then in the following module we determine the new shape id based on the existing shape ids
- if(shapeID = NEW_SHAPEID)
- {
- int tempShapeID;
-
- if(m_shapeIDNumPrototypesMap.size() > 0)
- {
- map<int,int>::reverse_iterator m_shapeIDNumPrototypesMapIter;
- m_shapeIDNumPrototypesMapIter = m_shapeIDNumPrototypesMap.rbegin();
- tempShapeID = m_shapeIDNumPrototypesMapIter->first;
- shapeID = tempShapeID+1;
- }
- else
- {
- shapeID = LTK_START_SHAPEID;
- }
-
- }
-
- vector<LTKShapeFeaturePtr> tempFeatureVec;
-
- errorCode = extractFeatVecFromTraceGroup(sampleTraceGroup,tempFeatureVec);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::addClass()" << endl;
- LTKReturnError(errorCode);
- }
-
- shapeMatrix newShapeMatrix;
-
- newShapeMatrix.push_back(tempFeatureVec);
-
- //add the feature vector as a singleton Vector
- ActiveDTWShapeModel newShapeModel;
-
-
- errorCode = newShapeModel.setShapeId(shapeID);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " "<< endl;
- LTKReturnError(errorCode);
- }
-
- newShapeModel.setSingletonVector(newShapeMatrix);
-
- if(m_prototypeShapes.empty())
- {
- m_prototypeShapes.push_back(newShapeModel);
- }
- else
- {
- int prototypeShapesSize = m_prototypeShapes.size();
- int maxClassId = m_prototypeShapes[prototypeShapesSize - 1].getShapeId();
-
- if(shapeID > maxClassId)
- m_prototypeShapes.push_back(newShapeModel);
- else
- {
- vector<ActiveDTWShapeModel>::iterator prototypeShapesIter = m_prototypeShapes.begin();
-
- while(prototypeShapesIter != m_prototypeShapes.end())
- {
- int currentShapeId = (*prototypeShapesIter).getShapeId();
-
- if(currentShapeId > shapeID)
- {
- m_prototypeShapes.insert(prototypeShapesIter,newShapeModel);
- break;
- }
- prototypeShapesIter++;
- }
- }
- }
-
- //Update m_shapeIDNumPrototypesMap
- m_shapeIDNumPrototypesMap[shapeID]= 1;
-
- //Update MDT File
- errorCode = writePrototypeShapesToMDTFile();
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " ActiveDTWShapeRecognizer::addClass()" << endl;
- LTKReturnError(errorCode);
- }
-
- //clearing vectors
- tempFeatureVec.clear();
- newShapeMatrix.clear();
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::addClass()" << endl;
-
- return SUCCESS;
-}
-/**********************************************************************************
-* AUTHOR : S Anand
-* DATE : 3-MAR-2009
-* NAME : deleteClass
-* DESCRIPTION : Deletes the class with shapeID
-* ARGUMENTS : INPUT
-shapeID int
-* RETURNS : integer Holds error value if occurs
-* Holds SUCCESS if no errors
-*************************************************************************************/
-int ActiveDTWShapeRecognizer::deleteClass(int shapeID)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "ActiveDTWShapeRecognizer::deleteClass()" << endl;
-
- if(!m_projectTypeDynamic)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROJ_NOT_DYNAMIC << " " <<
- "Not allowed to delete shapes to a project with fixed number of Shapes"<<
- " ActiveDTWShapeRecognizer::deleteClass()" << endl;
-
- LTKReturnError(EPROJ_NOT_DYNAMIC);
- }
-
- //Validate Input Parameters - shapeID
- if(m_shapeIDNumPrototypesMap.find(shapeID) ==m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_SHAPEID << " " <<
- "shapeID is not valid"<<
- " ActiveDTWShapeRecognizer::deleteClass()" << endl;
-
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- vector<ActiveDTWShapeModel>::iterator prototypeShapesIter;
-
- int prototypeShapesSize = m_prototypeShapes.size();
- int k = 0;
-
- for(int i = 0; i < prototypeShapesSize; i++)
- {
- prototypeShapesIter = m_prototypeShapes.begin() + k;
-
- int classId = (*prototypeShapesIter).getShapeId();
-
- if(classId == shapeID)
- {
- vector<ActiveDTWClusterModel> currentClusterModelVector;
- shapeMatrix currentSingletonVector;
-
- //clearing cluster Model and singleton vectors
- currentClusterModelVector = (*prototypeShapesIter).getClusterModelVector();
- currentClusterModelVector.clear();
- (*prototypeShapesIter).setClusterModelVector(currentClusterModelVector);
-
- currentSingletonVector = (*prototypeShapesIter).getSingletonVector();
- currentSingletonVector.clear();
- (*prototypeShapesIter).setSingletonVector(currentSingletonVector);
-
- m_prototypeShapes.erase(prototypeShapesIter);
- continue;
- }
- k++;
- prototypeShapesIter++;
- }
-
- //Update m_shapeIDNumPrototypesMap
- m_shapeIDNumPrototypesMap.erase(shapeID);
-
- //Update MDT File
- int returnStatus = writePrototypeShapesToMDTFile();
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " << returnStatus << " " <<
- "Exiting ActiveDTWShapeRecognizer::deleteClass" <<endl;
- LTKReturnError(returnStatus);
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "ActiveDTWShapeRecognizer::deleteClass()" << endl;
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h
deleted file mode 100644
index 9459d5c7..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.h
+++ /dev/null
@@ -1,1203 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies
-* or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
-* SVN MACROS
-*
-* $LastChangedDate: 2011-08-23 13:28:15 +0530 (Tue, 23 Aug 2011) $
-* $Revision: 857 $
-* $Author: jitender $
-*
-************************************************************************/
-/*********************************************************************************************
-* FILE DESCR: Definitions for ActiveDTW Shape Recognition module
-*
-* CONTENTS:
-*
-* AUTHOR: S Anand
-*
-*
-* DATE:3-MAR-2009
-* CHANGE HISTORY:
-* Author Date Description of change
-***********************************************************************************************/
-
-
-#ifndef __ACTIVEDTWSHAPERECOGNIZER_H
-#define __ACTIVEDTWSHAPERECOGNIZER_H
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-#include "LTKMacros.h"
-#include "LTKShapeRecognizer.h"
-#include "LTKShapeRecoUtil.h"
-#include "LTKShapeSample.h"
-#include "LTKCheckSumGenerate.h"
-#include "LTKDynamicTimeWarping.h"
-#include "ActiveDTWShapeModel.h"
-#include "ActiveDTWAdapt.h"
-
-class LTKTraceGroup;
-class LTKPreprocessorInterface;
-class LTKShapeSample;
-class LTKShapeFeatureExtractor;
-class LTKShapeFeature;
-class LTKAdapt;
-
-#define SIMILARITY(distance) (1 / (distance + EPS ))
-#define SUPPORTED_MIN_VERSION "3.0.0"
-
-#define CLUSTER 0
-#define SINGLETON 1
-
-#define INVALID_SHAPEID -2
-#define NEW_SHAPEID -2
-
-//#ifdef _INTERNAL
-//#endif
-
-typedef int (*FN_PTR_LOCAL_DISTANCE)(LTKShapeFeaturePtr, LTKShapeFeaturePtr,float&);
-typedef int (*FN_PTR_CREATELTKLIPIPREPROCESSOR)(const LTKControlInfo& , LTKPreprocessorInterface** );
-typedef int (*FN_PTR_DELETELTKLIPIPREPROCESSOR)(LTKPreprocessorInterface* );
-
-typedef vector<LTKShapeFeaturePtr> shapeFeature;
-typedef vector<shapeFeature> shapeMatrix;
-
-
-/**
-* @ingroup ActiveDTWShapeRecognizer.h
-* @brief The Header file for the ActiveDTWShapeRecognizer
-* @class ActiveDTWShapeRecognizer
-*<p> <p>
-*/
-
-class ActiveDTWShapeRecognizer: public LTKShapeRecognizer
-{
-
-public:
- //#ifdef _INTERNAL
- friend class LTKAdapt;
- int adapt(int shapeID );
- int adapt(const LTKTraceGroup& sampleTraceGroup, int shapeID );
-
- /**
- * This function does the recognition function required for training phase (called from trainLVQ)
- * The input parameter are the incharacter, which is compared with the existing
- * set of prototypes and then the matched code vector and along with its index (and also the shape id) is returned
- * @param incharacter is the character which we are trying to recognise.
- * @param returnshapeID is the value of the matched character which is returned, codeCharacter is the matched prototype (code vector) vector, and codeVecIndex is the matched prototype (code vector) index
- */
- int trainRecognize(LTKShapeSample& inShapeSample, LTKShapeSample& bestShapeSample, int& codeVecIndex);
-
- int writePrototypeShapesToMDTFile();
-
- int addClass(const LTKTraceGroup& sampleTraceGroup, int& shapeID);
-
- int deleteClass(int shapeID);
-
- int readInternalClassifierConfig();
-
-private:
-
- int deleteAdaptInstance();
-
-
-
- // #endif
-
-
-private:
-
- FN_PTR_DELETELTKLIPIPREPROCESSOR m_deleteLTKLipiPreProcessor;
- //Function pointer for deleteLTKLipiPreProcessor
-
- // preproc lib handle
- void *m_libHandler;
-
- // feature extractor lib handle
- void *m_libHandlerFE;
-
- unsigned short m_numShapes;
- /**< @brief Number of shapes
- * <p>
- * It Defines the number of shapes to be recognized
- *
- * DEFAULT: 0
- *
- * Note: If the project is dynamic, then this numShapes was set to 0
- * If the project is not dynamic, then the numShapes was read from project configuration file
- * </p>
- */
-
-
- string m_prototypeSelection;
- /**< @brief The Prototype Selection
- * <p>
- * if Prototype Selection = clustering, the training method used was clustering
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_PROTOTYPESELECTION
- * Possible values are "clustering"
- * </p>
- */
-
- int m_prototypeReductionFactor;
- /**< @brief The prototype Reduction factor
- * <p>
- * if PrototypeReductionFactor = 0 every training sample is cluster on its own
- * = 100 all training samples are represented by one prototype
- * = 80 then all samples are represented by 20% of the training samples
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_PROTOTYPEREDUCTIONFACTOR
- * RANGE: 0 TO 100
- * </p>
- */
-
- int m_numClusters;
- /**< @brief The number of clusters
- * <p>
- * if NumClusters = k, then k clusters are found from the training samples
- *
- *
- *
- * DEFAULT: There is no default as this and prototype reduction factor are dependent
- * RANGE:
- * </p>
- */
-
-
- float m_percentEigenEnergy;
- /**< @brief The percent of Eigen Energy
- * <p>
- * if PercentEigenEnergy = 90 then those eigen values contributing to 90% of the Eigen Energy,
- * and their corresponding eigen vectors are retained
- *
- *
- * DEFAULT: LTKClassifierDefaults::ACTIVEDTW_DEF_PERCENTEIGENENERGY
- * RANGE: 1-100
- * </p>
- */
-
- int m_eigenSpreadValue;
- /**< @brief The eigen values spread range
- * <p>
- * if EigenSpreadValue = 16 then deformation parameters for computing the optimal deformation,
- * can lie in the range [-4*Eigen Value,4*Eigen Value]
- *
- *
- * DEFAULT: LTKClassifierDefaults::ACTIVEDTW_DEF_EIGENSPREADVALUE
- * RANGE: greater than 0
- * </p>
- */
-
- int m_minClusterSize;
- /**< @brief The minimum cluster size
- * <p>
- * It specifies the minimum number of samples required to form a cluster
- *
- *
- * DEFAULT: LTKPreprocDefaults::ADAPT_DEF_MIN_NUMBER_SAMPLES_PER_CLASS
- * RANGE: >= 2
- * </p>
- */
-
- bool m_useSingleton;
- /**< @brief Use Singletons
- * <p>
- * It specifies if singletons should be considered during the recognition process
- * If Use Singleton is true, singletons will be considered during the recognition process,
- * else they will be ignored
- *
- * DEFAULT: LTKClassifierDefaults::ACTIVEDTW_DEF_USESINGLETON
- * RANGE: True or False
- * </p>
- */
-
-
- int m_nearestNeighbors;
- /**< @brief Nearest Neighbors
- * <p>
- *
- * DEFAULT: LTKClassifierDefaults::NN_DEF_NEARESTNEIGHBORS
- * </p>
- */
-
-
- float m_dtwBanding;
- /**< @brief DTW Banding
- * <p>
- *
- * DEFAULT: LTKClassifierDefaults::NN_DEF_BANDING
- * </p>
- */
-
- int m_dtwEuclideanFilter;
- /**< @brief DTW Euclidean Filter
- * <p>
- *
- * DEFAULT: LTKClassifierDefaults::ACTIVEDTW_DEF_DTWEUCLIDEANFILTER
- * </p>
- */
-
- string m_featureExtractorName;
- /**< @brief The Feature Extractor
- * <p>
- *
- * DEFAULT:
- *
- * </p>
- */
-
- bool m_projectTypeDynamic;
- /**< @brief Project Dynamic
- * <p>
- * if projectTypeDynamic = true, then the project is dynamic ie, the numShapes can take any number of value
- * = false, then the project is not dynamic ie, the numShape can take value specified in project.cfg file
- *
- * DEFAULT: false
- * </p>
- */
-
- LTKPreprocessorInterface *m_ptrPreproc;
- /**< @brief Pointer to preprocessor instance
- * <p>
- * Instance which is used to call the preprocessing methods before recognition
- *
- * DEFAULT: NULL
- * </p>
- */
-
- string m_activedtwCfgFilePath;
- /**< @brief Full path of ActiveDTW configuration file
- * <p>
- * Assigned value in the ActiveDTWShapeRecognizer::initialize function
- * </p>
- */
-
- string m_activedtwMDTFilePath;
- /**< @brief Full path of Model data file
- * <p>
- * Assigned value in the ActiveDTWShapeRecognizer::initialize function
- * </p>
- */
-
- stringStringMap m_headerInfo;
- /**< @brief Header Information
- * <p>
- * </p>
- */
-
- LTKShapeRecoUtil m_shapeRecUtil;
- /**< @brief Pointer to LTKShapeRecoUtil class
- * <p>
- * Instance which used to call Shape Recognizer Utility functions
- *
- * DEFAULT: NULL
- */
-
- string m_lipiRootPath;
- /**< @brief Path of the Lipi Root
- * <p>
- * DEFAULT: LipiEngine::getLipiPath()
- * </p>
- */
-
- string m_lipiLibPath;
- /**< @brief Path of the Lipi Libraries
- * <p>
- * DEFAULT: LipiEngine::getLipiLibPath()
- * </p>
- */
-
- LTKShapeFeatureExtractor *m_ptrFeatureExtractor;
- /**< @brief Pointer to LTKShapeFeatureExtractor class
- * <p>
- * DEFAULT: NULL
- * </p>
- */
-
- string m_preProcSeqn;
- /**< @brief Preprocessor Sequence
- * <p>
- * This string will holds what sequence the preprocessor methods to be executed
- * </p>
- */
-
- LTKCaptureDevice m_captureDevice;
-
- /** Structure to store information required for recognition and adaptation **/
- struct NeighborInfo
- {
- int typeId;
- int sampleId;
- int classId;
- double distance;
- };
- /**< @brief Structure to store information required for recognition and adaptation
- * <p>
- * TypeId: Specifies whether it is a singleton (defined by 1) or a cluster (defined by 0)
- * SampleId: Specifies which singleton or cluster sample. The range of values depend on
- * the number of clusters or singletons (>= 0)
- * ClassId: Specifies the class id
- * Distance: The distance between the test sample and singleton or
- * the distance between the test sample and optimal deformation (cluster case)
- * The range of values is >= 0
- *
- * DEFAULT: NULL
- * Range: Depends on Individual fields
- * </p>
- */
-
- /**Vector to store the distances from each class to test sample**/
- vector <struct NeighborInfo> m_neighborInfoVec;
- /**< @brief Neighbor Information Vector
- * <p>
- * This vector contains the distance information between the test samples and
- * prototype data. It is a vector of structures NeighborInfo
- * </p>
- */
-
- /** contains all the prototype data from load Model data **/
- vector<ActiveDTWShapeModel> m_prototypeShapes;
- /**< @brief Prototype Shapes
- * <p>
- * This is a vector of ActiveDTWShapeModels
- * This populated via the loadModelData function
- * </p>
- */
-
- /** Sorts dtw distances **/
- static bool sortDist(const NeighborInfo& x, const NeighborInfo& y);
- /**
- * This method compares distances
- *
- * Semantics
- *
- * - Compare distances
- *
- * @param NeighborInfo(X)
- * @param NeighborInfo(Y)
- *
- * @return TRUE: if X.distance lesser than Y.distance
- * FALSE: if X.distance greater than Y.distance
- * @exception none
- */
-
- vector<stringStringPair> m_preprocSequence;
-
- intIntMap m_shapeIDNumPrototypesMap;
- /**< @brief Map of shapeID and Number of Samples per shape
- * <p>
- *
- * </p>
- */
-
- int m_prototypeSetModifyCount;
- /**< @brief
- * <p>
- * Used to count number of modifications done to m_prototypeShapes.
- * Write to MDT after m_prototypeModifyCntCFG such modifications or at Exit.
- * </p>
- */
-
- int m_MDTUpdateFreq;
- /**< @brief Update MDT after a specified number of modifications to m_prototypeSet
- * <p>
- * Specified in ActiveDTW.cfg
- *
- * </p>
- */
-
- shapeFeature m_cachedShapeFeature;
- /**< @brief Store shapeFeature of the last inTraceGroup to Recognize
- * Used during subsequent call to Adapt
- * <p>
- *
- *
- * </p>
- */
-
- float m_rejectThreshold;
- /**< @brief Threshold on the confidence to reject a test sample
- * <p>
- *
- * </p>
- */
-
- bool m_adaptivekNN;
- /**< @brief Adaptive kNN method to compute confidence
- * <p>
- * If m_adaptivekNN = true, the adaptive kNN method is used for confidence computation
- * false, NN or kNN method is used, based on the value of m_nearestNeighbors
- * </p>
- */
-
- string m_currentVersion;
-
- string m_MDTFileOpenMode;
- /**< @brief File modes of the mdt file
- * <p>
- * If m_adaptivekNN = ascii, the mdt file is written in ascii mode
- * binary, the mdt file will be written in binary mode
- * Default: LTKPreprocDefaults::NN_MDT_OPEN_MODE_ASCII
- * </p>
- */
-
- //dtw obj for computing the dtw distance between features
- DynamicTimeWarping<LTKShapeFeaturePtr, float> m_dtwObj;
- /**< @brief Dynamic Time Warping Object
- * <p>
- * This object aids in calculating the dtw distance between two LTKShapeFeaturePtrs
- * and the distance is in float
- * </p>
- */
-
- //store the recognitioresults
- vector<LTKShapeRecoResult> m_vecRecoResult;
- /**< @brief Vector of LTKShapeRecoResult
- * <p>
- * This vector is used to store the confidence values computed using computeConfidence
- * </p>
- */
-
- //minimum numberOfSamples to form cluster
-
-
- public:
-
- /** @name Constructors and Destructor */
-
- /**
- * Constructor
- */
- ActiveDTWShapeRecognizer(const LTKControlInfo& controlInfo);
-
- /**
- * Destructor
- */
- ~ActiveDTWShapeRecognizer();
-
- //@}
-
- /**
- * This method initializes the ActiveDTW shape recognizer
- * <p>
- * Semantics
- * - Set the project name in ActiveDTWShapeRecognizer::headerInfo with the parameter passed.<br>
- * m_headerInfo[PROJNAME] = strProjectName;
- *
- * - Initialize ActiveDTWShapeRecognizer::m_activedtwCfgFilePath <br>
- * m_activedtwCfgFilePath = ActiveDTWShapeRecognizer::m_lipiRootPath + LTKMacros::PROJECTS_PATH_STRING +
- * strProjectName + LTKMacros::PROFILE_PATH_STRING + strProfileName +
- * LTKInc::SEPARATOR + LTKInc::ActiveDTW + LTKInc::CONFIGFILEEXT;
- *
- * - Initializes ActiveDTWShapeRecognizer::m_activedtwMDTFilePath <br>
- * m_activedtwMDTFilePath = ActiveDTWShapeRecognizer::m_lipiRootPath + LTKMacros::PROJECTS_PATH_STRING +
- * strProjectName + LTKMacros::PROFILE_PATH_STRING + strProfileName +
- * LTKInc::SEPARATOR + LTKInc::ActiveDTW + LTKInc::DATFILEEXT;
- *
- * - Initializes ActiveDTWShapeRecognizer::m_projectTypeDynamic with the value returned from LTKShapeRecoUtil::isProjectDynamic
- *
- * - Initialize the preprocessor using LTKShapeRecoUtil::initializePreprocessor and assign
- * default values for
- * -# Normalised size
- * -# Threshold size
- * -# Aspect ratio
- * -# Dot threshold
- *
- * - Initialize the recognizers instance variables with the values given in classifier config file.
- *
- * </p>
- * @param strProjectName : string : Holds the name of the Project
- * @param strProfileName : string : Holds the name of the Profile
- *
- * @return int : LTKInc::SUCCESS if initialization done successfully
- * errorValues if initialization has some errors
- *
- * @exception LTKErrorList::ECONFIG_FILE_OPEN Could not open project.cfg
- * @exception LTKErrorList::EINVALID_NUM_OF_SHAPES Negative value for number of shapes
- * @exception LTKErrorList::ELOAD_PREPROC_DLL Could not load preprocessor DLL
- * @exception LTKErrorList::EDLL_FUNC_ADDRESS_CREATE Could not map createPreprocInst
- * @exception LTKErrorList::EDLL_FUNC_ADDRESS_DELETE Could not map destroyPreprocInst
- */
-
- /**
- * This method calls the train method of the ActiveDTW classifier.
- *
- */
- int train(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string &comment,const string &dataset,
- const string &trainFileType=INK_FILE) ;
-
- /**
- * This method loads the Training Data of the ActiveDTW classifier.
- * @param
- * @return LTKInc::SUCCESS : if the model data was loaded successfully
- * @exception
- */
- int loadModelData();
-
- /**
- * This method unloads all the training data
- * @param none
- * @return LTKInc::SUCCESS : if the model data was unloaded successfully
- * @exception none
- */
- int unloadModelData();
-
- /**
- * This method sets the device context for the recognition
- *
- * @param deviceInfo The parameter to be set
- * @return
- * @exception
- */
- int setDeviceContext(const LTKCaptureDevice& deviceInfo);
-
- /**
- * Populates a vector of LTKShapeRecoResult consisting of top classes with their confidences.
- *
- * Semantics
- *
- * - Validate the input arguments
- * - Extract the features from traceGroup
- * - Compute the optimal deformation vectors for each class
- * - If the dtwEuclidean filter is on:
- * --Then for Clusters
- * -- Calculate the euclidean distances between the test samples and the optimal deformations
- * Accordingly populate the distFilter vector
- * --Then for singletons
- * --Calculate the euclidean distances between the test samples and the singletonVectors
- * Accordingly populate the distFilter vector
- * - Compute the dtw distances between the test sample and the optimal deformations and singletonVectors
- -- If the dtwEuclidean filter is on then calculate the dtw distances only
- to those deformations and singletonVectors recommended by the dtw euclidean filter
- * - Populate the distIndexPairVector with distances and shapeID
- * - Sort the distIndexPairVector based on the distances in ascending order
- * - Compute the confidences of the classes appearing in distIndexPairVector, call computeConfidence()
- * - Check if the first element of resultVector has confidence less than m_rejectThreshold, if so,
- empty the resultVector (reject the sample), log and return.
- * - If the confThreshold value was specified by the user (not equal to -1),
- delete the entries from resultVector with confidence values less than confThreshold.
- * - If the numChoices value was specified by the user (not equal to -1),
- update the resultVector with top numChoices entries, delete the other values.
- *
- * @param traceGroup The co-ordinates of the shape which is to be recognized
- * @param screenContext Contains information about the input field like whether it is boxed input
- * or continuous writing
- * @param subSetOfClasses A subset of the entire class space which is to be used for
- * recognizing the input shape.
- * @param confThreshold Classes with confidence below this threshold are not returned,
- * valid range of confThreshold: (0,1)
- * @param numOfChoices Number of top choices to be returned in the result structure
- * @param resultVector The result of recognition
- *
- * @return SUCCESS: resultVector populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int recognize(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector);
-
- /* Overloaded the above function to take vector<LTKShapeFeaturePtr> as
- * input
- */
- int recognize(const vector<LTKShapeFeaturePtr>& shapeFeatureVec,
- const vector<int>& inSubSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector);
-
- /**
- * In case of:
- * 1. Singleton Vectors: This method converts them to traceGroups
- * 2. Clusters: This method converts the cluster means to traceGroup
- * Semantics
- *
- * - Check if shapeID is valid, if not return error code
- * - Check if project is Dynamic, if not return ErrorCode
- * - Update PrototypeSet
- * - Update MDTFile
- *
- * @param shapeID : int : Holds shapeID
- * @param numberOfTraceGroups : int : Maximum number of Trace Groups to populate
- * @param outTraceGroups : vector<LTKTraceGroup> : TraceGroup
- *
- * @return SUCCESS: TraceGroup is populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int getTraceGroups(int shapeID, int numberOfTraceGroups, vector<LTKTraceGroup> &outTraceGroups);
-
-
-
- private:
- /**
- * This function is the train method using Clustering prototype selection technique.
- *
- *
- * Semantics
- *
- * - Note the start time for time calculations.
- *
- * - Create an instance of the feature extractor using ActiveDTWShapeRecognizer::initializeFeatureExtractorInstance() method
- *
- * - Call train method depending on the inFileType
- * - ActiveDTWShapeRecognizer::trainFromListFile() if inFileType = LTKMacros::INK_FILE
- * - ActiveDTWShapeRecognizer::trainFromFeatureFile() if inFileType = LTKMacros ::FEATURE_FILE
- *
- * - Update the headerInfo with algorithm version and name using ActiveDTWShapeRecognizer::updateHeaderWithAlgoInfo() method
- *
- * - Calculate the checksum.
- *
- * - Note the finish time for time calculations.
- *
- *
- * @param inputFilePath :string : Path of trainListFile / featureFile
- * @param strModelDataHeaderInfoFile : string : Holds the Header information of Model Data File
- * @param inFileType : string : Possible values ink / featureFile
- *
- * @return LTKInc::SUCCESS : if the training done successfully
- * @return errorCode : if it contains some errors
- */
- int trainClustering(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string& trainFileType);
-
-
- /**
- * This method do the map between the module name and function names from the cfg file
- *
- * Semantics
- *
- * - Read the Preprocess Sequence from the nn.cfg
- *
- * - Split the sequence into tokens with delimiter LTKMacros::DELEMITER_SEQUENCE using LTKStringUtil::tokenizeString
- *
- * - Split each token with delimiter LTKMacrosDELEMITER_FUNC using LTKStringUtil::tokenizeString
- * to get the Module name and Function name
- *
- * - Store the Module name and the Function name into a structure
- *
- *
- * @param none
- * @return LTKInc::SUCCESS : if functions are successfully mapped,
- * @return errorCodes : if contains any errors
- * @exception none
- */
- int mapPreprocFunctions();
-
- /**
- * This method will assign default values to the members
- *
- * Semantics
- *
- * - Assign Default values to all the data members
- *
- *
- * @param none
- *
- * @return none
- */
- void assignDefaultValues();
-
- /** Reads the ActiveDTW.cfg and initializes the instance variable of the classifier with the user defined
- * values.
- *
- * Semantics
- *
- * - Open the activedtw.cfg using LTKConfigFileReader
- *
- * - Incase of file open failure (activedtw.cfg), default values of the classifier parameters are used.
- *
- * - The valid values of the classifier parameters are cached in to the class data members.
- * LTKConfigFileReader::getConfigValue is used to get the value fora key defined in the config file
- *
- * - Exception is thrown if the user has specified an invalid valid for a parameter
- *
- *
- * @param none
- * @return SUCCESS : If the Config file read successfully
- * @return errorCode : If it contains some errors
- * @exception LTKErrorList::ECONFIG_FILE_RANGE The config file variable is not within the correct range
- */
- int readClassifierConfig();
-
- /**
- * This function serves as wrapper function to the Dtw distance computation function
- * (for use by clustering prototype selection)
- * @param train This is an input parameter and corresponds to the training character.
- * @param test This is an input parameter and corresponds to the testing character.
- */
- int computeDTWDistance(const LTKShapeSample& inFirstShapeSampleFeatures,
- const LTKShapeSample& inSecondShapeSampleFeatures,
- float& outDTWDistance);
-
- /**
- * computes the dtw distance between two shape feature vectors
- **/
- int computeDTWDistance(const vector<LTKShapeFeaturePtr>& inFirstFeatureVector,
- const vector<LTKShapeFeaturePtr>& inSecondFeatureVector,
- float& outDTWDistance);
- /**
- * This function serves as wrapper function to the Dtw distance computation function
- * (for use by recognize function)
- * @param train This is an input parameter and corresponds to the training character.
- * @param test This is an input parameter and corresponds to the testing character.
- */
-
-
- /**
- * Computes the euclidean distance between two shape Features
- **/
- int computeEuclideanDistance(const shapeFeature& inFirstFeature,
- const shapeFeature& inSecondFeature,
- float& outEuclideanDistance);
- /**
- * This function is used to compute the Euclidean distance between two shape Features
- * (for use by recognize when dtwEuclidean filter is on)
- * @param train This is an input parameter and corresponds to the training character.
- * @param test This is an input parameter and corresponds to the testing character.
- */
-
-
-
-
-
- /**
- * This method creates a custom feature extractor instance and stores it's address in
- * ActiveDTWShapeRecognizer::m_ltkFE. The local distance function pointer is also initialized.
- *
- * Semantics
- *
- *
- * - Intialize the ActiveDTWShapeRecognizer::m_ptrFeatureExtractor with address of the feature extractor instance created
- * using LTKShapeFeatureExtractorFactory::createFeatureExtractor
- *
- * - Cache the address of LTKShapeFeatureExtractor::getLocalDistance() in an instance variable
- *
- * @param none
- *
- * @return 0 on LTKInc::SUCCESS and 1 on LTKInc::FAILURE
- *
- * @exception none
- */
- int initializeFeatureExtractorInstance(const LTKControlInfo& controlInfo);
-
- /**
- * This method trains the classifier from the train list file whose path is passed as paramater.
- *
- * Semantics
- *
- * - Open the trainListFile for reading.
- *
- * - Open the mdt file for writing.
- *
- * - Write header information to the mdt file
- * - ActiveDTWShapeRecognizer::m_numShapes
- * - ActiveDTWShapeRecognizer::m_traceDimension
- * - ActiveDTWShapeRecognizer::m_flexibilityIndex
- *
- * - Get a valid line from the train list file
- * - Skip commented lines
- * - Skip lines where number_of_tokens != 2
- * - Throw error LTKErrorList::EINITSHAPE_NONZERO, if the first shape in the list file is not zero
- * - Throw error LTKErrorList::EINVALID_ORDER_LISTFILE if the shapes are not in sequential order
- *
- * - For every valid line get the ShapeSample from the ink file using ActiveDTWShapeRecognizer::getShapeSampleFromInkFile
- * - Read ink from UNIPEN ink file
- * - Skip if the trace group is empty
- * - Pre process the trace group read from the ink file
- * - Extract features
- *
- * - Push all the ShapeSamples corresponding to a shape into a vector of ShapeSample ShapeSamplesVec.
- *
- * - When all the ShapeSamples corresponding to a Shape have been collected, cluster them using ActiveDTWShapeRecognizer::performClustering
- *
- * - performClustering results in vector of clustered ShapeSamples.
- *
- * - computeCovarianceMatrix of clusters
- *
- * - computeEigenVectorsForLargeDimension for the covariance matrices of the clusters
- *
- * - construct shape models using cluster models and singletons
- *
- * - Append these clustered vector<ActiveDTWShapeModel> to the mdt file.
- *
- *
- * @param listFilePath : string : Holds the path for train list file
- * @param trainSet : ShapeSampleVector: Holds the ShapeSample for all shapes, used for LVQ only
- *
- * @return none
- *
- * @exception LTKErrorList::EFILE_OPEN_ERROR : Error in Opening a file (may be mdt file or list file)
- * @exception LTKErrorList::EINVALID_NUM_OF_SHAPES : Invalid value for number of shapes
- * @exception LTKErrorList::EINVALID_ORDER_LISTFILE: Invalid order of shapeId in List file
- * @exception LTKErrorList::EINITSHAPE_NONZERO : Initial shapeId must not be zero
- * @exception LTKErrorList::EEMPTY_EIGENVECTORS : Number of eigen vectors must be a positive number
- * @exception LTKErrorList::EINVALID_NUM_OF_EIGENVECTORS : Number of eigen vector must be a positive number
- */
-
- int trainFromListFile(const string& listFilePath);
-
- /**
- * This method will get the ShapeSample by giving the ink file path as input
- *
- * Semantics
- *
- * - Call the LTKShapeRecoUtil::readInkFromFile() method (Utility Method) to read the ink file
- * By reading this file, an inTraceGroup was generated
- *
- * - Preprocess the inTraceGroup and get the preprocessed trace group
- * LTKTraceGroup preprocessedTraceGroup
- *
- * - Extract features from the preprocessed trace group to get the ShapeSamples.
- *
- *
- * @param path : string : The path for Ink file
- * @param ShapeSample : ShapeSample : The ShapeSample generated after feature extraction
- *
- * @return SUCCESS : If the ShapeSample was got successfully
- * @return FAILURE : Empty traces group detected for current shape
- *
- * @exception LTKErrorList::EINKFILE_EMPTY : Ink file is empty
- * @exception LTKErrorList::EINK_FILE_OPEN : Unable to open unipen ink file
- * @exception LTKErrorList::EINKFILE_CORRUPTED : Incorrect or corrupted unipen ink file.
- * @exception LTKErrorList::EEMPTY_TRACE : Number of points in the trace is zero
- * @exception LTKErrorList::EEMPTY_TRACE_GROUP : Number of traces in the trace group is zero
- */
- int getShapeFeatureFromInkFile(const string& inkFilePath,
- vector<LTKShapeFeaturePtr>& shapeFeatureVec);
-
-
- /**
- * This method will do Custering for the given ShapeSamples
- *
- * Semantics
- *
- * - If the ActiveDTWShapeRecognizer::m_prototypeReductionFactor is -1 means Automatic clustering could be done
- *
- * - If the ActiveDTWShapeRecognizer::m_prototypeReductionFactor is 0 means No clustering was needed
- *
- * - Otherwise clustering is needed based on the value of ActiveDTWShapeRecognizer::m_prototypeReductionFactor
- *
- *
- *
- * @param ShapeSamplesVec : ShapeSampleVector : Holds all the ShapeSample for a single class
- * @param resultVector : int2DVector : Vector of indices of samples belonging to a cluster
- *
- * @return SUCCESS ; On successfully performing clustering
- * @return ErrorCode ; On some error
- * @exception none
- */
- int performClustering(const vector<LTKShapeSample>& shapeSamplesVec,
- int2DVector& outputVector);
-
- /**
- * This method computes the covariance matrix and the mean for a given feature matrix
- *
- * Semantics
- *
- * - Computes the mean of the feature matrix
- *
- * - Computes the mean corrected data
- *
- * - Computes the covariance matrix
- *
- *
- *
- * @param featureMatrix : double2DVector : Holds all the features of a cluster
- * @param covarianceMatrix : double2DVector : covariance matrix of the cluster
- * @param meanFeature : doubleVector : mean feature of the cluster
- *
- * @return SUCCESS ; On successfully computing the covariance matrix
- * @return ErrorCode ; On some error
- * @exception LTKErrorList:: EEMPTY_FEATUREMATRIX, Feature matrix is empty
- */
- int computeCovarianceMatrix(double2DVector& featureMatrix,
- double2DVector& covarianceMatrix,doubleVector& meanFeature);
-
- /**
- * compute the eigen vectors
- * for a covariance Matrix
- * @inparam covarianceMatrix,rank,nrot --> no of rotations
- * @outparam eigenValueVec, eigenVectorMatrix
- **/
- int computeEigenVectors(double2DVector &covarianceMatrix,const int rank,
- doubleVector &eigenValueVec, double2DVector &eigenVectorMatrix, int& nrot);
-
-
- /**
- * This method will Update the Header information for the MDT file
- *
- * Semantics
- *
- * - Copy the version number to a string
- *
- * - Update the version info and algoName to ActiveDTWShapeRecognizer::m_headerInfo, which specifies the
- * header information for MDT file
- *
- *
- * @param none
- *
- * @return none
-
- * @exception none
- */
- void updateHeaderWithAlgoInfo();
-
- int preprocess (const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outPreprocessedTraceGroup);
-
-
- /**
- * This append the shape model data to the mdt file
- *
- * Semantics
- *
- * - Append cluster models
- *
- * - Append singleton vectors
- *
- *
- *
- * @param shapeModel : ActiveDTWShapeModel : Holds clusters and singletons of a shape
- * @param mdtFileHandle : ofstream : file handle for the mdt file
- *
- * @return SUCCESS ; On successfully appending the data to mdt file
- * @return ErrorCode:
- * @exception LTKErrorList:: EINVALID_FILE_HANDLE, unable to open mdt file
- */
- int appendShapeModelToMDTFile(const ActiveDTWShapeModel& shapeModel,ofstream& mdtFileHandle);
-
- /**
- * find optimal deformation parameters using bound constrained optimization
- * here any third part library can be called
- * we will solve the equation
- * Min f(x)
- * Subject to: lb <= x <= ub
- * where lb -- lower bound ub --- upper bound
- **/
-
- /**
- * This solves the optimization problem and finds the deformation parameters
- * It constructs the optimal deformation, the sample in the cluster closest to the test sample
- * Semantics
- *
- * - Solve the optimization problem
- * Min f(x)
- * Subject to: lb <= x <= ub
- * where lb -- lower bound ub --- upper bound
- *
- *
- *
- * @param eigenValues : doubleVector : eigen values of a cluster
- * @param eigenVector : double2DVector : eigen vectorsof a cluster
- * @param clusterMean : doubleVector : mean of the cluster
- * @param testSample : doubleVector : test sample
- * @param deformationParameters : doubleVector : parameters required to construct the optimal deformation
- *
- * @return SUCCESS ; On successfully appending the data to mdt file
- * @return ErrorCode:
- * @exception LTKErrorList:: EEMPTY_EIGENVALUES, eigen values are empty
- * @exception LTKErrorList:: EEMPTY_EIGENVECTORS, eigen vectors are empty
- * @exception LTKErrorList:: EEMPTY_CLUSTERMEAN, cluster mean is empty
- * @exception LTKErrorList:: ENUM_EIGVALUES_NOTEQUALTO_NUM_EIGVECTORS, number of eigen value is not equal to the number of eigen vectors
- * @exception LTKErrorList:: EEMPTY_EIGENVECTORS, eigen vectors are empty
- */
- int findOptimalDeformation(doubleVector& deformationParameters,doubleVector& eigenValues, double2DVector& eigenVector,
- doubleVector& clusterMean, doubleVector& testSample);
-
- static void getDistance(const LTKShapeFeaturePtr& f1,const LTKShapeFeaturePtr& f2, float& distance);
-
-
- /**
- * This method computes the confidences of test sample belonging to various classes
- *
- * Semantics
- *
- * - Compute the confidence based on the values of m_nearestNeighbors and m_adaptiveKNN
- * - Populate the resultVector
- * - Sort the resultVector
- * -
- *
- * @param distIndexPairVector : vector<struct NeighborInfo>: Holds the samples, classIDs and distances to the test sample
- * @param resultVector : vector<LTKShapeRecoResult> : Holds the classIDs and the respective confidences
- *
- * @return SUCCESS: resultVector populated
- * FAILURE: return ErrorCode
- * @exception none
- */
- int computeConfidence();
-
- /**
- * The comparison function object of STL's sort() method, overloaded for class LTKShapeRecoResult, used to sort the vector of LTKShapeRecoResult based on the member variable confidence
- *
- * Semantics
- *
- * - Check if the first object's confidence value is greater than the second object's confidence value
- * - Return true or false
- * -
- *
- * @param x : LTKShapeRecoResult : First object for comparison
- * @param y : LTKShapeRecoResult : Second object for comparison
- *
- * @return true: If x.confidence > y.confidence
- * false: If x.confidence <= y.confidence
- * @exception none
- */
- static bool sortResultByConfidence(const LTKShapeRecoResult& x, const LTKShapeRecoResult& y);
-
- static bool compareMap( const map<int, int>::value_type& lhs, const map<int, int>::value_type& rhs );
-
- int mapFeatureExtractor();
-
- int deleteFeatureExtractorInstance();
- /**
- * This method extracts shape features from given TraceGroup
- *
- * Semantics
- *
- * - PreProcess tracegroup
- * - Extract Features
- *
- * @param inTraceGroup : LTKTraceGroup : Holds TraceGroup of sample
- *
- * @return SUCCESS: if shapeFeatures is populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
-
- int extractFeatVecFromTraceGroup(const LTKTraceGroup& traceGroup,
- vector<LTKShapeFeaturePtr>& featureVec);
-
-
- /** This method is used to initialize the PreProcessor
- *
- * Semantics
- *
- * - Load the preprocessor DLL using LTKLoadDLL().
- *
- * - Get the proc address for creating and deleting the preprocessor instance.
- *
- * - Create preprocessor instance.
- *
- * - Start the logging for the preprocessor module.
- *
- * @param preprocDLLPath : string : Holds the Path of the Preprocessor DLL,
- * @param errorStatus : int : Holds SUCCESS or Error Values, if occurs
- * @return preprocessor instance
- *
- * @exception ELOAD_PREPROC_DLL Could not load preprocessor DLL
- * @exception EDLL_FUNC_ADDRESS_CREATE Could not map createPreprocInst
- * @exception EDLL_FUNC_ADDRESS_DELETE Could not map destroyPreprocInst
- */
- int initializePreprocessor(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocInstance);
-
- /** This method is used to deletes the PreProcessor instance
- *
- * Semantics
- *
- * - Call deleteLTKPreprocInst from the preproc.dll.
- *
- * - Unload the preprocessor DLL.
- *
- * @param ptrPreprocInstance : Holds the pointer to the LTKPreprocessorInterface
- * @return none
- * @exception none
- */
-
- int deletePreprocessor();
-
- /** This method is used to Unloads the preprocessor DLL.
- *
- * Semantics
- *
- * - If m_libHandler != NULL, unload the DLL
- * LTKUnloadDLL(m_libHandler);
- * m_libHandler = NULL;
- *
- * @param none
- * @return none
- * @exception none
- */
- int unloadPreprocessorDLL();
-
- /**< @brief Pointer to LTKOSUtil interface
- * <p>
- *
- * </p>
- */
- LTKOSUtil* m_OSUtilPtr;
-
- int validatePreprocParameters(stringStringMap& headerSequence);
-
- /**
- * Computes the eigen values and eigen vectors of the larger covariance matrix using the
- * a smaller covariance matrix
- *
- * Semantics
- *
- * - Compute the smaller covariance matrix, using meanCorrectedData(Transpose)*meanCorrectedData(Transpose)
- *
- * - Compute the eigen vectors of the smaller covariance matrix
- *
- * - Determine the number of eigen vectors, depending on the eigen energy to be retained
- *
- * - Compute the eigen vectors of the larger covariance matrix
- *
- * - Normalizing the eigen vectors
- *
- *
- *
- * @param meanCorrectedData : double2DVector : mean corrected data
- * @param covarianceMatrix : double2DVector : covariance matrix of the corresponding mean corrected data
- * @param eigenValues : doubleVector : output selected eigen values
- * @param eigenVector : double2DVectorr : output selected eigen vectors
- *
- * @return SUCCESS ; On successfully computing eigen values and eigen vectors
- * @return ErrorCode:
- * @exception LTKErrorList:: EEMPTY_MEANCORRECTEDDATA, empty mean corrected data
- * @exception LTKErrorList:: EEMPTY_COVARIANCEMATRIX, empty covariance matrix
- */
- int computeEigenVectorsForLargeDimension(double2DVector& meanCorrectedData,double2DVector& covarianceMatrix,
- double2DVector& eigenVector,doubleVector& eigenValues);
-
- /**
- * This converts the double vector to a feature vector
- * It constructs the optimal deformation, the sample in the cluster closest to the test sample
- *
- *
- * @param featureVec : doubleVector : input double feature vector
- * @param shapeFeatureVec : vector<LTkShapeFeaturePtr> : output feature vector
- *
- * @return SUCCESS ; On successfully conversion
- * @return ErrorCode:
- * @exception LTKErrorList:: EINVALID_INPUT_FORMAT
- */
- int convertDoubleToFeatureVector(vector<LTKShapeFeaturePtr>& shapeFeatureVec,doubleVector& featureVec);
-
-
-};
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/CMakeLists.txt
deleted file mode 100644
index 0d80c7e0..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# Generated from activedtw.pro.
-
-#####################################################################
-## activedtw Generic Library:
-#####################################################################
-
-qt_add_cmake_library(activedtw
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- ActiveDTW.cpp ActiveDTW.h
- ActiveDTWAdapt.cpp ActiveDTWAdapt.h
- ActiveDTWClusterModel.cpp ActiveDTWClusterModel.h
- ActiveDTWShapeModel.cpp ActiveDTWShapeModel.h
- ActiveDTWShapeRecognizer.cpp ActiveDTWShapeRecognizer.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- ../featureextractor/common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(activedtw)
-
-#### Keys ignored in scope 1:.:.:activedtw.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(activedtw CONDITION WIN32
- DEFINES
- ACTIVEDTW_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(activedtw CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(activedtw)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg
deleted file mode 100644
index 142470cf..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.cfg
+++ /dev/null
@@ -1,422 +0,0 @@
-#------------------------------------------------------------------------------
-# activedtw.cfg
-#
-# Configuration file for Active-DTW Classification Method for
-# Lipi Toolkit 4.0.0
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# The standard format for the configuration entries is the name of the
-# configuration parameter seperated by an equal to sign and then the value of
-# the configuration parameter. For example:
-# ConfigurationEntryName = value
-#
-# Lines starting with a # are commnet lines
-#
-# A cfg entry is strictly a key value pair and leaving the key without the
-# value or specification of a value out of the range is not permitted
-#
-# If a cfg entry is not specified at all, then default values are used by the
-# recognizer
-#------------------------------------------------------------------------------
-
-#-------------------------------
-# PREPROCESSING
-#-------------------------------
-
-#-------------------------------------------------------------------------------
-# ResampTraceDimension
-#
-# Description: The number of target points for resampling. In other words,
-# each character will be resampled to this number of points. In case of
-# multistroke characters, this number of points will be distributed between
-# the strokes in proportion to their lengths in proportion to their initial
-# number of points.
-#
-# Valid values: Any integer > 0
-# Units: Points
-# Default value: 60
-# Typical value: Average number of points per character in the training data set.
-#-------------------------------------------------------------------------------
-ResampTraceDimension = 60
-
-
-
-#-------------------------------------------------------------------------------
-# ResampPointAllocation
-#
-# Description: Method to be used for point allocation among different strokes
-# during resampling. Two schemes have been implemented lengthbased and point
-# based. In lengthbased allocation scheme, the number of points allocated to
-# each stroke is proportional to the length of the stroke. Length of a stroke
-# is calculated as the sum of the distances between each point in the stroke.
-# In the pointbased allocation scheme, the target stroke point allocation is
-# proportional to the number of points in the initial stroke.
-#
-# Valid value: [lengthbased | pointbased]
-# Default value: lengthbased
-#-------------------------------------------------------------------------------
-ResampPointAllocation = lengthbased
-
-
-#-------------------------------------------------------------------------------
-# NormDotSizeThreshold
-#
-# Description: This threshold is used to determine whether a character is a dot.
-# It is expressed in real length terms (inches) and converted internally to
-# points using knowledge of the device�s spatial resolution. If the width
-# and height are both less than this threshold, then all the points are replaced
-# with the center of the of the normalized character, basically to represent it
-# as a dot
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormDotSizeThreshold = 0.01
-
-#-------------------------------------------------------------------------------
-# NormLineWidthThreshold
-#
-# Description: This threshold is used to detect whether the character is a
-# vertical or horizontal line. If only the height is less than this threshold
-# then the character is detected as a horizontal line and if only the width is
-# less than this threshold then the character is detected as a vertical line.
-# Assuming the height is along the y-dimension and width is along the x-
-# dimension, during normalization of a horizontal line only the x-coordinates
-# are scaled and the y-coordinates are translated to the center of the character,
-# with out scaling. Similarly for the vertical line only the y-coordinates are
-# normalized and the x-coordinates are translated to the center with out scaling
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormLineWidthThreshold = 0.01
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatio
-#
-# Description: This parameter is used to indicate whether the aspect ratio
-# has to be preserved during normalization. The aspect ratio is the calculated
-# as maximum of (height/width , width/height). The aspect ratio is preserved only
-# if the calculated aspect ratio is greater than the threshold value specified
-# through NormPreserveAspectRatioThreshold and this configuration variable is
-# set to true. If this configuration variable is set to false the aspect ratio
-# is not preserved during normalization.
-#
-# Valid value: [true | false]
-# Default value: true
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatio = true
-
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatioThreshold
-#
-# Description: Aspect ratio is preserved during normalization if the computed
-# aspect ratio (max(height/width, width/height)) is greater than this threshold
-# and the configuration value NormPreserveAspectRatio is set to true. During
-# aspect ratio preserving normalization, the larger of the two dimensions is
-# normalized to the standard size and the other dimension is normalized
-# proportional to the initial height and width ratio, so that the initial
-# aspect ratio is maintained.
-#
-# Valid values: Any real number >= 1
-# Default value: 3
-# Typical value: >= 1.5
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatioThreshold = 3
-
-#-------------------------------------------------------------------------------
-# NormPreserveRelativeYPosition
-#
-# Description: The relative Y position is the mean of the y-coordinates in the
-# input character. During normalization if this parameter is set to true, each
-# y-coordinate of the character point is translated by the initial y-mean value,
-# so that the mean of the y-coordinates remains the same before and after
-# normalization. This is typically used in the word recognition context where
-# each stroke of the character has to be normalized separately and the relative
-# position of the strokes should be maintained even after normalization.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NormPreserveRelativeYPosition = false
-
-#-------------------------------------------------------------------------------
-# SmoothWindowSize
-#
-# Description: The configuration value specifies the length of the moving
-# average filter (size of the window) for smoothing the character image.
-# If this value is set to N, then each point in the input character is replaced
-# by the average of value of this point, (N-1)/2 points on the right and (N-1)/2
-# on the left of this point.
-#
-# Valid value: Any integer > 0
-# Units: Points
-# Typical value: 5
-# Default value: 3
-#-------------------------------------------------------------------------------
-SmoothWindowSize = 3
-
-#-------------------------------------------------------------------------------
-# NNPreprocSequence
-#
-# Description: This variable is used to specify the sequence of preprocessing
-# operations to be carried out on the input character sample before extracting
-# the features. A valid preprocessing sequence can consist of combination of one
-# or more of the functions selected from the valid values set mentioned below.
-# The CommonPreProc prefix is used specify the default preprocessing module of
-# LipiTk. The user can add his own preprocessing functions in other modules and
-# specify them in the preprocessing sequence.
-#
-# Valid values: Any sequence formed from the following set
-# CommonPreProc::normalizeSize;
-# CommonPreProc::removeDuplicatePoints;
-# CommonPreProc::smoothenTraceGroup;
-# CommonPreProc::dehookTraces;
-# CommonPreProc::normalizeOrientation;
-# CommonPreProc::resampleTraceGroup;
-# Default value: {CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-#-------------------------------------------------------------------------------
-PreprocSequence={CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-
-#---------------------------------------
-# TRAINING
-#---------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeSelectionMethod
-#
-# Description: This is used to specify the prototype selection method to be used
-# while training the shape recognizer. When set to hier-clustering, the
-# prototypes are selected using hierarchical clustering method.
-#
-# Valid value: [hier-clustering]
-# Default value: hier-clustering
-#-------------------------------------------------------------------------------
-NNTrainPrototypeSelectionMethod=hier-clustering
-
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeReductionFactorPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This config parameter is used to specify the amount of the
-# initial prototypes to be excluded during prototype selection.
-# Set it to automatic if the number of clusters is to be determined
-# automatically. Set it to none if no prototype selection is required. If the
-# value of this parameter is set to a number between 1-100, say 25, then 75%
-# (i.e 100-25) of the initial training data are retained as prototypes.
-# This parameter can be specified only if the NNTrainNumPrototypesPerClass
-# is not specified.
-#
-# Valid value: [automatic | none | any real number from 0-100]
-# Default value: automatic
-#-------------------------------------------------------------------------------
-NNTrainPrototypeReductionFactorPerClass = 25
-
-#-------------------------------------------------------------------------------
-# NNTrainNumPrototypesPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This is used to specify the number of prototypes to be selected
-# from the training data. This parameter can be specified only if
-# PrototypeReductionFactor is not specified. This config entry is commented as
-# only one of NNTrainPrototypeReductionFactorPerClass or
-# NNTrainNumPrototypesPerClass can be active in a valid cfg file.
-#
-# Valid value: [automatic | none | any integer from 1-N]
-# (N is the number of samples # per class)
-# Default value: automatic
-#-------------------------------------------------------------------------------
-#NNTrainNumPrototypesPerClass=100
-
-# Note: Only one of either PrototypeReductionFactor or NumClusters can be
-# enabled at any particular instance
-
-#-------------------------------------------------------------------------------
-# ActiveDTWRetainPercentEigenEnergy
-#
-# Description: This config parameter is used to specify the amount of Eigen
-# energy to be included to select the number of eigen vectors
-#
-# Valid value: [any integer from 0-100]
-#
-# Default value: 90
-#-------------------------------------------------------------------------------
-ActiveDTWRetainPercentEigenEnergy= 90
-
-#-------------------------------------------------------------------------------
-# ActiveDTWMinClusterSize
-#
-# Description: This config parameter is used to specify the minimum number
-# of samples required to form a cluster
-#
-# Valid value: [any postive integer > 1]
-#
-# Default value: 2
-#-------------------------------------------------------------------------------
-ActiveDTWMinClusterSize = 2
-
-#-----------------------------------------
-# FEATURE EXTRACTION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# FeatureExtractor
-#
-# Description: The configuration value is used to specify the feature extraction
-# module to be used for feature extraction. The point float feature extraction
-# module extracts the x,y,cosine and sine angle features at every point of the
-# character.
-#
-# Valid value: [PointFloatShapeFeatureExtractor]
-# Default value: PointFloatShapeFeatureExtractor
-#-------------------------------------------------------------------------------
-FeatureExtractor=PointFloatShapeFeatureExtractor
-
-#-----------------------------------------
-# RECOGNITION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNRecoDTWEuFilterOutputSize
-#
-# Description: This config parameter is used to set the proportion of nearest
-# cluster or singleton vectors from a class (filtered based on euclidean distance)
-# to be considered for calculating deformations or dtw distance. Set to 100 if
-# all clusters or singletons are to be considered for calculating dtw distance.
-# This is mainly used to increase the speed of recognition.
-#
-# Valid value: [all | any number from 1-100]
-# Default Value: all
-#-------------------------------------------------------------------------------
-NNRecoDTWEuFilterOutputSize = 30
-
-#-------------------------------------------------------------------------------
-# ActiveDTWEigenSpreadValue
-#
-# Description: This value is used to configure the range of values the
-# bound constraint optimization algorithm will take to calculate the
-# optimal deformation sample
-# Valid value: [greater than 0| default = 16]
-#-------------------------------------------------------------------------------
-ActiveDTWEigenSpreadValue = 16
-
-#-------------------------------------------------------------------------------
-# ActiveDTWUseSingleton
-#
-# Description: This value is used to configure whether singleton vectors
-# from classes will be taken into consideration during the recognition
-# process
-# Valid value: [true | false]
-# Default Value: true
-#-------------------------------------------------------------------------------
-ActiveDTWUseSingleton = true
-
-#-------------------------------------------------------------------------------
-# NNRecoRejectThreshold
-#
-# Description: Threshold to reject the test sample. If the confidence obtained
-# for the recognition of test sample is less than this threshold then the test
-# sample is rejected.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.001
-#-------------------------------------------------------------------------------
-NNRecoRejectThreshold = 0.001
-
-#-------------------------------------------------------------------------------
-# NNRecoNumNearestNeighbors
-#
-# Description: Number of nearest neighbors to be considered during recognition
-# and computation of confidence. If the value is set to 1, nearest neighbor
-# classifier is used, otherwise k-nearest neighbor or Adaptive k-nearest
-# neighbor classifiers are used. By default, nearest neighbor classifier is used.
-#
-# Valid value: Any integer >= 1
-# Default value: 1
-#-------------------------------------------------------------------------------
-NNRecoNumNearestNeighbors = 1
-
-#-------------------------------------------------------------------------------
-# NNRecoUseAdaptiveKNN
-#
-# Description: This parameter is used to specify whether Adaptive k-nearest
-# neighbor recognizer (A-kNN) is to be used. If set to true, A-kNN recognizer is
-# used, otherwise kNN recognizer is used. The A-kNN recognizer automatically
-# determines the number of nearest neighbors to be considered for recognition in
-# each class. If NNRecoNumNearestNeighbors is set to 1, this parameter is
-# automatically set to false and the manually set value will not be considered.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NNRecoUseAdaptiveKNN = false
-
-#--------------------------------------------
-# ADAPTATION
-#--------------------------------------------
-
-#-------------------------------------------------------------------------------
-# ActiveDTWMaxClusterSize
-#
-# Description: This config parameter is used to specify the maximum number
-# of samples a cluster is permitted to have
-#
-# Valid value: [any postive integer > 1 And Greater than ActiveDTWMinClusterSize]
-#
-# Default value: 2
-#-------------------------------------------------------------------------------
-ActiveDTWMaxClusterSize = 30
-
-#--------------------------------------------
-# COMMON FOR TRAINING AND RECOGNITION
-#--------------------------------------------
-
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the banding radius
-# to be used for DTW computation. This is used to speed up the computation
-# process. If this value is zero no banding is done. The value is specified as
-# fraction of ResampTraceDimension to be used while computing the DTW
-# distance.
-#
-# Valid values: Any real number > 0 and <= 1
-# Default Value: 0.33
-#-------------------------------------------------------------------------------
-NNDTWBandingRadius=0.33
-
-#-------------------------------------------------------------------------------
-#ActiveDTWMDTFileUpdateFreq
-#
-# Description: This configuration parameter specifies the number of iterations after
-# which MDT file is to be updated.
-# Every call to addClass or deleteClass will add/delete the given class. These
-# in-memory changes will be reflected in nn.mdt only after the specified
-# number of such iterations and on application exit.
-#
-# Valid values: Any integer > 0
-# Default value: 5
-# Typical value: 5
-#-------------------------------------------------------------------------------
-ActiveDTWMDTFileUpdateFreq = 100
-
-#-------------------------------------------------------------------------------
-# NNMDTFileOpenMode
-#
-# Description: This configuration parameter specifies the mode for
-# opening the mdt file.
-#
-# Valid values: ascii, binary
-# Default Value: ascii
-#-------------------------------------------------------------------------------
-
-NNMDTFileOpenMode=ascii
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro
deleted file mode 100644
index 255c5512..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/activedtw/activedtw.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-LIPILIBS = shaperecommon ltkcommon ltkutil featureextractorcommon
-include(../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../util/lib \
- ../featureextractor/common \
- ../common \
-
-HEADERS += \
- ActiveDTW.h \
- ActiveDTWAdapt.h \
- ActiveDTWClusterModel.h \
- ActiveDTWShapeModel.h \
- ActiveDTWShapeRecognizer.h \
-
-SOURCES += \
- ActiveDTW.cpp \
- ActiveDTWShapeRecognizer.cpp\
- ActiveDTWClusterModel.cpp \
- ActiveDTWShapeModel.cpp \
- ActiveDTWAdapt.cpp \
-
-win32 {
- DEFINES += ACTIVEDTW_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = ActiveDTW.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/CMakeLists.txt
deleted file mode 100644
index 1ae4f285..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Generated from common.pro.
-
-#####################################################################
-## shaperecommon Generic Library:
-#####################################################################
-
-qt_add_cmake_library(shaperecommon
- STATIC
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/lib"
- SOURCES
- LTKShapeRecoConfig.cpp
- LTKShapeRecoResult.cpp
- LTKShapeRecoUtil.cpp
- LTKShapeRecognizer.cpp
- LTKShapeSample.cpp
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../featureextractor/common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(shaperecommon)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(shaperecommon CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp
deleted file mode 100644
index 8ff31c80..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoConfig.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 11:00:11 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 832 $
- * $Author: dineshm $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKShapeRecoConfig which holds the configuration information read
- * from the configuration files
- *
- * CONTENTS:
- * readConfigInfo
- * getLipiRoot
- * getShapeSet
- * getProfile
- * getShapeRecognizerName
- * getNumberOfShapes
- * setLipiRoot
- * setShapeSet
- * setProfile
- * setShapeRecognizerName
- * setNumShapes
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKShapeRecoConfig.h"
-#include "LTKErrorsList.h"
-#include "LTKLoggerUtil.h"
-#include "LTKErrors.h"
-#include "LTKShapeRecoConfig.h"
-#include "LTKException.h"
-#include "LTKConfigFileReader.h"
-#include "LTKMacros.h"
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKShapeRecoConfig
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKShapeRecoConfig::LTKShapeRecoConfig()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered default constructor of LTKShapeRecoConfig" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting default constructor of LTKShapeRecoConfig" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKShapeRecoConfig
-* DESCRIPTION : Constructor initializing the member variables
-* ARGUMENTS : lipiRoot - root directory of the Lipi Tool Kit
-* shapeSet - shape set to be used for training/recognition
-* profile - profile to be used for training/recognition
-* shapeRecognizerName - name of the shape recognizer to be used for training/recognition
-* numShapes - number of shapes in the recognition problem
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-LTKShapeRecoConfig::LTKShapeRecoConfig(const string& lipiRoot, const string& shapeSet,
- const string& profile, const string& shapeRecognizerName, int numShapes) :
- m_lipiRoot(lipiRoot), m_shapeSet(shapeSet), m_profile(profile),
- m_shapeRecognizerName(shapeRecognizerName), m_numShapes(numShapes)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered initialization constructor of LTKShapeRecoConfig" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_lipiRoot = " << m_lipiRoot << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_shapeSet = " << m_shapeSet << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_profile = " << m_profile << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_shapeRecognizerName = " << m_shapeRecognizerName << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_numShapes = " << m_numShapes << endl;
-
- int errorCode;
- if(m_numShapes <= 0)
- {
- errorCode = EINVALID_NUM_OF_SHAPES;
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Invalid value for number of shapes :" << m_numShapes << endl;
-
- throw LTKException(errorCode);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting initialization constructor of LTKShapeRecoConfig" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : readConfig
-* DESCRIPTION : Reads the configuration files
-* ARGUMENTS : configFile - name of the main configuration file
-* RETURNS : SUCCESS on successful reading of the configuration file
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-int LTKShapeRecoConfig::readConfigInfo(const string& configFile)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::readConfig" << endl;
-
- string shapeSetCfg; // shape set configuration file
-
- string profileCfg; // profile configuration file
-
- LTKConfigFileReader* mainProperties; // main config file name value pairs
-
- LTKConfigFileReader* shapesetProperties; // shapeset config name value pairs
-
- LTKConfigFileReader* profileProperties; // profile config name value pairs
-
- // reading the main configuration file
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Main configuration file is " << configFile << endl;
-
- mainProperties = new LTKConfigFileReader(configFile);
-
- LOG( LTKLogger::LTK_LOGLEVEL_INFO) <<
- "Main configuration read" << endl;
-
- // setting config information
-
- mainProperties->getConfigValue("shapeset", m_shapeSet);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "shapeSet = " << m_shapeSet << endl;
-
- mainProperties->getConfigValue("profile", m_profile);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "profile = " << m_profile << endl;
-
- // composing the shape set configuration file name
-
- shapeSetCfg = m_lipiRoot + SEPARATOR + m_shapeSet + SEPARATOR + SHAPESETFILE;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Shapeset configuration file is " << shapeSetCfg << endl;
-
- // reading the shape set configuration file
-
- shapesetProperties = new LTKConfigFileReader(shapeSetCfg);
-
- LOG( LTKLogger::LTK_LOGLEVEL_INFO) <<
- "Shapeset configuration read" << endl;
-
- // setting config information
- string numShapesStr;
- shapesetProperties->getConfigValue(PROJECT_CFG_ATTR_NUMSHAPES_STR, numShapesStr);
- m_numShapes = atoi(numShapesStr.c_str());
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_numShapes = " << m_numShapes << endl;
-
- if(m_numShapes <= 0)
- {
- delete mainProperties;
- delete shapesetProperties;
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Invalid value for number of shapes : " << m_numShapes << endl;
-
- LTKReturnError(EINVALID_NUM_OF_SHAPES); // Error while reading project.cfg
-
- //throw LTKException("numShapes cannot be less than or equal to zero");
- }
-
- // composing the proile configuration file name
-
- profileCfg = m_lipiRoot + SEPARATOR + m_shapeSet + SEPARATOR + m_profile + SEPARATOR + PROFILEFILE;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Profile configuration file is " << profileCfg << endl;
-
- // reading the profile configuration file
-
- profileProperties = new LTKConfigFileReader(profileCfg);
-
- LOG( LTKLogger::LTK_LOGLEVEL_INFO) << "Profile configuration read" << endl;
-
- // setting config information
-
- profileProperties->getConfigValue(SHAPE_RECOGNIZER_STRING, m_shapeRecognizerName);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_shapeRecognizerName = " << m_shapeRecognizerName << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting LTKShapeRecoConfig::readConfig" << endl;
-
- delete mainProperties;
- delete shapesetProperties;
- delete profileProperties;
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getLipiRoot
-* DESCRIPTION : returns the root directory of the lipi tool kit
-* ARGUMENTS :
-* RETURNS : root directory of the lipi tool kit
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-const string& LTKShapeRecoConfig::getLipiRoot()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::getLipiRoot" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::getLipiRoot with return value " <<
- m_lipiRoot << endl;
-
- return m_lipiRoot;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getShapeSet
-* DESCRIPTION : returns the shape set to be used for training/recognition
-* ARGUMENTS :
-* RETURNS : shape set to be used for training/recognition
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-const string& LTKShapeRecoConfig::getShapeSet()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::getShapeSet" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::getShapeSet with return value " <<
- m_shapeSet << endl;
-
- return m_shapeSet;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getProfile
-* DESCRIPTION : returns the profile to be used for training/recognition
-* ARGUMENTS :
-* RETURNS : profile to be used for training/recognition
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-const string& LTKShapeRecoConfig::getProfile()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::getProfile" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::getProfile with return value " <<
- m_profile << endl;
-
- return m_profile;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getShapeRecognizerName
-* DESCRIPTION : returns the name of the shape recognizer being used
-* ARGUMENTS :
-* RETURNS : name of the shape recognizer being used
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-const string& LTKShapeRecoConfig::getShapeRecognizerName()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::getShapeRecognizerName" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::getShapeRecognizerName with return value " <<
- m_shapeRecognizerName << endl;
-
- return m_shapeRecognizerName;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getNumShapes
-* DESCRIPTION : returns the number of shapes in the recognition problem
-* ARGUMENTS :
-* RETURNS : number of shapes in the recognition problem
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-int LTKShapeRecoConfig::getNumShapes()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::getNumShapes" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::getNumShapes with return value " << m_numShapes << endl;
-
- return m_numShapes;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setLipiRoot
-* DESCRIPTION : sets the root directory of the lipi tool kit
-* ARGUMENTS : lipiRootStr - root directory of the lipi tool kit
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-int LTKShapeRecoConfig::setLipiRoot(const string& lipiRootStr)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::setLipiRoot" << endl;
-
- this->m_lipiRoot = lipiRootStr;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_lipiRoot = " << m_lipiRoot << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::setLipiRoot" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setShapeSet
-* DESCRIPTION : sets the shape set to be used for training/recognition
-* ARGUMENTS : shapeSetStr - shape set to be used for training/recognition
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKShapeRecoConfig::setShapeSet(const string& shapeSetStr)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::setShapeSet" << endl;
-
- this->m_shapeSet = shapeSetStr;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_shapeSet = " << m_shapeSet << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::setShapeSet" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setProfile
-* DESCRIPTION : sets the profile to be used for training/recognition
-* ARGUMENTS : profileStr - profile to be used for training/recognition
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKShapeRecoConfig::setProfile(const string& profileStr)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::setProfile" << endl;
-
- this->m_profile = profileStr;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_profile = " << m_profile << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::setProfile" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setShapeRecognizerName
-* DESCRIPTION : sets the name of the shape recognizer to be used for training/recognition
-* ARGUMENTS : shapeRecognizerName - name of the shape recognizer to be used for training/recognition
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-int LTKShapeRecoConfig::setShapeRecognizerName(const string& shapeRecognizerName)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::setShapeRecognizerName" << endl;
-
- this->m_shapeRecognizerName = shapeRecognizerName;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_shapeRecognizerName = " << m_shapeRecognizerName << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::setShapeRecognizerName" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setNumShapes
-* DESCRIPTION : sets the number of shapes in the recongition problem
-* ARGUMENTS : numShapes - number of shapes in the recongition problem
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-int LTKShapeRecoConfig::setNumShapes(int numShapes)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered LTKShapeRecoConfig::setNumShapes" << endl;
-
- this->m_numShapes = numShapes;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_numShapes = " << m_numShapes << endl;
-
- if(m_numShapes <= 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Invalid value for number of shapes : " << m_numShapes << endl;
-
- LTKReturnError(EINVALID_NUM_OF_SHAPES)
- //return ECONFIG_FILE_OPEN_ERR; // Error while reading project.cfg
-
- //throw LTKException("m_numShapes cannot be less than or equal to zero");
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKShapeRecoConfig::setNumShapes" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKShapeRecoConfig
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* ************************************************************************************/
-
-LTKShapeRecoConfig::~LTKShapeRecoConfig()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entered destructor of LTKShapeRecoConfig" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting destructor of LTKShapeRecoConfig" << endl;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp
deleted file mode 100644
index 746d45dc..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoResult.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
- * $Revision: 827 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKShapeRecoResult which holds the recognition results of the
- * shape recognition engine
- *
- * CONTENTS:
- * getShapeID
- * getConfidence
- * setShapeID
- * setConfidence
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKInc.h"
-
-#include "LTKMacros.h"
-
-#include "LTKErrors.h"
-
-#include "LTKErrorsList.h"
-
-#include "LTKShapeRecoResult.h"
-
-#include "LTKLoggerUtil.h"
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKShapeRecoResult
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKShapeRecoResult::LTKShapeRecoResult()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoResult::LTKShapeRecoResult()" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoResult::LTKShapeRecoResult()" <<endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKShapeRecoResult
-* DESCRIPTION : Constructor initializing the member variables
-* ARGUMENTS : shapeId - shape id of the result
-* confidence - its corresponding confidence value
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKShapeRecoResult::LTKShapeRecoResult(int shapeId, float confidence) : m_shapeId(shapeId),
- m_confidence(confidence)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoResult::LTKShapeRecoResult(int, float)" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoResult::LTKShapeRecoResult(int, float)" <<endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getShapeId
-* DESCRIPTION : returns the shape id of the result
-* ARGUMENTS :
-* RETURNS : shape id of the result
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKShapeRecoResult::getShapeId() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoResult::getShapeId()" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoResult::getShapeId()" <<endl;
- return m_shapeId;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getConfidence
-* DESCRIPTION : returns the confidence value of the result
-* ARGUMENTS :
-* RETURNS : confidence value of the result
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-float LTKShapeRecoResult::getConfidence() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoResult::getConfidence()" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoResult::getConfidence()" <<endl;
- return m_confidence;
-}
-
-/**********************************************************************************
- * AUTHOR : Balaji R.
- * DATE : 23-DEC-2004
- * NAME : setShapeId
- * DESCRIPTION : sets the shape id of the result
- * ARGUMENTS : shapeId - shape id of the result
- * RETURNS : SUCCESS on successful set function
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- *************************************************************************************/
-
-int LTKShapeRecoResult::setShapeId(int shapeId)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoResult::setShapeId()" <<endl;
-
- if(shapeId < 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- getErrorMessage(EINVALID_CLASS_ID)<<
- " LTKShapeRecoResult::setShapeId()" <<endl;
-
- LTKReturnError(EINVALID_CLASS_ID);
- }
- this->m_shapeId = shapeId;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoResult::setShapeId()" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Balaji R.
- * DATE : 23-DEC-2004
- * NAME : setConfidence
- * DESCRIPTION : sets the confidence of the result
- * ARGUMENTS : confidenceVal - confidence of the result
- * RETURNS : SUCCESS on successful set function
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- *************************************************************************************/
-
-int LTKShapeRecoResult::setConfidence(float confidenceVal)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoResult::setConfidence()" <<endl;
-
- if( confidenceVal < 0 || confidenceVal > 1)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- getErrorMessage(EINVALID_CONFIDENCE_VALUE)<<
- " LTKShapeRecoResult::setShapeId()" <<endl;
-
- LTKReturnError(EINVALID_CONFIDENCE_VALUE);
- }
-
- this->m_confidence = confidenceVal;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoResult::setConfidence()" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Balaji R.
- * DATE : 23-DEC-2004
- * NAME : ~LTKShapeRecoResult
- * DESCRIPTION : destructor
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- *************************************************************************************/
-
-LTKShapeRecoResult::~LTKShapeRecoResult()
-{
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp
deleted file mode 100644
index 2d944d0c..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecoUtil.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
-* FILE DESCR: Implementation for LTKShapeRecoUtil
-*
-* CONTENTS:
-* getAbsolutePath
-* isProjectDynamic
-* initializePreprocessor
-* deletePreprocessor
-* unloadPreprocessor
-* readInkFromFile
-* checkEmptyTraces
-* shapeFeatureVectorToFloatVector
-* shapeFeatureVectorToIntVector
-*
-* AUTHOR: Saravanan R.
-*
-* DATE: January 23, 2004
-* CHANGE HISTORY:
-* Author Date Description of change
-************************************************************************/
-
-#ifdef _WIN32
-#include "windows.h"
-#endif
-
-#include "LTKInc.h"
-#include "LTKLoggerUtil.h"
-#include "LTKTrace.h"
-#include "LTKMacros.h"
-#include "LTKErrors.h"
-#include "LTKException.h"
-#include "LTKErrorsList.h"
-#include "LTKInkFileReader.h"
-#include "LTKTraceGroup.h"
-#include "LTKStringUtil.h"
-#include "LTKConfigFileReader.h"
-#include "LTKShapeRecoUtil.h"
-#include "LTKShapeFeatureExtractor.h"
-#include "LTKShapeFeature.h"
-#include "LTKPreprocessorInterface.h"
-
-
-//FN_PTR_DELETE_SHAPE_FTR_PTR LTKShapeRecoUtil::m_deleteShapeFeatureFunc = NULL;
-
-/**********************************************************************************
-* AUTHOR : Saravanan. R
-* DATE : 11-01-2007
-* NAME : LTKShapeRecoUtil
-* DESCRIPTION : Constructor
-* ARGUMENTS : None
-* RETURNS : None
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-LTKShapeRecoUtil::LTKShapeRecoUtil()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entered LTKShapeRecoUtil::LTKShapeRecoUtil()" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoUtil::LTKShapeRecoUtil()" <<endl;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 31-01-2007
- * NAME : LTKShapeRecoUtil
- * DESCRIPTION : Destructor
- * ARGUMENTS : None
- * RETURNS : None
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-LTKShapeRecoUtil::~LTKShapeRecoUtil()
-{
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 11-01-2007
- * NAME : getAbsolutePath
- * DESCRIPTION : This method is used to convert the relative path to the absolute path
- * ARGUMENTS : pathName : string : Holds the path of the training file
- * lipiRootPath : string : Holds the lipiroot path
- *
- * RETURNS : SUCCESS only
- * NOTES :
- * CHANGE HISTROY
- * Author Date Descriptionh
- *************************************************************************************/
-int LTKShapeRecoUtil::getAbsolutePath (const string& inputPath,
- const string& lipiRootPath,
- string& outPath)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entered LTKShapeRecoUtil::getAbsolutePath()" <<endl;
-
- outPath = "";
- vector<string> tokens;
-
- int returnStatus = SUCCESS;
-
- //Split the path name into number of tokens based on the delimter
- returnStatus = LTKStringUtil::tokenizeString(inputPath, "\\/", tokens);
-
- if(returnStatus != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Error: " <<
- getErrorMessage(returnStatus) <<
- " LTKShapeRecoUtil::getAbsolutePath()" <<endl;
-
- LTKReturnError(returnStatus);
- }
-
- //The first token must be the $LIPI_ROOT. Otherwise return from the function
- if (tokens[0] != LIPIROOT)
- {
- outPath = inputPath;
- return SUCCESS;
- }
-
- //Store the Environment variable into the tokens
- tokens[0] = lipiRootPath;
-
- //Reinitialize the outPath
- for(int i=0 ; i < tokens.size() ; i++)
- {
- outPath += tokens[i] + SEPARATOR;
- }
-
- // Erase the last character '\'
- outPath.erase(outPath.size()-1,1);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoUtil::getAbsolutePath()" <<endl;
-
- return SUCCESS;
-}
-
-
-/***********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 19-01-2007
- * NAME : isProjectDynamic
- * DESCRIPTION : This method reads the project.cfg to find whether the project
- * is dynamic or not
- * ARGUMENTS : configFilePath : string : Holds the path of the project.cfg
- * numShapes : unsigned short : Holds the NumShapes value from config file
- * returnStauts : int : Holds SUCCESS or ErrorValues
- * strNumShapes : string : Holds the NumShapes value from config file
- * RETURNS : true : if the project was dynamic
- * false : if the project was dynamic
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int LTKShapeRecoUtil::isProjectDynamic(const string& configFilePath,
- unsigned short& numShapes,
- string& strNumShapes,
- bool& outIsDynamic )
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoUtil::isProjectDynamic()" <<endl;
-
- //Specifies the project is dynamic or not
- outIsDynamic = false;
-
- string numShapesCfgAttr = "";
-
- //As numshapes was unsigned short we use this tempNumShapes as integer,
- //it is used for checking whether it is less than 0
- int tempNumShapes = 0;
- LTKConfigFileReader* projectCfgAttrs = NULL;
- string valueFromCFG = "0";
-
- int errorCode = SUCCESS;
-
- try
- {
- //Read the config entries
- projectCfgAttrs = new LTKConfigFileReader(configFilePath);
- errorCode = projectCfgAttrs->getConfigValue(PROJECT_CFG_ATTR_NUMSHAPES_STR, numShapesCfgAttr);
-
- //Checking whether the numshapes was dynamic
- if(errorCode != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- "NumShapes should be set to dynamic or the number of training classes" <<
- " LTKShapeRecoUtil::isProjectDynamic()" <<endl;
-
- LTKReturnError(errorCode);
-
- }
- else if( LTKSTRCMP(numShapesCfgAttr.c_str(), DYNAMIC) == 0 )
- {
- //Numshapes was dynamic
- outIsDynamic = true;
- tempNumShapes = 0;
- }
- else
- {
- bool isPositiveInteger=true;
-
- valueFromCFG = numShapesCfgAttr;
-
- for(int charIndex=0 ; charIndex < valueFromCFG.size() ; ++charIndex)
- {
- if(!(valueFromCFG[charIndex]>='0' && valueFromCFG[charIndex]<='9'))
- {
- isPositiveInteger=false;
- break;
- }
- }
-
-
-
- if(!isPositiveInteger)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error" <<
- "NumShapes should be set to dynamic or the number of training classes" <<
- " LTKShapeRecoUtil::isProjectDynamic()" <<endl;
-
- LTKReturnError(EINVALID_NUM_OF_SHAPES);
- }
- else
- {
- tempNumShapes = atoi(valueFromCFG.c_str());
- if(tempNumShapes==0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error" <<
- "NumShapes should be set to dynamic or the number of training classes" <<
- " LTKShapeRecoUtil::isProjectDynamic()" <<endl;
-
- LTKReturnError(EINVALID_NUM_OF_SHAPES);
- }
- else
- {
- //Numshapes was not dynamic
- outIsDynamic = false;
- }
-
- }
-
- }
-
- numShapes = tempNumShapes;
- strNumShapes = valueFromCFG;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "NumShapes in the project is " << valueFromCFG <<endl;
-
-
- }
- catch(LTKException e)
- {
- delete projectCfgAttrs;
- throw e;
- }
-
- delete projectCfgAttrs;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoUtil::isProjectDynamic()" <<endl;
-
- return SUCCESS;
-}
-
-
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 30-01-2007
- * NAME : readInkFromFile
- * DESCRIPTION : This method reads the Ink file and check from empty traces
- * ARGUMENTS : string : Holds the Path of the unipen ink file
-string : Holds the Path of the lipi root
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int LTKShapeRecoUtil::readInkFromFile(const string& path, const string& lipiRootPath,
- LTKTraceGroup& inTraceGroup,
- LTKCaptureDevice& captureDevice,
- LTKScreenContext& screenContext)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoUtil::readInkFromFile()" <<endl;
-
- //inTraceGroup.emptyAllTraces();
-
- string tempPath = path;
-
- //Check and convert Relative path to Absolute path
- string outPath = "";
- getAbsolutePath(tempPath, lipiRootPath, outPath);
-
- //Print the path name
- cout << outPath << endl;
-
- //Read Ink file to inTraceGroup
- // errorVal = LTKInkFileReader::readUnipenInkFile(tempPath,inTraceGroup,captureDevice,screenContext);
- int errorCode = LTKInkFileReader::readUnipenInkFile(outPath,inTraceGroup,captureDevice,screenContext);
-
- if (errorCode != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- getErrorMessage(errorCode) <<
- " LTKShapeRecoUtil::readInkFromFile()" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- //Check for empty traces in inTraceGroup
-
- if (inTraceGroup.containsAnyEmptyTrace())
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Error: " <<
- "TraceGroup has empty traces" <<
- " LTKShapeRecoUtil::readInkFromFile()" <<endl;
-
- LTKReturnError(EEMPTY_TRACE);
- }
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoUtil::readInkFromFile()" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 30-01-2007
- * NAME : checkEmptyTraces
- * DESCRIPTION : This method checks for empty traces
- * ARGUMENTS : inTraceGroup : LTKTraceGroup :
- * RETURNS : 1 if it contains empty trace group, 0 otherwise
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-/*
-int LTKShapeRecoUtil::checkEmptyTraces(const LTKTraceGroup& inTraceGroup)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoUtil::checkEmptyTraces()" <<endl;
-
- int returnVal = SUCCESS;
-
- vector<LTKTrace> tracesVec = inTraceGroup.getAllTraces(); //traces in trace group
-
- int numTraces = tracesVec.size();
-
- int numTracePoints = 0;
-
- LTKTrace trace; // a trace of the trace group
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "numTraces = " << numTraces <<endl;
-
-
- for(int traceIndex=0; traceIndex < numTraces; ++traceIndex)
- {
- trace = tracesVec.at(traceIndex);
-
- numTracePoints=trace.getNumberOfPoints();
-
- if(numTracePoints==0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- getError(EEMPTY_TRACE) <<
- "Exiting LTKShapeRecoUtil::checkEmptyTraces()" <<endl;
- LTKReturnError(EEMPTY_TRACE);
- }
-
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoUtil::checkEmptyTraces()" <<endl;
- return SUCCESS;
-}
-*/
-int LTKShapeRecoUtil::convertHeaderToStringStringMap(const string& header, stringStringMap& headerSequence)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecoUtil::convertHeaderToStringStringMap()" <<endl;
-
- vector<string> tokens;
- vector<string> strList;
-
- int returnStatus = SUCCESS;
-
- LTKStringUtil::tokenizeString(header, "<>", tokens);
-
- for(int i=0 ; i < tokens.size(); ++i)
- {
- returnStatus = LTKStringUtil::tokenizeString(tokens[i], "=", strList);
- if(returnStatus != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- getErrorMessage(returnStatus) <<
- " LTKShapeRecoUtil::convertHeaderToStringStringMap()" <<endl;
- LTKReturnError(returnStatus);
- }
- if(strList.size() == 2)
- {
- headerSequence[strList[0]] = strList[1];
- }
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecoUtil::convertHeaderToStringStringMap()" <<endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Saravanan. R
-* DATE : 14-03-2007
-* NAME : shapeFeatureVectorToFloatVector
-* DESCRIPTION : This method converts the ShapeFeatureVector to float vector
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int LTKShapeRecoUtil::shapeFeatureVectorToFloatVector(const vector<LTKShapeFeaturePtr>& shapeFeature,
- floatVector& outFloatVector)
-{
- int returnVal = SUCCESS;
-
- //Iterators for the LTKShapeFeature
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIter = shapeFeature.begin();
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIterEnd = shapeFeature.end();
-
-
- vector<float> shapeFeatureFloatvector;
-
- for(; shapeFeatureIter != shapeFeatureIterEnd; ++shapeFeatureIter)
- {
-
- //Convert the shapefeature to float vector
- returnVal = (*shapeFeatureIter)->toFloatVector(shapeFeatureFloatvector);
-
- if ( returnVal != SUCCESS )
- {
- break;
- }
-
- outFloatVector.insert(outFloatVector.end(),
- shapeFeatureFloatvector.begin(),
- shapeFeatureFloatvector.end());
-
- shapeFeatureFloatvector.clear();
-
- }
-
- return returnVal;
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp
deleted file mode 100644
index bed1ca48..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeRecognizer.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-30 15:57:38 +0530 (Wed, 30 Jul 2008) $
- * $Revision: 576 $
- * $Author: kuanish $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKShapeRecognizer which would be used as a place holder in LTKShapeRecognizer
- * for anyone of the implemented shape recognizers like PCAShapeRecognizer which is derived from this class
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKShapeRecognizer.h"
-#include "LTKLoggerUtil.h"
-#include "LTKException.h"
-#include "LTKErrorsList.h"
-#include "LTKErrors.h"
-#include "LTKInc.h"
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKShapeRecognizer
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKShapeRecognizer::LTKShapeRecognizer() : m_cancelRecognition(false)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecognizer::LTKShapeRecognizer()" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecognizer::LTKShapeRecognizer()" <<endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKShapeRecognizer
-* DESCRIPTION : Initializes the member(s) of the class
-* ARGUMENTS : shapeRecognzierName - name of the derived shape recognizer which is being held
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKShapeRecognizer::LTKShapeRecognizer(const string& shapeRecognzierName) : m_shapeRecognizerName(shapeRecognzierName), m_cancelRecognition(false)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecognizer::LTKShapeRecognizer(const string&)" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecognizer::LTKShapeRecognizer(const string&)" <<endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 07-JUN-2007
-* NAME : AddCLass
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKShapeRecognizer::addClass(const LTKTraceGroup& sampleTraceGroup,int& shapeID)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecognizer::addClass()" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- getErrorMessage(ESHAPE_RECOCLASS_NOIMPLEMENTATION) <<
- " LTKShapeRecognizer::addClass()" <<endl;
-
- LTKReturnError(ESHAPE_RECOCLASS_NOIMPLEMENTATION);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecognizer::addClass()" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR :
-* DATE :
-* NAME : AddSample
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKShapeRecognizer::addSample(const LTKTraceGroup& sampleTraceGroup,int shapeID)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecognizer::AddSample()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- getErrorMessage(ESHAPE_RECOCLASS_NOIMPLEMENTATION) <<
- " LTKShapeRecognizer::AddSample()" <<endl;
-
- LTKReturnError(ESHAPE_RECOCLASS_NOIMPLEMENTATION);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecognizer::AddSample()" <<endl;
-
- return SUCCESS;
-}
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 07-JUN-2007
-* NAME : Delete Class
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKShapeRecognizer::deleteClass(int shapeID)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecognizer::deleteClass()" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- getErrorMessage(ESHAPE_RECOCLASS_NOIMPLEMENTATION) <<
- " LTKShapeRecognizer::deleteClass()" <<endl;
-
- LTKReturnError(ESHAPE_RECOCLASS_NOIMPLEMENTATION);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecognizer::deleteClass()" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-AUG-2007
-* NAME : Adapt
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKShapeRecognizer::adapt(int shapeID )
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecognizer::adapt()" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- getErrorMessage(ESHAPE_RECOCLASS_NOIMPLEMENTATION) <<
- " LTKShapeRecognizer::adapt()" <<endl;
-
- LTKReturnError(ESHAPE_RECOCLASS_NOIMPLEMENTATION);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecognizer::adapt()" <<endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-AUG-2007
-* NAME : Adapt
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKShapeRecognizer::adapt(const LTKTraceGroup& sampleTraceGroup, int shapeID)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeRecognizer::adapt(const LTKTraceGroup&, int)" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " <<
- getErrorMessage(ESHAPE_RECOCLASS_NOIMPLEMENTATION) <<
- " LTKShapeRecognizer::adapt()" <<endl;
-
- LTKReturnError(ESHAPE_RECOCLASS_NOIMPLEMENTATION);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeRecognizer::adapt(const LTKTraceGroup&, int)" <<endl;
-
- return SUCCESS;
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKShapeRecognizer
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKShapeRecognizer::~LTKShapeRecognizer()
-{
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp
deleted file mode 100644
index 4044c86f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-07-01 20:12:22 +0530 (Wed, 01 Jul 2009) $
- * $Revision: 784 $
- * $Author: mnab $
- *
- ************************************************************************/
-#include "LTKShapeSample.h"
-
-#include "LTKShapeFeature.h"
-
-#include "LTKRefCountedPtr.h"
-
-#include "LTKLoggerUtil.h"
-
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : LTKShapeSample
- * DESCRIPTION : Default Constructor
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-
-LTKShapeSample::LTKShapeSample()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample::LTKShapeSample()" <<endl;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample::LTKShapeSample()" <<endl;
-
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : LTKShapeSample
- * DESCRIPTION : Copy Constructor
- * ARGUMENTS : sampleFeatures - LTKShapeSample to be copied
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-
-LTKShapeSample::LTKShapeSample(const LTKShapeSample& sampleFeatures)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample::LTKShapeSample(const LTKShapeSample& )" <<endl;
-
- m_featureVector = sampleFeatures.m_featureVector;
- m_classId = sampleFeatures.m_classId;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample::LTKShapeSample(const LTKShapeSample& )" <<endl;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : operator=
- * DESCRIPTION : Overloaded assignment operator
- * ARGUMENTS : sampleFeatures - LTKShapeSample to be assigned to
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-
-LTKShapeSample& LTKShapeSample::operator=(const LTKShapeSample& sampleFeatures)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample::operator=(const LTKShapeSample& )" <<endl;
-
- if ( this != &sampleFeatures )
- {
- m_featureVector = sampleFeatures.m_featureVector;
- m_classId = sampleFeatures.m_classId;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample::operator=(const LTKShapeSample& )" <<endl;
- return *this;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : ~LTKShapeSample
- * DESCRIPTION : destructor
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-
-LTKShapeSample::~LTKShapeSample()
-{
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : setFeatureVector
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-void LTKShapeSample::setFeatureVector(const vector<LTKShapeFeaturePtr>& inFeatureVec)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample:setFeatureVector()" <<endl;
-
- m_featureVector = inFeatureVec;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample:setFeatureVector()" <<endl;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : setClassID
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-void LTKShapeSample::setClassID(int inClassId)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample:setClassID()" <<endl;
-
- m_classId = inClassId;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample:setClassID()" <<endl;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : getFeatureVector
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-const vector<LTKShapeFeaturePtr>& LTKShapeSample::getFeatureVector() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample:getFeatureVector()" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample:getFeatureVector()" <<endl;
-
- return m_featureVector;
-}
-
-/**********************************************************************************
- * AUTHOR : The Qt Company
- * DATE : 17-Mar-2015
- * NAME : getFeatureVectorRef
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-vector<LTKShapeFeaturePtr>& LTKShapeSample::getFeatureVectorRef()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample:getFeatureVectorRef()" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample:getFeatureVectorRef()" <<endl;
-
- return m_featureVector;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 22-Mar-2007
- * NAME : getClassID
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ************************************************************************************/
-int LTKShapeSample::getClassID() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample:getClassID()" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample:getClassID()" <<endl;
-
- return m_classId;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 28-Nov-2007
- * NAME : clearShapeSampleFeatures
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ****************************************************************************/
-void LTKShapeSample::clearShapeSampleFeatures()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample:clearShapeSampleFeatures()" <<endl;
-
- m_featureVector.clear();
- m_classId = -1;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample:clearShapeSampleFeatures()" <<endl;
-}
-/**************************************************************************
- * AUTHOR : Balaji MNA
- * DATE : 30-June-2009
- * NAME : getCountStrokes
- * DESCRIPTION : get strokes count
- * ARGUMENTS : NONE
- * RETURNS : return number of strokes
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description of change
- * ****************************************************************************/
-int LTKShapeSample::getCountStrokes() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKShapeSample::getCountStrokes()" <<endl;
-
- int countStrokes = 0;
-
- vector<LTKShapeFeaturePtr>::const_iterator featureIter = m_featureVector.begin();
- vector<LTKShapeFeaturePtr>::const_iterator featureEnd = m_featureVector.end();
-
- for(; featureIter != featureEnd; ++featureIter)
- {
- if ((*featureIter)->isPenUp())
- ++countStrokes;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKShapeSample::getCountStrokes()" <<endl;
-
- return countStrokes;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h
deleted file mode 100644
index 02ec1f7f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/LTKShapeSample.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-07-01 16:41:37 +0530 (Wed, 01 Jul 2009) $
- * $Revision: 783 $
- * $Author: mnab $
- *
- ************************************************************************/
-#ifndef __LTKSHAPESAMPLE_H
-#define __LTKSHAPESAMPLE_H
-
-#include "LTKInc.h"
-
-#include "LTKShapeFeatureMacros.h"
-
-class LTKShapeFeature;
-
-
-class LTKShapeSample
-{
- private:
- vector<LTKShapeFeaturePtr> m_featureVector;
- int m_classId;
-
- public:
- /** @name Constructors and Destructor */
- //@{
-
- /**
- * Default Constructor.
- */
-
- LTKShapeSample();
-
- /**
- * Copy Constructor
- */
- LTKShapeSample(const LTKShapeSample& shapeFeatures);
-
- /**
- * Destructor
- */
- ~LTKShapeSample();
- //@}
-
- /**
- * @name Assignment operator
- */
- //@{
-
- /**
- * Assignment operator
- * @param shapeFeatures The object to be copied by assignment
- *
- * @return LTKShapeSample object
- */
-
- LTKShapeSample& operator=(const LTKShapeSample& shapeFeatures);
- //@}
-
- /**
- * @name Getter Functions
- */
- //@{
-
-
- /**
- * @brief getter method for feature vector
- * @param none
- * @return featureVec Type : LTKShapeFeaturePtrtor
- */
- const vector<LTKShapeFeaturePtr>& getFeatureVector() const;
-
-
- /**
- * @brief getter method for feature vector
- * @param none
- * @return featureVec Type : LTKShapeFeaturePtrtor
- */
- vector<LTKShapeFeaturePtr>& getFeatureVectorRef();
-
-
- /**
- * @brief setter method for class ID
- * @param none
- * @return classID Type : int
- */
- int getClassID() const;
- //@}
-
-
- /**
- * @name Setter Functions
- */
- //@{
-
- /**
- * @brief setter method for feature vector
- * @param featureVec Type : LTKShapeFeaturePtrtor
- */
- void setFeatureVector(const vector<LTKShapeFeaturePtr>& inFeatureVec);
-
-
- /**
- * @brief setter method for class ID
- * @param classID Type : int
- */
- void setClassID(int inClassId);
- //@}
-
- /**
- * @brief setter method for strokes count
- * @param none
- * @return strokes count Type : int
- */
- int getCountStrokes() const;
-
- void clearShapeSampleFeatures();
-
- //Since pointer is a member variable we should implement constructor, copy-constructor, assignment operator, virtual destructor
-};
-
-#endif
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro
deleted file mode 100644
index b4cdbcd5..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/common/common.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-BASE_TARGET_NAME = shaperecommon
-include(../../../lipilib.pri)
-
-INCLUDEPATH += \
- ../../../util/lib \
- ../featureextractor/common \
-
-SOURCES += \
- LTKShapeRecoConfig.cpp \
- LTKShapeRecognizer.cpp \
- LTKShapeRecoResult.cpp \
- LTKShapeRecoUtil.cpp \
- LTKShapeSample.cpp
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/CMakeLists.txt
deleted file mode 100644
index 90611f5b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated from featureextractor.pro.
-
-add_subdirectory(common)
-add_subdirectory(l7)
-add_subdirectory(npen)
-add_subdirectory(pointfloat)
-add_subdirectory(substroke)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/CMakeLists.txt
deleted file mode 100644
index dc74d7e3..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated from common.pro.
-
-#####################################################################
-## featureextractorcommon Generic Library:
-#####################################################################
-
-qt_add_cmake_library(featureextractorcommon
- STATIC
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/lib"
- SOURCES
- LTKShapeFeatureExtractor.cpp
- LTKShapeFeatureExtractorFactory.cpp
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(featureextractorcommon)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(featureextractorcommon CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h
deleted file mode 100644
index c233d3c5..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeature.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
- * $Revision: 827 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: function prototype for the LTKShapeFeature class
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: 07-FEB-2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKSHAPEFEATURE_H
-#define __LTKSHAPEFEATURE_H
-#include "LTKTypes.h"
-#include "LTKException.h"
-#include "LTKErrorsList.h"
-#include "LTKMacros.h"
-#include "LTKErrors.h"
-#include "LTKShapeFeatureMacros.h"
-
-/**
- * \defgroup feature_extractor The feature extractor module
- * <p>
- * The feature extractor module consists of following directories
- * - common
- * - Builds as a static library called <b> featureextractorcommon.lib</b>
- *
- * - Various feature extractors viz PointFloatShapeFeatureExtractor
- * - These feature extractor are built as DLLs
- *
- * User can specify the feature extractor name in the classifier config file
- * and the corresponding extractor is instantiated at run-time.
- *
- * </p>
- */
-
-/** @ingroup feature_extractor
-* @brief An abstract class that defines the interface for a class representing a feature.
-* @class LTKShapeFeature
-* The LTKShapeFeature is the abstract base class. Any class representing a shape feature
-* is derived from the LTKShapeFeature class.
-*/
-class LTKShapeFeature
-{
-public:
- /** @name Constructors and Destructor */
- //@{
-
- /**
- * Default Constructor.
- */
-
- LTKShapeFeature(){};
-
- /**
- * Virtual destructor.
- */
- virtual ~LTKShapeFeature()
- {
- };
- //@}
-
- /** @Purely cirtual functions */
- //@{
-
- /**
- * <b>Responsibility</b><br>
- * This function initializes the instance of type LTKShapeFeature using the initialization string
- * passed as parameter.
- *
- * @param initString : string& : reference to the initialization string.
- */
-
- virtual int initialize(const string& initString)=0;
-
- virtual int initialize(const floatVector& initFloatVector)=0;
-
- virtual int initialize(floatVector::const_pointer initFloatData, size_t dataSize) { (void)initFloatData; (void)dataSize; return SUCCESS; }
-
- /**
- * <b>Responsibility</b><br>
- * This function returns the character (char*) representation for the instance of type LTKShapeFeature.
- *
- * @param p1 : char* : Pointer to the character array.
- */
-
- virtual void toString(string& strFeat) const =0;
-
- /**
- * <b>Responsibility</b><br>
- * Creates a new instance of type LTKShapeFeature and initializes it with the calling instance.
- *
- * @param none.
- *
- * @return LTKShapeFeature* Pointer to the LTKShapeFeature instance
- */
-
- virtual LTKShapeFeaturePtr clone() const =0;
-
- /**
- * <b>Responsibility</b><br>
- * Returns the distance between two instances of LTKShapeFeature.
- *
- * @param shapeFeaturePtr : LTKShapeFeature* : Pointer to LTKShapeFeature
- *
- * @return distance (float) Distance between two instances of LTKShapeFeature class.
- */
-
- virtual void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const = 0;
-
- //@}
-
- /**
- * <b>Responsibility</b><br>
- * Returns the representation of LTKShapeFeature instance as a vetor of floats.
- *
- * @param floatVec : vector<float>& : Reference to the vector of floats.
- *
- * @return FAILURE If no implementation is provided by the derived class
- */
- virtual int toFloatVector(vector<float>& floatVec) { return FAILURE; }
-
- /**
- * <b>Responsibility</b><br>
- * Returns the representation of LTKShapeFeature instance as a vetor of integers.
- *
- *
- * @param intVec : vector<float>& : Reference to the vector of integers.
- *
- * @return FAILURE If no implementation is provided by the derived class
- */
- virtual int toIntVector(vector<int>& intVec) { return FAILURE; }
-
- //ADAPTATION REQUIREMENTS
-
- /**
- * <b>Responsibility</b><br>
- * Adds two instances of type LTKShapeFeature.
- *
- * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature
- *
- * @return LTKShapeFeature* : The pointer to LTKShapeFeature holding the result of adding
- *
- * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class
- */
-
- virtual int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const
- {
- LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
- }
-
- /**
- * <b>Responsibility</b><br>
- * Subtract two instances of LTKShapeFeature.
- *
- *
- * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature
- *
- * @return LTKShapeFeature* : The pointer to LTKShapeFeature holding the result of subtraction
- *
- * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class
- */
-
- virtual int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const
- {
- LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
- }
-
- /**
- * <b>Responsibility</b><br>
- * Scales the instance of LTKShapeFeature by the floating point number alpha passed as parameter.
- *
- *
- * @param secondFeature : LTKShapeFeature* : Pointer to LTKShapeFeature
- *
- * @return LTKShapeFeature* : The pointer to scaled LTKShapeFeature
- *
- * @exception LTKErrorsList::EFTR_RPRCLASS_NOIMPLEMENTATION If no implementation is provided by the derived class
- */
-
- virtual int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
- {
- LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
- }
-
- virtual int getFeatureDimension() = 0;
-
- virtual bool isPenUp() const
- {
- LTKReturnError(EFTR_RPRCLASS_NOIMPLEMENTATION);
- }
-
-};
-
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp
deleted file mode 100644
index 1b4e9532..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2007-05-14 13:35:33 +0530 (Mon, 14 May 2007) $
- * $Revision: 92 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKShapeFeatureExtractor which would be used as
- * a place holder in LTKShapeFeatureExtractor
- * for anyone of the implemented feature extractor
- * which is derived from this class
- *
- * CONTENTS:
- *
- * AUTHOR:
- *
- * DATE:
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKShapeFeatureExtractor.h"
-#include "LTKErrorsList.h"
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 07-Aug-2007
-* NAME : convertToTraceGroup
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKShapeFeatureExtractor::convertFeatVecToTraceGroup(
- const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup)
-{
-
- return(EFTR_RPRCLASS_NOIMPLEMENTATION);
-
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h
deleted file mode 100644
index 51ab4b57..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractor.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Function prototype for feature extraction module
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: 07-FEB-2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKFEATUREEXTRACTOR_H
-#define __LTKFEATUREEXTRACTOR_H
-
-
-#include "LTKTypes.h"
-#include "LTKShapeFeatureMacros.h"
-
-// Forward class declarations
-class LTKTraceGroup;
-class LTKShapeFeature;
-
-/**
-* @ingroup feature_extractor
-* @brief An abstract class which is extended by all the feature extractors.
-* @class LTKShapeFeatureExtractor
-*
-*/
-class LTKShapeFeatureExtractor
-{
-public:
- /**
- * <b>Responsibility</b><br>
- * Extract features from the input TraceGroup passed a parameter.
- *
- * <b>Description</b>
- * <p>
- * Every feature representation class has a feature extractor associated with it. The feature extractor
- * extracts the features from the trace group passed as parameter.
- * </p>
- *
- * <p>This function is based on run-time polymorphism.
- * The pointer to the derived class instances are stored in a vector of base class (<i>LTKShapeFeature</i>) pointers.
- * </p>
- *
- * @return Pointer to the vector of LTKShapeFeature pointers.
- */
- virtual int extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec)=0;
-
- /**
- * <b>Responsibility</b><br>
- * Returns the instance of the shape feature class associated with the feature extractor.
- *
- * @return Pointer to the shape feature class.
- *
- */
- virtual LTKShapeFeaturePtr getShapeFeatureInstance()=0;
-
-
- /**
- * <b>Responsibility</b><br>
- * Constructs traceGroup based on input LTKShapeFeaturePtr
- *
- * @return Pointer to Trace Group.
- *
- */
- virtual int convertFeatVecToTraceGroup(
- const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup);
-};
-
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp
deleted file mode 100644
index 07fa2adc..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-06-25 16:40:26 +0530 (Thu, 25 Jun 2009) $
- * $Revision: 778 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
-* FILE DESCR: Implementation for LTKFeatureExtractor factory class
-*
-* CONTENTS:
-* createFeatureExtractor
-*
-* AUTHOR: Nidhi Sharma
-*
-* DATE: December 23, 2004
-* CHANGE HISTORY:
-* Author Date Description of LTKShapeFeatureExtractorFactory
-************************************************************************/
-#include "LTKShapeFeatureExtractorFactory.h"
-#include "LTKMacros.h"
-#include "LTKErrorsList.h"
-#include "LTKException.h"
-#include "LTKLoggerUtil.h"
-#include "LTKErrors.h"
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-
-/*************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 07-FEB-2007
-* NAME : createFeatureExtractor
-* DESCRIPTION : create method of a factory class
-* ARGUMENTS :
-* RETURNS : Pointer to the instance of LTKShapeFeatureExtractor
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of LTKFeatureExtractor
-*****************************************************************************/
-
-LTKShapeFeatureExtractorFactory::LTKShapeFeatureExtractorFactory()
-{
-}
-
-/***********************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 07-FEB-2007
-* NAME : createFeatureExtractor
-* DESCRIPTION : create method of a factory class
-* ARGUMENTS :
-* RETURNS : Pointer to the instance of LTKShapeFeatureExtractor
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of LTKFeatureExtractor
-******************************************************************************/
-int LTKShapeFeatureExtractorFactory::createFeatureExtractor(
- const string& featureExtractorName,
- const string& lipiRootPath,
- const string& lipiLibPath,
- void** m_libHandlerFE,
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "LTKShapeFeatureExtractorFactory::createFeatureExtractor()" << endl;
-
- string feName = "";
-
- int errorCode = mapFeatureExtractor(featureExtractorName, feName);
-
- if (errorCode != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- << getErrorMessage(errorCode)
- << "LTKShapeFeatureExtractorFactory::createFeatureExtractor:"
- << endl;
-
- LTKReturnError(errorCode);
- }
-
- errorCode = getFeatureExtractorInst(lipiRootPath, lipiLibPath, feName, m_libHandlerFE,
- controlInfo, outFeatureExtractor);
-
- if ( errorCode != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- << getErrorMessage(errorCode) << ":" << feName
- << "LTKShapeFeatureExtractorFactory::createFeatureExtractor:"
- << endl;
-
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "LTKShapeFeatureExtractorFactory::createFeatureExtractor()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 11-Dec-2007
-* NAME : getFeatureExtractorInst
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of LTKFeatureExtractor
-*************************************************************************************/
-int LTKShapeFeatureExtractorFactory::getFeatureExtractorInst(
- const string& lipiRootPath,
- const string& lipiLibPath,
- const string& feName,
- void** m_libHandlerFE,
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor)
-{
- FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR createFeatureExtractorPtr;
- void *functionHandle = NULL;
-
- LTKOSUtil* utilPtr = LTKOSUtilFactory::getInstance();
-
- int returnVal = utilPtr->loadSharedLib(lipiLibPath, feName, m_libHandlerFE);
-
-
- if(returnVal != SUCCESS)
- {
- LTKReturnError(ELOAD_FEATEXT_DLL);
- }
-
- returnVal = utilPtr->getFunctionAddress(*m_libHandlerFE,
- CREATE_SHAPE_FEATURE_EXTRACTOR,
- &functionHandle);
-
- if(returnVal != SUCCESS)
- {
- utilPtr->unloadSharedLib(m_libHandlerFE);
- *m_libHandlerFE = NULL;
-
- LTKReturnError(EDLL_FUNC_ADDRESS_CREATE_FEATEXT);
- }
-
- createFeatureExtractorPtr = (FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR)functionHandle;
-
- int errorCode = createFeatureExtractorPtr(controlInfo, outFeatureExtractor);
-
- if (errorCode != SUCCESS)
- {
- LTKReturnError(errorCode);
- }
-
- delete utilPtr;
- return SUCCESS;
-
-}
-
-/******************************************************************************
- * AUTHOR : Saravanan
- * DATE : 24-03-2007
- * NAME : mapFeatureExtractor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int LTKShapeFeatureExtractorFactory::mapFeatureExtractor(const string& featureExtractorName,
- string& outFEName)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "LTKShapeFeatureExtractorFactory::mapFeatureExtractor()" << endl;
-
- int returnCode = SUCCESS;
-
- if(LTKSTRCMP(featureExtractorName.c_str(), NAME_POINT_FLOAT_SHAPE_FEATURE_EXTRACTOR) == 0)
- {
- outFEName = POINT_FLOAT;
- }
- else if(LTKSTRCMP(featureExtractorName.c_str(), NAME_L7_SHAPE_FEATURE_EXTRACTOR) == 0)
- {
- outFEName = L7;
- }
- else if(LTKSTRCMP(featureExtractorName.c_str(),NAME_NPEN_SHAPE_FEATURE_EXTRACTOR) == 0)
- {
- outFEName = NPEN;
- }
- else if(LTKSTRCMP(featureExtractorName.c_str(),NAME_SUBSTROKE_SHAPE_FEATURE_EXTRACTOR) == 0)
- {
- outFEName = SUBSTROKE;
- }
- else
- {
- returnCode = EFTR_EXTR_NOT_EXIST;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "LTKShapeFeatureExtractorFactory::mapFeatureExtractor()" << endl;
-
- return returnCode;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h
deleted file mode 100644
index d178d6ef..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/LTKShapeFeatureExtractorFactory.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Function prototype for the Factory class LTKShapeFeatureExtractorFactory
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: 07-FEB-2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKFEATUREEXTRACTORFACTORY_H
-#define __LTKFEATUREEXTRACTORFACTORY_H
-#include "LTKTypes.h"
-
-#ifndef _WIN32
-#include <dlfcn.h>
-#else
-#include <windows.h>
-#endif
-
-class LTKShapeFeatureExtractor;
-
-/**
-* @ingroup feature_extractor
-* @brief A factory class which return a pointer to the feature extractor.
-* @class LTKShapeFeatureExtractorFactory
-*
-*
-* <p>
-* A factory class which return a pointer to the feature extractor depending
-* on the featureExtractorType passed to it
-* </p>
-*/
-typedef int (*FN_PTR_CREATE_SHAPE_FEATURE_EXTRACTOR)
- (const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor);
-
-class LTKShapeFeatureExtractorFactory
-{
-
-public:
-
- LTKShapeFeatureExtractorFactory();
-
- int createFeatureExtractor(const string& featureExtractorType,
- const string& lipiRootPath,
- const string& lipiLibPath,
- void** m_libHandlerFE,
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor);
-
- int getFeatureExtractorInst(const string& lipiRootPath,
- const string& lipiLibPath,
- const string& feName,
- void** m_libHandlerFE,
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor);
-
-private:
- int mapFeatureExtractor(const string& featureExtractorName,
- string& outFECode);
-};
-
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro
deleted file mode 100644
index 91e91a78..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/common/common.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-BASE_TARGET_NAME = featureextractorcommon
-include(../../../../lipilib.pri)
-
-INCLUDEPATH += \
- ../../../../util/lib \
-
-SOURCES += \
- LTKShapeFeatureExtractorFactory.cpp \
- LTKShapeFeatureExtractor.cpp
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro
deleted file mode 100644
index 538b9f29..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/featureextractor.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- common \
- l7 \
- npen \
- pointfloat \
- substroke
-
-l7.depends = common
-npen.depends = common
-pointfloat.depends = common
-substroke.depends = common
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/.prev_CMakeLists.txt
deleted file mode 100644
index d01ef36b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from l7.pro.
-
-#####################################################################
-## l7 Generic Library:
-#####################################################################
-
-qt_add_cmake_library(l7
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- L7ShapeFeature.cpp L7ShapeFeature.h
- L7ShapeFeatureExtractor.cpp L7ShapeFeatureExtractor.h
- l7.cpp l7.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(l7)
-
-#### Keys ignored in scope 1:.:.:l7.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(l7 CONDITION WIN32
- DEFINES
- L7_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(l7 CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(l7)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/CMakeLists.txt
deleted file mode 100644
index 8d120c0b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from l7.pro.
-
-#####################################################################
-## l7 Generic Library:
-#####################################################################
-
-qt_add_cmake_library(l7
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- L7ShapeFeature.cpp L7ShapeFeature.h
- L7ShapeFeatureExtractor.cpp L7ShapeFeatureExtractor.h
- l7.cpp l7.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(l7)
-
-#### Keys ignored in scope 1:.:.:l7.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(l7 CONDITION WIN32
- DEFINES
- L7_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(l7 CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(l7)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp
deleted file mode 100644
index 16eaaca4..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.cpp
+++ /dev/null
@@ -1,673 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR : Implementation of L7ShapeFeature class
- * AUTHOR : Naveen Sundar G.
- * DATE : August 30, 2005
- * CHANGE HISTORY :
- * Author Date Description of change
- ************************************************************************/
-
-#include "L7ShapeFeature.h"
-#include "LTKStringUtil.h"
-#include <sstream>
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : L7ShapeFeature
-* DESCRIPTION : Constructor for the L7ShapeFeature class.
-* ARGUMENTS : none
-* RETURNS :
-* NOTES : Initializes the string delimiter used in writing feature values to a file.
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-L7ShapeFeature::L7ShapeFeature():
-m_data_delimiter(",")
-{
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 12-Dec-2007
-* NAME : L7ShapeFeature
-* DESCRIPTION : Parameterized Constructor for the L7ShapeFeature class.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-L7ShapeFeature::L7ShapeFeature(float inX, float inY, float inXFirstDerv,
- float inYFirstDerv, float inXSecondDerv,
- float inYSecondDerv, float inCurvature,
- bool inPenUp):
-m_x(inX),
-m_y(inY),
-m_xFirstDerv(inXFirstDerv),
-m_yFirstDerv(inYFirstDerv),
-m_xSecondDerv(inXSecondDerv),
-m_ySecondDerv(inYSecondDerv),
-m_curvature(inCurvature),
-m_penUp(inPenUp),
-m_data_delimiter(",")
-{
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : ~L7ShapeFeature
-* DESCRIPTION : Destructor for the L7ShapeFeature class
-* ARGUMENTS : none
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-L7ShapeFeature::~L7ShapeFeature()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getX
-* DESCRIPTION : Get method for the x co-ordinate value
-* ARGUMENTS : none
-* RETURNS : X co-ordinate of the shape feature
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float L7ShapeFeature::getX() const
-{
- return m_x;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getY
-* DESCRIPTION : Get method for the y co-ordinate value
-* ARGUMENTS : none
-* RETURNS : Y co-ordinate of the shape feature
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float L7ShapeFeature::getY() const
-{
- return m_y;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getXFirstDerv
-* DESCRIPTION : Get method for the first derivative value along the X axis
-* ARGUMENTS : none
-* RETURNS : First derivative value along the X axis.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float L7ShapeFeature::getXFirstDerv() const
-{
- return m_xFirstDerv;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getYFirstDerv
-* DESCRIPTION : Get method for the first derivative value along the Y axis
-* ARGUMENTS : none
-* RETURNS : First derivative value along the Y axis.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float L7ShapeFeature::getYFirstDerv() const
-{
- return m_yFirstDerv;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getXSecondDerv
-* DESCRIPTION : Get method for the second derivative value along the X axis.
-* ARGUMENTS : none
-* RETURNS : Second derivative value along the X axis.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float L7ShapeFeature::getXSecondDerv() const
-{
- return m_xSecondDerv;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getYSecondDerv
-* DESCRIPTION : Get method for the second derivative value along the Y axis.
-* ARGUMENTS : none
-* RETURNS : Second derivative value along the Y axis.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float L7ShapeFeature::getYSecondDerv() const
-{
- return m_ySecondDerv;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getCurvature
-* DESCRIPTION : Get method for the curvature
-* ARGUMENTS : none
-* RETURNS : The curvature value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float L7ShapeFeature::getCurvature() const
-{
- return m_curvature;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : isPenUp
-* DESCRIPTION : Get method for the penUp
-* ARGUMENTS : none
-* RETURNS : The PenUp value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Balaji MNA 01-July-2009 Rename getPenUp to isPenUp
-*************************************************************************************/
-bool L7ShapeFeature::isPenUp() const
-{
- return m_penUp;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setX
-* DESCRIPTION : Set method for the X co-ordinate value
-* ARGUMENTS : X co-ordinate value to be set
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setX(float x)
-{
- m_x = x;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setY
-* DESCRIPTION : Set method for the Y co-ordinate value
-* ARGUMENTS : Y co-ordinate value to be set
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setY(float y)
-{
- m_y = y;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setXFirstDerv
-* DESCRIPTION : Set method for the first derivative along the X axis
-* ARGUMENTS : The first derivative value along the X axis
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setXFirstDerv(float xFirstDerv)
-{
- m_xFirstDerv = xFirstDerv;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setYFirstDerv
-* DESCRIPTION : Set method for the first derivative along the Y axis
-* ARGUMENTS : The first derivative value along the Y axis to be set
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setYFirstDerv(float yFirstDerv)
-{
- m_yFirstDerv = yFirstDerv;
-}/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setXSecondDerv
-* DESCRIPTION : Set method for the second derivative along the X axis
-* ARGUMENTS : The second derivative value along the X axis to be set
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setXSecondDerv(float xSecondDerv)
-{
- m_xSecondDerv = xSecondDerv;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setYSecondDerv
-* DESCRIPTION : Set method for the second derivative value along the y axis
-* ARGUMENTS : The second derivative value along the Y axis to be set
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setYSecondDerv(float ySecondDerv)
-{
- m_ySecondDerv = ySecondDerv;
-}/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setCurvature
-* DESCRIPTION : This method sets the curvature
-* ARGUMENTS : The curvature value to be set
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setCurvature(float curvature)
-{
- m_curvature=curvature;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : setPenUp
-* DESCRIPTION : This method sets the penUp
-* ARGUMENTS : The penUp value to be set
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::setPenUp(bool penUp)
-{
- m_penUp=penUp;
-
-
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : clone
-* DESCRIPTION : Clone method for an L7ShapeFeature object
-* ARGUMENTS : none
-* RETURNS : A copy of the invoking L7ShapeFeature object
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKShapeFeaturePtr L7ShapeFeature::clone() const
-{
- L7ShapeFeature* l7Inst = new L7ShapeFeature();
-
- l7Inst->setX(this->getX());
- l7Inst->setY(this->getY());
- l7Inst->setXFirstDerv(this->getXFirstDerv());
- l7Inst->setYFirstDerv(this->getYFirstDerv());
- l7Inst->setXSecondDerv(this->getXSecondDerv());
- l7Inst->setYSecondDerv(this->getYSecondDerv());
- l7Inst->setCurvature(this->getCurvature());
- l7Inst->setPenUp(this->isPenUp());
-
- return (LTKShapeFeaturePtr)l7Inst;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getDistance
-* DESCRIPTION : Returns the distance between two L7ShapeFeature objects
-* ARGUMENTS : An L7ShapeFeature object the distance of which is to be found from the invoking L7ShapeFeature object
-* RETURNS : The squared Euclidean distance
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const
-{
- float xDiff = 0, yDiff = 0;
- float xFirstDervDiff=0, yFirstDervDiff=0, xSecondDervDiff=0, ySecondDervDiff=0;
- float curvatureDiff=0;
-
- L7ShapeFeature *inFeature = (L7ShapeFeature*)(shapeFeaturePtr.operator ->());
-
- xDiff = m_x - inFeature->getX();
- yDiff = m_y - inFeature->getY();
- xFirstDervDiff = m_xFirstDerv - inFeature->getXFirstDerv();
- xFirstDervDiff = m_yFirstDerv - inFeature->getYFirstDerv();
- xSecondDervDiff = m_xSecondDerv - inFeature->getXSecondDerv();
- ySecondDervDiff = m_ySecondDerv - inFeature->getYSecondDerv();
- curvatureDiff = m_curvature - inFeature->getCurvature();
-
- outDistance = ( (xDiff * xDiff) + (yDiff * yDiff) );
- outDistance += ( (xFirstDervDiff * xFirstDervDiff) + (yFirstDervDiff * yFirstDervDiff) );
- outDistance += ( (xSecondDervDiff * xSecondDervDiff) + (ySecondDervDiff * ySecondDervDiff) );
- outDistance += ( (curvatureDiff * curvatureDiff));
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : initialize
-* DESCRIPTION : This method initializes an L7ShapeFeature object from a string
-* ARGUMENTS : The string containing the feature values
-* RETURNS : SUCCESS on successful completion
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeature::initialize(const string& initString)
-{
- stringVector tokens;
-
- LTKStringUtil::tokenizeString(initString, m_data_delimiter, tokens);
-
- //Token size must be eight
- if(tokens.size() != 8)
- return FAILURE; //Returning an error
-
- m_x = LTKStringUtil::convertStringToFloat(tokens[0]);
- m_y = LTKStringUtil::convertStringToFloat(tokens[1]);
- m_xFirstDerv = LTKStringUtil::convertStringToFloat(tokens[2]);
- m_yFirstDerv = LTKStringUtil::convertStringToFloat(tokens[3]);
- m_xSecondDerv = LTKStringUtil::convertStringToFloat(tokens[4]);
- m_ySecondDerv = LTKStringUtil::convertStringToFloat(tokens[5]);
- m_curvature= LTKStringUtil::convertStringToFloat(tokens[6]);
-
- if(atoi(tokens[7].c_str()) == 1)
- m_penUp = true;
- else
- m_penUp = false;
-
- return SUCCESS;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : toString
-* DESCRIPTION : This method prints the components of the feature object a string.
-* ARGUMENTS : pointer to char
-* RETURNS : The feature object in string format
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeature::toString(string& strFeat) const
-{
- ostringstream tempString;
-
- tempString << m_x << m_data_delimiter << m_y << m_data_delimiter <<
- m_xFirstDerv << m_data_delimiter <<
- m_yFirstDerv << m_data_delimiter <<
- m_xSecondDerv << m_data_delimiter <<
- m_ySecondDerv << m_data_delimiter <<
- m_curvature << m_data_delimiter <<
- m_penUp ;
-
-
- strFeat = tempString.str();
-
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : addFeature
-* DESCRIPTION : This method adds the passed L7ShapeFeature object to the invoking L7ShapeFeature object
-* ARGUMENTS : The feature instance to be added
-* RETURNS : The result feature object
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeature::addFeature(const LTKShapeFeaturePtr& secondFeature,
- LTKShapeFeaturePtr& outResult ) const
-{
- L7ShapeFeature* resultFeature = new L7ShapeFeature();
-
- L7ShapeFeature *inFeature = (L7ShapeFeature*)(secondFeature.operator ->());
-
- resultFeature->setX(m_x + inFeature->getX());
- resultFeature->setY(m_y + inFeature->getY());
- resultFeature->setXFirstDerv(m_xFirstDerv + inFeature->getXFirstDerv());
- resultFeature->setYFirstDerv(m_yFirstDerv + inFeature->getYFirstDerv());
- resultFeature->setXSecondDerv(m_xSecondDerv + inFeature->getXSecondDerv());
- resultFeature->setYSecondDerv(m_ySecondDerv + inFeature->getYSecondDerv());
- resultFeature->setCurvature(m_curvature + inFeature->getCurvature());
- resultFeature->setPenUp(m_penUp);
-
- outResult = LTKShapeFeaturePtr(resultFeature);
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : subtractFeature
-* DESCRIPTION : This method subtracts the elements of the passed L7ShapeFeature object from the invoking L7ShapeFeature object.
-* ARGUMENTS :
-* RETURNS : The result feature object
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeature::subtractFeature(const LTKShapeFeaturePtr& secondFeature,
- LTKShapeFeaturePtr& outResult ) const
-{
- L7ShapeFeature* resultFeature = new L7ShapeFeature();
-
- L7ShapeFeature *inFeature = (L7ShapeFeature*)(secondFeature.operator ->());
-
- resultFeature->setX(m_x-inFeature->getX());
- resultFeature->setY(m_y-inFeature->getY());
- resultFeature->setXFirstDerv(m_xFirstDerv - inFeature->getXFirstDerv());
- resultFeature->setYFirstDerv(m_yFirstDerv - inFeature->getYFirstDerv());
- resultFeature->setXSecondDerv(m_xSecondDerv - inFeature->getXSecondDerv());
- resultFeature->setYSecondDerv(m_ySecondDerv - inFeature->getYSecondDerv());
- resultFeature->setCurvature(m_curvature - inFeature->getCurvature());
- resultFeature->setPenUp(m_penUp);
-
- outResult = LTKShapeFeaturePtr(resultFeature);
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : scaleFeature
-* DESCRIPTION : This method mulitplies the elements of the invoking L7ShapeFeature object by alpha.
-* ARGUMENTS : alpha which is the scaling factor
-* RETURNS : The scaled feature object
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeature::scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
-{
- L7ShapeFeature* resultFeature = new L7ShapeFeature();
-
- resultFeature->setX(m_x * alpha);
- resultFeature->setY(m_y * alpha);
- resultFeature->setXFirstDerv(m_xFirstDerv * alpha);
- resultFeature->setYFirstDerv(m_yFirstDerv * alpha);
- resultFeature->setXSecondDerv(m_xSecondDerv * alpha);
- resultFeature->setYSecondDerv(m_ySecondDerv * alpha);
- resultFeature->setCurvature(m_curvature * alpha);
- resultFeature->setPenUp(m_penUp);
-
- outResult = LTKShapeFeaturePtr(resultFeature);
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : toFloatVector
-* DESCRIPTION : This method converts the feature instance to a floatVector.
-* ARGUMENTS : The float vector passed by reference
-* RETURNS : 0 on success.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeature::toFloatVector(floatVector& floatVec)
-{
- floatVec.push_back(m_x);
- floatVec.push_back(m_y);
- floatVec.push_back(m_xFirstDerv);
- floatVec.push_back(m_yFirstDerv);
- floatVec.push_back(m_xSecondDerv);
- floatVec.push_back(m_ySecondDerv);
- floatVec.push_back(m_curvature);
-
- if(m_penUp == true)
- floatVec.push_back(1.0);
- else
- floatVec.push_back(0.0);
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : toIntVector
-* DESCRIPTION : This method converts the feature instance to an intVector.
-* ARGUMENTS : The integer vector passed by reference
-* RETURNS : 0 on success.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeature::toIntVector(intVector& intVec)
-{
- intVec.push_back(m_x);
- intVec.push_back(m_y);
- intVec.push_back(m_xFirstDerv);
- intVec.push_back(m_yFirstDerv);
- intVec.push_back(m_xSecondDerv);
- intVec.push_back(m_ySecondDerv);
- intVec.push_back(m_curvature);
- intVec.push_back(m_penUp);
-
- return SUCCESS;
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 23-Apr-2008
-* NAME : initialize
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Date Description:
-
-*****************************************************************************/
-int L7ShapeFeature::initialize(const floatVector& initFloatVector)
-{
-
- if (initFloatVector.size() == 0)
- {
- return FAILURE;
- }
-
- m_x = initFloatVector[0];
- m_y = initFloatVector[1];
- m_xFirstDerv = initFloatVector[2];
- m_yFirstDerv = initFloatVector[3];
- m_xSecondDerv = initFloatVector[4];
- m_ySecondDerv = initFloatVector[5];
- m_curvature = initFloatVector[6];
-
- if(initFloatVector[7] == 1)
- {
- m_penUp = true;
- }
- else
- {
- m_penUp = false;
- }
-
- return SUCCESS;
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 23-Apr-2008
-* NAME : getFeatureDimension
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Date Description:
-
-*****************************************************************************/
-
-int L7ShapeFeature::getFeatureDimension()
-{
- return 8;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h
deleted file mode 100644
index 6c767112..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeature.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-#include "LTKShapeFeature.h"
-
-
-
-/** @ingroup L7ShapeFeatureExtractor
-* @brief The feature representation class for L7 features
-* This class represents X and Y coordinates, Normalized X and Y First Derivatives, Normalized X and Y Second Derivatives and the Curvature values of a point.
-* @class L7ShapeFeature
-*
-*/
-class L7ShapeFeature : public LTKShapeFeature
-{
- /** @name private data members */
- //@{
-
-private:
- /** @brief X value */
- float m_x;
-
- /** @brief Y value */
- float m_y;
-
- /** @brief Normalized First Derivative w.r.t X */
- float m_xFirstDerv;
-
- /** @brief Normalized First Derivative w.r.t Y */
- float m_yFirstDerv;
-
- /** @brief Normalized Second Derivative w.r.t X */
- float m_xSecondDerv;
-
- /** @brief Normalized Second Derivative w.r.t Y */
- float m_ySecondDerv;
-
- /** @brief Curvature value */
- float m_curvature;
-
- /** @brief Pen-up information */
- bool m_penUp;
-
- /** @brief Delimiter character */
- string m_data_delimiter;
- //@}
-
-public:
-
- /** @name Constructors and Destructor */
- //@{
-
- /**
- * Default Constructor.
- */
- L7ShapeFeature();
-
- /** parameterized constructor
- */
- L7ShapeFeature(float inX, float inY, float inXFirstDerv, float inYFirstDerv,
- float inXSecondDerv, float inYSecondDerv, float inCurvature,
- bool inPenUp);
-
- /**
- * Default destructor.
- */
- ~L7ShapeFeature();
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_x
- */
- float getX() const;
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_y
- */
- float getY() const;
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_xFirstDerv
- */
- float getXFirstDerv() const;
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_yFirstDerv
- */
- float getYFirstDerv() const;
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_xSecondDerv
- */
- float getXSecondDerv() const;
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_ySecondDerv
- */
- float getYSecondDerv() const;
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_curvature
- */
- float getCurvature() const;
-
- /**
- * Returns the value of the class data member L7ShapeFeature::m_penUp
- */
- bool isPenUp() const;
-
- /**
- * Sets the value of L7ShapeFeature::m_x
- */
- void setX(float x);
-
- /**
- * Sets the value of L7ShapeFeature::m_y
- */
- void setY(float y);
-
- /**
- * Sets the value of L7ShapeFeature::m_xFirstDerv
- */
- void setXFirstDerv(float xFirstDerv);
-
- /**
- * Sets the value of L7ShapeFeature::m_yFirstDerv
- */
-
- void setYFirstDerv(float yFirstDerv);
- /**
- * Sets the value of L7ShapeFeature::m_xSecondDerv
- */
- void setXSecondDerv(float xSecondDerv);
-
- /**
- * Sets the value of L7ShapeFeature::m_ySecondDerv
- */
- void setYSecondDerv(float ySecondDerv);
-
- /**
- * Sets the value of L7ShapeFeature::m_curvature
- */
- void setCurvature(float curvature);
-
- /**
- * Sets the value of L7ShapeFeature::m_penUp
- */
- void setPenUp(bool penUp);
-
-
- /**
- * @brief Initializes an instance of L7ShapeFeature from the string passed as parameter.
- *
- * <b>Semantics</b>
- *
- * - Tokenize the input string on L7ShapeFeature::m_data_delimiter using StringTokenizer::tokenizeString
- * - Initialize the data members of the class with the tokens returned.
- *
- * @param initString : string& : Reference to the initialization string.
- *
- * @return FAILURE : If the initalization string contains more than or less than seven tokens (after tokenizing on L7ShapeFeature::m_data_delimiter)
- * @return SUCCESS : If initialization done without any errors.
- *
- */
-
- //see interface
- int initialize(const string& initString);
-
- int initialize(const floatVector& initFloatVector);
-
- /**
- * @brief Gives the string representation of the L7ShapeFeature instance
- */
- //see interface
- void toString(string& strFeat) const;
-
- /**
- * This method implements the clone pattern and returns a cloned instance of the invoking L7ShapeFeature object
- */
- LTKShapeFeaturePtr clone() const;
-
-
- /**
- * @brief Computes the Euclidean Distance between two L7ShapeFeature instances.
- * Computes the square root of ( (m_x-passed_x)^2 + (m_y-passed_y)^2+ (m_xFirstDerv-passed_x1)^2 +(m_yFirstDerv-passed_y1)^2+(m_xSecondDerv-passed_x2)^2+(m_ySecondDerv-passed_y2)^2+(m_curvature-passed_curvature)^2).
- * @param f : LTKShapeFeature* : Base class pointer holding a pointer to L7ShapeFeature instance from which the distance to the invoking object is to be computed.
- *
- * @return float : Distance between two points in the LocalSeven feature representation
- *
- */
- void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;
-
- /**
- * @brief Adds two L7ShapeFeature instances.
- * Computes the sum of the member variables of the passed LTKShapeFeature object and the invoking LTKShapeFeature object. The new member variables are stored in a newly created L7ShapeFeature object. Neither the invoking nor the passed object object are changed.
- * new_x=m_x+ (*secondFeature).m_x;
- * @param secondFeature : LTKShapeFeature* : Base class pointer holding a pointer to the L7ShapeFeature instance which is to be added to the invoking L7ShapeFeature object.
- *
- * @return LTKShapeFeature* : Base class pointer to the L7ShapeFeature instance holding the result of the addition operation.
- *
- */
- int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const;
-
- /**
- * @brief Subtracts two L7ShapeFeature instances.
- * Subtracts the member variables of the passed LTKShapeFeature object from the invoking LTKShapeFeature object. The new member variables are stored in a newly created L7ShapeFeature object, which is returned. Neither the invoking nor the passed object object are changed.
- * new_x=m_x-(*secondFeature).m_x;
- *
- * @param secondFeature : LTKShapeFeature* : Base class pointer holding a pointer to the L7ShapeFeature instance which is to be subtracted.
- *
- * @return LTKShapeFeature* : Base class pointer to the L7ShapeFeature instance holding the result of the subtraction operation.
- *
- */
- int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const;
-
- /**
- * @brief Scales the L7ShapeFeature feature by a scalar (float value).
- * Mulitplies all the member variables of the invoking L7ShapeFeature object by alpha. The new member variables are stored in a newly created L7ShapeFeature object, which is returned. The invoking LTKShapeFeature object is not changed.
- * new_x=alpha*m_x
- *
- * @param alpha : float: The float value by which all the member variables should be multiplied.
- * @return LTKShapeFeature* : Base class pointer to the L7ShapeFeature instance holding the result of the scaling operation .
- *
- */
- int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const;
-
- /**
- * Converts the LocalSeven feature instance into a float vector. The elements of the float vector are m_x,m_y,m_xFirstDerv,m_yFirstDerv,m_xSecondDerv,m_ySecondDerv and m_curvature in this order.
- * @param floatVec: vector<float>&: The float vector which will contain the member values.
- * @return int : returns SUCCESS or FAILURE
- *
- */
- int toFloatVector(vector<float>& floatVec);
-
- /**
- * Converts the LocalSeven feature instance into a integer vector. The elements of the int vector are m_x,m_y,m_xFirstDerv,m_yFirstDerv,m_xSecondDerv,m_ySecondDerv and m_curvature in this order.
- * @param intVec: vector<int>&: The int vector which will contain the member values.
- * @return int : returns SUCCESS or FAILURE
- *
- */
- int toIntVector(vector<int>& intVec);
-
- int getFeatureDimension();
-};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp
deleted file mode 100644
index 19e6a9c1..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.cpp
+++ /dev/null
@@ -1,587 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of RunShaperec tool
- *
- * CONTENTS:
- * extractFeatures
- * getShapeFeatureInstance
- * clearFeatureVector
- * computeDerivativeDenominator
- * computeDerivative
- *
- * AUTHOR: Naveen Sundar G.
- *
- * DATE: August 30, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-
-#include "L7ShapeFeatureExtractor.h"
-#include "L7ShapeFeature.h"
-#include "LTKTraceGroup.h"
-#include "LTKTrace.h"
-#include "LTKChannel.h"
-#include "LTKTraceFormat.h"
-#include "LTKConfigFileReader.h"
-#include "LTKMacros.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKLoggerUtil.h"
-
-/******************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 1-Oct-2007
-* NAME : L7ShapeFeatureExtractor
-* DESCRIPTION : parameterized constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*******************************************************************************/
-L7ShapeFeatureExtractor::L7ShapeFeatureExtractor(const LTKControlInfo& controlInfo):
-m_radius(FEATEXTR_L7_DEF_RADIUS)
-{
- string cfgFilePath = "";
-
- // Config file
- if ( ! ((controlInfo.lipiRoot).empty()) &&
- ! ((controlInfo.projectName).empty()) &&
- ! ((controlInfo.profileName).empty()) &&
- ! ((controlInfo.cfgFileName).empty()))
- {
- // construct the cfg path using project and profile name
- cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
- (controlInfo.projectName) + PROFILE_PATH_STRING +
- (controlInfo.profileName) + SEPARATOR +
- (controlInfo.cfgFileName) + CONFIGFILEEXT;
- }
- else if ( ! ((controlInfo.cfgFilePath).empty() ))
- {
- cfgFilePath = controlInfo.cfgFilePath;
- }
- else
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
-
- int returnVal = readConfig(cfgFilePath);
-
- if (returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: L7ShapeFeatureExtractor::L7ShapeFeatureExtractor()" <<endl;
-
- throw LTKException(returnVal);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "L7ShapeFeatureExtractor::L7ShapeFeatureExtractor()" << endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 1-Oct-2007
-* NAME : readConfig
-* DESCRIPTION : read the config values from cfg file and set member variables
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*************************************************************************************/
-
-int L7ShapeFeatureExtractor::readConfig(const string& cfgFilePath)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "L7ShapeFeatureExtractor::readConfig()" << endl;
-
- LTKConfigFileReader* configurableProperties = NULL;
- string tempStringVar = "";
-
- try
- {
- configurableProperties = new LTKConfigFileReader(cfgFilePath);
-
- int errorCode = configurableProperties->getConfigValue(L7RADIUS, tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if (setRadius(atoi((tempStringVar).c_str())) != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- ECONFIG_FILE_RANGE << " : " <<
- getErrorMessage(ECONFIG_FILE_RANGE) <<
- " L7ShapeFeatureExtractor::readConfig" <<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- }
-
- catch(LTKException e)
- {
- delete configurableProperties;
-
- int eCode = e.getErrorCode();
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode <<
- " : " << getErrorMessage(eCode) <<
- " L7ShapeFeatureExtractor::readConfig" <<endl;
-
- LTKReturnError(eCode);
- }
- delete configurableProperties;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "L7ShapeFeatureExtractor::readConfig()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 1-Oct-2007
-* NAME : setRadius
-* DESCRIPTION : set the radius(the size of window) to compute L7 features
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*************************************************************************************/
-int L7ShapeFeatureExtractor::setRadius(int radius)
-{
- int returnVal = FAILURE;
-
- if ( radius > 0 )
- {
- m_radius = radius;
- returnVal = SUCCESS;
- }
-
- return returnVal;
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 15-Feb-2008
-* NAME : getRadius
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*************************************************************************************/
-int L7ShapeFeatureExtractor::getRadius()
-{
- return m_radius;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : extractFeatures
-* DESCRIPTION : Extracts L7 features from a trace group
-* ARGUMENTS : The trace group from which features have to be extracted
-* RETURNS : vector of L7ShapeFeature objects
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "L7ShapeFeatureExtractor::extractFeatures()" << endl;
-
- L7ShapeFeature* featurePtr = NULL;
- float delta;
- int currentStrokeSize;
- int numPoints;
-
- int numberOfTraces = inTraceGroup.getNumTraces();
-
- if (numberOfTraces == 0 )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error :" <<
- EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP) <<
- "L7ShapeFeatureExtractor::extractFeatures()" << endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
-
- LTKTraceVector allTraces = inTraceGroup.getAllTraces();
- LTKTraceVector::iterator traceIter = allTraces.begin();
- LTKTraceVector::iterator traceEnd = allTraces.end();
-
- //the feature vector
- vector<float> xVec;
- vector<float> yVec;
- vector<bool> penUp;
-
- //concatentating the strokes
- for (; traceIter != traceEnd ; ++traceIter)
- {
- floatVector tempxVec, tempyVec;
-
- (*traceIter).getChannelValues("X", tempxVec);
-
- (*traceIter).getChannelValues("Y", tempyVec);
-
- currentStrokeSize = tempxVec.size();
-
- if (currentStrokeSize == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error :" <<
- EEMPTY_TRACE<< " : " << getErrorMessage(EEMPTY_TRACE) <<
- "L7ShapeFeatureExtractor::extractFeatures()" << endl;
-
- LTKReturnError(EEMPTY_TRACE);
- }
-
- for(int point=0;point<currentStrokeSize;point++)
- {
- xVec.push_back(tempxVec[point]);
- yVec.push_back(tempyVec[point]);
-
- if(point == currentStrokeSize - 1 )
- {
- penUp.push_back(true);
- }
- else
- {
- penUp.push_back(false);
- }
- }
- }
- //concatentating the strokes
-
- numPoints=xVec.size();
-
- vector<float> normfirstderv_x(numPoints); // Array to store the first normalized derivative w.r.t x
- vector<float> normfirstderv_y(numPoints); // Array to store the first normalized derivative w.r.t y
- vector<float> normsecondderv_x(numPoints); // Array to store the second normalized derivative w.r.t x
- vector<float> normsecondderv_y(numPoints); // Array to store the second normalized derivative w.r.t y
- vector<float> curvature(numPoints); // Array to store the curvature
-
- computeDerivative(xVec,yVec,normfirstderv_x,normfirstderv_y,m_radius);
-
- computeDerivative(normfirstderv_x,normfirstderv_y,normsecondderv_x,normsecondderv_y,m_radius);
-
- for(int i=0; i<numPoints; ++i)
- {
- //computing the curvature
- delta= sqrt(pow(pow(normfirstderv_x[i],2)+pow(normfirstderv_y[i],2),3));
- curvature[i]= ((normfirstderv_x[i]*normsecondderv_y[i]) - (normsecondderv_x[i]*normfirstderv_y[i]))/(delta+EPS);
-
- featurePtr = new L7ShapeFeature(xVec[i], yVec[i],
- normfirstderv_x[i], normfirstderv_y[i],
- normsecondderv_x[i], normsecondderv_y[i],
- curvature[i], penUp[i]);
- //populating the feature vector
- outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
- featurePtr = NULL;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "L7ShapeFeatureExtractor::extractFeatures()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : getShapeFeatureInstance
-* DESCRIPTION : Returns an L7ShapeFeature instance
-* ARGUMENTS :
-* RETURNS : An L7ShapeFeature instance
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKShapeFeaturePtr L7ShapeFeatureExtractor::getShapeFeatureInstance()
-{
- LTKShapeFeaturePtr tempPtr(new L7ShapeFeature);
- return tempPtr;
-}
-
-
-/******************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : Sept-10-2007
-* NAME : convertFeatVecToTraceGroup
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int L7ShapeFeatureExtractor::convertFeatVecToTraceGroup(
- const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "L7ShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
-
- vector<LTKChannel> channels; // channels of a trace
-
- LTKChannel xChannel("X", DT_INT, true); // x-coordinate channel of the trace
- LTKChannel yChannel("Y", DT_INT, true); // y-coordinate channel of the trace
-
- //initializing the channels of the trace
- channels.push_back(xChannel);
- channels.push_back(yChannel);
-
- // composing the trace format object
- LTKTraceFormat traceFormat(channels);
-
- vector<float> point; // a point of a trace
-
- LTKTrace trace(traceFormat);
-
- for(int count=0;count<(int)shapeFeature.size();count++)
- {
- float Xpoint, Ypoint;
- bool penUp;
-
- L7ShapeFeature* ptr = (L7ShapeFeature*)(shapeFeature[count].operator ->());
- Xpoint = ptr->getX();
- Ypoint = ptr->getY();
- penUp = ptr->isPenUp();
-
-
-
- point.push_back(Xpoint);
- point.push_back(Ypoint);
-
- trace.addPoint(point);
- point.clear();
-
-
- if(penUp == true) // end of a trace, clearing the trace now
- {
- outTraceGroup.addTrace(trace);
- trace.emptyTrace();
- LTKTrace tempTrace(traceFormat);
- trace = tempTrace;
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "L7ShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : computeDerivativeDenominator
-* DESCRIPTION : Computes the denominator to be used in the derivative computation
-* ARGUMENTS : The index used in derivative computation
-* RETURNS : The denominator
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int L7ShapeFeatureExtractor::computeDerivativeDenominator(int index)
-{
- int denominator=0;
-
- for (int i=1;i<=index;i++)
- {
-
- denominator=denominator+i*i;
- }
- return 2*denominator;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 10-AUGUST-2007
-* NAME : computeDerivative
-* DESCRIPTION : Computes the derivative
-* ARGUMENTS : The input and output vectors. The output vectors are the derivatives of the input vectors
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void L7ShapeFeatureExtractor::computeDerivative(const vector<float>& xVec,
- const vector<float>& yVec,
- vector<float>& dx,
- vector<float>& dy,
- int index)
-{
- int size = xVec.size();
- int denominator = computeDerivativeDenominator(index);
- float x,y,diffx,diffy,delta;
- float firstderv_x,firstderv_y;
- int i,j;
-
- if(index<size-index)
- {
- for(i=index; i<size-index; ++i)
- {
- x= xVec[i];
- y= yVec[i];
- diffx=0;
- diffy=0;
-
- for( j=1;j<=index;j++)
- {
- diffx = diffx + j*(xVec[i+j]-xVec[i-j]) ;
- diffy = diffy + j*(yVec[i+j]-yVec[i-j]) ;
- }
-
- firstderv_x = diffx/denominator;
- firstderv_y = diffy/denominator;
- delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
- if(delta!=0)
- {
- dx[i] = firstderv_x/(delta);
- dy[i] = firstderv_y/(delta);
- }
- else
- {
- dx[i] = 0;
- dy[i] = 0;
- }
-
-
- }
-
- for(i=0;i<index;i++)
- {
- x= xVec[i];
- y= yVec[i];
- diffx=0;
- diffy=0;
-
- for( j=1;j<=index;j++)
- {
- diffx = diffx + j*(xVec[i+j]-x) ;
- diffy = diffy + j*(yVec[i+j]-y) ;
- }
- firstderv_x = diffx/denominator;
- firstderv_y = diffy/denominator;
- delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
- if(delta!=0)
- {
- dx[i] = firstderv_x/(delta);
- dy[i] = firstderv_y/(delta);
- }
- else
- {
- dx[i] = 0;
- dy[i] = 0;
- }
-
- }
-
- for(i=size-index;i<=size-1;i++)
- {
- x= xVec[i];
- y= yVec[i];
- diffx=0;
- diffy=0;
-
- for( j=1;j<=index;j++)
- {
- diffx = diffx + j*(x-xVec[i-j]) ;
- diffy = diffy + j*(y-yVec[i-j]) ;
- }
- firstderv_x = diffx/denominator;
- firstderv_y = diffy/denominator;
- delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
- if(delta!=0)
- {
- dx[i] = firstderv_x/(delta);
- dy[i] = firstderv_y/(delta);
- }
- else
- {
- dx[i] = 0;
- dy[i] = 0;
- }
- }
- }
- if(index>size-index)
- {
- for(i=0; i<size; ++i)
- {
- x= xVec[i];
- y= yVec[i];
- diffx=0;
- diffy=0;
- if((0<i+j)&(i+j<size))
- {
- for( j=1;j<=index;j++)
- {
- diffx = diffx + j*(xVec[i+j]-x) ;
- diffy = diffy + j*(yVec[i+j]-y) ;
- }
- }
- else
- {
- for(j=1;j<=index;j++)
- {
- diffx = diffx + j*(x-xVec[i-j]) ;
- diffy = diffy + j*(y-yVec[i-j]) ;
- }
- }
-
- firstderv_x = diffx/denominator;
- firstderv_y = diffy/denominator;
- delta = sqrt(pow(firstderv_x,2)+pow(firstderv_y,2));
- if(delta!=0)
- {
- dx[i] = firstderv_x/(delta);
- dy[i] = firstderv_y/(delta);
- }
- else
- {
- dx[i] = 0;
- dy[i] = 0;
- }
-
- }
- }
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h
deleted file mode 100644
index 9c48636d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/L7ShapeFeatureExtractor.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-#include "LTKShapeFeatureExtractor.h"
-/** @ingroup L7ShapeFeatureExtractor
-* @brief The feature extractor for L7 features.
-* @class L7ShapeFeatureExtractor
-*
-*/
-#define FEATEXTR_L7_DEF_RADIUS 2
-
-
-class L7ShapeFeatureExtractor : public LTKShapeFeatureExtractor
-{
-private:
- int m_radius;
-
-public:
- /** @brief Constructor for the L7 feature extractor
- * Gets the cfg file path from the contorInfo
- * Reads the cfg variables and poputlates the member variables
- * @param controlInfo: LTKControlInfo : The control information
- * @return no return value as it is a constructor
- */
- L7ShapeFeatureExtractor(const LTKControlInfo& controlInfo);
-
- /** @brief Extracts L7 features from an LTKTraceGroup
- * The XY Coordinate values are extracted from the trace gruoup.
- * Using the coordinate values, normalized first derivatives are computed.
- * After computing the first derivatives, the normalized second derivatives and the curvature are computed. The second derivative and curvature computation occur simultaneously.
- * @param inTraceGroup: LTKTraceGroup& : The trace group from which local seven features have to be extracted
- * @return LTKShapeFeaturePtr* : A vector of pointers to LTKShapeFeature objects. The pointers point to instances of the L7ShapeFeature class. The vector contains local-seven features extracted from the trace group.
- */
-
- int extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec);
-
- /** @brief Returns an instance of the L7ShapeFeature class
- * @return LTKShapeFeature*: The returned empty L7ShapeFeature instance.
- */
- LTKShapeFeaturePtr getShapeFeatureInstance();
-
- /** @brief Converts a feature vector to trace group
- * @param shapeFeature : LTKShapeFeaturePtr* : The feature vector to be converted to a trace group.
- * @param outTraceGroup : LTKTraceGroup& : The output trace group
- */
- //see interface
- int convertFeatVecToTraceGroup(const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup);
-
- int getRadius();
-
-private:
-
- /** @brief Computes the denominator for derivative calculation
- * @param index : int: The index used in derivative computation
- * @return int : The denominator used in derivative computation
- */
- int computeDerivativeDenominator(int index);
-
- /** @brief Computes the derivative for two input sequences
- * @param xVec : vector<float>&: Input x vector.
- * @param yVec : vector<float>&: Input y vector.
- * @param dx : vector<float>&: Derivative vector of x
- * @param dy : vector<float>&: Derivative vector of y
- * @param index : int : The window size used in derivative computation
- *
- */
- void computeDerivative(const vector<float>& xVec,
- const vector<float>& yVec,
- vector<float>& dx,
- vector<float>& dy,
- int index);
-
- /** @brief reads the cfg file and sets the member variables
- * @param cfgFilePath : const string&: The path of the cfg file to be opened
- * @return int : The sucess or failure of the function
- */
- int readConfig(const string& cfgFilePath);
-
- /** @validates the value passed and sets the member variable
- * @param radius : const int: The value of the variable to be set
- * @return int : The sucess or failure of the function
- */
- int setRadius(int radius);
-
-
-};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp
deleted file mode 100644
index eca6cf84..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-// l7.cpp : Defines the entry point for the DLL application.
-
-#include "l7.h"
-#include "L7ShapeFeatureExtractor.h"
-#include "LTKShapeFeatureExtractor.h"
-#include "L7ShapeFeature.h"
-#include "LTKErrors.h"
-
-
-#ifdef _WIN32
-#include <windows.h>
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G
-* DATE : 10-Aug-2007
-* NAME : createFeatureExtractor
-* DESCRIPTION : Creates instance of type l7ShapeFeatureExtractor and retuns of type
- LTKShapeFeatureExtractor. (Acts as a Factory Method).
-* ARGUMENTS :
-* RETURNS : returns an instace of type LTKShapeFeatureExtractor.
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*************************************************************************************/
-int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor)
-{
- try
- {
- *outFeatureExtractor = new L7ShapeFeatureExtractor(controlInfo);
- }
- catch(LTKException e)
- {
- *outFeatureExtractor = NULL;
-
- LTKReturnError(e.getErrorCode());
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G
-* DATE : 10-Aug-2007
-* NAME : deleteShapeFeatureExtractor
-* DESCRIPTION : Destroy the instance by taking the address as its argument.
-* ARGUMENTS : Address of LTKShapeRecognizerFeatureExtractor instnace.
-* RETURNS : Returns 0 on Success
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*************************************************************************************/
-int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
-{
- if ( obj != NULL )
- {
- delete obj;
- obj = NULL;
- }
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def
deleted file mode 100644
index 9a185d39..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- createShapeFeatureExtractor @1
- deleteShapeFeatureExtractor @2
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h
deleted file mode 100644
index c0f64a01..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the L7_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// L7_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef _WIN32
-#ifdef L7_EXPORTS
-#define L7_API __declspec(dllexport)
-#else
-#define L7_API __declspec(dllimport)
-#endif //ifdef L7_EXPORTS
-#else
-#define L7_API
-#endif //#ifdef _WIN32
-
-#include "LTKTypes.h"
-
-class LTKShapeFeatureExtractor;
-class LTKShapeFeature;
-
-/** @defgroup L7ShapeFeatureExtractor
-*@brief The L7ShapeFeatureExtractor
-*/
-
-/**
-* @ingroup L7ShapeFeatureExtractor
-* @file L7.cpp
-* <p>
-* The functions exported by the DLL
-* - ::createShapeFeatureExtractor
-* - ::deleteShapeFeatureExtractor
-* - ::getCurrentVersion
-* - ::deleteShapeFeaturePtr
-*/
-
-/**
-* @brief Returns a pointer to the instance of L7ShapeFeatureExtractor
-*
-* <p>
-* This function is based on run-time polymorphism. It creates an instance of
-* L7ShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
-* </p>
-*
-* @param none
-*
-* @return Pointer to LTKShapeFeatureExtractor
-*/
-//extern "C" L7_API int createShapeFeatureExtractor(const LTKControlInfo& controlInfo, LTKShapeFeatureExtractor**);
-extern "C" L7_API int createShapeFeatureExtractor(
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor);
-
-/**
-* @brief Deletes the feature extractor instance.
-*
-* <p>
-* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
-* </p>
-*
-* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
-*
-* @return 0 on Success
-*/
-
-//smart pointer for LTKShapeFeatureExtractor??
-extern "C" L7_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro
deleted file mode 100644
index 2372c2cf..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/l7/l7.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-LIPILIBS = ltkcommon ltkutil featureextractorcommon
-include(../../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../../util/lib \
- ../common \
-
-HEADERS += \
- l7.h \
- L7ShapeFeature.h \
- L7ShapeFeatureExtractor.h \
-
-SOURCES += \
- l7.cpp \
- L7ShapeFeature.cpp \
- L7ShapeFeatureExtractor.cpp \
-
-win32 {
- DEFINES += L7_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = l7.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/.prev_CMakeLists.txt
deleted file mode 100644
index e71fd73e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from npen.pro.
-
-#####################################################################
-## npen Generic Library:
-#####################################################################
-
-qt_add_cmake_library(npen
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- NPen.cpp NPen.h
- NPenShapeFeature.cpp NPenShapeFeature.h
- NPenShapeFeatureExtractor.cpp NPenShapeFeatureExtractor.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(npen)
-
-#### Keys ignored in scope 1:.:.:npen.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(npen CONDITION WIN32
- DEFINES
- NPEN_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(npen CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(npen)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/CMakeLists.txt
deleted file mode 100644
index 1a4d87cd..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from npen.pro.
-
-#####################################################################
-## npen Generic Library:
-#####################################################################
-
-qt_add_cmake_library(npen
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- NPen.cpp NPen.h
- NPenShapeFeature.cpp NPenShapeFeature.h
- NPenShapeFeatureExtractor.cpp NPenShapeFeatureExtractor.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(npen)
-
-#### Keys ignored in scope 1:.:.:npen.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(npen CONDITION WIN32
- DEFINES
- NPEN_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(npen CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(npen)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp
deleted file mode 100644
index 1d142230..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-// NPen.cpp : Defines the entry point for the DLL application.
-
-#include "NPen.h"
-#include "NPenShapeFeatureExtractor.h"
-#include "LTKShapeFeatureExtractor.h"
-#include "NPenShapeFeature.h"
-#include "LTKErrors.h"
-
-
-#ifdef _WIN32
-#include <windows.h>
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 12-Jun-2008
-* NAME : createFeatureExtractor
-* DESCRIPTION : Creates instance of type NPenShapeFeatureExtractor and retuns of type
- LTKShapeFeatureExtractor. (Acts as a Factory Method).
-* ARGUMENTS :
-* RETURNS : returns an instace of type LTKShapeFeatureExtractor.
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*************************************************************************************/
-int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor)
-{
- try
- {
- *outFeatureExtractor = new NPenShapeFeatureExtractor(controlInfo);
- }
- catch(LTKException e)
- {
- *outFeatureExtractor = NULL;
-
- LTKReturnError(e.getErrorCode());
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 12-Jun-2008
-* NAME : deleteShapeFeatureExtractor
-* DESCRIPTION : Destroy the instance by taking the address as its argument.
-* ARGUMENTS : Address of LTKShapeRecognizerFeatureExtractor instnace.
-* RETURNS : Returns 0 on Success
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*************************************************************************************/
-int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
-{
- if ( obj != NULL )
- {
- delete obj;
- obj = NULL;
- }
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def
deleted file mode 100644
index 9a185d39..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- createShapeFeatureExtractor @1
- deleteShapeFeatureExtractor @2
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h
deleted file mode 100644
index c1a410d7..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPen.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the NPen_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// NPen_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef _WIN32
-#ifdef NPen_EXPORTS
-#define NPen_API __declspec(dllexport)
-#else
-#define NPen_API __declspec(dllimport)
-#endif //ifdef NPen_EXPORTS
-#else
-#define NPen_API
-#endif //#ifdef _WIN32
-
-#include "LTKTypes.h"
-
-class LTKShapeFeatureExtractor;
-class LTKShapeFeature;
-
-/** @defgroup NPenShapeFeatureExtractor
-*@brief The NPenShapeFeatureExtractor
-*/
-
-/**
-* @ingroup NPenShapeFeatureExtractor
-* @file NPen.cpp
-* <p>
-* The functions exported by the DLL
-* - ::createShapeFeatureExtractor
-* - ::deleteShapeFeatureExtractor
-* - ::getCurrentVersion
-* - ::deleteShapeFeaturePtr
-*/
-
-/**
-* @brief Returns a pointer to the instance of NPenShapeFeatureExtractor
-*
-* <p>
-* This function is based on run-time polymorphism. It creates an instance of
-* NPenShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
-* </p>
-*
-* @param none
-*
-* @return Pointer to LTKShapeFeatureExtractor
-*/
-//extern "C" NPen_API int createShapeFeatureExtractor(const LTKControlInfo& controlInfo, LTKShapeFeatureExtractor**);
-extern "C" NPen_API int createShapeFeatureExtractor(
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor);
-
-/**
-* @brief Deletes the feature extractor instance.
-*
-* <p>
-* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
-* </p>
-*
-* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
-*
-* @return 0 on Success
-*/
-
-//smart pointer for LTKShapeFeatureExtractor??
-extern "C" NPen_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp
deleted file mode 100644
index a05867be..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.cpp
+++ /dev/null
@@ -1,340 +0,0 @@
-#include "NPenShapeFeature.h"
-#include "LTKStringUtil.h"
-#include "LTKPreprocDefaults.h"
-
-#include <sstream>
-
-
-NPenShapeFeature::NPenShapeFeature():m_data_delimiter(",")
- {
-
- }
-
-
- NPenShapeFeature::NPenShapeFeature(float inX, float inY, float cosAlpha, float inSinAlpha,
- float inCosBeta, float inSinBeta, float inAspect, float inCurliness,
- float inLinearity, float inSlope, bool isPenUp):m_data_delimiter(",")
- {
-
- }
-
-
- NPenShapeFeature::~NPenShapeFeature()
- {
-
- }
-
-
- float NPenShapeFeature::getX() const
- {
- return m_x;
- }
-
-
- float NPenShapeFeature::getY() const
- {
- return m_y;
- }
-
-
- float NPenShapeFeature::getCosAlpha() const
- {
- return m_cosAlpha;
- }
-
-
- float NPenShapeFeature::getSinAlpha() const
- {
- return m_sinAlpha;
- }
-
-
- float NPenShapeFeature::getCosBeta() const
- {
- return m_cosBeta;
- }
-
-
- float NPenShapeFeature::getSinBeta() const
- {
- return m_sinBeta;
- }
-
- float NPenShapeFeature::getAspect() const
- {
- return m_aspect;
- }
-
-
- float NPenShapeFeature::getCurliness() const
- {
- return m_curliness;
- }
-
-
- float NPenShapeFeature::getLinearity() const
- {
- return m_linearity;
- }
-
-
- float NPenShapeFeature::getSlope() const
- {
- return m_slope;
- }
-
-
- bool NPenShapeFeature::isPenUp() const
- {
- return m_isPenUp;
- }
-
-
- void NPenShapeFeature::setX(float x)
- {
- m_x = x;
- }
-
-
- void NPenShapeFeature::setY(float y)
- {
- m_y = y;
- }
-
-
- void NPenShapeFeature::setCosAlpha(float cosAlpha)
- {
- m_cosAlpha = cosAlpha;
- }
-
-
- void NPenShapeFeature::setSinAlpha(float sinAlpha)
- {
- m_sinAlpha = sinAlpha;
- }
-
-
- void NPenShapeFeature::setCosBeta(float cosBeta)
- {
- m_cosBeta = cosBeta;
- }
-
-
- void NPenShapeFeature::setSinBeta(float sinBeta)
- {
- m_sinBeta = sinBeta;
- }
-
-
- void NPenShapeFeature::setAspect(float aspect)
- {
- m_aspect = aspect;
- }
-
- void NPenShapeFeature::setCurliness(float curliness)
- {
- m_curliness = curliness;
- }
-
- void NPenShapeFeature::setLinearity(float linearity)
- {
- m_linearity = linearity;
- }
-
- void NPenShapeFeature::setSlope(float slope)
- {
- m_slope = slope;
- }
-
-
- void NPenShapeFeature::setPenUp(bool isPenUp)
- {
- m_isPenUp = isPenUp;
- }
-
-
-
- int NPenShapeFeature::initialize(const string& initString)
- {
- stringVector tokens;
- LTKStringUtil::tokenizeString(initString,m_data_delimiter,tokens);
-
- if(tokens.size() != 11)
- {
- return FAILURE;
- }
-
- m_x = LTKStringUtil::convertStringToFloat(tokens[0]);
-
- m_y = LTKStringUtil::convertStringToFloat(tokens[1]);
-
-
- m_cosAlpha = LTKStringUtil::convertStringToFloat(tokens[2]);
-
- m_sinAlpha = LTKStringUtil::convertStringToFloat(tokens[3]);
-
- m_cosBeta = LTKStringUtil::convertStringToFloat(tokens[4]);
-
- m_sinBeta = LTKStringUtil::convertStringToFloat(tokens[5]);
-
- m_aspect = LTKStringUtil::convertStringToFloat(tokens[6]);
-
- m_curliness = LTKStringUtil::convertStringToFloat(tokens[7]);
-
- m_linearity = LTKStringUtil::convertStringToFloat(tokens[8]);
-
- m_slope = LTKStringUtil::convertStringToFloat(tokens[9]);
-
- if(fabs(LTKStringUtil::convertStringToFloat(tokens[10]) - 1.0f) < EPS)
- {
- m_isPenUp = true;
- }
- else
- {
- m_isPenUp = false;
- }
-
- return SUCCESS;
-
-
- }
-
-
- void NPenShapeFeature::toString(string& strFeat) const
- {
- ostringstream tempString;
-
- tempString << m_x << m_data_delimiter << m_y << m_data_delimiter <<
- m_cosAlpha << m_data_delimiter <<
- m_sinAlpha << m_data_delimiter <<
- m_cosBeta << m_data_delimiter <<
- m_sinBeta << m_data_delimiter <<
- m_aspect << m_data_delimiter <<
- m_curliness << m_data_delimiter <<
- m_linearity << m_data_delimiter <<
- m_slope << m_data_delimiter<<
- m_isPenUp;
-
- strFeat = tempString.str();
-
-
- }
-
-
- LTKShapeFeaturePtr NPenShapeFeature::clone() const
- {
- NPenShapeFeature* npenSF = new NPenShapeFeature();
-
-
- npenSF->setX(this->getX());
- npenSF->setY(this->getY());
- npenSF->setCosAlpha(this->getCosAlpha());
- npenSF->setSinAlpha(this->getSinAlpha());
- npenSF->setCosBeta(this->getCosBeta());
- npenSF->setSinBeta(this->getSinBeta());
- npenSF->setAspect(this->getAspect());
- npenSF->setCurliness(this->getCurliness());
- npenSF->setLinearity(this->getLinearity());
- npenSF->setSlope(this->getSlope());
- npenSF->setPenUp(this->isPenUp());
-
-
-
- return (LTKShapeFeaturePtr)npenSF;
- }
-
-
-
- void NPenShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const
- {
- outDistance = 0.0;
-
- NPenShapeFeature *inFeature = (NPenShapeFeature*)(shapeFeaturePtr.operator ->());
-
- outDistance += (m_x - inFeature->getX())*(m_x - inFeature->getX());
- outDistance += (m_y - inFeature->getY())*(m_y - inFeature->getY());
- outDistance += (m_cosAlpha - inFeature->getCosAlpha())*(m_cosAlpha - inFeature->getCosAlpha());
- outDistance += (m_sinAlpha - inFeature->getSinAlpha())*(m_sinAlpha - inFeature->getSinAlpha());
- outDistance += (m_cosBeta - inFeature->getCosBeta())*(m_cosBeta - inFeature->getCosBeta());
- outDistance += (m_sinBeta - inFeature->getSinBeta())*(m_sinBeta - inFeature->getSinBeta());
- outDistance += (m_aspect - inFeature->getAspect())*(m_aspect - inFeature->getAspect());
- outDistance += (m_curliness - inFeature->getCurliness())*(m_curliness - inFeature->getCurliness());
- outDistance += (m_linearity - inFeature->getLinearity())*(m_linearity - inFeature->getLinearity());
- outDistance += (m_slope - inFeature->getSlope())*(m_slope - inFeature->getSlope());
- }
-
-
- int NPenShapeFeature::toFloatVector(vector<float>& floatVec)
- {
- floatVec.push_back(m_x);
- floatVec.push_back(m_y);
- floatVec.push_back(m_cosAlpha);
- floatVec.push_back(m_sinAlpha);
- floatVec.push_back(m_cosBeta);
- floatVec.push_back(m_sinBeta);
- floatVec.push_back(m_aspect);
- floatVec.push_back(m_curliness);
- floatVec.push_back(m_linearity);
- floatVec.push_back(m_slope);
-
- if(isPenUp())
- {
- floatVec.push_back(1.0f);
- }
- else
- {
- floatVec.push_back(0.0f);
- }
-
- return SUCCESS;
- }
-
-
- int NPenShapeFeature::getFeatureDimension()
- {
-
- return 11;
- }
-
-
- int NPenShapeFeature::initialize(const floatVector& initFloatVector)
- {
-
-
- if(initFloatVector.size() != 11)
- {
- return FAILURE;
- }
-
- m_x = initFloatVector[0];
-
- m_y = initFloatVector[1];
-
-
- m_cosAlpha = initFloatVector[2];
-
- m_sinAlpha = initFloatVector[3];
-
- m_cosBeta = initFloatVector[4];
-
- m_sinBeta = initFloatVector[5];
-
- m_aspect = initFloatVector[6];
-
- m_curliness = initFloatVector[7];
-
- m_linearity = initFloatVector[8];
-
- m_slope = initFloatVector[9];
-
- if(fabs(initFloatVector[10] - 1.0f) < EPS)
- {
- m_isPenUp = true;
- }
- else
- {
- m_isPenUp = false;
- }
-
- return SUCCESS;
- }
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h
deleted file mode 100644
index 1f9f5f08..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeature.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-#include "LTKShapeFeature.h"
-
-#define DELIMITER_SIZE 5
-
-
-/** @ingroup NPenShapeFeatureExtractor
-* @brief The feature representation class for NPen features
-* This class represents NPen++ features such as X, Y, cos/sin alpha, cos/sin beta, aspect, curliness, linearity, slope and pen-up/down bit
-* @class NPenShapeFeature
-*
-*/
-class NPenShapeFeature : public LTKShapeFeature
-{
- /** @name private data members */
- //@{
-
-private:
- /** @brief X value */
- float m_x;
-
- /** @brief Y value */
- float m_y;
-
-
- float m_cosAlpha;
-
- float m_sinAlpha;
-
- float m_cosBeta;
-
- float m_sinBeta;
-
- float m_aspect;
-
- float m_curliness;
-
- float m_linearity;
-
- float m_slope;
-
- bool m_isPenUp;
-
-
- string m_data_delimiter;
- //@}
-
-public:
-
- /** @name Constructors and Destructor */
- //@{
-
- /**
- * Default Constructor.
- */
- NPenShapeFeature();
-
- /** parameterized constructor
- */
- NPenShapeFeature(float inX, float inY, float cosAlpha, float inSinAlpha,
- float inCosBeta, float inSinBeta, float inAspect, float inCurliness,
- float inLinearity, float inSlope, bool isPenUp);
-
- /**
- * Default destructor.
- */
- ~NPenShapeFeature();
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_x
- */
- float getX() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_y
- */
- float getY() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_cosAlpha
- */
- float getCosAlpha() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_sinAlpha
- */
- float getSinAlpha() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_cosBeta
- */
- float getCosBeta() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_sinBeta
- */
- float getSinBeta() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_aspect
- */
- float getAspect() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_curliness
- */
- float getCurliness() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_linearity
- */
- float getLinearity() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_slope
- */
- float getSlope() const;
-
- /**
- * Returns the value of the class data member NPenShapeFeature::m_penUp
- */
- bool isPenUp() const;
-
- /**
- * Sets the value of NPenShapeFeature::m_x
- */
- void setX(float x);
-
- /**
- * Sets the value of NPenShapeFeature::m_y
- */
- void setY(float y);
-
- /**
- * Sets the value of NPenShapeFeature::m_cosAlpha
- */
- void setCosAlpha(float cosAlpha);
-
- /**
- * Sets the value of NPenShapeFeature::m_sinAlpha
- */
- void setSinAlpha(float sinAlpha);
-
- /**
- * Sets the value of NPenShapeFeature::m_cosBeta
- */
- void setCosBeta(float cosBeta);
-
- /**
- * Sets the value of NPenShapeFeature::m_sinBeta
- */
- void setSinBeta(float sinBeta);
-
- /**
- * Sets the value of NPenShapeFeature::m_aspect
- */
- void setAspect(float aspect);
-
- /**
- * Sets the value of NPenShapeFeature::m_curliness
- */
- void setCurliness(float curliness);
-
- /**
- * Sets the value of NPenShapeFeature::m_linearity
- */
- void setLinearity(float linearity);
-
- /**
- * Sets the value of NPenShapeFeature::m_slope
- */
- void setSlope(float slope);
-
- /**
- * Sets the value of NPenShapeFeature::m_penUp
- */
- void setPenUp(bool penUp);
-
-
- /**
- * @brief Initializes an instance of NPenShapeFeature from the string passed as parameter.
- *
- * <b>Semantics</b>
- *
- * - Tokenize the input string on NPenShapeFeature::m_data_delimiter using StringTokenizer::tokenizeString
- * - Initialize the data members of the class with the tokens returned.
- *
- * @param initString : string& : Reference to the initialization string.
- *
- * @return FAILURE : If the initalization string contains more than or less than seven tokens (after tokenizing on NPenShapeFeature::m_data_delimiter)
- * @return SUCCESS : If initialization done without any errors.
- *
- */
-
- //see interface
- int initialize(const string& initString);
-
- /**
- * @brief Gives the string representation of the NPenShapeFeature instance
- */
- //see interface
- void toString(string& strFeat) const;
-
- /**
- * This method implements the clone pattern and returns a cloned instance of the invoking NPenShapeFeature object
- */
- LTKShapeFeaturePtr clone() const;
-
-
-
- void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;
-
- /**
- * Converts the local feature instance into a float vector. The elements of the float vector are m_x, m_y, m_cosAlpha, m_sinAlpha, m_cosBeta, m_sinBeta, m_aspect, m_curliness, m_linearity, m_slope and m_isPenUp in the order.
- * @param floatVec: vector<float>&: The float vector which will contain the member values.
- * @return int : returns SUCCESS or FAILURE
- *
- */
- int toFloatVector(vector<float>& floatVec);
-
-
- int getFeatureDimension();
-
-
-
- int initialize(const floatVector& initFloatVector);
-
-
-};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp
deleted file mode 100644
index e20b63dc..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.cpp
+++ /dev/null
@@ -1,722 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of RunShaperec tool
- *
- * CONTENTS:
- * extractFeatures
- * getShapeFeatureInstance
- * clearFeatureVector
- *
- * AUTHOR: Bharath A
- *
- * DATE: June 11, 2008
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-
-#include "NPenShapeFeatureExtractor.h"
-#include "NPenShapeFeature.h"
-#include "LTKTraceGroup.h"
-#include "LTKTrace.h"
-#include "LTKChannel.h"
-#include "LTKTraceFormat.h"
-#include "LTKConfigFileReader.h"
-#include "LTKMacros.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKLoggerUtil.h"
-#include "LTKPreprocDefaults.h"
-
-/******************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 1-Oct-2007
-* NAME : NPenShapeFeatureExtractor
-* DESCRIPTION : parameterized constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*******************************************************************************/
-NPenShapeFeatureExtractor::NPenShapeFeatureExtractor(const LTKControlInfo& controlInfo):
-m_windowSize(FEATEXTR_NPEN_DEF_WINDOW_SIZE)
-{
- string cfgFilePath = "";
-
- // Config file
- if ( ! ((controlInfo.lipiRoot).empty()) &&
- ! ((controlInfo.projectName).empty()) &&
- ! ((controlInfo.profileName).empty()) &&
- ! ((controlInfo.cfgFileName).empty()))
- {
- // construct the cfg path using project and profile name
- cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
- (controlInfo.projectName) + PROFILE_PATH_STRING +
- (controlInfo.profileName) + SEPARATOR +
- (controlInfo.cfgFileName) + CONFIGFILEEXT;
- }
- else if ( ! ((controlInfo.cfgFilePath).empty() ))
- {
- cfgFilePath = controlInfo.cfgFilePath;
- }
- else
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
-
-
- int returnVal = readConfig(cfgFilePath);
-
- if (returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: NPenShapeFeatureExtractor::NPenShapeFeatureExtractor()" <<endl;
-
- throw LTKException(returnVal);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NPenShapeFeatureExtractor::NPenShapeFeatureExtractor()" << endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 1-Oct-2007
-* NAME : readConfig
-* DESCRIPTION : read the config values from cfg file and set member variables
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*************************************************************************************/
-
-int NPenShapeFeatureExtractor::readConfig(const string& cfgFilePath)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NPenShapeFeatureExtractor::readConfig()" << endl;
-
- LTKConfigFileReader* configurableProperties = NULL;
- string tempStringVar = "";
-
- try
- {
- configurableProperties = new LTKConfigFileReader(cfgFilePath);
-
- int errorCode = configurableProperties->getConfigValue(NPEN_WINDOW_SIZE, tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if (setWindowSize(atoi((tempStringVar).c_str())) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- ECONFIG_FILE_RANGE << " : " <<
- getErrorMessage(ECONFIG_FILE_RANGE) <<
- " NPenShapeFeatureExtractor::readConfig" <<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- }
-
- catch(LTKException e)
- {
- delete configurableProperties;
-
- int eCode = e.getErrorCode();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode <<
- " : " << getErrorMessage(eCode) <<
- " NPenShapeFeatureExtractor::readConfig" <<endl;
-
- LTKReturnError(eCode);
- }
- delete configurableProperties;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NPenShapeFeatureExtractor::readConfig()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 1-Oct-2007
-* NAME : setRadius
-* DESCRIPTION : set the radius(the size of window) to compute NPen features
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*************************************************************************************/
-int NPenShapeFeatureExtractor::setWindowSize(int windowSize)
-{
- int returnVal = FAILURE;
-
- if ( windowSize > 0 && (windowSize%2 == 1))
- {
- m_windowSize = windowSize;
- returnVal = SUCCESS;
- }
-
- return returnVal;
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 15-Feb-2008
-* NAME : getRadius
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date
-*************************************************************************************/
-int NPenShapeFeatureExtractor::getWindowSize()
-{
- return m_windowSize;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 12-Jun-2008
-* NAME : extractFeatures
-* DESCRIPTION : Extracts NPen features from a trace group
-* ARGUMENTS : The trace group from which features have to be extracted
-* RETURNS : vector of NPenShapeFeature objects
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int NPenShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NPenShapeFeatureExtractor::extractFeatures()" << endl;
-
- NPenShapeFeature* featurePtr = NULL;
-
- vector<vector<float> > floatFeatureValues;
-
-
-
- int errorCode;
-
- if(inTraceGroup.getNumTraces() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: FeatureExtractor::findAllFeatures"<<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
-
- vector<vector<float> > concatenatedCoord;
- int currPenUpPointIndex = -1;
- vector<int> penUpPointsIndices;
-
-
- int halfWindowSize = m_windowSize/2;
-
- if(halfWindowSize==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: FeatureExtractor::findAllFeatures"<<endl;
-
- LTKReturnError(EINVALID_NUM_OF_POINTS);
- }
-
-
- for(int t=0;t<inTraceGroup.getNumTraces();++t)
- {
-
- LTKTrace eachTrace;
- inTraceGroup.getTraceAt(t,eachTrace);
-
- if(eachTrace.isEmpty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: FeatureExtractor::findAllFeatures"<<endl;
-
- LTKReturnError(EEMPTY_TRACE);
-
- }
-
- vector<float> xVec;
- vector<float> yVec;
-
- eachTrace.getChannelValues(X_CHANNEL_NAME,xVec);
- eachTrace.getChannelValues(Y_CHANNEL_NAME,yVec);
-
- if(t==0)
- {
- vector<float> firstPoint;
- firstPoint.push_back(xVec[0]);
- firstPoint.push_back(yVec[0]);
-
- concatenatedCoord.insert(concatenatedCoord.begin(),halfWindowSize,firstPoint);
- }
-
- for(int p=0;p<xVec.size();++p)
- {
- vector<float> point;
- point.push_back(xVec[p]);
- point.push_back(yVec[p]);
-
- concatenatedCoord.push_back(point);
-
- }
-
- currPenUpPointIndex += xVec.size();
-
- penUpPointsIndices.push_back(currPenUpPointIndex);
-
- if(t==(inTraceGroup.getNumTraces()-1))
- {
- vector<float> lastPoint;
- lastPoint.push_back(xVec[xVec.size()-1]);
- lastPoint.push_back(yVec[yVec.size()-1]);
-
- concatenatedCoord.insert(concatenatedCoord.end(),halfWindowSize,lastPoint);
- }
-
- }
-
-
-
- /* 0 - normalized x
- 1 - normalized y
- 2 - cos alpha
- 3 - sin alpha
- 4 - cos beta
- 5 - sin beta
- 6 - aspect
- 7 - curliness
- 8 - linearity
- 9 - slope
- 10 - pen-up / pen-down stroke (0 for pen-down and 1 for pen-up)*/
-
- float deltaX=0;
- float deltaY=0;
- float hypotenuse=0;
-
-
- float cosalpha=0;
- float sinalpha=0;
- float cosbeta=0;
- float sinbeta=0;
- float ispenup=0;
- float aspect=0;
- float curliness=0;
- float linearity=0;
- float slope=0;
-
-
- float xMin,yMin,xMax,yMax; //for vicnity bounding box;
- float bbWidth,bbHeight;
- float maxOfWidthHeight;
-
-
-
- currPenUpPointIndex = 0;
-
-
- for(int f=halfWindowSize;f<(concatenatedCoord.size()-halfWindowSize);++f)
- {
-
- vector<float> eachPointFeature;
-
- eachPointFeature.push_back(concatenatedCoord[f][0]); //x
- eachPointFeature.push_back(concatenatedCoord[f][1]); //y
-
- deltaX = concatenatedCoord[f-1][0] - concatenatedCoord[f+1][0];
- deltaY = concatenatedCoord[f-1][1] - concatenatedCoord[f+1][1];
-
- hypotenuse = sqrt((deltaX*deltaX)+(deltaY*deltaY));
-
- if(hypotenuse < EPS)
- {
- cosalpha = 1;
- sinalpha = 0;
- }
- else
- {
- cosalpha = deltaX / hypotenuse;
- sinalpha = deltaY / hypotenuse;
- }
-
- eachPointFeature.push_back(cosalpha);
- eachPointFeature.push_back(sinalpha);
-
- eachPointFeature.push_back(cosbeta); //creating empty spaces for cosine and sine betas for future assignment
- eachPointFeature.push_back(sinbeta);
-
- vector<vector<float> > vicinity;
-
- float vicinityTrajLen = 0.0f;
-
- for(int v=f-halfWindowSize;v<=f+halfWindowSize;++v)
- {
- vicinity.push_back(concatenatedCoord[v]);
-
- if(v<(f+halfWindowSize))
- {
- vicinityTrajLen += (sqrt(((concatenatedCoord[v+1][1]-concatenatedCoord[v][1])*(concatenatedCoord[v+1][1]-concatenatedCoord[v][1]))+((concatenatedCoord[v+1][0]-concatenatedCoord[v][0])*(concatenatedCoord[v+1][0]-concatenatedCoord[v][0]))));
- }
- }
-
- findVicinityBoundingBox(vicinity,xMin,yMin,xMax,yMax);
-
- bbWidth = xMax - xMin;
-
- bbHeight = yMax - yMin;
-
- if(fabs(bbHeight+bbWidth)<EPS)
- {
- aspect = 0.0;
- }
- else
- {
- aspect = (bbHeight-bbWidth)/(bbHeight+bbWidth);
- }
-
-
- eachPointFeature.push_back(aspect);
-
-
- maxOfWidthHeight = ( bbWidth > bbHeight) ? bbWidth : bbHeight;
-
- if(fabs(maxOfWidthHeight) < EPS)
- {
- curliness = 0.0f;
- }
- else
- {
- curliness = (vicinityTrajLen / maxOfWidthHeight) - 2;
- }
-
- eachPointFeature.push_back(curliness);
-
- computeLinearityAndSlope(vicinity,linearity,slope);
-
- eachPointFeature.push_back(linearity);
- eachPointFeature.push_back(slope);
-
- if(penUpPointsIndices[currPenUpPointIndex] == (f-halfWindowSize))
- {
- ispenup = 1;
- ++currPenUpPointIndex;
- }
- else
- {
- ispenup = 0;
- }
- eachPointFeature.push_back(ispenup); //currently assuming pen-up strokes are not resampled
-
- floatFeatureValues.push_back(eachPointFeature);
-
- }
-
-
- //duplicating first and last features
- vector<float> firstFeaturePoint = floatFeatureValues[0];
-
- floatFeatureValues.insert(floatFeatureValues.begin(),1,firstFeaturePoint);
-
- vector<float> lastFeaturePoint = floatFeatureValues[floatFeatureValues.size()-1];
-
- floatFeatureValues.insert(floatFeatureValues.end(),1,lastFeaturePoint);
-
-
- for(int ff=1;ff<(floatFeatureValues.size()-1);++ff)
- {
-
- floatFeatureValues[ff][4] = (floatFeatureValues[ff-1][2]*floatFeatureValues[ff+1][2]) + (floatFeatureValues[ff-1][3]*floatFeatureValues[ff+1][3]);
- floatFeatureValues[ff][5] = (floatFeatureValues[ff-1][2]*floatFeatureValues[ff+1][3]) - (floatFeatureValues[ff-1][3]*floatFeatureValues[ff+1][2]);
-
- }
-
- //removing the extraneous feature points at the beginning and end
- floatFeatureValues.erase(floatFeatureValues.begin(),floatFeatureValues.begin()+1);
- floatFeatureValues.pop_back();
-
-
- for(int a=0;a<floatFeatureValues.size();++a)
- {
- NPenShapeFeature* ptrFeature = new NPenShapeFeature();
- ptrFeature->setX(floatFeatureValues[a][0]);
- ptrFeature->setY(floatFeatureValues[a][1]);
- ptrFeature->setCosAlpha((1+floatFeatureValues[a][2])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
- ptrFeature->setSinAlpha((1+floatFeatureValues[a][3])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
- ptrFeature->setCosBeta((1+floatFeatureValues[a][4])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
- ptrFeature->setSinBeta((1+floatFeatureValues[a][5])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
- ptrFeature->setAspect(floatFeatureValues[a][6]);
- ptrFeature->setCurliness(floatFeatureValues[a][7]);
- ptrFeature->setLinearity(floatFeatureValues[a][8]);
- ptrFeature->setSlope((1+floatFeatureValues[a][9])*((float)PREPROC_DEF_NORMALIZEDSIZE/2.0));
-
- if(fabs(floatFeatureValues[a][10]-1.0f) < EPS)
- {
- ptrFeature->setPenUp(true);
- }
- else
- {
- ptrFeature->setPenUp(false);
- }
-
- outFeatureVec.push_back(LTKShapeFeaturePtr(ptrFeature));
-
- ptrFeature = NULL;
-
- }
-
-
-
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NPenShapeFeatureExtractor::extractFeatures()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 12-Jun-2008
-* NAME : getShapeFeatureInstance
-* DESCRIPTION : Returns an NPenShapeFeature instance
-* ARGUMENTS :
-* RETURNS : An NPenShapeFeature instance
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKShapeFeaturePtr NPenShapeFeatureExtractor::getShapeFeatureInstance()
-{
- LTKShapeFeaturePtr tempPtr(new NPenShapeFeature);
- return tempPtr;
-}
-
-
-/******************************************************************************
-* AUTHOR : Bharath A
-* DATE : 12-Jun-2008
-* NAME : convertFeatVecToTraceGroup
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int NPenShapeFeatureExtractor::convertFeatVecToTraceGroup(
- const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NPenShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
-
- vector<LTKChannel> channels; // channels of a trace
-
- LTKChannel xChannel("X", DT_FLOAT, true); // x-coordinate channel of the trace
- LTKChannel yChannel("Y", DT_FLOAT, true); // y-coordinate channel of the trace
-
- //initializing the channels of the trace
- channels.push_back(xChannel);
- channels.push_back(yChannel);
-
- // composing the trace format object
- LTKTraceFormat traceFormat(channels);
-
- vector<float> point; // a point of a trace
-
- LTKTrace trace(traceFormat);
-
- for(int count=0;count<(int)shapeFeature.size();count++)
- {
- float Xpoint, Ypoint;
- bool penUp;
-
- NPenShapeFeature* ptr = (NPenShapeFeature*)(shapeFeature[count].operator ->());
- Xpoint = ptr->getX();
- Ypoint = ptr->getY();
- penUp = ptr->isPenUp();
-
-
-
- point.push_back(Xpoint);
- point.push_back(Ypoint);
-
- trace.addPoint(point);
- point.clear();
-
-
- if(penUp == true) // end of a trace, clearing the trace now
- {
- outTraceGroup.addTrace(trace);
- trace.emptyTrace();
- LTKTrace tempTrace(traceFormat);
- trace = tempTrace;
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NPenShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
- return SUCCESS;
-
-}
-
-
-void NPenShapeFeatureExtractor::findVicinityBoundingBox(vector<vector<float> >& inputXYCoords, float& xMin, float& yMin, float& xMax, float& yMax)
- {
- xMin = FLT_MAX;
- yMin = FLT_MAX;
-
- xMax = -FLT_MAX;
- yMax = -FLT_MAX;
-
- for(int i=0;i<inputXYCoords.size();++i)
- {
- if(inputXYCoords[i][0] < xMin)
- {
- xMin = inputXYCoords[i][0];
- }
-
- if(inputXYCoords[i][0] > xMax)
- {
- xMax = inputXYCoords[i][0];
- }
-
- if(inputXYCoords[i][1] < yMin)
- {
- yMin = inputXYCoords[i][1];
- }
-
- if(inputXYCoords[i][1] > yMax)
- {
- yMax = inputXYCoords[i][1];
- }
- }
-
- }
-
-
-
-int NPenShapeFeatureExtractor::computeLinearityAndSlope(const vector<vector<float> >& vicinity,float& linearity,float& slope)
- {
- if(vicinity.size()<3)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: FeatureExtractor::computeLinearity"<<endl;
-
- LTKReturnError(FAILURE);
- }
-
- float x1 = vicinity[0][0];
- float y1 = vicinity[0][1];
-
- float x2 = vicinity[vicinity.size()-1][0];
- float y2 = vicinity[vicinity.size()-1][1];
-
- float avgX = 0.0f;
- float avgY = 0.0f;
-
- float denominator = sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
-
- /*if(denominator < EPS)
- {
- linearity = 0.0f;
- slope = 1.0f;
-
- return SUCCESS;
- }*/
-
- if(denominator < EPS)
- {
- slope = 1.0f;
-
-
- //considering the case of loop where the end points are the same
- avgX = (x1+x2)/2.0f;
- avgY = (y1+y2)/2.0f;
- }
- else if(fabs(x2-x1) < EPS)
- {
- slope = 0.0f;
- }
- else
- {
- slope = cos(atan((y2-y1)/(x2-x1)));
- }
-
-
- float x0 = 0.0f;
- float y0 = 0.0f;
-
- float distance = 0.0f;
-
-
- linearity = 0.0f;
-
- for(int v=1; v<(vicinity.size()-1); ++v)
- {
-
- if(vicinity[v].size() < 2)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: FeatureExtractor::computeLinearity"<<endl;
-
- LTKReturnError(FAILURE);
- }
-
- x0 = vicinity[v][0];
- y0 = vicinity[v][1];
-
- if(denominator < EPS)
- {
- distance = sqrt(((avgX-x0)*(avgX-x0))+((avgY-y0)*(avgY-y0)));
- }
- else
- {
- distance = fabs(((x2-x1)*(y1-y0))-((x1-x0)*(y2-y1))) / denominator;
- }
-
- linearity += (distance*distance);
-
- }
-
- linearity /= (vicinity.size()-2); // 2 to exclude the end points of vicinity while computing average squared distance
-
- return SUCCESS;
- }
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h
deleted file mode 100644
index 18ca347e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/NPenShapeFeatureExtractor.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-02-20 10:03:51 +0530 (Wed, 20 Feb 2008) $
- * $Revision: 423 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-#include "LTKShapeFeatureExtractor.h"
-/** @ingroup NPenShapeFeatureExtractor
-* @brief The feature extractor for NPen features.
-* @class NPenShapeFeatureExtractor
-*
-*/
-#define FEATEXTR_NPEN_DEF_WINDOW_SIZE 5
-
-class LTKLoggerInterface;
-
-class NPenShapeFeatureExtractor : public LTKShapeFeatureExtractor
-{
-private:
- int m_windowSize;
- LTKLoggerInterface* m_ptrLog;
-
-public:
- /** @brief Constructor for the NPen feature extractor
- * Gets the cfg file path from the contorInfo
- * Reads the cfg variables and poputlates the member variables
- * @param controlInfo: LTKControlInfo : The control information
- * @return no return value as it is a constructor
- */
- NPenShapeFeatureExtractor(const LTKControlInfo& controlInfo);
-
- /** @brief Extracts NPen features from an LTKTraceGroup
- * The XY Coordinate values are extracted from the trace gruoup.
- * Using the coordinate values, normalized first derivatives are computed.
- * After computing the first derivatives, the normalized second derivatives and the curvature are computed. The second derivative and curvature computation occur simultaneously.
- * @param inTraceGroup: LTKTraceGroup& : The trace group from which local seven features have to be extracted
- * @return LTKShapeFeaturePtr* : A vector of pointers to LTKShapeFeature objects. The pointers point to instances of the NPenShapeFeature class. The vector contains local-seven features extracted from the trace group.
- */
-
- int extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec);
-
- /** @brief Returns an instance of the NPenShapeFeature class
- * @return LTKShapeFeature*: The returned empty NPenShapeFeature instance.
- */
- LTKShapeFeaturePtr getShapeFeatureInstance();
-
- /** @brief Converts a feature vector to trace group
- * @param shapeFeature : LTKShapeFeaturePtr* : The feature vector to be converted to a trace group.
- * @param outTraceGroup : LTKTraceGroup& : The output trace group
- */
- //see interface
- int convertFeatVecToTraceGroup(const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup);
-
- int getWindowSize();
-
-private:
-
-
- /** @brief reads the cfg file and sets the member variables
- * @param cfgFilePath : const string&: The path of the cfg file to be opened
- * @return int : The sucess or failure of the function
- */
- int readConfig(const string& cfgFilePath);
-
- /** @validates the value passed and sets the member variable
- * @param radius : const int: The value of the variable to be set
- * @return int : The sucess or failure of the function
- */
- int setWindowSize(int radius);
-
-
- void findVicinityBoundingBox(vector<vector<float> >& inputXYCoords, float& xMin, float& yMin, float& xMax, float& yMax);
-
- int computeLinearityAndSlope(const vector<vector<float> >& vicinity,float& linearity,float& slope);
-
-};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro
deleted file mode 100644
index dacec369..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/npen/npen.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-LIPILIBS = ltkcommon ltkutil featureextractorcommon
-include(../../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../../util/lib \
- ../common \
-
-HEADERS += \
- NPen.h \
- NPenShapeFeature.h \
- NPenShapeFeatureExtractor.h \
-
-SOURCES += \
- NPen.cpp \
- NPenShapeFeature.cpp \
- NPenShapeFeatureExtractor.cpp \
-
-win32 {
- DEFINES += NPEN_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = NPen.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/.prev_CMakeLists.txt
deleted file mode 100644
index a50421e1..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from pointfloat.pro.
-
-#####################################################################
-## pointfloat Generic Library:
-#####################################################################
-
-qt_add_cmake_library(pointfloat
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- PointFloat.cpp PointFloat.h
- PointFloatShapeFeature.cpp PointFloatShapeFeature.h
- PointFloatShapeFeatureExtractor.cpp PointFloatShapeFeatureExtractor.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(pointfloat)
-
-#### Keys ignored in scope 1:.:.:pointfloat.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(pointfloat CONDITION WIN32
- DEFINES
- POINTFLOAT_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(pointfloat CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(pointfloat)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/CMakeLists.txt
deleted file mode 100644
index 009836d2..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from pointfloat.pro.
-
-#####################################################################
-## pointfloat Generic Library:
-#####################################################################
-
-qt_add_cmake_library(pointfloat
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- PointFloat.cpp PointFloat.h
- PointFloatShapeFeature.cpp PointFloatShapeFeature.h
- PointFloatShapeFeatureExtractor.cpp PointFloatShapeFeatureExtractor.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(pointfloat)
-
-#### Keys ignored in scope 1:.:.:pointfloat.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(pointfloat CONDITION WIN32
- DEFINES
- POINTFLOAT_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(pointfloat CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(pointfloat)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp
deleted file mode 100644
index 81678e45..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*****************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-* THE SOFTWARE.
-******************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-// pointFloat.cpp : Defines the entry point for the DLL application.
-
-#include "PointFloat.h"
-#include "PointFloatShapeFeatureExtractor.h"
-#include "LTKShapeFeatureExtractor.h"
-#include "PointFloatShapeFeature.h"
-#include "LTKErrors.h"
-
-
-#ifdef _WIN32
-#include <windows.h>
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif
-
-/***************************************************************************
-* AUTHOR : Saravanan R
-* DATE : 15-Mar-2007
-* NAME : createFeatureExtractor
-* DESCRIPTION : Creates instance of type PointFloatShapeFeatureExtractor and retuns of type
- LTKShapeFeatureExtractor. (Acts as a Factory Method).
-* ARGUMENTS :
-* RETURNS : returns an instace of type LTKShapeFeatureExtractor.
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*******************************************************************************/
-int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor)
-{
- try
- {
- *outFeatureExtractor = new PointFloatShapeFeatureExtractor(controlInfo);
- }
- catch(LTKException e)
- {
- *outFeatureExtractor = NULL;
-
- LTKReturnError(e.getErrorCode());
- }
-
- return SUCCESS;
-}
-
-/****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 15-Mar-2007
-* NAME : deleteShapeFeatureExtractor
-* DESCRIPTION : Destroy the instance by taking the address as its argument.
-* ARGUMENTS : Address of LTKShapeRecognizerFeatureExtractor instnace.
-* RETURNS : Returns 0 on Success
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*****************************************************************************/
-int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
-{
- if ( obj != NULL )
- {
- delete obj;
- obj = NULL;
- }
-
- return 0;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def
deleted file mode 100644
index 9a185d39..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- createShapeFeatureExtractor @1
- deleteShapeFeatureExtractor @2
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h
deleted file mode 100644
index 91ee5e6b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloat.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
-* FILE DESCR: Definitions for PointFloat dll exporting functions.
-*
-* CONTENTS:
-*
-* AUTHOR: Vijayakumara M.
-*
-* DATE: 28-July-2005
-* CHANGE HISTORY:
-* Author Date Description
-************************************************************************/
-#ifndef __POINTFLOAT_H__
-#define __POINTFLOAT_H__
-
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the POINTFLOAT_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// POINTFLOAT_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef _WIN32
-#ifdef POINTFLOAT_EXPORTS
-#define POINTFLOAT_API __declspec(dllexport)
-#else
-#define POINTFLOAT_API __declspec(dllimport)
-#endif //ifdef POINTFLOAT_EXPORTS
-#else
-#define POINTFLOAT_API
-#endif //#ifdef _WIN32
-
-
-#include "LTKTypes.h"
-#include "LTKLoggerUtil.h"
-
-class LTKShapeFeatureExtractor;
-class LTKShapeFeature;
-
-/** @defgroup PointFloatShapeFeatureExtractor
-*@brief The PointFloatShapeFeatureExtractor
-*/
-
-/**
-* @ingroup PointFloatShapeFeatureExtractor
-* @file PointFloat.cpp
-* <p>
-* The functions exported by the DLL
-* - ::createShapeFeatureExtractor
-* - ::deleteShapeFeatureExtractor
-* - ::getCurrentVersion
-* - ::deleteShapeFeaturePtr
-*/
-
-/**
-* @brief Returns a pointer to the instance of PointFloatShapeFeatureExtractor
-*
-* <p>
-* This function is based on run-time polymorphism. It creates an instance of
-* PointFloatShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
-* </p>
-*
-* @param none
-*
-* @return Pointer to LTKShapeFeatureExtractor
-*/
-extern "C" POINTFLOAT_API int createShapeFeatureExtractor(
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor);
-
-/**
-* @brief Deletes the feature extractor instance.
-*
-* <p>
-* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
-* </p>
-*
-* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
-*
-* @return 0 on Success
-*/
-extern "C" POINTFLOAT_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
-
-#endif //#ifndef __POINTFLOAT_H__
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp
deleted file mode 100644
index 02e5c9c7..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.cpp
+++ /dev/null
@@ -1,517 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-07-01 20:12:22 +0530 (Wed, 01 Jul 2009) $
- * $Revision: 784 $
- * $Author: mnab $
- *
- ************************************************************************/
-#include "PointFloatShapeFeature.h"
-#include "LTKStringUtil.h"
-#include <sstream>
-
-const string PointFloatShapeFeature::m_data_delimiter = ",";
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : Default Constructor
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-PointFloatShapeFeature::PointFloatShapeFeature()
-{
-}
-
-/******************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 10-Dec-2007
-* NAME : Parameterized Constructor
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-PointFloatShapeFeature::PointFloatShapeFeature(float inX, float inY,
- float inSinTheta, float inCosTheta, bool inPenUp):
-m_x(inX),
-m_y(inY),
-m_sinTheta(inSinTheta),
-m_cosTheta(inCosTheta),
-m_penUp(inPenUp)
-{
-}
-
-/*****************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : Default Constructor
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-PointFloatShapeFeature::~PointFloatShapeFeature()
-{
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : getX
-* DESCRIPTION :
-* ARGUMENTS : none
-* RETURNS : float : x value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-float PointFloatShapeFeature::getX() const
-{
- return m_x;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE :15-Mar-2007
-* NAME : getY
-* DESCRIPTION :
-* ARGUMENTS : none
-* RETURNS : float : y value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-float PointFloatShapeFeature::getY() const
-{
- return m_y;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE :13-Sept-2007
-* NAME : getSinTheta
-* DESCRIPTION :
-* ARGUMENTS : none
-* RETURNS : float : sintheta value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-float PointFloatShapeFeature::getSinTheta() const
-{
- return m_sinTheta;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE :13-Sept-2007
-* NAME : getCosTheta
-* DESCRIPTION :
-* ARGUMENTS : none
-* RETURNS : float : costheta value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-float PointFloatShapeFeature::getCosTheta() const
-{
- return m_cosTheta;
-}
-
-/***************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE :13-Sept-2007
-* NAME : isPenUp
-* DESCRIPTION :
-* ARGUMENTS : none
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-* Balaji MNA 01-July-2009 Rename getPenUp to isPenUp
-******************************************************************************/
-bool PointFloatShapeFeature::isPenUp() const
-{
- return m_penUp;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : setX
-* DESCRIPTION :
-* ARGUMENTS : float : x value
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void PointFloatShapeFeature::setX(float x)
-{
- m_x = x;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : setY
-* DESCRIPTION :
-* ARGUMENTS : float : y value
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void PointFloatShapeFeature::setY(float y)
-{
- m_y = y;
-}
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 13-Sept_2007
-* NAME : setSinTheta
-* DESCRIPTION :
-* ARGUMENTS : float : sintheta value
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void PointFloatShapeFeature::setSinTheta(float sintheta)
-{
- m_sinTheta = sintheta;
-}
-
-/**********************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 13-Sept_2007
-* NAME : setTheta
-* DESCRIPTION :
-* ARGUMENTS : float : costheta value
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void PointFloatShapeFeature::setCosTheta(float costheta)
-{
- m_cosTheta = costheta;
-}
-
-/**************************************************************************
-* AUTHOR : Naveen Sundar G.
-* DATE : 13-Sept_2007
-* NAME : setPenUp
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*****************************************************************************/
-void PointFloatShapeFeature::setPenUp(bool penUp)
-{
- m_penUp = penUp;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : clone
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
-*************************************************************************************/
-LTKShapeFeaturePtr PointFloatShapeFeature::clone() const
-{
- PointFloatShapeFeature* pointInst = new PointFloatShapeFeature();
-
- pointInst->setX(this->getX());
- pointInst->setY(this->getY());
- pointInst->setSinTheta(this->getSinTheta());
- pointInst->setCosTheta(this->getCosTheta());
- pointInst->setPenUp(this->isPenUp());
-
- return (LTKShapeFeaturePtr)pointInst;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : getDistance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
-*************************************************************************************/
-void PointFloatShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr,
- float& outDistance) const
-{
- PointFloatShapeFeature *inPointFloatFeature = (PointFloatShapeFeature*)(shapeFeaturePtr.operator ->());
-
- float xDiff = (m_x) - inPointFloatFeature->m_x;
-
- float yDiff = (m_y) - inPointFloatFeature->m_y;
-
- float sinthetaDiff = (m_sinTheta) - inPointFloatFeature->m_sinTheta;
-
- float costhetaDiff = (m_cosTheta) - inPointFloatFeature->m_cosTheta;
-
- outDistance = ( (xDiff * xDiff) + (yDiff * yDiff) +
- (sinthetaDiff * sinthetaDiff) + (costhetaDiff * costhetaDiff) );
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : initialize
-* DESCRIPTION : To convert the string to xy value
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
-*************************************************************************************/
-int PointFloatShapeFeature::initialize(const string& initString)
-{
- stringVector tokens;
-
- LTKStringUtil::tokenizeString(initString, m_data_delimiter, tokens);
-
- //Token size must be 4
-// if(tokens.size() != 4)
- if(tokens.size() != 5)
- return FAILURE; //Returning an error
-
- m_x = LTKStringUtil::convertStringToFloat(tokens[0]);
- m_y = LTKStringUtil::convertStringToFloat(tokens[1]);
- m_sinTheta = LTKStringUtil::convertStringToFloat(tokens[2]);
- m_cosTheta = LTKStringUtil::convertStringToFloat(tokens[3]);
-
- if(atoi(tokens[4].c_str()) == 1)
- {
- m_penUp = true;
- }
- else
- {
- m_penUp = false;
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 15-Mar-2007
-* NAME : toString
-* DESCRIPTION : To convert the points to a string
-* ARGUMENTS : string : holds the string value of xy points
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
-*************************************************************************************/
-void PointFloatShapeFeature::toString(string& strFeat) const
-{
- ostringstream tempString;
-
- tempString << m_x << m_data_delimiter << m_y << m_data_delimiter <<
- m_sinTheta << m_data_delimiter << m_cosTheta <<
- m_data_delimiter << m_penUp;
-
- strFeat = tempString.str();
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 30-Mar-2007
-* NAME : addFeature
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
-*************************************************************************************/
-int PointFloatShapeFeature::addFeature(const LTKShapeFeaturePtr& secondFeature,
- LTKShapeFeaturePtr& outResult ) const
-{
- PointFloatShapeFeature* resultFeature = new PointFloatShapeFeature();
-
- PointFloatShapeFeature *inFeature = (PointFloatShapeFeature*)(secondFeature.operator ->());
-
- resultFeature->setX(m_x + inFeature->getX());
- resultFeature->setY (m_y + inFeature->getY());
- resultFeature->setSinTheta (m_sinTheta + inFeature->getSinTheta());
- resultFeature->setCosTheta (m_cosTheta + inFeature->getCosTheta());
- resultFeature->setPenUp (m_penUp);
-
- outResult = LTKShapeFeaturePtr(resultFeature);
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 30-Mar-2007
-* NAME : subtractFeature
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
-*************************************************************************************/
-int PointFloatShapeFeature::subtractFeature(const LTKShapeFeaturePtr& secondFeature,
- LTKShapeFeaturePtr& outResult ) const
-{
- PointFloatShapeFeature* resultFeature=new PointFloatShapeFeature();
-
- PointFloatShapeFeature *inFeature = (PointFloatShapeFeature*)(secondFeature.operator ->());
-
- resultFeature->setX (m_x - inFeature->getX());
- resultFeature->setY (m_y - inFeature->getY());
- resultFeature->setSinTheta (m_sinTheta - inFeature->getSinTheta());
- resultFeature->setCosTheta (m_cosTheta - inFeature->getCosTheta());
- resultFeature->setPenUp (m_penUp);
-
- outResult = LTKShapeFeaturePtr(resultFeature);
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 30-Mar-2007
-* NAME : scaleFeature
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description: Implemented Support for theta
-*************************************************************************************/
-int PointFloatShapeFeature::scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
-{
- PointFloatShapeFeature* resultFeature=new PointFloatShapeFeature();
-
- resultFeature->setX (m_x * alpha);
- resultFeature->setY (m_y * alpha);
- resultFeature->setSinTheta (m_sinTheta * alpha);
- resultFeature->setCosTheta (m_cosTheta * alpha);
- resultFeature->setPenUp(m_penUp);
-
- outResult = LTKShapeFeaturePtr(resultFeature);
-
- return SUCCESS;
-}
-
-/***************************************************************************
-* AUTHOR : Saravanan R.
-* DATE : 30-Mar-2007
-* NAME : scaleFeature
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Naveen Sundar G. Date: 13-Sept-2007 Description:
- Implemented Support for theta
-*****************************************************************************/
-int PointFloatShapeFeature::toFloatVector(floatVector& floatVec)
-{
- floatVec.push_back(m_x);
- floatVec.push_back(m_y);
- floatVec.push_back(m_sinTheta);
- floatVec.push_back(m_cosTheta);
- if(m_penUp == true)
- floatVec.push_back(1.0);
- else
- floatVec.push_back(0.0);
-
- return SUCCESS;
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 23-Apr-2008
-* NAME : initialize
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Date Description:
-
-*****************************************************************************/
-int PointFloatShapeFeature::initialize(const floatVector& initFloatVector)
-{
- return initialize(initFloatVector.data(), initFloatVector.size());
-}
-
-int PointFloatShapeFeature::initialize(floatVector::const_pointer initFloatData, size_t dataSize)
-{
- if (dataSize < 5)
- {
- return FAILURE;
- }
-
- m_x = *(initFloatData++);
- m_y = *(initFloatData++);
- m_sinTheta = *(initFloatData++);
- m_cosTheta = *(initFloatData++);
- m_penUp = *(initFloatData++) != 0;
-
- return SUCCESS;
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 23-Apr-2008
-* NAME : getFeatureDimension
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author: Date Description:
-
-*****************************************************************************/
-
-int PointFloatShapeFeature::getFeatureDimension()
-{
- return 5;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h
deleted file mode 100644
index 4e05a0ca..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeature.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-07-01 20:12:22 +0530 (Wed, 01 Jul 2009) $
- * $Revision: 784 $
- * $Author: mnab $
- *
- ************************************************************************/
-#ifndef __POINTFLOATSHAPEFEATURE_H
-#define __POINTFLOATSHAPEFEATURE_H
-
-#include "LTKShapeFeature.h"
-
-
-/** @defgroup PointFloatShapeFeatureExtractor
-*/
-
-/** @ingroup PointFloatShapeFeatureExtractor
-* @brief The feature representation class for X, Y features (float)
-* @class PointFloatShapeFeature
-*
-*/
-class PointFloatShapeFeature : public LTKShapeFeature
-{
- /** @name private data members */
- //@{
-
-private:
- /** @brief X value */
- float m_x;
-
- /** @brief Y value */
- float m_y;
-
- /** @brief sin theta value */
- float m_sinTheta;
-
- /** @brief cos theta value */
- float m_cosTheta;
-
- /** @brief Pen-up information */
- bool m_penUp;
-
- /** @brief Delimiter character */
- static const string m_data_delimiter;
- //@}
-
-public:
-
- /** @name Constructors and Destructor */
- //@{
-
- /**
- * Default Constructor.
- */
- PointFloatShapeFeature();
-
- /** Parameterized Constructor */
- PointFloatShapeFeature(float inX, float inY, float inSinTheta,
- float inCosTheta, bool inPenUp);
-
- /**
- * Default destructor.
- */
- ~PointFloatShapeFeature();
-
- /**
- * Returns the value of class data member PointFloatShapeFeature::m_x
- */
- float getX() const;
-
- /**
- * Returns the value of PointFloatShapeFeature::m_y
- */
- float getY() const;
-
- /**
- * Returns the value of PointFloatShapeFeature::m_sinTheta
- */
- float getSinTheta() const;
-
- /**
- * Returns the value of PointFloatShapeFeature::m_cosTheta
- */
- float getCosTheta() const;
-
- bool isPenUp() const;
-
-
- /**
- * Sets the value of PointFloatShapeFeature::m_x
- */
-
- void setX(float x);
-
- /**
- * Sets the value of PointFloatShapeFeature::m_y
- */
- void setY(float y);
-
- /**
- * Sets the value of PointFloatShapeFeature::m_sinTheta
- */
-
- //int setSinTheta(float y);
- void setSinTheta(float y);
-
-
- /**
- * Sets the value of PointFloatShapeFeature::m_cosTheta
- */
- //int setCosTheta(float y);
- void setCosTheta(float y);
-
-
- void setPenUp(bool penUp);
- /**
- * @brief Initializes the PointFloatShapeFeature from the string passed as parameter.
- *
- * <b>Semantics</b>
- *
- * - Tokenize the input string on PointFloatShapeFeature::m_data_delimiter using StringTokenizer::tokenizeString
- * - Initialize the data members of the class with the tokens returned.
- *
- * @param initString : string& : Reference to the initialization string.
- *
- * @return FAILURE : If the initalization string contains more than two tokens (after tokenizing on PointFloatShapeFeature::m_data_delimiter)
- * @return SUCCESS : If initialization done without any errors.
- *
- */
- int initialize(const string& initString);
-
- int initialize(const floatVector& initFloatVector);
-
- int initialize(floatVector::const_pointer initFloatData, size_t dataSize);
-
- int toFloatVector(vector<float>& floatVec);
-
- /**
- * @brief Gives the string representation of the PointFloatShapeFeature instance
- */
- void toString(string& strFeat) const;
- /**
- * This method sets the value of x
- */
-
- LTKShapeFeaturePtr clone() const;
-
- void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;
-
-
-
- /**
- * @brief Adds two PoinFloatShapeFeature instances.
- *
- * @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to PointFloatShapeFeature instance
- *
- * @return LTKShapeFeature* : Pointer to PointFloatShapeFeature instance holding the result of addition.
- *
- */
- int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;
-
- /**
- * @brief Subtracts two PoinFloatShapeFeature instances.
- *
- * @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to PointFloatShapeFeature instance
- *
- * @return LTKShapeFeature* : Pointer to PointFloatShapeFeature instance holding the result of subtraction.
- *
- */
- int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;
-
- int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const ;
-
- int getFeatureDimension();
-
-};
-
-#endif
-//#ifndef __POINTFLOATSHAPEFEATURE_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp
deleted file mode 100644
index 49260852..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-/*****************************************************************************************
- * Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
- * Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-07-01 20:12:22 +0530 (Wed, 01 Jul 2009) $
- * $Revision: 784 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation for PointFloat Shape FeatureExtractor module
- *
- * CONTENTS:
- *
- * AUTHOR: Saravanan R.
- *
- * DATE: March 15, 2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "PointFloatShapeFeatureExtractor.h"
-#include "PointFloatShapeFeature.h"
-#include "LTKTraceGroup.h"
-#include "LTKTrace.h"
-#include "LTKChannel.h"
-#include "LTKTraceFormat.h"
-#include "LTKConfigFileReader.h"
-#include "LTKMacros.h"
-#include "LTKPreprocDefaults.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKLoggerUtil.h"
-
-
-/**********************************************************************************
- * AUTHOR : Naveen Sundar G
- * DATE : 1-Oct-2007
- * NAME : PointFloatShapeFeatureExtractor
- * DESCRIPTION : parameterized constructor
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date
- *************************************************************************************/
-PointFloatShapeFeatureExtractor::PointFloatShapeFeatureExtractor(
- const LTKControlInfo& controlInfo)
-{
- string cfgFilePath = "";
-
- // Config file
- if ( ! ((controlInfo.lipiRoot).empty()) &&
- ! ((controlInfo.projectName).empty()) &&
- ! ((controlInfo.profileName).empty()) &&
- ! ((controlInfo.cfgFileName).empty()))
- {
- // construct the cfg path using project and profile name
- cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
- (controlInfo.projectName) + PROFILE_PATH_STRING +
- (controlInfo.profileName) + SEPARATOR +
- (controlInfo.cfgFileName) + CONFIGFILEEXT;
- }
- else if ( ! ((controlInfo.cfgFilePath).empty() ))
- {
- cfgFilePath = controlInfo.cfgFilePath;
- }
- else
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
-
- int returnVal = readConfig(cfgFilePath);
-
- if (returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: PointFloatShapeFeatureExtractor::PointFloatShapeFeatureExtractor()"
- << endl;
-
- throw LTKException(returnVal);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "PointFloatShapeFeatureExtractor::PointFloatShapeFeatureExtractor()" << endl;
-}
-
-/**********************************************************************************
- * AUTHOR : Naveen Sundar G
- * DATE : 1-Oct-2007
- * NAME : readConfig
- * DESCRIPTION : read the config values from cfg file and set member variables
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date
- *************************************************************************************/
-
-int PointFloatShapeFeatureExtractor::readConfig(const string& cfgFilePath)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "PointFloatShapeFeatureExtractor::readConfig()" << endl;
-
- LTKConfigFileReader* configurableProperties = NULL;
- string tempStringVar = "";
-
- try
- {
- configurableProperties = new LTKConfigFileReader(cfgFilePath);
- }
-
- catch(LTKException e)
- {
- delete configurableProperties;
-
- int eCode = e.getErrorCode();
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode <<
- " : " << getErrorMessage(eCode) <<
- " PointFloatShapeFeatureExtractor::readConfig" <<endl;
-
- LTKReturnError(eCode);
- }
-
- delete configurableProperties;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "PointFloatShapeFeatureExtractor::readConfig()" << endl;
- return SUCCESS;
-
-}
-
-/**************************************************************************
- * AUTHOR : Naveen Sundar G
- * DATE :
- * NAME :
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date
- ****************************************************************************/
-
-int PointFloatShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "PointFloatShapeFeatureExtractor::extractFeatures()" << endl;
-
- PointFloatShapeFeature *featurePtr = NULL;
- float x,y,deltax;
- int numPoints=0; // number of pts
- int count=0;
- int currentStrokeSize;
- float sintheta, costheta,sqsum;
- int i;
-
- int numberOfTraces = inTraceGroup.getNumTraces();
-
- if (numberOfTraces == 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP)<<
- " PointFloatShapeFeatureExtractor::extractFeatures" <<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
- LTKTraceVector allTraces = inTraceGroup.getAllTraces();
- LTKTraceVector::iterator traceIter = allTraces.begin();
- LTKTraceVector::iterator traceEnd = allTraces.end();
-
-
- //***CONCATENTATING THE STROKES***
- for (; traceIter != traceEnd ; ++traceIter)
- {
- floatVector tempxVec, tempyVec;
-
- (*traceIter).getChannelValues("X", tempxVec);
-
- (*traceIter).getChannelValues("Y", tempyVec);
-
- // Number of points in the stroke
- numPoints = numPoints + tempxVec.size();
- }
-
- //***THE CONCATENATED FULL STROKE***
- floatVector xVec(numPoints);
- floatVector yVec(numPoints);
-
-
- traceIter = allTraces.begin();
- traceEnd = allTraces.end();
-
- boolVector penUp;
- // Add the penUp here
- for (; traceIter != traceEnd ; ++traceIter)
- {
- floatVector tempxVec, tempyVec;
-
- (*traceIter).getChannelValues("X", tempxVec);
-
- (*traceIter).getChannelValues("Y", tempyVec);
-
- currentStrokeSize = tempxVec.size();
-
- if (currentStrokeSize == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EEMPTY_TRACE << " : " << getErrorMessage(EEMPTY_TRACE) <<
- " PointFloatShapeFeatureExtractor::extractFeatures" <<endl;
-
- LTKReturnError(EEMPTY_TRACE);
- }
-
- for( int point=0; point < currentStrokeSize ; point++ )
- {
- xVec[count] = tempxVec[point];
- yVec[count] = tempyVec[point];
- count++;
-
- if(point == currentStrokeSize - 1 )
- {
- penUp.push_back(true);
- }
- else
- {
- penUp.push_back(false);
- }
- }
-
- }
- //***CONCATENTATING THE STROKES***
-
- vector<float> theta(numPoints);
- vector<float> delta_x(numPoints-1);
- vector<float> delta_y(numPoints-1);
-
- for(i=0; i<numPoints-1; ++i)
- {
- delta_x[i]=xVec[i+1]-xVec[i];
- delta_y[i]=yVec[i+1]-yVec[i];
-
- }
-
- //Add the controlInfo here
- sqsum = sqrt( pow(xVec[0],2)+ pow(yVec[0],2))+ EPS;
-
- sintheta = (1+yVec[0]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
-
- costheta = (1+xVec[0]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
-
- featurePtr = new PointFloatShapeFeature(xVec[0],
- yVec[0],
- sintheta,
- costheta,
- penUp[0]);
-
- outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
- featurePtr = NULL;
-
-
- for( i=1; i<numPoints; ++i)
- {
-
- //Add the controlInfo here
-
- sqsum = sqrt(pow(delta_x[i-1],2) + pow(delta_y[i-1],2))+EPS;
- sintheta = (1+delta_y[i-1]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
- costheta = (1+delta_x[i-1]/sqsum)*PREPROC_DEF_NORMALIZEDSIZE/2;
-
- featurePtr = new PointFloatShapeFeature(xVec[i],
- yVec[i],
- sintheta,
- costheta,
- penUp[i]);
- //***POPULATING THE FEATURE VECTOR***
- outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
- featurePtr = NULL;
-
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "PointFloatShapeFeatureExtractor::extractFeatures()" << endl;
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Naveen Sundar G
- * DATE :
- * NAME :
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date
- ****************************************************************************/
-LTKShapeFeaturePtr PointFloatShapeFeatureExtractor::getShapeFeatureInstance()
-{
- LTKShapeFeaturePtr tempPtr(new PointFloatShapeFeature);
- return tempPtr;
-}
-
-
-/******************************************************************************
- * AUTHOR : Tarun Madan
- * DATE : Aug-07-2007
- * NAME : convertToTraceGroup
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int PointFloatShapeFeatureExtractor::convertFeatVecToTraceGroup(
- const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "PointFloatShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
-
- vector<LTKChannel> channels; // channels of a trace
-
- LTKChannel xChannel("X", DT_INT, true); // x-coordinate channel of the trace
- LTKChannel yChannel("Y", DT_INT, true); // y-coordinate channel of the trace
-
- //initializing the channels of the trace
- channels.push_back(xChannel);
- channels.push_back(yChannel);
-
- // composing the trace format object
- LTKTraceFormat traceFormat(channels);
-
- vector<float> point; // a point of a trace
-
- LTKTrace trace(traceFormat);
- int featureVectorSize = shapeFeature.size();
-
- for(int count=0; count < featureVectorSize; count++)
- {
- float Xpoint, Ypoint;
- bool penUp;
-
- PointFloatShapeFeature* ptr = (PointFloatShapeFeature*)(shapeFeature[count].operator ->());
- Xpoint = ptr->getX();
- Ypoint = ptr->getY();
- penUp = ptr->isPenUp();
-
-
-
- point.push_back(Xpoint);
- point.push_back(Ypoint);
-
- trace.addPoint(point);
- point.clear();
-
-
- if(penUp == true) // end of a trace, clearing the trace now
- {
- outTraceGroup.addTrace(trace);
- trace.emptyTrace();
- LTKTrace tempTrace(traceFormat);
- trace = tempTrace;
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "PointFloatShapeFeatureExtractor::convertFeatVecToTraceGroup()" << endl;
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h
deleted file mode 100644
index 59f14e20..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/PointFloatShapeFeatureExtractor.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-07-01 16:41:37 +0530 (Wed, 01 Jul 2009) $
- * $Revision: 783 $
- * $Author: mnab $
- *
- ************************************************************************/
-#ifndef __POINTFLOATSHAPEFEATUREEXTRACTOR_H
-#define __POINTFLOATSHAPEFEATUREEXTRACTOR_H
-
-#define SUPPORTED_MIN_VERSION "4.0.0"
-#define FEATEXTR_POINTFLOAT_DEF_SIZE 10
-
-#include "LTKShapeFeatureExtractor.h"
-
-
-class PointFloatShapeFeatureExtractor : public LTKShapeFeatureExtractor
-{
-public:
- /** @brief Constructor for the PointFloata feature extractor
- * Gets the cfg file path from the contorInfo
- * Reads the cfg variables and poputlates the member variables
- * @param controlInfo: LTKControlInfo : The control information
- * @return no return value as it is a constructor
- */
-
- PointFloatShapeFeatureExtractor(const LTKControlInfo& controlInfo);
-
- int extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec);
-
- LTKShapeFeaturePtr getShapeFeatureInstance();
-
-
- int convertFeatVecToTraceGroup(const vector<LTKShapeFeaturePtr>& shapeFeature,
- LTKTraceGroup& outTraceGroup);
-
-private:
- /** @brief reads the cfg file and sets the member variables
- * @param cfgFilePath : const string&: The path of the cfg file to be opened
- * @return int : The sucess or failure of the function
- */
- //int readConfigFile(const string& cfgFilePath);
- int readConfig(const string& cfgFilePath);
-
-};
-
-
-#endif
-//#ifndef __POINTFLOATSHAPEFEATUREEXTRACTOR_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro
deleted file mode 100644
index 39eff0ee..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/pointfloat/pointfloat.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-LIPILIBS = ltkcommon ltkutil featureextractorcommon
-include(../../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../../util/lib \
- ../common \
-
-HEADERS += \
- PointFloat.h \
- PointFloatShapeFeature.h \
- PointFloatShapeFeatureExtractor.h \
-
-SOURCES += \
- PointFloat.cpp \
- PointFloatShapeFeature.cpp \
- PointFloatShapeFeatureExtractor.cpp \
-
-win32 {
- DEFINES += POINTFLOAT_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = PointFloat.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/.prev_CMakeLists.txt
deleted file mode 100644
index c553d43a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from substroke.pro.
-
-#####################################################################
-## substroke Generic Library:
-#####################################################################
-
-qt_add_cmake_library(substroke
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- SubStroke.cpp SubStroke.h
- SubStrokeShapeFeature.cpp SubStrokeShapeFeature.h
- SubStrokeShapeFeatureExtractor.cpp SubStrokeShapeFeatureExtractor.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(substroke)
-
-#### Keys ignored in scope 1:.:.:substroke.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(substroke CONDITION WIN32
- DEFINES
- SUBSTROKE_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(substroke CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(substroke)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/CMakeLists.txt
deleted file mode 100644
index caf50828..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from substroke.pro.
-
-#####################################################################
-## substroke Generic Library:
-#####################################################################
-
-qt_add_cmake_library(substroke
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- SubStroke.cpp SubStroke.h
- SubStrokeShapeFeature.cpp SubStrokeShapeFeature.h
- SubStrokeShapeFeatureExtractor.cpp SubStrokeShapeFeatureExtractor.h
- INCLUDE_DIRECTORIES
- ../../../../include
- ../../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(substroke)
-
-#### Keys ignored in scope 1:.:.:substroke.pro:<TRUE>:
-# LIPILIBS = "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(substroke CONDITION WIN32
- DEFINES
- SUBSTROKE_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(substroke CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(substroke)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp
deleted file mode 100644
index 8484b39d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: $
- * $Revision: $
- * $Author: $
- *
- ************************************************************************/
-// SubStroke.cpp : Defines the entry point for the DLL application.
-
-#include "SubStroke.h"
-#include "SubStrokeShapeFeatureExtractor.h"
-#include "LTKShapeFeatureExtractor.h"
-#include "SubStrokeShapeFeature.h"
-#include "LTKErrors.h"
-
-
-#ifdef _WIN32
-#include <windows.h>
-BOOL APIENTRY DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : createShapeFeatureExtractor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int createShapeFeatureExtractor(const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor)
-{
- try
- {
- *outFeatureExtractor = new SubStrokeShapeFeatureExtractor(controlInfo);
- }
- catch(LTKException e)
- {
- *outFeatureExtractor = NULL;
-
- LTKReturnError(e.getErrorCode());
- }
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : deleteShapeFeatureExtractor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *obj)
-{
- if ( obj != NULL )
- {
- delete obj;
- obj = NULL;
- }
-
- return 0;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def
deleted file mode 100644
index c35a826e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- createShapeFeatureExtractor @1
- deleteShapeFeatureExtractor @2 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h
deleted file mode 100644
index 125ab5ae..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStroke.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: $
- * $Revision: $
- * $Author: $
- *
- ************************************************************************/
-
-#ifndef __SUBSTROKE_H__
-#define __SUBSTROKE_H__
-
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the SUBSTROKE_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// SUBSTROKE_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef _WIN32
-#ifdef SUBSTROKE_EXPORTS
-#define SUBSTROKE_API __declspec(dllexport)
-#else
-#define SUBSTROKE_API __declspec(dllimport)
-#endif //ifdef SUBSTROKE_EXPORTS
-#else
-#define SUBSTROKE_API
-#endif //#ifdef _WIN32
-
-
-#include "LTKTypes.h"
-#include "LTKLoggerUtil.h"
-
-class LTKShapeFeatureExtractor;
-class LTKShapeFeature;
-
-/** @defgroup SubStrokeShapeFeatureExtractor
-*@brief The SubStrokeShapeFeatureExtractor
-*/
-
-/**
-* @ingroup SubStrokeShapeFeatureExtractor
-* @file SubStroke.cpp
-* <p>
-* The functions exported by the DLL
-* - ::createShapeFeatureExtractor
-* - ::deleteShapeFeatureExtractor
-*/
-
-/**
-* @brief Returns a pointer to the instance of SubStrokeShapeFeatureExtractor
-*
-* <p>
-* This function is based on run-time polymorphism. It creates an instance of
-* SubStrokeShapeFeatureExtractor at run-time and returns it as a pointer to the base class <i>LTKShapeFeatureExtractor</i>
-* </p>
-*
-* @param none
-*
-* @return Pointer to LTKShapeFeatureExtractor
-*/
-extern "C" SUBSTROKE_API int createShapeFeatureExtractor(
- const LTKControlInfo& controlInfo,
- LTKShapeFeatureExtractor** outFeatureExtractor);
-
-/**
-* @brief Deletes the feature extractor instance.
-*
-* <p>
-* This function cleans up all the memory allocations done by the feature extractor by calling it's destructor.
-* </p>
-*
-* @param featureExtractorPtr - Pointer to LTKShapeFeatureExtractor.
-*
-* @return 0 on Success
-*/
-extern "C" SUBSTROKE_API int deleteShapeFeatureExtractor(LTKShapeFeatureExtractor *featureExtractorPtr);
-
-#endif //#ifndef __SUBSTROKE_H__ \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp
deleted file mode 100644
index fb282d31..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.cpp
+++ /dev/null
@@ -1,675 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: $
- * $Revision: $
- * $Author: $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation for SubStrokeShapeFeature module
- *
- * CONTENTS:
- *
- * AUTHOR: Tanmay Mondal
- *
- * DATE: February 2009
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#include "SubStrokeShapeFeature.h"
-#include "LTKStringUtil.h"
-#include <sstream>
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : Default Constructor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-SubStrokeShapeFeature::SubStrokeShapeFeature():
-m_data_delimiter(",")
-{
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : Parameterized Constructor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-SubStrokeShapeFeature::SubStrokeShapeFeature(vector<float>& inSlopeVector,float inCgX,float inCgY,float inLength):
-m_slopeVector(inSlopeVector),
-m_xComponentOfCenterOfGravity(inCgX),
-m_yComponentOfCenterOfGravity(inCgY),
-m_subStrokeLength(inLength),
-m_data_delimiter(",")
-{
-}
-
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : Default Destructor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-SubStrokeShapeFeature::~SubStrokeShapeFeature()
-{
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : clone
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-LTKShapeFeaturePtr SubStrokeShapeFeature::clone() const
-{
- SubStrokeShapeFeature* pointInst = new SubStrokeShapeFeature();
-
- //set the value of the tan theta
- vector<float> tempSlopeVector;
-
- this->getSlopeVector(tempSlopeVector);
-
- pointInst->setSlopeVector(tempSlopeVector);
-
- //set the value of center of gravity
- pointInst->setXcomponentOfCenterOfGravity(this->getXcomponentOfCenterOfGravity());
- pointInst->setYcomponentOfCenterOfGravity(this->getYcomponentOfCenterOfGravity());
-
- //set the value of the length
- pointInst->setSubStrokeLength(this->getSubStrokeLength());
-
- return (LTKShapeFeaturePtr)pointInst;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getDistance
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-void SubStrokeShapeFeature::getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr,
- float& outDistance) const
-{
-
- float xDiff = 0.0, yDiff =0.0;
-
- float sumSlopeDiff = 0.0;
-
- int slopeIndex = 0;
-
- int numSlope = 0;
-
- float slopeDiff = 0.0, tempSlopeDiff1 = 0.0, tempSlopeDiff2 = 0.0;
-
- float lengthDiff = 0.0;
-
- floatVector featureVector;
-
- SubStrokeShapeFeature *inSubStrokeFeature = (SubStrokeShapeFeature*)(shapeFeaturePtr.operator ->());
-
- inSubStrokeFeature->getSlopeVector(featureVector);
-
- numSlope = featureVector.size();
-
- // feature vector dimension for each substroke is 8 (NUMBER_OF_SLOPE + 3)
- // The constant 3 in the above corresponds to x,y coordinates of center of gravity of the substroke and its length
-
- if(numSlope != (inSubStrokeFeature->getFeatureDimension()-3))
- {
- //write log
- return; // error
- }
-
- // compute the distance between the slope vectors of two instances of SubStrokeShapeFeature
- for(slopeIndex = 0; slopeIndex < numSlope; ++slopeIndex)
- {
- // difference between two slope components
- tempSlopeDiff1 = fabs((m_slopeVector[slopeIndex]) - featureVector[slopeIndex]);
-
- tempSlopeDiff2 = fabs((360.0 - tempSlopeDiff1));
-
- // take the minimum of the above two differences to take care of the circular nature of slope function
- if(tempSlopeDiff1 > tempSlopeDiff2)
- slopeDiff = tempSlopeDiff2;
- else
- slopeDiff = tempSlopeDiff1;
-
- sumSlopeDiff += slopeDiff;
-
- }
-
- // compute the distance between the center of gravity of two instances of SubStrokeShapeFeature
- xDiff = fabs((m_xComponentOfCenterOfGravity) - inSubStrokeFeature->getXcomponentOfCenterOfGravity());
-
- yDiff = fabs((m_yComponentOfCenterOfGravity) - inSubStrokeFeature->getYcomponentOfCenterOfGravity());
-
- // compute the difference between the length of two instances of SubStrokeShapeFeature
- lengthDiff = fabs((m_subStrokeLength) - inSubStrokeFeature->getSubStrokeLength());
-
- outDistance = (sumSlopeDiff + (xDiff * xDiff) + (yDiff * yDiff) + lengthDiff);
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : initialize
- * DESCRIPTION : initialize the feature instance from string
- * ARGUMENTS : string: initString
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int SubStrokeShapeFeature::initialize(const string& initString)
-{
-
- int index;
-
- stringVector tokens;
-
- LTKStringUtil::tokenizeString(initString, m_data_delimiter, tokens);
-
- int tokensSize = tokens.size();
-
- //code for converting the string feature in to value and initialised the feature vector
- if(tokensSize != getFeatureDimension())
- {
- //write log
- //invalide size of feature vector
- return FAILURE; //returning an error
- }
-
- for( index = 0; index < tokensSize - 3; ++index )
- {
- m_slopeVector.push_back(LTKStringUtil::convertStringToFloat(tokens[index]));
- }
-
- m_xComponentOfCenterOfGravity = LTKStringUtil::convertStringToFloat(tokens[index]);
-
- m_yComponentOfCenterOfGravity = LTKStringUtil::convertStringToFloat(tokens[index+1]);
-
- m_subStrokeLength = LTKStringUtil::convertStringToFloat(tokens[index+2]);
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : initialize
- * DESCRIPTION : initialize the feature instance
- * ARGUMENTS : floatVector: initFloatVector
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int SubStrokeShapeFeature::initialize(const floatVector& initFloatVector)
-{
-
- int index;
-
- int vectorSize = initFloatVector.size();
-
- if(vectorSize != getFeatureDimension() )
- {
- //write log
- //invalide size of feature vector
- return FAILURE; //returning an error
- }
-
- for( index = 0; index < vectorSize - 3; ++index )
- {
- m_slopeVector.push_back(initFloatVector[index]);
- }
-
- m_xComponentOfCenterOfGravity = initFloatVector[index];
-
- m_yComponentOfCenterOfGravity = initFloatVector[index+1];
-
- m_subStrokeLength = initFloatVector[index+2];
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : toFloatVector
- * DESCRIPTION : To convert feature to a float vector
- * ARGUMENTS : vector<float>: holds the floating point value of feature
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int SubStrokeShapeFeature::toFloatVector(vector<float>& outFloatVec)
-{
-
- int slopeIndex;
-
- int numSlope = m_slopeVector.size();
-
- if(numSlope != (getFeatureDimension() - 3))
- {
- //write log
- //invalide size of angle vector
- return FAILURE; //returning an error
- }
-
- for( slopeIndex = 0; slopeIndex < numSlope; ++slopeIndex)
- {
- outFloatVec.push_back(m_slopeVector[slopeIndex]);
- }
-
- outFloatVec.push_back(m_xComponentOfCenterOfGravity);
-
- outFloatVec.push_back(m_yComponentOfCenterOfGravity);
-
- outFloatVec.push_back(m_subStrokeLength);
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : toString
- * DESCRIPTION : To convert the feature to a string
- * ARGUMENTS : string : holds the string value of feature
- * RETURNS : NONE
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-void SubStrokeShapeFeature::toString(string& outStrFeat) const
-{
-
- ostringstream tempString;
-
- int slopeIndex;
-
- int numSlope = m_slopeVector.size();
-
- if(numSlope != NUMBER_OF_SLOPE)
- {
- //write log
- //invalide size of angle vector
- return; //returning an error
- }
-
- //convert the value of the feture vector to string
- for( slopeIndex = 0; slopeIndex < numSlope; slopeIndex++)
- {
- tempString << m_slopeVector[slopeIndex] << m_data_delimiter;
- }
-
- tempString << m_xComponentOfCenterOfGravity << m_data_delimiter
- << m_yComponentOfCenterOfGravity << m_data_delimiter
- << m_subStrokeLength;
-
-
- outStrFeat = tempString.str();
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getSlopeVector
- * DESCRIPTION :
- * ARGUMENTS : vector<float>: outSlopeVector
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-void SubStrokeShapeFeature::getSlopeVector(vector<float>& outSlopeVector) const
-{
- outSlopeVector = m_slopeVector;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getSubStrokeLength
- * DESCRIPTION : Ratio of the length and normalised height
- * ARGUMENTS : none
- * RETURNS : float: m_subStrokeLength
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-float SubStrokeShapeFeature::getSubStrokeLength() const
-{
- return m_subStrokeLength;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getXcomponentOfCenterOfGravity
- * DESCRIPTION : X co-ordinate of CG
- * ARGUMENTS : none
- * RETURNS : float: m_xComponentOfCenterOfGravity
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-float SubStrokeShapeFeature::getXcomponentOfCenterOfGravity() const
-{
- return m_xComponentOfCenterOfGravity;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getYcomponentOfCenterOfGravity
- * DESCRIPTION : Y co-ordinate of CG
- * ARGUMENTS : none
- * RETURNS : float: m_yComponentOfCenterOfGravity
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-float SubStrokeShapeFeature::getYcomponentOfCenterOfGravity() const
-{
- return m_yComponentOfCenterOfGravity;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : setSlopeVector
- * DESCRIPTION : set the slope vector of substroke
- * ARGUMENTS : vector<float>: inSlopeVector
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-void SubStrokeShapeFeature::setSlopeVector(const vector<float>& inSlopeVector)
-{
- m_slopeVector = inSlopeVector;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : setSubStrokeLength
- * DESCRIPTION : set the length of the substroke
- * ARGUMENTS : float: length
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-void SubStrokeShapeFeature::setSubStrokeLength(float inSubStrokeLength)
-{
- m_subStrokeLength = inSubStrokeLength;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : setXcomponentOfCenterOfGravity
- * DESCRIPTION :
- * ARGUMENTS : float: x value
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-void SubStrokeShapeFeature::setXcomponentOfCenterOfGravity(float inX)
-{
- m_xComponentOfCenterOfGravity = inX;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : setYcomponentOfCenterOfGravity
- * DESCRIPTION :
- * ARGUMENTS : float: y value
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-void SubStrokeShapeFeature::setYcomponentOfCenterOfGravity(float inY)
-{
- m_yComponentOfCenterOfGravity = inY;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : addFeature
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int SubStrokeShapeFeature::addFeature(const LTKShapeFeaturePtr& secondFeature,
- LTKShapeFeaturePtr& outResult ) const
-{
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : subtractFeature
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int SubStrokeShapeFeature::subtractFeature(const LTKShapeFeaturePtr& secondFeature,
- LTKShapeFeaturePtr& outResult ) const
-{
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : scaleFeature
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int SubStrokeShapeFeature::scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const
-{
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getFeatureDimension
- * DESCRIPTION :
- * ARGUMENTS : none
- * RETURNS : int: dimension of the feature
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int SubStrokeShapeFeature::getFeatureDimension()
-{
- // The constant 3 in the above corresponds to x,y coordinates of center of gravity of the substroke and its length
- return (NUMBER_OF_SLOPE + 3);
-}
-/**********************************************************************************
-* AUTHOR : Balaji MNA.
-* DATE : 01-July-2009
-* NAME : isPenUp
-* DESCRIPTION : Get method for the penUp
-* ARGUMENTS : none
-* RETURNS : The PenUp value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-bool SubStrokeShapeFeature::isPenUp() const
-{
- return 0;
-
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h
deleted file mode 100644
index 791ed9a7..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeature.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: $
- * $Revision: $
- * $Author: $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for SubStrokeShapeFeature module
- *
- * CONTENTS:
- *
- * AUTHOR: Tanmay Mondal
- *
- * DATE: February 2009
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef __SUBSTROKESHAPEFEATURE_H
-#define __SUBSTROKESHAPEFEATURE_H
-
-#include "LTKShapeFeature.h"
-
-#define NUMBER_OF_SLOPE 5
-
-
-class SubStrokeShapeFeature : public LTKShapeFeature
-{
- /** @name private data members */
- //@{
-
-private:
-
- /** @brief slope value
- m_slopeVector slop(five angle) extracted from one substrokes*/
- vector<float> m_slopeVector;
-
- /** @brief x value
- m_xComponentOfCenterOfGravity, normalised x - value (by width) of the center of gravity of substrokes*/
- float m_xComponentOfCenterOfGravity;
-
- /**@brief y value
- m_yComponentOfCenterOfGravity, normalised y - value (by height) of the center of gravity of substrokes*/
- float m_yComponentOfCenterOfGravity;
-
- /** @brief length value
- m_subStrokeLength, this is the ratio of the total length of the substrokes and the normalised height of the character*/
- float m_subStrokeLength;
-
- /** @brief Delimiter character */
- string m_data_delimiter;
- //@}
-
-public:
-
- /** @name Constructors and Destructor */
- //@{
-
- /**
- * Default Constructor.
- */
- SubStrokeShapeFeature();
-
- /** Parameterized Constructor */
- SubStrokeShapeFeature(vector<float>& inSlopeVector,float inCgX,float inCgY,float inLength);
-
- /**
- * Default destructor.
- */
- ~SubStrokeShapeFeature();
-
- /**
- * Returns the value of SubStrokeShapeFeature:: m_slopeVector
- */
- void getSlopeVector(vector<float>& outSlopeVector) const;
-
- /**
- * Returns the value of SubStrokeShapeFeature::m_subStrokeLength
- */
- float getSubStrokeLength() const;
-
- /**
- * Returns the value of SubStrokeShapeFeature::m_xComponentOfCenterOfGravity
- */
- float getXcomponentOfCenterOfGravity() const;
-
- /**
- * Returns the value of SubStrokeShapeFeature::m_yComponentOfCenterOfGravity
- */
- float getYcomponentOfCenterOfGravity() const;
-
- /**
- * Sets the value of SubStrokeShapeFeature::m_slopeVector
- */
- void setSlopeVector(const vector<float>& inSlopeVector);
-
- /**
- * Set the value of SubStrokeShapeFeature::m_subStrokeLength
- */
- void setSubStrokeLength(float inSubStrokeLength);
-
- /**
- * Set the value of SubStrokeShapeFeature::m_xComponentOfCenterOfGravity
- */
- void setXcomponentOfCenterOfGravity(float inX);
-
- /**
- * Set the value of SubStrokeShapeFeature::m_yComponentOfCenterOfGravity
- */
- void setYcomponentOfCenterOfGravity(float inY);
-
-
- /**
- * @brief Initializes the SubStrokeShapeFeature from the string passed as parameter.
- *
- * <b>Semantics</b>
- *
- * - Tokenize the input string on SubStrokeShapeFeature::m_data_delimiter using StringTokenizer::tokenizeString
- * - Initialize the data members of the class with the tokens returned.
- *
- * @param initString : string& : Reference to the initialization string.
- *
- * @return FAILURE : If the initalization string contains more than two tokens (after tokenizing on AngleShapeFeature::m_data_delimiter)
- * @return SUCCESS : If initialization done without any errors.
- *
- */
- int initialize(const string& initString);
-
- int initialize(const floatVector& initFloatVector);
-
- /**
- * @brief Gives the floating point representation of the SubStrokeShapeFeature instance
- */
- int toFloatVector(vector<float>& outFloatVec);
-
- /**
- * @brief Gives the string representation of the SubStrokeShapeFeature instance
- */
- void toString(string& outStrFeat) const;
-
-
- LTKShapeFeaturePtr clone() const;
-
- /**
- * @brief Gives the distance between two SubStrokeShapeFeature instance
- */
- void getDistance(const LTKShapeFeaturePtr& shapeFeaturePtr, float& outDistance) const;
-
- /**
- * @brief Adds two SubStrokeShapeFeature instances.
- *
- * @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to SubStrokeShapeFeature instance
- *
- * @return LTKShapeFeature* : Pointer to SubStrokeShapeFeature instance holding the result of addition.
- *
- */
- int addFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;
-
- /**
- * @brief Subtracts two SubStrokeShapeFeature instances.
- *
- * @param secondFeature : LTKShapeFeature* : Base class pointer holding pointer to SubStrokeShapeFeature instance
- *
- * @return LTKShapeFeature* : Pointer to SubStrokeShapeFeature instance holding the result of subtraction.
- *
- */
- int subtractFeature(const LTKShapeFeaturePtr& secondFeature, LTKShapeFeaturePtr& outResult ) const ;
-
- int scaleFeature(float alpha, LTKShapeFeaturePtr& outResult) const ;
-
- int getFeatureDimension();
-
- /**
- * Returns the value of the class data member SubStrokeShapeFeature::m_penUp
- */
- bool isPenUp() const;
-};
-
-#endif //#ifndef __SUBSTROKESHAPEFEATURE_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp
deleted file mode 100644
index 87e0cd05..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.cpp
+++ /dev/null
@@ -1,1035 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: $
- * $Revision: $
- * $Author: $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation for SubStroke feature extractor module
- *
- * CONTENTS:
- *
- * AUTHOR: Tanmay Mondal
- *
- * DATE: February 2009
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "SubStrokeShapeFeatureExtractor.h"
-#include "SubStrokeShapeFeature.h"
-#include "LTKTraceGroup.h"
-#include "LTKTrace.h"
-#include "LTKChannel.h"
-#include "LTKTraceFormat.h"
-#include "LTKConfigFileReader.h"
-#include "LTKMacros.h"
-#include "LTKPreprocDefaults.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKLoggerUtil.h"
-
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : SubStrokeShapeFeatureExtractor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-SubStrokeShapeFeatureExtractor::SubStrokeShapeFeatureExtractor(const LTKControlInfo& controlInfo)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::SubStrokeShapeFeatureExtractor()" << endl;
-
- string cfgFilePath = "";
-
- // Config file
- if ( ! ((controlInfo.lipiRoot).empty()) &&
- ! ((controlInfo.projectName).empty()) &&
- ! ((controlInfo.profileName).empty()) &&
- ! ((controlInfo.cfgFileName).empty()))
- {
- cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
- (controlInfo.projectName) + PROFILE_PATH_STRING +
- (controlInfo.profileName) + SEPARATOR +
- (controlInfo.cfgFileName) + CONFIGFILEEXT;
- }
- else if ( ! ((controlInfo.cfgFilePath).empty() ))
- {
- cfgFilePath = controlInfo.cfgFilePath;
- }
- else
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::SubStrokeShapeFeatureExtractor()" << endl;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getShapeFeatureInstance
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-LTKShapeFeaturePtr SubStrokeShapeFeatureExtractor::getShapeFeatureInstance()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::getShapeFeatureInstance()" << endl;
-
- LTKShapeFeaturePtr tempPtr(new SubStrokeShapeFeature);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::getShapeFeatureInstance()" << endl;
-
- return tempPtr;
-}
-
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : extractFeatures
- * DESCRIPTION : calculate the feature of the Ink file
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int SubStrokeShapeFeatureExtractor::extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::extractFeatures()" << endl;
-
- int numberOfTraces = inTraceGroup.getNumTraces();
-
- //validating inTraceGroup
- if (numberOfTraces == 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP)<<
- " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
- SubStrokeShapeFeature *featurePtr = NULL;
-
- int numberOfSubstrokes = 0; // number of substrokes from a trace group
-
- int slopeIndex = 0; // index of the point
-
- int totalNumberOfSlopeValues = 0; // total number of slope values for input tracegroup
-
- int lengthIndex=0; // index of the substroke length vector
-
- int cgIndex = 0; // index of the center of gravity vector
-
- float maxX=0.0,maxY=0.0,minX=0.0,minY=0.0;
-
- float subStokeLength = 0.0; // length of one substroke
-
- float centerOfGravityX = 0.0; // x component of center of gravity of one substroke
-
- float centerOfGravityY = 0.0; // y component of center of gravity of one substroke
-
- vector<float> subStrokeSlopeVector; // slope values obtained from all the substrokes
-
- vector<float> subStrokeLengthVector; // lengths of all substrokes
-
- vector<float> subStrokeCenterOfGravityVector; // center of gravity of all substrokes
-
- vector<float> tempSlope; // slope values of one substroke
-
- vector<struct subStrokePoint> subStrokeVec; // store all the sub-strokes
-
- // extract the substrokes from input trace group, and populate subStrokeVec
- int errorCode = extractSubStrokesFromInk(inTraceGroup, subStrokeVec);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- // compute the features from each substroke in subStrokeVec
- errorCode = extractFeaturesFromSubStroke(subStrokeVec,subStrokeSlopeVector,subStrokeLengthVector,subStrokeCenterOfGravityVector);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- inTraceGroup.getBoundingBox(minX,minY,maxX,maxY);
-
- //computing size of subStrokeSlopeVector
- totalNumberOfSlopeValues = subStrokeSlopeVector.size();
-
- if(totalNumberOfSlopeValues == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EEMPTY_SLOPE_VECTOR << " : " << getErrorMessage(EEMPTY_SLOPE_VECTOR)<<
- " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
-
- LTKReturnError(EEMPTY_SLOPE_VECTOR);
- }
-
-
- //populating outFeatureVec with the features computed
- for(slopeIndex=0; slopeIndex < totalNumberOfSlopeValues; ++slopeIndex)
- {
- if(subStrokeSlopeVector.at(slopeIndex) == SUBSTROKES_ANGLE_DELIMITER)
- {
- if(tempSlope.size() != NUMBER_OF_SLOPE)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EINVALID_SLOPE_VECTOR_DIMENSION << " : " << getErrorMessage(EINVALID_SLOPE_VECTOR_DIMENSION)<<
- " SubStrokeShapeFeatureExtractor::extractFeatures" <<endl;
-
- return FAILURE;
- }
-
- centerOfGravityX = ((subStrokeCenterOfGravityVector.at(cgIndex) / (maxX - minX)) * 100.0);
-
- centerOfGravityY = ((subStrokeCenterOfGravityVector.at((cgIndex + 1)) / (maxY - minY)) * 100.0);
-
- subStokeLength = ((subStrokeLengthVector.at(lengthIndex) / (maxY - minY)) * 100.0);
-
- featurePtr = new SubStrokeShapeFeature(tempSlope,centerOfGravityX ,centerOfGravityY,subStokeLength);
-
- //***FEATURE VECTOR***
-
- outFeatureVec.push_back(LTKShapeFeaturePtr(featurePtr));
-
- featurePtr = NULL;
-
- ++numberOfSubstrokes;
-
- tempSlope.clear();
-
- ++lengthIndex;
-
- cgIndex += 2;
-
- continue;
- }
- tempSlope.push_back(subStrokeSlopeVector.at(slopeIndex));
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::extractFeatures()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : computeSlope
- * DESCRIPTION : calculate slope of the line joining given two points
- * ARGUMENTS :
- * RETURNS : float
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int SubStrokeShapeFeatureExtractor::computeSlope(const float inDeltaX, const float inDeltaY, float& outSlope)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::computeSlope()" << endl;
-
- outSlope = -1.0;
-
- if(inDeltaX == 0.0)
- {
- if(inDeltaY > 0.0)
- {
- outSlope = 90.0;
- }
- if(inDeltaY < 0.0)
- {
- outSlope = 270.0;
- }
- if(inDeltaY == 0.0)
- {
- outSlope = 0.0;
- }
- }
-
- if(inDeltaX > 0.0)
- {
- outSlope = (((atan(inDeltaY/inDeltaX)) * PI_DEGREE) / PI);
-
- if(outSlope < 0.0)
- {
- outSlope += (2 * PI_DEGREE);
- }
- }
-
- if(inDeltaX < 0.0)
- {
- outSlope = (((atan(inDeltaY/inDeltaX)) * PI_DEGREE) / PI);
-
- outSlope += PI_DEGREE;
- }
-
- if(outSlope < 0.0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EINVALID_SLOPE << " : " << getErrorMessage(EINVALID_SLOPE)<<
- " SubStrokeShapeFeatureExtractor::computeSlope" <<endl;
-
- LTKReturnError(EINVALID_SLOPE);
- }
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::computeSlope()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : extractSubStrokesFromInk
- * DESCRIPTION : extract substroke from the Ink
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk(const LTKTraceGroup& inTraceGroup, vector<struct subStrokePoint>& outSubStrokeVector)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk()" << endl;
-
- int numberOfTraces = inTraceGroup.getNumTraces();
-
- if (numberOfTraces == 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EEMPTY_TRACE_GROUP << " : " << getErrorMessage(EEMPTY_TRACE_GROUP)<<
- " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
- int errorCode = -1;
-
- int dimension = 0; // stores the number of points in each trace of the inTraceGroup
-
- int landMarkPoint = 0; // first point of each sub-stroke
-
- float landMarkSlope = 0.0; // slope of the line joining the land mark point and the following point
-
- float nextSlope = 0.0; // slope of the line joining the consicutive two points
-
- struct subStrokePoint tempSubStroke; // stores sub-stroke
-
- vector<struct subStrokePoint> subStrokeVec; // stores all the sub-strokes
-
- vector<float> slopeVector; // stores the angle made with x-axis for each point of trace
-
- bool segment; // true if stroke segment into substroke
-
- LTKTraceVector allTraces = inTraceGroup.getAllTraces();
-
- LTKTraceVector::iterator traceIter = allTraces.begin();
- LTKTraceVector::iterator traceEnd = allTraces.end();
-
- // Segmenting inTraceGroup into substrokes
- for (; traceIter != traceEnd ; ++traceIter)
- {
- floatVector tempxVec, tempyVec;
-
- //compute all the slope values from points on the trace
- if( (errorCode = getSlopeFromTrace(*traceIter,slopeVector)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- // computing total number of points present in a trace
- dimension = (*traceIter).getNumberOfPoints();
-
- // Validating the slopeVector, its size should be equal to one less than number of points in trace
- if((dimension-1) != slopeVector.size())
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EINVALID_SLOPE_VECTOR_DIMENSION << " : " << getErrorMessage(EINVALID_SLOPE_VECTOR_DIMENSION)<<
- " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
-
- LTKReturnError(EINVALID_SLOPE_VECTOR_DIMENSION);
- }
-
- (*traceIter).getChannelValues("X", tempxVec);
-
- (*traceIter).getChannelValues("Y", tempyVec);
-
- // initialised landmark point for next stroke, assume that the first point is
- // landmark point for every stroke
- landMarkPoint = 0;
-
-
- int pointIndex = 0;
- for( pointIndex = 0; pointIndex < (dimension - 1); ++pointIndex)
- {
-
- //for the first point in the trace, landMarkSlope and
- //nextSlope will be the same
- landMarkSlope = slopeVector[landMarkPoint];
-
- nextSlope = slopeVector[pointIndex];
-
- //check of the trace can be segmented at the current point
- if( (errorCode = canSegmentStrokes(landMarkSlope,nextSlope, segment)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- if( segment )
- {
- // Segment the stroke into substroke
- outSubStrokeVector[outSubStrokeVector.size() - 1].penUp = true;
-
- // set new landmark point for next substrokes of stroke
- landMarkPoint = pointIndex;
-
- } // end if ( segment )
-
- //substrokes continue
- tempSubStroke.X = tempxVec[pointIndex];
- tempSubStroke.Y = tempyVec[pointIndex];
- tempSubStroke.penUp = false;
-
- outSubStrokeVector.push_back(tempSubStroke);
-
-
- } // end for
-
- // terminal point of a stroke
- tempSubStroke.X = tempxVec[pointIndex];
- tempSubStroke.Y = tempyVec[pointIndex];
- tempSubStroke.penUp = true;
-
- outSubStrokeVector.push_back(tempSubStroke);
-
- } // end traceItr
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::extractSubStrokesFromInk()" << endl;
-
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : extractFeatureFromSubStroke
- * DESCRIPTION :
- * ARGUMENTS : extract feature vector of dimension (NUMBER_OF_THETA+3) from a given substroke
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
- int SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke(const vector<struct subStrokePoint>& inSubStrokeVector, vector<float>& outSlope, vector<float>& outLength, vector<float>& outCenterOfGravity)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::extractFeatureFromSubStroke()" << endl;
-
- int numSubStrokesPoints = 0;
-
- //total number of points present in all substrokes
- numSubStrokesPoints = inSubStrokeVector.size();
-
- //validating inSubStrokeVector
- if( numSubStrokesPoints <= 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- ENO_SUBSTROKE << " : " << getErrorMessage(ENO_SUBSTROKE)<<
- " SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke" <<endl;
-
- LTKReturnError(ENO_SUBSTROKE);
- }
-
- int ptIndex = 0; // index of point in a trace
-
- int pointIndex = 0; // counter variable to loop over the points in a trace
-
- int currentPointIndex =0; // index of the current point
-
- int startIndxOfSubStrokes = 0; // starting index of the substroke
-
- float x = 0.0; // value of x-coordinate
-
- float y = 0.0; // value of y-coordinate
-
- float slope = 0.0; // store slope value
-
- float xDiff = 0.0; // difference in x-direction
-
- float yDiff = 0.0; // difference in y-direction
-
- float xTemp = 0.0; // temporary variable for x-coordinate
-
- float yTemp = 0.0; // temporary variable for y-coordinate
-
- float unitLength = 0.0; // length of each substroke after resampling
-
- float pointDistance = 0.0; // distance detween two consecutive point
-
- float residualDistance = 0.0; // distance between the last resampled point and the next original sample point
-
- float cumulativeDistance = 0.0; // sum of distances between consecutive points
-
- float segmentRatioLeft = 0.0, segmentRatioRight = 0.0; // ratio for segmenting the line joining two points
-
- float dx = 0.0, dy = 0.0;
-
- floatVector distanceVec; // vector to store distances between points
-
- struct subStrokePoint tempStroke;
-
- //vector to store all the substrokes
- vector<struct subStrokePoint> subStrokeVec;
-
- //*************************************************************************//
- // represent each extracted substroke from ink by six equidistant points
- //*************************************************************************//
- for(int ptIdx = 0; ptIdx < numSubStrokesPoints; ++ptIdx)
- {
- if(inSubStrokeVector[ptIdx].penUp)
- {
- // ignore substrokes whose length are less than thresold value
- if(unitLength < SUBSTROKES_LENGTH_REJECT_THRESHOLD)
- {
- // initialised for next substroke
- unitLength = 0.0;
-
- residualDistance = 0.0;
-
- ptIndex = 0;
-
- distanceVec.clear();
-
- //starting index of the next substroke
- startIndxOfSubStrokes = ptIdx+1;
-
- continue;
- }
-
- // length of the extracted sub-strokes(curve length)
- outLength.push_back(unitLength);
-
- // dividing to get NUMBER_OF_SLOPE number of points on each substroke
- unitLength /= (NUMBER_OF_SLOPE);
-
- // adding x of first point
- x = inSubStrokeVector[startIndxOfSubStrokes].X;
-
- // adding y of first point
- y = inSubStrokeVector[startIndxOfSubStrokes].Y;
-
- tempStroke.X = x;
- tempStroke.Y = y;
- tempStroke.penUp = false;
-
- // pushing back the first point to subStrokeVec
- subStrokeVec.push_back(tempStroke);
-
- // Genareting four equidistant points
- for(pointIndex = 1; pointIndex < (NUMBER_OF_SLOPE); ++pointIndex)
- {
- cumulativeDistance = residualDistance;
-
- while(cumulativeDistance < unitLength)
- {
- cumulativeDistance += distanceVec.at(ptIndex++);
-
- if(ptIndex == 1)
- {
- currentPointIndex = (startIndxOfSubStrokes + ptIndex);
- }
- else
- {
- currentPointIndex++;
- }
- }
-
- if(ptIndex < 1) ptIndex = 1;
-
- segmentRatioRight = cumulativeDistance - unitLength;
-
- segmentRatioLeft = distanceVec.at(ptIndex -1) - segmentRatioRight;
-
- //interpolating to get equidistant points
- if( fabs(segmentRatioLeft+segmentRatioRight) > EPS)
- {
- xTemp = (segmentRatioLeft* inSubStrokeVector[currentPointIndex].X + segmentRatioRight* inSubStrokeVector[currentPointIndex - 1].X)/(segmentRatioLeft+segmentRatioRight);
-
- yTemp = (segmentRatioLeft* inSubStrokeVector[currentPointIndex].Y + segmentRatioRight* inSubStrokeVector[currentPointIndex - 1].Y)/(segmentRatioLeft+segmentRatioRight);
- }
- else
- {
- xTemp = inSubStrokeVector[currentPointIndex].X;
-
- yTemp = inSubStrokeVector[currentPointIndex].Y;
- }
-
- tempStroke.X = xTemp;
- tempStroke.Y = yTemp;
- tempStroke.penUp = false;
-
- subStrokeVec.push_back(tempStroke);
-
- residualDistance = segmentRatioRight;
- }
-
- // adding x of the last point of the substroke
- x = inSubStrokeVector[ptIdx].X;
-
- // adding y of the last point of the substroke
- y = inSubStrokeVector[ptIdx].Y;
-
- tempStroke.X = x;
- tempStroke.Y = y;
- tempStroke.penUp = true;
-
- subStrokeVec.push_back(tempStroke);
-
- // initialised for next substroke
- unitLength = 0.0;
-
- residualDistance = 0.0;
-
- ptIndex = 0;
-
- distanceVec.clear();
-
- //starting index of the next substroke
- startIndxOfSubStrokes = ptIdx+1;
- }
- else
- {
-
- xDiff = (inSubStrokeVector[ptIdx].X - inSubStrokeVector[ptIdx + 1].X);
-
- yDiff = (inSubStrokeVector[ptIdx].Y - inSubStrokeVector[ptIdx + 1].Y);
-
- //distance between points.
- pointDistance = (float) (sqrt(xDiff*xDiff + yDiff*yDiff));
-
- // finding the length of a substroke.
- unitLength += pointDistance;
-
- //storing distances between every two consecutive points in a substroke.
- distanceVec.push_back(pointDistance);
- }
- }
-
-
- //************************************************************************************************//
- // compute the feature vector for each substroke after representing them by six equidistant points
- //************************************************************************************************//
-
- // total number of points in all substrokes after genarating equidistant points
- numSubStrokesPoints = 0;
-
- numSubStrokesPoints = subStrokeVec.size();
-
- if( numSubStrokesPoints <= 0 )
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- ENO_SUBSTROKE << " : " << getErrorMessage(ENO_SUBSTROKE)<<
- " SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke" <<endl;
-
- LTKReturnError(ENO_SUBSTROKE);
- }
-
-
- int errorCode = -1;
-
- float sumOfX = 0.0;
- float sumOfY = 0.0;
-
- //computing slopes and center of gravity values from the equidistant points extracted from each substroke
- for(pointIndex = 0; pointIndex < numSubStrokesPoints; ++pointIndex)
- {
- if(!subStrokeVec[pointIndex].penUp)
- {
-
- // Compute slope of line joining consecutive points in a substrokes
- dx = (subStrokeVec[pointIndex + 1].X - subStrokeVec[pointIndex].X);
- dy = (subStrokeVec[pointIndex + 1].Y - subStrokeVec[pointIndex].Y);
-
- if( (errorCode = computeSlope(dx,dy,slope)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::extractFeaturesFromSubStroke" <<endl;
-
- LTKReturnError(errorCode);
- }
-
-
- outSlope.push_back(slope);
-
- sumOfX += subStrokeVec[pointIndex].X;
-
- sumOfY += subStrokeVec[pointIndex].Y;
-
- }
- else
- {
- int div = (NUMBER_OF_SLOPE + 1);
-
- sumOfX += subStrokeVec[pointIndex].X;
-
- sumOfY += subStrokeVec[pointIndex].Y;
-
- sumOfX = sumOfX / (float)div;
-
- sumOfY = sumOfY / (float)div;
-
- outCenterOfGravity.push_back(sumOfX);
-
- outCenterOfGravity.push_back(sumOfY);
-
- outSlope.push_back(SUBSTROKES_ANGLE_DELIMITER);
-
- sumOfX = 0.0;
-
- sumOfY = 0.0;
-
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::extractFeatureFromSubStroke()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getDirectionCode
- * DESCRIPTION : quantize the slope
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
- int SubStrokeShapeFeatureExtractor::getDirectionCode(const float inSlope, int& outDirectionCode)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::getDirectionCode()" << endl;
-
- //Validating inSlope
- if(inSlope < 0.0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EINVALID_SLOPE << " : " << getErrorMessage(EINVALID_SLOPE)<<
- " SubStrokeShapeFeatureExtractor::getDirectionCode" <<endl;
-
- LTKReturnError(EINVALID_SLOPE);
- }
-
- outDirectionCode = 0;
-
- // return the octant value as slope value
-
- if((inSlope< ANGLE_HIGHER_LIMIT_1) || (inSlope >= ANGLE_HIGHER_LIMIT_8))
- {
- outDirectionCode = DIRECTION_CODE_EAST;
- }
-
- else if((inSlope < ANGLE_HIGHER_LIMIT_2) && (inSlope >=ANGLE_HIGHER_LIMIT_1))
- {
- outDirectionCode = DIRECTION_CODE_NORTH_EAST;
- }
-
- else if(((inSlope >= ANGLE_HIGHER_LIMIT_2) && (inSlope < ANGLE_HIGHER_LIMIT_3)) )
- {
- outDirectionCode = DIRECTION_CODE_NORTH;
- }
-
- else if( (inSlope < ANGLE_HIGHER_LIMIT_4 ) && (inSlope >= ANGLE_HIGHER_LIMIT_3))
- {
- outDirectionCode = DIRECTION_CODE_NORTH_WEST;
- }
-
- else if((inSlope >= ANGLE_HIGHER_LIMIT_4) && (inSlope < ANGLE_HIGHER_LIMIT_5))
- {
- outDirectionCode = DIRECTION_CODE_WEST;
- }
-
- else if((inSlope >= ANGLE_HIGHER_LIMIT_5) && (inSlope < ANGLE_HIGHER_LIMIT_6))
- {
- outDirectionCode = DIRECTION_CODE_SOUTH_WEST;
- }
-
- else if(((inSlope >= ANGLE_HIGHER_LIMIT_6) && (inSlope < ANGLE_HIGHER_LIMIT_7)))
- {
- outDirectionCode = DIRECTION_CODE_SOUTH;
- }
-
- else if((inSlope >= ANGLE_HIGHER_LIMIT_7) && (inSlope < ANGLE_HIGHER_LIMIT_8))
- {
- outDirectionCode = DIRECTION_CODE_SOUTH_EAST;
- }
-
- if(outDirectionCode == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EINVALID_DIRECTION_CODE << " : " <<
- getErrorMessage(EINVALID_DIRECTION_CODE)<<
- " SubStrokeShapeFeatureExtractor::getDirectionCode" <<endl;
-
- LTKReturnError(EINVALID_DIRECTION_CODE);;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::getDirectionCode()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : canSegmentStrokes
- * DESCRIPTION : decision is taken towards dividing a stroke into substroke
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int SubStrokeShapeFeatureExtractor::canSegmentStrokes(const float inFirstSlope, const float inSecondSlope, bool& outSegment)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::canSegmentStrokes()" << endl;
-
- //Validating slope values
- if(inFirstSlope < 0.0 || inSecondSlope < 0.0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EINVALID_SLOPE << " : " << getErrorMessage(EINVALID_SLOPE)<<
- " SubStrokeShapeFeatureExtractor::canSegmentStrokes" <<endl;
-
- LTKReturnError(EINVALID_SLOPE);
- }
-
- int directionCodeOfFirstSlope = 0;
- int directionCodeOfSecondSlope = 0;
-
- outSegment = false;
-
- int errorCode = -1;
-
- // Computing octants of hte inFirstSlope and inSecondSlope
- if( (errorCode = getDirectionCode(inFirstSlope, directionCodeOfFirstSlope)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::canSegmentStrokes" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = getDirectionCode(inSecondSlope, directionCodeOfSecondSlope)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::canSegmentStrokes" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- if(abs(directionCodeOfSecondSlope - directionCodeOfFirstSlope) <= STROKE_SEGMENT_VALUE )
- outSegment = false;
- else
- outSegment = true;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::canSegmentStrokes()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE : Feb-2009
- * NAME : getSlopeFromTrace
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int SubStrokeShapeFeatureExtractor::getSlopeFromTrace(const LTKTrace& inTrace, vector<float>& outSlopeVector)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "SubStrokeShapeFeatureExtractor::getSlopeFromTrace()" << endl;
-
- int dimension = 0; //Stores the number of points in a trace
-
- dimension = inTrace.getNumberOfPoints();
-
- if(dimension == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " <<
- EEMPTY_TRACE << " : " << getErrorMessage(EEMPTY_TRACE)<<
- " SubStrokeShapeFeatureExtractor::getSlopeFromTrace" <<endl;
-
- LTKReturnError(EEMPTY_TRACE);
- }
-
- int pointIndex = 0;
-
- float dx = 0.0, dy = 0.0; //Variables to store differences in x and y-directions to compute slope
-
- float slope = 0.0;
-
- floatVector xVec, yVec;
-
- int errorCode = -1;
-
- if( (errorCode = inTrace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: SubStrokeShapeFeatureExtractor::getSlopeFromTrace"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = inTrace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: SubStrokeShapeFeatureExtractor::getSlopeFromTrace"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- outSlopeVector.clear();
-
- for(pointIndex=0; pointIndex < dimension-1; ++pointIndex)
- {
- dx = xVec[pointIndex+1] - xVec[pointIndex];
-
- dy = yVec[pointIndex+1] - yVec[pointIndex];
-
- if( (errorCode = computeSlope(dx, dy, slope)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " SubStrokeShapeFeatureExtractor::getSlopeFromTrace" <<endl;
-
- LTKReturnError(errorCode);
- }
-
- outSlopeVector.push_back(slope);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "SubStrokeShapeFeatureExtractor::getSlopeFromTrace()" << endl;
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h
deleted file mode 100644
index 7d803727..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/SubStrokeShapeFeatureExtractor.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: $
- * $Revision: $
- * $Author: $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for SubStroke feature extractor module
- *
- * CONTENTS:
- *
- * AUTHOR: Tanmay Mondal
- *
- * DATE: February 2009
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef __SUBSTROKESHAPEFEATUREEXTRACTOR_H
-#define __SUBSTROKESHAPEFEATUREEXTRACTOR_H
-
-#define SUPPORTED_MIN_VERSION "3.0.0"
-
-// delimiter of the slope of extracted substroke
-#define SUBSTROKES_ANGLE_DELIMITER -999.0
-
-#define SUBSTROKES_LENGTH_REJECT_THRESHOLD 0.001
-
-#define STROKE_SEGMENT_VALUE 0
-
-#define SINGLE_SUBSTROKES 1
-
-#define ANGLE_HIGHER_LIMIT_1 22.5
-
-#define ANGLE_HIGHER_LIMIT_2 67.5
-
-#define ANGLE_HIGHER_LIMIT_3 112.5
-
-#define ANGLE_HIGHER_LIMIT_4 157.5
-
-#define ANGLE_HIGHER_LIMIT_5 202.5
-
-#define ANGLE_HIGHER_LIMIT_6 247.5
-
-#define ANGLE_HIGHER_LIMIT_7 292.5
-
-#define ANGLE_HIGHER_LIMIT_8 337.5
-
-#define PI_DEGREE 180.0
-
-#include "LTKShapeFeatureExtractor.h"
-
-class SubStrokeShapeFeatureExtractor : public LTKShapeFeatureExtractor
-{
-
-public:
- /** @brief Constructor for the SubStroke feature extractor
- * Gets the cfg file path from the contorInfo
- * Reads the cfg variables and poputlates the member variables
- * @param controlInfo: LTKControlInfo : The control information
- * @return no return value as it is a constructor
- */
-
- SubStrokeShapeFeatureExtractor(const LTKControlInfo& controlInfo);
-
- int extractFeatures(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& outFeatureVec);
-
- LTKShapeFeaturePtr getShapeFeatureInstance();
-
-private:
-
- //store extracted sub-strokes
- struct subStrokePoint
- {
- float X; // x point
- float Y; // y point
- bool penUp; // If point is penup then penUp = 1 else penUp =0
- };
-
- /** extract feature from sub strokes
- */
- int extractFeaturesFromSubStroke(const vector<struct subStrokePoint>& inSubStrokeVector,
- vector<float>& outSlope,
- vector<float>& outLength,
- vector<float>& outCenterOfGravity);
-
- /** extract the sub strokes from the preprocessed trace group
- */
- int extractSubStrokesFromInk(const LTKTraceGroup& inTraceGroup, vector<struct subStrokePoint>& outSubStrokeVector);
-
- /** @brief claculate the angle
- * inDeltaX,inDeltaY : float : the difference of x[i] and x[i+1] and difference of y[i] and y[i+1] of ink point
- * float : the angle made with x axis and the point
- */
- int computeSlope(const float inDeltaX, const float inDeltaY, float& outSlope);
-
- /** decide the octant of the point along the ink
- * slope : float : value of the angle
- * int : the octant code
- */
- int getDirectionCode(const float inSlope, int& outDirectionCode);
-
- /** break the stroke into substrokes
- * infirstSlope, insecondSlope : float : value of the slope
- * int : SUCCESS : FAILURE
- */
- int canSegmentStrokes(const float inFirstSlope, const float inSecondSlope, bool& outSegment);
-
- /** compute the slope of each point present in the tace
- * inTrace : LTKTrace : value of a trace
- * int : SUCCESS : FAILURE : errorcode
- */
- int getSlopeFromTrace(const LTKTrace& inTrace, vector<float>& outSlopeVector);
-
-};
-
-#endif //#ifndef __SUBSTROKESHAPEFEATUREEXTRACTOR_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro
deleted file mode 100644
index 804d1f42..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/featureextractor/substroke/substroke.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-LIPILIBS = ltkcommon ltkutil featureextractorcommon
-include(../../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../../util/lib \
- ../common \
-
-HEADERS += \
- SubStroke.h \
- SubStrokeShapeFeature.h \
- SubStrokeShapeFeatureExtractor.h \
-
-SOURCES += \
- SubStroke.cpp \
- SubStrokeShapeFeature.cpp \
- SubStrokeShapeFeatureExtractor.cpp \
-
-win32 {
- DEFINES += SUBSTROKE_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = SubStroke.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/.prev_CMakeLists.txt
deleted file mode 100644
index 9d7b3b69..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from neuralnet.pro.
-
-#####################################################################
-## neuralnet Generic Library:
-#####################################################################
-
-qt_add_cmake_library(neuralnet
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- NeuralNet.cpp NeuralNet.h
- NeuralNetShapeRecognizer.cpp NeuralNetShapeRecognizer.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- ../featureextractor/common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(neuralnet)
-
-#### Keys ignored in scope 1:.:.:neuralnet.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(neuralnet CONDITION WIN32
- DEFINES
- NEURALNET_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(neuralnet CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(neuralnet)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/CMakeLists.txt
deleted file mode 100644
index fc8eae7d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from neuralnet.pro.
-
-#####################################################################
-## neuralnet Generic Library:
-#####################################################################
-
-qt_add_cmake_library(neuralnet
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- NeuralNet.cpp NeuralNet.h
- NeuralNetShapeRecognizer.cpp NeuralNetShapeRecognizer.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- ../featureextractor/common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(neuralnet)
-
-#### Keys ignored in scope 1:.:.:neuralnet.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(neuralnet CONDITION WIN32
- DEFINES
- NEURALNET_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(neuralnet CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(neuralnet)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp
deleted file mode 100644
index ac6cdae5..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// NEURALNET.cpp : Defines the entry point for the DLL application.
-//
-
-#include "NeuralNet.h"
-#include "LTKShapeRecognizer.h"
-#include "NeuralNetShapeRecognizer.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKOSUtil.h"
-
-#ifdef _WIN32
-#include <windows.h>
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif
-
-
-/**********************************************************************************
-* AUTHOR : Saravanan R
-* DATE : 23-Jan-2007
-* NAME : createShapeRecoginizer
-* DESCRIPTION : Creates instance of type NNShaperecongnizer and retuns of type
- LTKShapeRecognizer. (Acts as a Factory Method).
-* ARGUMENTS :
-* RETURNS : returns an instace of type LTKShapeRecoginzer.
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*************************************************************************************/
-int createShapeRecognizer(const LTKControlInfo& controlInfo,
- LTKShapeRecognizer** ptrObj )
-{
- try
- {
- *ptrObj = new NeuralNetShapeRecognizer(controlInfo);
- return SUCCESS;
- }
- catch(LTKException e)
- {
- LTKReturnError(e.getErrorCode());
- }
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R
-* DATE : 23-Jan-2007
-* NAME : deleteShapeRecoginzer
-* DESCRIPTION : Destroy the instance by taking the address as its argument.
-* ARGUMENTS : Address of LTKShapeRecognizer instance.
-* RETURNS : Returns 0 on Success
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*************************************************************************************/
-int deleteShapeRecognizer(LTKShapeRecognizer *obj)
-{
- try
- {
- if (obj != NULL )
- {
- delete obj;
- obj = NULL;
- }
- }
- catch(LTKException e)
- {
- LTKReturnError(e.getErrorCode());
- }
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR :Tarun Madan
-* DATE :
-* NAME :
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int getTraceGroups(LTKShapeRecognizer *obj, int shapeId,
- int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups)
-{
- int errorCode = ((NeuralNetShapeRecognizer*)obj)->getTraceGroups(shapeId,
- numberOfTraceGroups, outTraceGroups);
-
- if ( errorCode != SUCCESS )
- {
- LTKReturnError(errorCode);
- }
-
- return SUCCESS;
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def
deleted file mode 100644
index 0a4f75c9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.def
+++ /dev/null
@@ -1,4 +0,0 @@
-EXPORTS
- createShapeRecognizer @1
- deleteShapeRecognizer @2
- getTraceGroups @3 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h
deleted file mode 100644
index bfe4ac02..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNet.h
+++ /dev/null
@@ -1,62 +0,0 @@
-
-#ifndef __NEURALNET_H__
-#define __NEURALNET_H__
-
-
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the NEURALNET_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// NEURALNET_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef _WIN32
-#ifdef NEURALNET_EXPORTS
-#define NEURALNET_API __declspec(dllexport)
-#else
-#define NEURALNET_API __declspec(dllimport)
-#endif //#ifdef NEURALNET_EXPORTS
-#else
-#define NEURALNET_API
-#endif //#ifdef _WIN32
-
-class LTKTraceGroup;
-class LTKShapeRecognizer;
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-
-/** @defgroup NeuralNetShapeRecognizer NeuralNetShapeRecognizer
-*@brief The NeuralNetShapeRecognizer
-*/
-
-/**
-* @ingroup NeuralNetShapeRecognizer
-* @file NEURALNET.cpp
-*/
-
-/**
- * Crates instance of type NeuralNetShapeRecognizer and returns of type
- * LTKShpeRecognizer. (Acts as a Factory Method).
- *
- * @param none
- *
- * @return LTKShapeRecognizer - an instance of type LTKShapeRecognizer.
- */
-extern "C" NEURALNET_API int createShapeRecognizer(const LTKControlInfo& controlInfo,
- LTKShapeRecognizer** pReco );
-
-/**
- * Destroy the instance by taking the address as its argument.
- *
- * @param obj - Address of LTKShapeRecognizer instance.
- *
- * @return 0 on Success
- */
-extern "C" NEURALNET_API int deleteShapeRecognizer(LTKShapeRecognizer *obj);
-
-extern "C" NEURALNET_API int getTraceGroups(LTKShapeRecognizer *obj, int shapeID, int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups);
-
-void unloadDLLs();
-
-#endif //#ifndef __NEURALNET_H__ \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp
deleted file mode 100644
index 3c406f68..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.cpp
+++ /dev/null
@@ -1,4682 +0,0 @@
-#include "LTKConfigFileReader.h"
-
-#include "NeuralNetShapeRecognizer.h"
-
-#include "LTKPreprocDefaults.h"
-
-#include "LTKHierarchicalClustering.h"
-
-#include "LTKPreprocessorInterface.h"
-
-#include "LTKShapeFeatureExtractorFactory.h"
-
-#include "LTKShapeFeatureExtractor.h"
-
-#include "LTKShapeFeature.h"
-
-#include "LTKVersionCompatibilityCheck.h"
-
-#include "LTKInkFileWriter.h"
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKClassifierDefaults.h"
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : assignDefaultValues
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-void NeuralNetShapeRecognizer::assignDefaultValues()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::assignDefaultValues()" << endl;
-
- m_numShapes = 0;
- m_neuralnetCfgFilePath = "";
- m_neuralnetMDTFilePath = "";
- m_ptrPreproc = NULL;
- m_projectTypeDynamic=false;
- m_preProcSeqn=NN_DEF_PREPROC_SEQ;
- m_ptrFeatureExtractor=NULL;
- m_featureExtractorName=NN_DEF_FEATURE_EXTRACTOR;
- m_neuralnetNormalizationFactor=NEURALNET_DEF_NORMALIZE_FACTOR;
- m_neuralnetRandomNumberSeed=NEURALNET_DEF_RANDOM_NUMBER_SEED;
- m_neuralnetLearningRate=NEURALNET_DEF_LEARNING_RATE;
- m_neuralnetMomemtumRate=NEURALNET_DEF_MOMEMTUM_RATE;
- m_neuralnetTotalError=NEURALNET_DEF_TOTAL_ERROR;
- m_neuralnetIndividualError=NEURALNET_DEF_INDIVIDUAL_ERROR;
- m_neuralnetNumHiddenLayers=NEURALNET_DEF_HIDDEN_LAYERS_SIZE;
- m_layerOutputUnitVec.push_back(0); // for input layer
- for(int i = 0; i < m_neuralnetNumHiddenLayers; ++i)
- {
- m_layerOutputUnitVec.push_back(NEURALNET_DEF_HIDDEN_LAYERS_UNITS); // for hidden layer
- }
- m_layerOutputUnitVec.push_back(0); // for output layer
- m_layerOutputUnitVec.push_back(0);
- m_isNeuralnetWeightReestimate=false;
- m_neuralnetMaximumIteration=NEURALNET_DEF_MAX_ITR;
- m_isCreateTrainingSequence=true;
- m_rejectThreshold=NN_DEF_REJECT_THRESHOLD;
- m_deleteLTKLipiPreProcessor=NULL;
- m_MDTFileOpenMode = NN_MDT_OPEN_MODE_ASCII;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::assignDefaultValues()" << endl;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : NeuralNetShapeRecognizer
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-NeuralNetShapeRecognizer::NeuralNetShapeRecognizer(const LTKControlInfo& controlInfo):
-m_OSUtilPtr(LTKOSUtilFactory::getInstance()),
-m_libHandler(NULL),
-m_libHandlerFE(NULL)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::NeuralNetShapeRecognizer()" << endl;
-
- try
- {
- LTKControlInfo tmpControlInfo=controlInfo;
-
- string strProjectName = "";
- string strProfileName = "";
-
-
- if( (tmpControlInfo.projectName).empty() )
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
- if( (tmpControlInfo.lipiRoot).empty() )
- {
- throw LTKException(ELIPI_ROOT_PATH_NOT_SET);
- }
-
- if( (tmpControlInfo.profileName).empty() )
- {
- strProfileName = DEFAULT_PROFILE;
- tmpControlInfo.profileName = strProfileName;
- }
-
- if ( tmpControlInfo.toolkitVersion.empty() )
- {
- throw LTKException(ENO_TOOLKIT_VERSION);
- }
-
- assignDefaultValues();
-
- m_lipiRootPath = tmpControlInfo.lipiRoot;
- m_lipiLibPath = tmpControlInfo.lipiLib;
- m_currentVersion = tmpControlInfo.toolkitVersion;
- strProjectName = tmpControlInfo.projectName;
- strProfileName = tmpControlInfo.profileName;
-
-
- //Holds the value of Number of Shapes in string format
- string strNumShapes = "";
-
- string strProfileDirectory = m_lipiRootPath + PROJECTS_PATH_STRING +
- strProjectName + PROFILE_PATH_STRING;
-
- //Holds the path of the Project.cfg
- string projectCFGPath = strProfileDirectory + PROJECT_CFG_STRING;
-
- // Config file
-
- m_neuralnetCfgFilePath = m_lipiRootPath + PROJECTS_PATH_STRING +
- (tmpControlInfo.projectName) + PROFILE_PATH_STRING +
- (tmpControlInfo.profileName) + SEPARATOR +
- NEURALNET + CONFIGFILEEXT;
-
-
- //Set the path for neuralnet.mdt
- m_neuralnetMDTFilePath = strProfileDirectory + strProfileName + SEPARATOR + NEURALNET + DATFILEEXT;
-
- //To find whether the project was dynamic or not andto read read number of shapes from project.cfg
- int errorCode = m_shapeRecUtil.isProjectDynamic(projectCFGPath,
- m_numShapes, strNumShapes, m_projectTypeDynamic);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NeuralNetShapeRecognizer::NeuralNetShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
-
- //Set the NumShapes to the m_headerInfo
- m_headerInfo[NUMSHAPES] = strNumShapes;
-
- //Currently preproc cfg also present in NEURALNET
- tmpControlInfo.cfgFileName = NEURALNET;
- errorCode = initializePreprocessor(tmpControlInfo,
- &m_ptrPreproc);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NeuralNetShapeRecognizer::NeuralNetShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- //Reading NEURALNET configuration file
- errorCode = readClassifierConfig();
-
- if( errorCode != SUCCESS)
- {
- cout<<endl<<"Encountered error in readClassifierConfig"<<endl;
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NeuralNetShapeRecognizer::NeuralNetShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- //Writing Feature extractor name and version into the header
- m_headerInfo[FE_NAME] = m_featureExtractorName;
- m_headerInfo[FE_VER] = SUPPORTED_MIN_VERSION; //FE version
-
- //Writting mdt file open mode to the mdt header
- m_headerInfo[MDT_FOPEN_MODE] = m_MDTFileOpenMode;
-
- errorCode = initializeFeatureExtractorInstance(tmpControlInfo);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NeuralNetShapeRecognizer::NeuralNetShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- }
- catch(LTKException e)
- {
-
- deletePreprocessor();
-
- //Unloading the feature Extractor instance
- deleteFeatureExtractorInstance();
-
- delete m_OSUtilPtr;
- throw e;
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::NeuralNetShapeRecognizer()" << endl;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : ~NeuralNetShapeRecognizer
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-NeuralNetShapeRecognizer::~NeuralNetShapeRecognizer()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::~NeuralNetShapeRecognizer()" << endl;
-
- int returnStatus = SUCCESS;
-
- //clear the traning set
- try{
-
- m_trainSet.clear();
-
- //clear all the vector nedded for traning
- m_delW.clear();
-
- m_previousDelW.clear();
-
- m_layerOutputUnitVec.clear();
-
- m_outputLayerContentVec.clear();
-
- m_targetOutputVec.clear();
-
- m_connectionWeightVec.clear();
- }
- catch(LTKException e)
- {
- delete m_OSUtilPtr;
-
- throw e;
- }
-
- returnStatus = deletePreprocessor();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NeuralNetShapeRecognizer::~NeuralNetShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
- }
-
- //Unloading the feature Extractor instance
- returnStatus = deleteFeatureExtractorInstance();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NeuralNetShapeRecognizer::~NeuralNetShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
- }
-
- delete m_OSUtilPtr;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::~NeuralNetShapeRecognizer()" << endl;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : readClassifierConfig
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::readClassifierConfig()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::readClassifierConfig()" << endl;
-
- string tempStringVar = "";
- int tempIntegerVar = 0;
- float tempFloatVar = 0.0;
- LTKConfigFileReader *shapeRecognizerProperties = NULL;
- int errorCode = FAILURE;
-
- try
- {
- shapeRecognizerProperties = new LTKConfigFileReader(m_neuralnetCfgFilePath);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<< "Info: " <<
- "Config file not found, using default values of the parameters" <<
- "NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- return FAILURE;
- }
-
- //Pre-processing sequence
- errorCode = shapeRecognizerProperties->getConfigValue(PREPROCSEQUENCE, m_preProcSeqn);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO) << "Info: " <<
- "Using default value of prerocessing sequence: "<< m_preProcSeqn <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- m_preProcSeqn = NN_DEF_PREPROC_SEQ;
- }
- else
- {
- m_headerInfo[PREPROC_SEQ] = m_preProcSeqn;
- }
-
- if((errorCode = mapPreprocFunctions()) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<" Error: " << errorCode <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(errorCode);
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(REJECT_THRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 && tempFloatVar < 1)
- {
- m_rejectThreshold = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- REJECT_THRESHOLD << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << REJECT_THRESHOLD <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << REJECT_THRESHOLD <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << REJECT_THRESHOLD <<
- " : " << m_rejectThreshold << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(FEATUREEXTRACTOR,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_featureExtractorName = tempStringVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- FEATUREEXTRACTOR << " = "<<tempStringVar<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << FEATUREEXTRACTOR << " : " <<
- m_featureExtractorName << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(MDT_FILE_OPEN_MODE,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( tempStringVar == NN_MDT_OPEN_MODE_ASCII ||
- tempStringVar == NN_MDT_OPEN_MODE_BINARY )
- {
- m_MDTFileOpenMode = tempStringVar;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << MDT_FILE_OPEN_MODE <<
- " should be ascii or binary" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << MDT_FILE_OPEN_MODE <<
- " : " << m_MDTFileOpenMode << endl;
- }
-
- //Rendom number seed
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(RANDOM_NUMBER_SEED,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- m_neuralnetRandomNumberSeed = atoi(tempStringVar.c_str());
- if(m_neuralnetRandomNumberSeed<=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << RANDOM_NUMBER_SEED <<
- " should be zero or a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << RANDOM_NUMBER_SEED <<
- " should be zero or a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << RANDOM_NUMBER_SEED <<
- " : " << m_neuralnetRandomNumberSeed << endl;
- }
-
- //Normalised factor
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEURALNET_NORMALISED_FACTOR,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- //Writing normalised factor
- m_headerInfo[NORMALISED_FACTOR] = tempStringVar;
-
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 )
- {
- m_neuralnetNormalizationFactor = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NEURALNET_NORMALISED_FACTOR << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_NORMALISED_FACTOR <<
- " should be a positive real number" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_NORMALISED_FACTOR <<
- " should be a positive real number" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_NORMALISED_FACTOR <<
- " : " << m_neuralnetNormalizationFactor << endl;
- }
-
- //Learning rate
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEURALNET_LEARNING_RATE,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- //Writing Learning rate
- m_headerInfo[LEARNING_RATE] = tempStringVar;
-
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0.0 && tempFloatVar <= 1.0)
- {
- m_neuralnetLearningRate = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NEURALNET_LEARNING_RATE << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_LEARNING_RATE <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_LEARNING_RATE <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_LEARNING_RATE <<
- " : " << m_neuralnetLearningRate << endl;
- }
-
- //Momemtum rate
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEURALNET_MOMEMTUM_RATE,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- m_headerInfo[MOMEMTUM_RATE] = tempStringVar;
-
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0.0 && tempFloatVar <= 1.0)
- {
- m_neuralnetMomemtumRate = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NEURALNET_MOMEMTUM_RATE << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_MOMEMTUM_RATE <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_MOMEMTUM_RATE <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_MOMEMTUM_RATE <<
- " : " << m_neuralnetMomemtumRate << endl;
- }
-
- //Total error
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEURALNET_TOTAL_ERROR,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 && tempFloatVar < 1)
- {
- m_neuralnetTotalError = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NEURALNET_TOTAL_ERROR << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_TOTAL_ERROR <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_TOTAL_ERROR <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_TOTAL_ERROR <<
- " : " << m_neuralnetTotalError << endl;
- }
-
- //individual error
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEURALNET_INDIVIDUAL_ERROR,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 && tempFloatVar < 1)
- {
- m_neuralnetIndividualError = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NEURALNET_INDIVIDUAL_ERROR << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_INDIVIDUAL_ERROR <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_INDIVIDUAL_ERROR <<
- " should be in the range (0-1)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_INDIVIDUAL_ERROR <<
- " : " << m_neuralnetIndividualError << endl;
- }
-
- //hidden layer
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEURALNET_HIDDEN_LAYERS_SIZE,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- //Writing number of hidden layer
- m_headerInfo[HIDDEN_LAYER] = tempStringVar;
-
- m_neuralnetNumHiddenLayers = atoi(tempStringVar.c_str());
- if(m_neuralnetNumHiddenLayers<=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_HIDDEN_LAYERS_SIZE <<
- " should be a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_HIDDEN_LAYERS_SIZE <<
- " should be a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_HIDDEN_LAYERS_SIZE <<
- " : " << m_neuralnetNumHiddenLayers << endl;
- }
-
- //hidden layer unit
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEURALNET_HIDDEN_LAYERS_UNITS,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- stringVector tokens;
-
- LTKStringUtil::tokenizeString(tempStringVar, HIDDEN_LAYER_UNIT_DELIMITER, tokens);
-
- if(tokens.size() == m_neuralnetNumHiddenLayers)
- {
- m_layerOutputUnitVec.clear();
-
- m_layerOutputUnitVec.push_back(0); // input layer
-
- for(int i = 0; i < m_neuralnetNumHiddenLayers; ++i)
- {
- if ( LTKStringUtil::isInteger(tokens[i]) )
- {
- m_layerOutputUnitVec.push_back(atoi(tokens[i].c_str())); // for hidden layer
-
- if(m_layerOutputUnitVec[i+1]<=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_HIDDEN_LAYERS_UNITS <<
- " should be a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_HIDDEN_LAYERS_UNITS <<
- " should be a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }// end for
-
- m_layerOutputUnitVec.push_back(0); // output layer
-
- m_layerOutputUnitVec.push_back(0); // extra
-
- tokens.clear();
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_HIDDEN_LAYERS_UNITS <<
- " should be a positive integer (number of unit should be same with number of hidden layer)" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_HIDDEN_LAYERS_UNITS <<
- " : " << m_neuralnetNumHiddenLayers << endl;
-
- m_neuralnetNumHiddenLayers=NEURALNET_DEF_HIDDEN_LAYERS_SIZE;
- }
-
- //initialised weight from previously train weight
- tempStringVar = "";
- shapeRecognizerProperties->getConfigValue(NEURALNET_WEIGHT_REESTIMATION, tempStringVar);
-
- if(LTKSTRCMP(tempStringVar.c_str(), "true") ==0)
- {
- m_isNeuralnetWeightReestimate = true;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Confidence computation method: " << NEURALNET_WEIGHT_REESTIMATION << endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_WEIGHT_REESTIMATION << " : " <<
- m_isNeuralnetWeightReestimate << endl;
- }
-
- //number of itaretion
- tempStringVar = "";
- shapeRecognizerProperties->getConfigValue(NEURALNET_TRAINING_ITERATION, tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- m_neuralnetMaximumIteration = atoi(tempStringVar.c_str());
-
- if(m_neuralnetMaximumIteration<=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_TRAINING_ITERATION <<
- " should be a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEURALNET_TRAINING_ITERATION <<
- " should be a positive integer" <<
- " NeuralNetShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_TRAINING_ITERATION <<
- " : " << m_neuralnetMaximumIteration << endl;
- }
-
- //prepare traning sequence
- tempStringVar = "";
- shapeRecognizerProperties->getConfigValue(NEURALNET_TRAINING_SEQUENCE, tempStringVar);
-
- if(LTKSTRCMP(tempStringVar.c_str(), "false") ==0)
- {
- m_isCreateTrainingSequence = false;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Confidence computation method: " << NEURALNET_TRAINING_SEQUENCE << endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << NEURALNET_TRAINING_SEQUENCE << " : " <<
- m_isCreateTrainingSequence << endl;
- }
-
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SIZETHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[DOT_SIZE_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(ASPECTRATIOTHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[ASP_RATIO_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(DOTTHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[DOT_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PRESERVERELATIVEYPOSITION,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[PRESER_REL_Y_POS] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PRESERVEASPECTRATIO,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[PRESER_ASP_RATIO] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SIZETHRESHOLD,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[NORM_LN_WID_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(RESAMPLINGMETHOD,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[RESAMP_POINT_ALLOC] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SMOOTHFILTERLENGTH,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[SMOOTH_WIND_SIZE] = tempStringVar;
- }
-
- tempStringVar = "";
- LTKStringUtil::convertIntegerToString(m_ptrPreproc->getTraceDimension(),
- tempStringVar);
-
- m_headerInfo[TRACE_DIM] = tempStringVar;
-
- delete shapeRecognizerProperties;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::readClassifierConfig()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : mapPreprocFunctions
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::mapPreprocFunctions()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::mapPreprocFunctions()" << endl;
-
- stringStringMap preProcSequence;
-
- stringStringPair tmpPair;
-
- stringVector moduleFuncNames;
- stringVector modFuncs;
- stringVector funcNameTokens;
-
- string module = "", funName = "", sequence = "";
- string::size_type indx;
-
- LTKTraceGroup local_inTraceGroup;
-
- LTKStringUtil::tokenizeString(m_preProcSeqn, DELEMITER_SEQUENCE, funcNameTokens);
-
- int numFunctions = funcNameTokens.size();
-
- if(numFunctions == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- "Wrong preprocessor sequence in cfg file : " + m_preProcSeqn <<
- " NeuralNetShapeRecognizer::mapPreprocFunctions()"<<endl;
-
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
-
- for (indx = 0; indx < numFunctions ; indx++)
- {
- moduleFuncNames.push_back(funcNameTokens[indx]);
- }
-
- int numModuleFunctions = moduleFuncNames.size();
-
- for(indx=0; indx < numModuleFunctions ; indx++)
- {
- sequence = moduleFuncNames[indx];
-
- LTKStringUtil::tokenizeString(sequence, DELEMITER_FUNC, modFuncs);
-
- if(modFuncs.size() >= 2)
- {
- module = modFuncs.at(0);
-
- funName = modFuncs.at(1);
-
- if(!module.compare("CommonPreProc"))
- {
- FN_PTR_PREPROCESSOR pPreprocFunc = NULL;
- pPreprocFunc = m_ptrPreproc->getPreprocptr(funName);
- if(pPreprocFunc!= NULL)
- {
- tmpPair.first = module;
- tmpPair.second = funName;
- m_preprocSequence.push_back(tmpPair);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : " <<funName<<
- " NeuralNetShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : " << module<<
- " NeuralNetShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : "<<module<<
- " NeuralNetShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::mapPreprocFunctions()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : initializePreprocessor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::initializePreprocessor(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocInstance)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::initializePreprocessor()" << endl;
-
- FN_PTR_CREATELTKLIPIPREPROCESSOR createLTKLipiPreProcessor = NULL;
- int errorCode;
-
- // Load the DLL with path=preprocDLLPath
- void* functionHandle = NULL;
-
- int returnVal = m_OSUtilPtr->loadSharedLib(controlInfo.lipiLib, PREPROC, &m_libHandler);
-
-
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ELOAD_PREPROC_DLL << " " <<
- getErrorMessage(ELOAD_PREPROC_DLL) <<
- " NeuralNetShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(ELOAD_PREPROC_DLL);
- }
-
- // Map createpreprocessor and deletePreprocessor functions
- returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandler,
- CREATEPREPROCINST,
- &functionHandle);
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- //Unload the dll
- unloadPreprocessorDLL();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EDLL_FUNC_ADDRESS_CREATE << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_CREATE) <<
- " NeuralNetShapeRecognizer::initializePreprocessor()" << endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS_CREATE);
- }
-
- createLTKLipiPreProcessor = (FN_PTR_CREATELTKLIPIPREPROCESSOR)functionHandle;
-
- functionHandle = NULL;
-
- // Map createpreprocessor and deletePreprocessor functions
- returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandler,
- DESTROYPREPROCINST,
- &functionHandle);
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- //Unload the dll
- unloadPreprocessorDLL();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EDLL_FUNC_ADDRESS_CREATE << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_CREATE) <<
- " NeuralNetShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(EDLL_FUNC_ADDRESS_CREATE);
- }
-
- m_deleteLTKLipiPreProcessor = (FN_PTR_DELETELTKLIPIPREPROCESSOR)functionHandle;
-
- // Create preprocessor instance
- errorCode = createLTKLipiPreProcessor(controlInfo, preprocInstance);
-
- if(errorCode!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(errorCode);
- }
-
- // Could not create a LTKLipiPreProcessor
- if(*preprocInstance == NULL)
- {
- // Unload the DLL
- unloadPreprocessorDLL();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ECREATE_PREPROC << " " <<
- getErrorMessage(ECREATE_PREPROC) <<
- " NeuralNetShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(ECREATE_PREPROC);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::initializePreprocessor()" << endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : unloadPreprocessorDLL
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::unloadPreprocessorDLL()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::unloadPreprocessorDLL()" << endl;
-
-
- //Check the preprocessor DLL was loaded already
- if(m_libHandler != NULL)
- {
- //Unload the DLL
- m_OSUtilPtr->unloadSharedLib(m_libHandler);
- m_libHandler = NULL;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::unloadPreprocessorDLL()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : initializeFeatureExtractorInstance
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::initializeFeatureExtractorInstance(const LTKControlInfo& controlInfo)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
-
-
- LTKShapeFeatureExtractorFactory factory;
- int errorCode = factory.createFeatureExtractor(m_featureExtractorName,
- m_lipiRootPath,
- m_lipiLibPath,
- &m_libHandlerFE,
- controlInfo,
- &m_ptrFeatureExtractor);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EFTR_EXTR_NOT_EXIST << " " <<
- " NeuralNetShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
- LTKReturnError(errorCode);
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : deleteFeatureExtractorInstance
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::deleteFeatureExtractorInstance()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- if (m_ptrFeatureExtractor != NULL)
- {
- typedef int (*FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR)(LTKShapeFeatureExtractor *obj);
- FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR deleteFeatureExtractor;
- void * functionHandle = NULL;
-
- // Map createpreprocessor and deletePreprocessor functions
- int returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandlerFE,
- DELETE_SHAPE_FEATURE_EXTRACTOR,
- &functionHandle);
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< EDLL_FUNC_ADDRESS_DELETE_FEATEXT << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_DELETE_FEATEXT) <<
- " NeuralNetShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS_DELETE_FEATEXT);
- }
-
- deleteFeatureExtractor = (FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR)functionHandle;
-
- deleteFeatureExtractor(m_ptrFeatureExtractor);
-
- m_ptrFeatureExtractor = NULL;
-
- // unload feature extractor dll
- if(m_libHandlerFE != NULL)
- {
- //Unload the DLL
- m_OSUtilPtr->unloadSharedLib(m_libHandlerFE);
- m_libHandlerFE = NULL;
-
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : deletePreprocessor
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::deletePreprocessor()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::deletePreprocessor()" << endl;
-
- //deleting the preprocessor instance
- if(m_ptrPreproc != NULL)
- {
- m_deleteLTKLipiPreProcessor(m_ptrPreproc);
- m_ptrPreproc = NULL;
- }
-
- //Unload the dll
- int returnStatus = unloadPreprocessorDLL();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NeuralNetShapeRecognizer::deletePreprocessor()" << endl;
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::deletePreprocessor()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : preprocess
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::preprocess(const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outPreprocessedTraceGroup)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::preprocess()" << endl;
-
- int indx = 0;
- int errorCode = -1;
-
- string module = "";
- string funName = "" ;
-
- LTKTraceGroup local_inTraceGroup;
-
- local_inTraceGroup = inTraceGroup;
-
- if(m_preprocSequence.size() != 0)
- {
- while(indx < m_preprocSequence.size())
- {
- module = m_preprocSequence.at(indx).first;
- funName = m_preprocSequence.at(indx).second;
-
- FN_PTR_PREPROCESSOR pPreprocFunc = NULL;
- pPreprocFunc = m_ptrPreproc->getPreprocptr(funName);
-
- if(pPreprocFunc!= NULL)
- {
- outPreprocessedTraceGroup.emptyAllTraces();
-
-
- if((errorCode = (m_ptrPreproc->*(pPreprocFunc))
- (local_inTraceGroup,outPreprocessedTraceGroup)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::preprocess()" << endl;
- LTKReturnError(errorCode);
- }
-
- local_inTraceGroup = outPreprocessedTraceGroup;
- }
- indx++;
- }
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting " <<
- "NeuralNetShapeRecognizer::preprocess()" << endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : getTraceGroups
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::getTraceGroups(int shapeID, int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering NeuralNetShapeRecognizer::getTraceGroups"
- <<endl;
-
- //base class function, to be implemented
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NeuralNetShapeRecognizer::getTraceGroups"
- <<endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : appendNeuralNetDetailsToMDTFile
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::appendNeuralNetDetailsToMDTFile(const double2DVector& resultVector,
- const bool isWeight,
- ofstream & mdtFileHandle)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::appendNeuralNetDetailsToMDTFile()" << endl;
-
- int index =0;
-
- double2DVector::const_iterator resultRowIter = resultVector.begin();
- double2DVector::const_iterator resultRowIterEnd = resultVector.end();
-
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_FILE_HANDLE << " " <<
- "Invalid file handle for MDT file"<<
- " NNShapeRecognizer::appendNeuralNetDetailsToMDTFile()" << endl;
- LTKReturnError(EINVALID_FILE_HANDLE);
- }
-
- if( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_BINARY )
- {
- int numOfLayer = resultVector.size();
-
- mdtFileHandle.write((char *)(&numOfLayer), sizeof(int));
- }
- else
- {
- if(isWeight)
- mdtFileHandle << "<Weight>" << NEW_LINE_DELIMITER;
- else
- mdtFileHandle << "<De_W Previous>" << NEW_LINE_DELIMITER;
- }
-
- for(; resultRowIter != resultRowIterEnd; resultRowIter++)
- {
- doubleVector::const_iterator colItr = (*resultRowIter).begin();
- doubleVector::const_iterator colItrEnd = (*resultRowIter).end();
-
- int numOfNode = (*resultRowIter).size();
-
- if(numOfNode != 0 && m_MDTFileOpenMode == NN_MDT_OPEN_MODE_BINARY)
- {
- mdtFileHandle.write((char *)(&numOfNode), sizeof(int));
- }
-
- for(; colItr != colItrEnd; colItr++)
- {
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_BINARY )
- {
- float floatValue = (*colItr);
- mdtFileHandle.write((char *)(&floatValue), sizeof(float));
- }
- else
- {
- mdtFileHandle <<scientific <<fixed << (*colItr);
-
- if(index > 99)
- {
- mdtFileHandle << NEW_LINE_DELIMITER;
-
- index =0;
- }
- else
- {
- mdtFileHandle << CLASSID_FEATURES_DELIMITER;
- ++index;
- }
- }
- }
-
- if(m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII)
- {
- mdtFileHandle <<NEW_LINE_DELIMITER;
- }
-
- }
-
- if( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- if(isWeight)
- mdtFileHandle << "<End Weight>" << NEW_LINE_DELIMITER;
- else
- mdtFileHandle << "<End De_W Previous>" << NEW_LINE_DELIMITER;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NeuralNetShapeRecognizer::appendNeuralNetDetailsToMDTFile()"
- <<endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME :
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::loadModelData()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::loadModelData()" << endl;
-
- int numofShapes = 0;
-
- int errorCode = -1;
-
- // variable for shape Id
- int classId = -1;
-
- int layerIndex = 0;
-
- int nodeValueIndex;
-
- //Algorithm version
- string algoVersionReadFromADT = "";
-
- stringStringMap headerSequence;
-
- LTKCheckSumGenerate cheSumGen;
-
- if(errorCode = cheSumGen.readMDTHeader(m_neuralnetMDTFilePath,headerSequence))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(errorCode);
- }
-
- // printing the headerseqn
- stringStringMap::const_iterator iter = headerSequence.begin();
- stringStringMap::const_iterator endIter = headerSequence.end();
-
- for(; iter != endIter; iter++)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Info: header seqn"<<
- iter->first << " : " <<
- iter->second << endl;
- }
-
- string featureExtractor = headerSequence[FE_NAME];
-
- if(LTKSTRCMP(m_featureExtractorName.c_str(), featureExtractor.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of FeatureExtractor parameter in config file ("<<
- m_featureExtractorName<<") does not match with the value in MDT file ("<<
- featureExtractor<<")"<<
- " NeuralNetShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- string feVersion = headerSequence[FE_VER];
-
- // comparing the mdt open mode read from cfg file with value in the mdt header
- string mdtOpenMode = headerSequence[MDT_FOPEN_MODE];
-
- if (LTKSTRCMP(m_MDTFileOpenMode.c_str(), mdtOpenMode.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of NEURAL_NETMDTFileOpenMode parameter in config file ("<<
- m_MDTFileOpenMode <<") does not match with the value in MDT file ("<<
- mdtOpenMode<<")"<<
- " NeuralNetShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
- // validating preproc parameters
- int iErrorCode = validatePreprocParameters(headerSequence);
- if (iErrorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Values of NEURAL_NETMDTFileOpenMode parameter in config file does not match with "
- <<"the values in MDT file " << "NeuralNetShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- iErrorCode = validateNeuralnetArchitectureParameters(headerSequence);
-
- if (iErrorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Values of NEURAL_NETMDTFileOpenMode parameter in config file does not match with "
- <<"the values in MDT file " << "NeuralNetShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- // Version comparison START
- algoVersionReadFromADT = headerSequence[RECVERSION].c_str();
-
- LTKVersionCompatibilityCheck verTempObj;
- string supportedMinVersion(SUPPORTED_MIN_VERSION);
- string currentVersionStr(m_currentVersion);
-
- bool compatibilityResults = verTempObj.checkCompatibility(supportedMinVersion,
- currentVersionStr,
- algoVersionReadFromADT);
-
- if(compatibilityResults == false)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINCOMPATIBLE_VERSION << " " <<
- " Incompatible version"<<
- " NeuralNetShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(EINCOMPATIBLE_VERSION);
- }
- // Version comparison END
-
- //Input Stream for Model Data file
- ifstream mdtFileHandle;
-
- if (m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_neuralnetMDTFilePath.c_str(), ios::in);
- }
- else
- {
- mdtFileHandle.open(m_neuralnetMDTFilePath.c_str(), ios::in | ios::binary);
- }
-
- //If error while opening, return an error
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- " Unable to open model data file : " <<m_neuralnetMDTFilePath<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- mdtFileHandle.seekg(atoi(headerSequence[HEADERLEN].c_str()),ios::beg);
-
- //Read the number of shapes
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle >> numofShapes;
- }
- else
- {
- mdtFileHandle.read((char*) &numofShapes,
- atoi(headerSequence[SIZEOFSHORTINT].c_str()));
- }
-
- if(!m_projectTypeDynamic && m_numShapes != numofShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of NumShapes parameter in config file ("<<m_numShapes<<
- ") does not match with the value in MDT file ("<<numofShapes<<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- else
- {
- m_numShapes = numofShapes;
- }
-
- //set output layer unit
- if(m_layerOutputUnitVec[(m_layerOutputUnitVec.size() - 2)] != m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of output unit parameter in config file ("<<m_numShapes<<
- ") does not match with the value in MDT file ("<<numofShapes<<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- // validating the header values
-
- string strValue = "";
-
- //testing for initialisation
- if(m_connectionWeightVec.size() == 0 || m_previousDelW.size() == 0)
- {
- for(int index = 0; index < (m_neuralnetNumHiddenLayers + 2); ++index)
- {
- doubleVector tempDoubleVec(((m_layerOutputUnitVec[index] + 1) * m_layerOutputUnitVec[index+1]));
-
- m_connectionWeightVec.push_back(tempDoubleVec);
-
- m_previousDelW.push_back(tempDoubleVec);
-
- tempDoubleVec.clear();
- }
- }
-
- int floatSize = atoi(headerSequence[SIZEOFFLOAT].c_str());
-
- int intSize = atoi(headerSequence[SIZEOFINT].c_str());
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- while(getline(mdtFileHandle, strValue, NEW_LINE_DELIMITER ))
- {
- if(LTKSTRCMP(strValue.c_str(),"<Weight>") == 0)
- {
- for (layerIndex = 0; layerIndex < m_neuralnetNumHiddenLayers + 1; layerIndex++)
- {
- for (nodeValueIndex =0; nodeValueIndex < (m_layerOutputUnitVec[layerIndex] + 1) * m_layerOutputUnitVec[layerIndex + 1]; nodeValueIndex++)
- {
- mdtFileHandle >> strValue;
-
- float floatValue = LTKStringUtil::convertStringToFloat(strValue);
-
- m_connectionWeightVec[layerIndex][nodeValueIndex] = (double)floatValue;
- }
- }
-
- }
- else if(LTKSTRCMP(strValue.c_str(),"<De_W Previous>") == 0)
- {
- for (layerIndex = 0; layerIndex < m_neuralnetNumHiddenLayers + 1; layerIndex++)
- {
- for (nodeValueIndex = 0; nodeValueIndex < (m_layerOutputUnitVec[layerIndex] + 1) * m_layerOutputUnitVec[layerIndex + 1]; nodeValueIndex++)
- {
- mdtFileHandle >> strValue;
-
- double floatValue = LTKStringUtil::convertStringToFloat(strValue);
-
- m_previousDelW[layerIndex][nodeValueIndex] = floatValue;
- }
- }
- }
- } // end while outer
- }
- else // for binary mode
- {
- int numOfLayer;
-
- while(!mdtFileHandle.eof())
- {
- mdtFileHandle.read((char*) &numOfLayer, intSize);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
-
- if( (numOfLayer - 1) != (m_neuralnetNumHiddenLayers + 1))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of hidden layer parameter in config file ("<<m_neuralnetNumHiddenLayers<<
- ") does not match with the value in MDT file ("<<(numOfLayer - 2)<<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- layerIndex = 0;
-
- for ( ; layerIndex < (numOfLayer - 1) ; layerIndex++)
- {
- nodeValueIndex = 0;
-
- int numberOfNode;
-
- mdtFileHandle.read((char*) &numberOfNode, intSize);
-
- cout<<numberOfNode << "::"<<endl;
-
- if(numberOfNode !=((m_layerOutputUnitVec[layerIndex] + 1) * m_layerOutputUnitVec[layerIndex + 1]))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of hidden node parameter in config file" <<
- " does not match with the value in MDT file" <<
- " NNShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- for(; nodeValueIndex < numberOfNode ; nodeValueIndex++)
- {
- float nodeValue = 0.0f;
-
- mdtFileHandle.read((char*) &nodeValue, floatSize);
-
- m_connectionWeightVec[layerIndex][nodeValueIndex] = nodeValue;
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
- }
-
- } //weight
-
- numOfLayer = 0;
-
- mdtFileHandle.read((char*) &numOfLayer, intSize);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
-
- if((numOfLayer - 1) != (m_neuralnetNumHiddenLayers + 1))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of hidden layer parameter in config file ("<<m_neuralnetNumHiddenLayers<<
- ") does not match with the value in MDT file ("<<(numOfLayer - 2)<<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- layerIndex = 0;
-
- for ( ; layerIndex < (numOfLayer - 1) ; layerIndex++)
- {
- int numberOfNode;
- mdtFileHandle.read((char*) &numberOfNode, intSize);
-
- if(numberOfNode !=((m_layerOutputUnitVec[layerIndex] + 1) * m_layerOutputUnitVec[layerIndex + 1]))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of hidden node parameter in config file" <<
- " does not match with the value in MDT file" <<
- " NNShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- nodeValueIndex = 0;
- for(; nodeValueIndex < numberOfNode ; nodeValueIndex++)
- {
- float nodeValue = 0.0f;
-
- mdtFileHandle.read((char*) &nodeValue, floatSize);
-
- m_previousDelW[layerIndex][nodeValueIndex] = nodeValue;
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
- }
-
- }
- }
- }
-
- mdtFileHandle.close();
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::loadModelData()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : validateNeuralnetArchitectureParameters
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters(stringStringMap& headerSequence)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
-
- string headerValue = "";
- int headerValueInt = 0;
- float headerValueFloat = 0.0f;
-
-
- if(LTKSTRCMP((headerSequence[HIDDEN_LAYER]).c_str(), "NA") != 0)
- {
- headerValueInt = atoi(headerSequence[HIDDEN_LAYER].c_str());
-
- if(headerValueInt != m_neuralnetNumHiddenLayers)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of hidden layer in config file ("<<
- m_neuralnetNumHiddenLayers<<") does not match with the value in MDT file ("<<
- headerValueInt <<")"<<
- " NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
- if(LTKSTRCMP((headerSequence[LEARNING_RATE].c_str()),"NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[LEARNING_RATE].c_str());
-
- if(headerValueFloat != m_neuralnetLearningRate)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of larning rate in config file ("<<
- m_neuralnetLearningRate<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
- }
-
- }
-
- if(LTKSTRCMP((headerSequence[MOMEMTUM_RATE].c_str()),"NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[MOMEMTUM_RATE].c_str());
-
- if(headerValueFloat != m_neuralnetMomemtumRate)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of momentum rate in config file ("<<
- m_neuralnetMomemtumRate<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
- }
-
- }
-
- if(LTKSTRCMP((headerSequence[NORMALISED_FACTOR].c_str()),"NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[NORMALISED_FACTOR].c_str());
-
- if(headerValueFloat != m_neuralnetNormalizationFactor)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of normalised factor in config file ("<<
- m_neuralnetNormalizationFactor<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- }
-
- stringVector unitTokens;
- string mdtHLayerUnit = headerSequence[HIDDENLAYERSUNIT];
-
- LTKStringUtil::tokenizeString(mdtHLayerUnit,
- HIDDEN_LAYER_UNIT_DELIMITER, unitTokens);
-
- if(unitTokens.size() != m_layerOutputUnitVec.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of layer stracture does not match" <<
- " does not match with the value in MDT file"<<
- " NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- else
- {
- int s = m_layerOutputUnitVec.size();
-
- for(int i = 0 ; i < (s - 1) ; ++i)
- {
- if(i == 0)
- {
- //set input layer
- m_layerOutputUnitVec[i] = atoi(unitTokens[i].c_str());
- }
- else if( i <= m_neuralnetNumHiddenLayers)
- {
- if(m_layerOutputUnitVec[i] != atoi(unitTokens[i].c_str()))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of hidden node does not match" <<
- " does not match with the value in MDT file"<<
- " NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
- else
- {
- m_layerOutputUnitVec[i] = atoi(unitTokens[i].c_str());
- }
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::validateNeuralnetArchitectureParameters()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : validatePreprocParameters
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::validatePreprocParameters(stringStringMap& headerSequence)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- string tempStrVar = "";
- string headerValue = "";
- int headerValueInt = 0;
- float headerValueFloat = 0.0f;
- int tempIntegerValue = 0;
- float tempFloatValue = 0.0f;
-
- //preproc sequence
- string mdtPreprocSeqn = headerSequence[PREPROC_SEQ];
- if(LTKSTRCMP(m_preProcSeqn.c_str(), mdtPreprocSeqn.c_str()) != 0 &&
- LTKSTRCMP("NA", mdtPreprocSeqn.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preprocSeqn in config file ("<<
- m_preProcSeqn <<") does not match with the value in MDT file ("<<
- mdtPreprocSeqn <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- //ResampTraceDimension
- headerValue = "";
- if(LTKSTRCMP("NA", headerSequence[TRACE_DIM].c_str()) != 0)
- {
- headerValueInt = atoi(headerSequence[TRACE_DIM].c_str());
- tempIntegerValue = m_ptrPreproc->getTraceDimension();
-
- if(headerValueInt != tempIntegerValue )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of TraceDimension in config file ("<<
- tempIntegerValue<<") does not match with the value in MDT file ("<<
- headerValueInt <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
- // preserve aspect ratio
- bool preProcPreserveAspectRatio = m_ptrPreproc->getPreserveAspectRatio();
- tempStrVar = "false";
- if (preProcPreserveAspectRatio == true)
- {
- tempStrVar = "true";
- }
-
- if(LTKSTRCMP((headerSequence[PRESER_ASP_RATIO]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[PRESER_ASP_RATIO]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcPreserveAspectRatio in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[PRESER_ASP_RATIO] <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- //NormPreserveRelativeYPosition
- bool preProcNormPreserveRelativeYPosition = m_ptrPreproc->getPreserveRealtiveYPosition();
- tempStrVar = "false";
- if (preProcNormPreserveRelativeYPosition == true)
- {
- tempStrVar = "true";
- }
-
- if(LTKSTRCMP((headerSequence[PRESER_REL_Y_POS]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[PRESER_REL_Y_POS]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormPreserveRelativeYPosition in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[PRESER_REL_Y_POS] <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- // NormPreserveAspectRatioThreshold
- tempFloatValue = m_ptrPreproc->getAspectRatioThreshold();
- if(LTKSTRCMP((headerSequence[ASP_RATIO_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[ASP_RATIO_THRES].c_str());
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcPreserveAspectRatioThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
- // NormLineWidthThreshold
- if(LTKSTRCMP((headerSequence[DOT_SIZE_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[DOT_SIZE_THRES].c_str());
- tempFloatValue = m_ptrPreproc->getSizeThreshold();
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormLineWidthThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
- // NormDotSizeThreshold
- if(LTKSTRCMP((headerSequence[DOT_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[DOT_THRES].c_str());
- tempFloatValue = m_ptrPreproc->getDotThreshold();
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormDotSizeThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
- //ResampPointAllocation
- tempStrVar = "";
- tempStrVar = m_ptrPreproc->getResamplingMethod();
- if(LTKSTRCMP((headerSequence[RESAMP_POINT_ALLOC]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[RESAMP_POINT_ALLOC]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcResampPointAllocation in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[RESAMP_POINT_ALLOC] <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
- //SmoothWindowSize
- if(LTKSTRCMP((headerSequence[SMOOTH_WIND_SIZE]).c_str(), "NA") != 0)
- {
- headerValueInt = atoi(headerSequence[SMOOTH_WIND_SIZE].c_str());
- tempIntegerValue = m_ptrPreproc->getFilterLength();
-
- if(headerValueInt != tempIntegerValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcSmoothWindowSize in config file ("<<
- tempIntegerValue<<") does not match with the value in MDT file ("<<
- headerValueInt <<")"<<
- " NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::validatePreprocParameters()" << endl;
- return SUCCESS;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : setDeviceContext
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::setDeviceContext(const LTKCaptureDevice& deviceInfo)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::setDeviceContext()" << endl;
-
- m_captureDevice = deviceInfo;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::setDeviceContext()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : unloadModelData
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::unloadModelData()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::unloadModelData()" << endl;
-
- int returnStatus = SUCCESS;
-
- m_connectionWeightVec.clear();
-
- m_previousDelW.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::unloadModelData()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : writeNeuralNetDetailsToMDTFile
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::writeNeuralNetDetailsToMDTFile()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::writeNeuralNetDetailsToMDTFile()" << endl;
-
- int returnStatus = SUCCESS;
-
- int index = 0;
-
- int maxIndex;
-
- double maxVal;
-
-
- //write the Neural net architecture i.e network and weight
- ofstream mdtFileHandle;
-
- double2DVector vecNetworkWeight;
-
- double2DVector vecNetworkDelW;
-
- double2DVector::iterator networkWeightIter;
-
- int connectionWeightSetSize = m_connectionWeightVec.size();
-
- if(connectionWeightSetSize == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EEMPTY_VECTOR << " " <<
- "Empty connection weights" <<
- " NNShapeRecognizer::writeNeuralNetDetailsToMDTFile()"<<endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- double2DVector::iterator networkDelWItr;
-
- int priviousDelWSetSize = m_previousDelW.size();
-
- if(priviousDelWSetSize == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EEMPTY_VECTOR << " " <<
- "Empty privious Del W" <<
- " NNShapeRecognizer::writeNeuralNetDetailsToMDTFile()"<<endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
-
- //Open the Model data file for writing mode
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_neuralnetMDTFilePath.c_str(), ios::out);
- }
- else
- {
- mdtFileHandle.open(m_neuralnetMDTFilePath.c_str(),ios::out|ios::binary);
- }
-
- //Throw an error if unable to open the Model data file
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- getErrorMessage(EMODEL_DATA_FILE_OPEN)<<
- " NeuralNetShapeRecognizer::writeNeuralNetDetailsToMDTFile()" << endl;
-
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- //Write the number of Shapes
- mdtFileHandle << m_numShapes << endl;
- }
- else
- {
- mdtFileHandle.write((char*) &m_numShapes, sizeof(unsigned short));
- }
-
- networkWeightIter = m_connectionWeightVec.begin();
-
- int i=0;
- for (i=0;i<connectionWeightSetSize;i++)
- {
- vecNetworkWeight.push_back((*networkWeightIter));
-
- networkWeightIter++;
- }
-
- returnStatus = appendNeuralNetDetailsToMDTFile(vecNetworkWeight,true,mdtFileHandle);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::writeNeuralNetDetailsToMDTFile()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- vecNetworkWeight.clear();
-
- networkDelWItr = m_previousDelW.begin();
-
- for (i=0;i<priviousDelWSetSize;i++)
- {
- vecNetworkDelW.push_back((*networkDelWItr));
-
- networkDelWItr++;
- }
-
- returnStatus = appendNeuralNetDetailsToMDTFile(vecNetworkDelW,false,mdtFileHandle);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::writeNeuralNetDetailsToMDTFile()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- vecNetworkDelW.clear();
-
- mdtFileHandle.close();
-
- //Updating the Header Information
- updateHeaderWithAlgoInfo();
-
- //Adding header information and checksum generation
- string strModelDataHeaderInfoFile = "";
- LTKCheckSumGenerate cheSumGen;
-
- returnStatus = cheSumGen.addHeaderInfo(
- strModelDataHeaderInfoFile,
- m_neuralnetMDTFilePath,
- m_headerInfo
- );
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::writeNeuralNetDetailsToMDTFile()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::writeNeuralNetDetailsToMDTFile()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : train
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::train(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string &comment,const string &dataset,
- const string &trainFileType)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::train()" << endl;
-
- int returnStatus = SUCCESS;
-
- if(comment.empty() != true)
- {
- m_headerInfo[COMMENT] = comment;
- }
-
- if(dataset.empty() != true)
- {
- m_headerInfo[DATASET] = dataset;
- }
-
- returnStatus = trainNetwork(trainingInputFilePath,
- mdtHeaderFilePath,
- trainFileType);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NNShapeRecognizer::train()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::train()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : updateHeaderWithAlgoInfo
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-void NeuralNetShapeRecognizer::updateHeaderWithAlgoInfo()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::updateHeaderWithAlgoInfo()" << endl;
-
- //Set the NumShapes to the m_headerInfo
- char strVal[80];
- //itoa function is not available in linux
- //itoa(m_numShapes,strVal,10);
- sprintf(strVal,"%d",m_numShapes);
- string strNumShapes(strVal);
- m_headerInfo[NUMSHAPES] = strNumShapes;
-
- ostringstream tempString;
-
- int size = m_layerOutputUnitVec.size();
-
- for(int i = 0; i < size; ++i)
- {
- tempString << m_layerOutputUnitVec[i] <<HIDDEN_LAYER_UNIT_DELIMITER;
- }
-
- string strhLayerUnit = tempString.str();
-
- m_headerInfo[HIDDENLAYERSUNIT] = strhLayerUnit;
-
- m_headerInfo[RECVERSION] = m_currentVersion;
- string algoName = NEURALNET;
- m_headerInfo[RECNAME] = algoName;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::updateHeaderWithAlgoInfo()" << endl;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : trainNetwork
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::trainNetwork(const string& trainingInputFilePath,
- const string &mdtHeaderFilePath,
- const string& inFileType)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::trainNetwork()" << endl;
-
- //Time at the beginning of Train Clustering
- m_OSUtilPtr->recordStartTime();
-
- int returnStatus = SUCCESS;
-
- ///////////////////////////////////////
- // Calculating feature for all sample and all class
- if(LTKSTRCMP(inFileType.c_str(), INK_FILE) == 0)
- {
- //If the Input file is UNIPEN Ink file
- returnStatus = trainFromListFile(trainingInputFilePath);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NeuralNetShapeRecognizer::trainNetwork()" << endl;
-
- LTKReturnError(returnStatus);
- }
- }
- else if(LTKSTRCMP(inFileType.c_str(), FEATURE_FILE) == 0)
- {
- //If the Input file is Feature file
- returnStatus = trainFromFeatureFile(trainingInputFilePath);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NeuralNetShapeRecognizer::trainNetwork()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- PreprocParametersForFeatureFile(m_headerInfo);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Feature store successfully" <<endl;
-
- if(m_isCreateTrainingSequence)
- {
- //rearrabging the feature for traning of neural net
- returnStatus = prepareNeuralNetTrainingSequence();
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NeuralNetShapeRecognizer::trainNetwork()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Success fully complete neural net traning sequence" <<endl;
- }
-
- //train the network
- returnStatus = prepareNetworkArchitecture();
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NeuralNetShapeRecognizer::trainNetwork()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Successfully train Network" <<endl;
-
- //write the weight
- returnStatus = writeNeuralNetDetailsToMDTFile();
-
- if( returnStatus != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<returnStatus << " " <<
- " NeuralNetShapeRecognizer::trainNetwork()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NeuralNetShapeRecognizer::trainClustering()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- ////////////////////////////////////////
- //Time at the end of Train Clustering
- m_OSUtilPtr->recordEndTime();
-
- string timeTaken = "";
- m_OSUtilPtr->diffTime(timeTaken);
-
- cout << "Time Taken = " << timeTaken << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::trainNetwork()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : trainFromListFile
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::trainFromListFile(const string& listFilePath)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::trainFromListFile()" << endl;
-
- //Count for the no. of samples read for a shape
- int sampleCount = 0;
-
- //Count of the no. of shapes read so far
- int shapeCount = 0;
-
- //Flag to skip reading a newline in the list file, when a new class starts
- bool lastshapeIdFlag = false;
-
- //Ink File Path
- string path = "";
-
- //Line from the list file
- string line = "";
-
- //Line is split into tokens
- stringVector tokens;
-
- //Flag is set when EOF is reached
- bool eofFlag = false;
-
- //ID for each shapes
- int shapeId = -1;
-
- //classId of the character
- int prevClassId = -1;
-
- //Indicates the first class
- bool initClassFlag = false;
-
- LTKShapeSample shapeSampleFeatures;
-
- vector<LTKShapeFeaturePtr> shapeFeature;
-
- //list file handle
- ifstream listFileHandle;
-
- //Opening the train list file for reading mode
- listFileHandle.open(listFilePath.c_str(), ios::in);
-
- //Throw an error if unable to open the training list file
- if(!listFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ETRAINLIST_FILE_OPEN << " " <<
- getErrorMessage(ETRAINLIST_FILE_OPEN)<<
- " NeuralNetShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(ETRAINLIST_FILE_OPEN);
- }
-
- int errorCode = SUCCESS;
- unsigned short numShapes = m_numShapes;
- while(!listFileHandle.eof())
- {
- // Not a sample of a new class
- if( lastshapeIdFlag == false )
- {
- //Get the line from the list file
- getline(listFileHandle, line, NEW_LINE_DELIMITER);
-
- path = "";
-
- //Check if EOF is reached
- if( listFileHandle.eof() )
- {
- eofFlag = true;
- }
-
- //Skip commented line
- if ( line[0] == COMMENTCHAR )
- {
- continue;
- }
-
- if (eofFlag == false)
- {
- //Tokenize the string
- errorCode = LTKStringUtil::tokenizeString(line, LIST_FILE_DELIMITER, tokens);
-
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::trainFromListFile()" << endl;
-
- listFileHandle.close();
-
- LTKReturnError(errorCode);
- }
-
-
- //Tokens must be of size 2, one is pathname and other is shapeId
- //If the end of file not reached then continue the looping
- if( tokens.size() != 2 && eofFlag == false )
- continue;
-
- //Tokens[0] indicates the path name
- path = tokens[0];
-
- //Tokens[1] indicates the shapeId
- shapeId = atoi( tokens[1].c_str() );
-
- if(shapeId < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "The NeuralNetShapeRecognizer requires training file class Ids to be positive integers and listed in the increasing order"<<
- " NeuralNetShapeRecognizer::trainFromListFile()" << endl;
- errorCode = EINVALID_SHAPEID;
- break;
- }
- else if(shapeId < prevClassId)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "Shape IDs in the train list file should be in the increasing order. Please use scripts/validateListFile.pl to generate list files." <<
- " NeuralNetShapeRecognizer::trainFromListFile()" << endl;
- errorCode = EINVALID_ORDER_LISTFILE;
- break;
- }
-
-
- //This condition is used to handle the first sample in the file
- if( initClassFlag == false )
- {
- initClassFlag = true;
- prevClassId=shapeId;
- }
- }
- }
- else //Sample of a new class; do not read the next line during this iteration
- {
- //flag unset to read next line during the next iteration
- lastshapeIdFlag = false;
- }
-
- // Sample from the same class, extract features, and push the extracted features to shapeSamplesVec
- if( shapeId == prevClassId && ! path.empty())
- {
- if( getShapeFeatureFromInkFile(path, shapeFeature) != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- "Error extracting features from the ink file: " <<
- path << ", extracting features from the next sample."<<
- " NeuralNetShapeRecognizer::trainFromListFile()" << endl;
-
- continue;
- }
-
- shapeSampleFeatures.setFeatureVector(shapeFeature);
- shapeSampleFeatures.setClassID(shapeId);
-
- ++sampleCount;
-
- shapeFeature.clear();
-
- //All the samples are pushed to m_trainSet used for neural net training
- m_trainSet.push_back(shapeSampleFeatures);
- }
- // Sample of new class seen, or end of list file reached; train all the samples of previous class ID
- if( shapeId != prevClassId || eofFlag == true )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Training for class : " << prevClassId << endl;
-
- //Increase shape count only if there are atleast one sample per class
- if( sampleCount > 0 )
- shapeCount++;
-
- //check that shapecount must not be greater than specified number
- //of shapes, if projecttype was not dynamic
- if( !m_projectTypeDynamic && shapeCount > numShapes )
- {
- errorCode = EINVALID_NUM_OF_SHAPES;
- break;
- }
-
- if( shapeCount > 0 && sampleCount > 0 )
- {
- //number of sample present in the traning shape
- m_sampleCountVec.push_back(sampleCount);
-
- //new shape is found
- //m_numShapes variable value is retreived from config file
- m_numShapes += 1;
-
- //Resetting sampleCount for the next class
- sampleCount = 0;
-
- //Set the flag so that the already read line of next class in the list file is not lost
- lastshapeIdFlag = true;
-
- prevClassId = shapeId;
-
- }
- }
- }//End of while
-
- //Closing the Train List file
- listFileHandle.close();
-
- if(!m_projectTypeDynamic && shapeCount != numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NUM_OF_SHAPES << " " <<
- getErrorMessage(EINVALID_NUM_OF_SHAPES)<<
- " NeuralNetShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(EINVALID_NUM_OF_SHAPES);
- }
- /*else
- {
- m_numShapes = shapeCount;
- }*/
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(errorCode);
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::trainFromListFile()" << endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : prepareNeuralNetTrainingSequence
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::prepareNeuralNetTrainingSequence()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::prepareNeuralNetTraningSequence()" << endl;
-
- int sizeOfTraningSet = m_trainSet.size();
-
- if(sizeOfTraningSet == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR << "(Empty traning set) " <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::prepareNeuralNetTraningSequence()" << endl;
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- vector<LTKShapeSample> shapeSamplesVec;
-
- LTKShapeSample shapeSampleFeatures;
-
- intVector countVector;
-
- intVector initIndexVec;
-
- int qumulativeIndex = 0;
-
- int index = 0;
-
- // store the shape ID which contain the maximum traning sample
- int patternId = -1;
-
- int max = -1;
-
- bool isPrepareTraningSet = false;
-
- try{
-
- //if traning set contain unequal number of sample,
- // then it make the equal number of sample for the traning set
- for(index = 0; index < m_sampleCountVec.size(); ++index)
- {
- if(index == 0)
- {
- qumulativeIndex = (m_sampleCountVec[index] - 1);
-
- max = m_sampleCountVec[index];
-
- patternId = index;
-
- initIndexVec.push_back(index);
- }
- else
- {
- qumulativeIndex = (countVector[index - 1] + m_sampleCountVec[index]);
-
- initIndexVec.push_back((countVector[index - 1] + 1));
-
- if(m_sampleCountVec[index] > max)
- {
- max = m_sampleCountVec[index];
-
- patternId = index;
- }
- }
-
- countVector.push_back(qumulativeIndex);
- }
-
- index = 0;
-
- // copy the whole traning set
- shapeSamplesVec = m_trainSet;
-
- m_trainSet.clear();
-
- while(!isPrepareTraningSet)
- {
- // currenly pointing the sample of a traning shape
- int currentIndex = initIndexVec[index];
-
- if(currentIndex <= countVector[index])
- {
- //point the next sample
- initIndexVec[index] += 1;
-
- int shapeId = shapeSamplesVec[currentIndex].getClassID();
-
- m_targetOutputVec.push_back(vector<double>());
-
- m_targetOutputVec[m_targetOutputVec.size() - 1] = doubleVector(m_numShapes);
-
- m_targetOutputVec[m_targetOutputVec.size() - 1][shapeId] = 1;
-
- vector<LTKShapeFeaturePtr> shapeFeature = shapeSamplesVec[currentIndex].getFeatureVector();
-
- //Normalised feature vector to prepare neural net traning feature lise between (-1 to 1)
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIter = shapeFeature.begin();
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIterEnd = shapeFeature.end();
-
- for(; shapeFeatureIter != shapeFeatureIterEnd; ++shapeFeatureIter)
- {
- floatVector floatFeatureVector;
-
- (*shapeFeatureIter)->toFloatVector(floatFeatureVector);
-
- int vectorSize = floatFeatureVector.size();
-
- int i=0;
- for (i=0; i< vectorSize; i++)
- {
- float floatValue = floatFeatureVector[i];
-
- floatFeatureVector[i] = floatValue;
- }
-
- if(floatFeatureVector[(i - 1)] > 0.0)
- {
- //for penup and pendown
- floatFeatureVector[(i - 1)] = 1;
- }
-
- //Initialised the neuralnet traning feature
- (*shapeFeatureIter)->initialize(floatFeatureVector);
-
- floatFeatureVector.clear();
-
- }
-
- shapeSampleFeatures.setFeatureVector(shapeFeature);
- shapeSampleFeatures.setClassID(shapeId);
-
- m_trainSet.push_back(shapeSampleFeatures);
-
- //Initialised the output vector (output node) for nuralne net traning
- doubleVector tempVector(m_numShapes);
- m_outputLayerContentVec.push_back(tempVector);
- tempVector.clear();
-
- ++index; // for next shape
- }
- else
- {
- //for putting duplicate copy for same traning
- if(index != patternId)
- {
- if(index == 0)
- initIndexVec[index] = 0;
- else
- initIndexVec[index] = (countVector[index - 1] + 1);
- }
- }
-
- // for back to the first class
- if(index == m_numShapes)
- {
- index = 0;
-
- if(initIndexVec[patternId] > countVector[patternId])
- {
- isPrepareTraningSet = true;
- }
- }
- }
-
- }//end try
- catch(LTKException e)
- {
- cout<<"Could not produce traning sequence." <<"\nPlease check the traning sequence."<<endl;
-
- shapeSamplesVec.clear();
-
- countVector.clear();
-
- initIndexVec.clear();
-
- m_trainSet.clear();
-
- throw e;
- }
-
- shapeSamplesVec.clear();
-
- countVector.clear();
-
- initIndexVec.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::prepareNeuralNetTraningSequence()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : trainFromFeatureFile
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::trainFromFeatureFile(const string& featureFilePath)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
-
- //TIME NEEDED
-
- //Count for the no. of samples read for a shape
- int sampleCount = 0;
-
- //Count of the no. of shapes read so far
- int shapeCount = 0;
-
- //ID for each shapes
- int shapeId = -1;
-
- //classId of the character
- int prevClassId = -1;
-
- //Flag to skip reading a newline in the list file, when a new class starts
- bool lastshapeIdFlag = false;
-
- //Flag is set when EOF is reached
- bool eofFlag = false;
-
- //Line from the list file
- string line = "";
-
- //Indicates the first class
- bool initClassFlag = false;
-
- //Input Stream for feature file
- ifstream featureFileHandle;
-
- LTKShapeSample shapeSampleFeatures;
-
- //Opening the feature file for reading mode
- featureFileHandle.open(featureFilePath.c_str(), ios::in);
-
- //Throw an error if unable to open the training list file
- if(!featureFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EFEATURE_FILE_OPEN << " " <<
- getErrorMessage(EFEATURE_FILE_OPEN) <<
- " NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(EFEATURE_FILE_OPEN);
-
- }
-
- //Reading feature file header
- getline(featureFileHandle, line, NEW_LINE_DELIMITER);
- stringStringMap headerSequence;
- int errorCode = SUCCESS;
- errorCode = m_shapeRecUtil.convertHeaderToStringStringMap(line, headerSequence);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- while(!featureFileHandle.eof())
- {
- if( lastshapeIdFlag == false )
- {
- //Get a line from the feature file
- getline(featureFileHandle, line, NEW_LINE_DELIMITER);
-
- if( featureFileHandle.eof() )
- {
- eofFlag = true;
- }
-
- if((getShapeSampleFromString(line, shapeSampleFeatures) != SUCCESS) && (eofFlag == false) )
- continue;
-
- shapeId = shapeSampleFeatures.getClassID();
-
- if(eofFlag == false)
- {
- if(shapeId < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "The NeuralNet Shape recognizer requires training file class Ids to be positive integers and listed in the increasing order" <<
- " NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
- errorCode = EINVALID_SHAPEID;
- break;
- }
- else if(shapeId < prevClassId)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "Shape IDs in the train list file should be in the increasing order. Please use scripts/validateListFile.pl to generate list files." <<
- " NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
- errorCode = EINVALID_ORDER_LISTFILE;
- break;
- }
- }
-
- if( initClassFlag == false )
- {
- initClassFlag = true;
- prevClassId=shapeId;
- }
-
- }
- else //Do not read next line during this iteration
- {
- //flag unset to read next line during the next iteration
- lastshapeIdFlag = false;
- }
- // Sample of the same class seen, keep pushing to the shapeSamplesVec
- if( shapeId == prevClassId )
- {
- //---------------------shapeSamplesVec.push_back(shapeSampleFeatures);
- ++sampleCount;
- //All the samples are pushed to trainSet for neuralnet traning
- m_trainSet.push_back(shapeSampleFeatures);
-
- shapeSampleFeatures.clearShapeSampleFeatures();
- }
- // Sample of a new class seen, or end of feature file reached, train the recognizer on the samples of the previous class
- if( shapeId != prevClassId || eofFlag == true )
- {
- //Increase shape count only if there are atleast one sample per class
- if( sampleCount > 0 )
- shapeCount++;
-
- //check that shapecount must not be greater than specified number
- //of shapes, if projecttype was not dynamic
- if( !m_projectTypeDynamic && shapeCount > m_numShapes )
- {
- errorCode = EINVALID_NUM_OF_SHAPES;
- break;
- }
-
- if( shapeCount > 0 && sampleCount > 0 )
- {
- //Clearing the shapeSampleVector and clusteredShapeSampleVector
- //---------------clusteredShapeSampleVec.clear();
- //----------------shapeSamplesVec.clear();
-
- //number of sample present in the traning shape
- m_sampleCountVec.push_back(sampleCount);
-
- //Resetting sampleCount for the next class
- sampleCount = 0;
-
- //Set the flag so that the already read line of next class in the list file is not lost
- lastshapeIdFlag = true;
-
- prevClassId = shapeId;
- }
- }
- }
-
- featureFileHandle.close();
-
- if(!m_projectTypeDynamic && shapeCount != m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NUM_OF_SHAPES << " " <<
- getErrorMessage(EINVALID_NUM_OF_SHAPES) <<
- " NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(EINVALID_NUM_OF_SHAPES);
- }
- {
- m_numShapes = shapeCount;
- }
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::trainFromFeatureFile()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : getShapeSampleFromString
- * DESCRIPTION : This method get the Shape Sample Feature from a given line
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::getShapeSampleFromString(const string& inString, LTKShapeSample& outShapeSample)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::getShapeSampleFromString()" << endl;
-
-
- //Line is split into tokens
- stringVector tokens;
-
- //Class Id
- int classId = -1;
-
- //Feature Vector string
- string strFeatureVector = "";
-
- //Tokenize the string
- int errorCode = LTKStringUtil::tokenizeString(inString, EMPTY_STRING, tokens);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::getShapeSampleFromString()" << endl;
- LTKReturnError(errorCode);
- }
-
-
- //Tokens must be of size 2, one is classId and other is Feature Vector
- if( tokens.size() != 2)
- return FAILURE;
-
- //Tokens[0] indicates the path name
- classId = atoi(tokens[0].c_str());
-
- //Tokens[1] indicates the shapeId
- strFeatureVector = tokens[1];
-
- errorCode = LTKStringUtil::tokenizeString(strFeatureVector, FEATURE_EXTRACTOR_DELIMITER, tokens);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::getShapeSampleFromString()" << endl;
- LTKReturnError(errorCode);
- }
-
-
- vector<LTKShapeFeaturePtr> shapeFeatureVector;
- LTKShapeFeaturePtr shapeFeature;
-
- for(int i = 0; i < tokens.size(); ++i)
- {
- shapeFeature = m_ptrFeatureExtractor->getShapeFeatureInstance();
- if(shapeFeature->initialize(tokens[i]) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< EINVALID_INPUT_FORMAT << " " <<
- "Number of features extracted from a trace is not correct" <<
- " NeuralNetShapeRecognizer::getShapeSampleFromString()" << endl;
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
- shapeFeatureVector.push_back(shapeFeature);
- }
-
- //Set the feature vector and class id to the shape sample features
- outShapeSample.setFeatureVector(shapeFeatureVector);
- outShapeSample.setClassID(classId);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::getShapeSampleFromString()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : PreprocParametersForFeatureFile
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::PreprocParametersForFeatureFile(stringStringMap& headerSequence)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::PreprocParametersForFeatureFile()" << endl;
-
- //preproc sequence
- headerSequence[PREPROC_SEQ] = "NA";
- //ResampTraceDimension
- headerSequence[TRACE_DIM] = "NA";
- // preserve aspect ratio
- headerSequence[PRESER_ASP_RATIO] = "NA";
- //NormPreserveRelativeYPosition
- headerSequence[PRESER_REL_Y_POS] = "NA";
- // NormPreserveAspectRatioThreshold
- headerSequence[ASP_RATIO_THRES] = "NA";
- // NormLineWidthThreshold
- headerSequence[DOT_SIZE_THRES] = "NA";
- // NormDotSizeThreshold
- headerSequence[DOT_THRES] = "NA";
- //ResampPointAllocation
- headerSequence[RESAMP_POINT_ALLOC] = "NA";
- //SmoothWindowSize
- headerSequence[SMOOTH_WIND_SIZE] = "NA";
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::PreprocParametersForFeatureFile()" << endl;
- return SUCCESS;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : getShapeFeatureFromInkFile
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::getShapeFeatureFromInkFile(const string& inkFilePath,
- vector<LTKShapeFeaturePtr>& shapeFeatureVec)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
-
- if ( inkFilePath.empty() )
- return FAILURE;
-
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
-
- LTKTraceGroup inTraceGroup, preprocessedTraceGroup;
- inTraceGroup.emptyAllTraces();
-
- int returnVal = m_shapeRecUtil.readInkFromFile(inkFilePath,
- m_lipiRootPath, inTraceGroup,
- captureDevice, screenContext);
-
- if (returnVal!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<returnVal<<
- " NeuralNetShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(returnVal);
- }
-
- m_ptrPreproc->setCaptureDevice(captureDevice);
- m_ptrPreproc->setScreenContext(screenContext);
-
- preprocessedTraceGroup.emptyAllTraces();
-
- //Preprocessing to be done for the trace group that was read
- int errorCode = preprocess(inTraceGroup, preprocessedTraceGroup);
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- //Extract feature from the preprocessed trace group
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- shapeFeatureVec);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : computeConfidence
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::computeConfidence()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::computeConfidence()" << endl;
-
- // Temporary vector to store the recognition results
- LTKShapeRecoResult outResult;
-
- int index = 0;
-
- //itaretor for the recognition result
- double2DVector::const_iterator outputLayerRowIter = m_outputLayerContentVec.begin();
-
- double2DVector::const_iterator outputLayerRowIterEnd = m_outputLayerContentVec.end();
-
- for(; outputLayerRowIter != outputLayerRowIterEnd; outputLayerRowIter++)
- {
- doubleVector::const_iterator colItr = (*outputLayerRowIter).begin();
-
- doubleVector::const_iterator colItrEnd = (*outputLayerRowIter).end();
-
- for(; colItr != colItrEnd; colItr++)
- {
- int classID = index++;
-
- double confidence = (*colItr);
-
- outResult.setShapeId(classID);
-
- outResult.setConfidence(confidence);
-
- m_vecRecoResult.push_back(outResult);
- }
- }
-
- //Sort the result vector in descending order of confidence
- sort(m_vecRecoResult.begin(), m_vecRecoResult.end(), sortResultByConfidence);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::computeConfidence()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : sortResultByConfidence
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-bool NeuralNetShapeRecognizer::sortResultByConfidence(const LTKShapeRecoResult& x, const LTKShapeRecoResult& y)
-{
- return (x.getConfidence()) > (y.getConfidence());
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : recognize
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::recognize(const vector<LTKShapeFeaturePtr>& shapeFeatureVector,
- const vector<int>& inSubSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::recognize()" << endl;
-
- // Validating numChoices: valid values: {-1, (0,m_numShapes]}
- if(numChoices <= 0 && numChoices != NUM_CHOICES_FILTER_OFF)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "numChoices ("<<numChoices<<")<=0, setting it to off (-1)"<<endl;
- numChoices = -1;
- }
-
- if(!m_projectTypeDynamic && numChoices > m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "numChoices ("<<numChoices<<") > numShapes ("<<
- m_numShapes<<"), using numShapes "<<m_numShapes<<" instead"<<endl;
- numChoices = m_numShapes;
- }
-
- int index;
-
- //store the feature for network
- double2DVector outptr;
-
- //initialised the network parameter
- doubleVector tempVector(m_numShapes);
-
- m_outputLayerContentVec.push_back(tempVector);
-
- for( index = 0; index < (m_neuralnetNumHiddenLayers + 2); ++index)
- {
- doubleVector tempDoubleV((m_layerOutputUnitVec[index] + 1));
-
- outptr.push_back(tempDoubleV);
-
- tempDoubleV.clear();
- }
-
- for(index = 0; index < (m_neuralnetNumHiddenLayers + 1); ++index)
- {
- outptr[index][m_layerOutputUnitVec[index]] = 1.0;
- }
-
- //compute the forward algo for recognition performance
- int errorCode = feedForward(shapeFeatureVector,outptr,0);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- errorCode = computeConfidence();
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- //copy the recognition result
- outResultVector = m_vecRecoResult;
-
- //clear the network parameter
- m_vecRecoResult.clear();
- m_outputLayerContentVec.clear();
- outptr.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::recognize()" << endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : recognize
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::recognize(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& inSubSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::recognize()" << endl;
-
- if(traceGroup.containsAnyEmptyTrace())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<EEMPTY_TRACE << " " <<
- " Input trace is empty"<<
- " NeuralNetShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(EEMPTY_TRACE);
- }
-
-
- //Contains TraceGroup after Preprocessing is done
- LTKTraceGroup preprocessedTraceGroup;
-
-
- //Preprocess the traceGroup
- int errorCode = preprocess(traceGroup, preprocessedTraceGroup);
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- getErrorMessage(errorCode)<<
- " NeuralNetShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
- }
-
- //Extract the shapeSample from preprocessedTraceGroup
- if(!m_ptrFeatureExtractor)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ENULL_POINTER << " " <<
- " m_ptrFeatureExtractor is NULL"<<
- " NeuralNetShapeRecognizer::recognize()" << endl;
- LTKReturnError(ENULL_POINTER);
- }
-
- vector<LTKShapeFeaturePtr> shapeFeatureVec;
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- shapeFeatureVec);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NeuralNetShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- // call recognize with featureVector
-
- if(recognize( shapeFeatureVec, inSubSetOfClasses, confThreshold,
- numChoices, outResultVector) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- getErrorMessage(errorCode)<<
- " NeuralNetShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::recognize()" << endl;
-
- return SUCCESS;
-
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : constractNeuralnetLayeredStructure
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::constractNeuralnetLayeredStructure()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::constractNeuralnetLayeredStructure()" << endl;
-
- int sizeOfTraningSet = m_trainSet.size();
- if(sizeOfTraningSet == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR << "(Empty traning set) " <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::constractNeuralnetLayeredStructure()" << endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- int outputLayerIndex;
-
- //Store how many feature extracted from a sample (i.e the number of input node)
- int inputNodes = 0;
-
- vector<LTKShapeFeaturePtr> shapeFeature = m_trainSet[0].getFeatureVector();
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIter = shapeFeature.begin();
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIterEnd = shapeFeature.end();
-
- //itaretor through all the feature vector
- for(; shapeFeatureIter != shapeFeatureIterEnd; ++shapeFeatureIter)
- {
- int dimention = (*shapeFeatureIter)->getFeatureDimension();
-
- inputNodes += dimention;
- }
-
- if(inputNodes <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NUM_OF_INPUT_NODE << "(Input node must be grater then zero) " <<
- getErrorMessage(EINVALID_NUM_OF_INPUT_NODE)<<
- " NeuralNetShapeRecognizer::constractNeuralnetLayeredStructure()" << endl;
-
- LTKReturnError(EINVALID_NUM_OF_INPUT_NODE);
- }
-
- // input node
- m_layerOutputUnitVec[0] = inputNodes;
-
- outputLayerIndex = (m_layerOutputUnitVec.size() - 2);
-
- if(m_numShapes <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NUM_OF_OUTPUT_NODE << "(Output node must be grater than zero) " <<
- getErrorMessage(EINVALID_NUM_OF_OUTPUT_NODE)<<
- " NeuralNetShapeRecognizer::constractNeuralnetLayeredStructure()" << endl;
-
- LTKReturnError(EINVALID_NUM_OF_OUTPUT_NODE);
- }
-
- // output node
- m_layerOutputUnitVec[outputLayerIndex] = m_numShapes;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::constractNeuralnetLayeredStructure()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : prepareNetworkArchitecture
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::prepareNetworkArchitecture()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::prepareNetworkArchitecture" << endl;
-
- int index;
-
- int returnStatus = SUCCESS;
-
- //Temporary vector for network parameter
- double2DVector outptr,errptr,target;
-
- //Store the error value of the network
- doubleVector ep;
-
- //Configur the node and layer of the network
- returnStatus = constractNeuralnetLayeredStructure();
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::prepareNetworkArchitecture()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- returnStatus = initialiseNetwork(outptr,errptr);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::prepareNetworkArchitecture()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- //Backpropogate function for creating the network
- returnStatus = adjustWeightByErrorBackpropagation(outptr,errptr,ep);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::prepareNetworkArchitecture()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting NeuralNetShapeRecognizer::prepareNetworkArchitecture" <<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : initialiseNetwork
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::initialiseNetwork(double2DVector& outptr,double2DVector& errptr)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::initialiseNetwork()" << endl;
-
- //Chack the total number of layer is correctly specified
- int numLayer = (m_layerOutputUnitVec.size());
-
- if((m_neuralnetNumHiddenLayers + 3) != numLayer) // 3 because input layer + output layer + one extra
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NETWORK_LAYER << "(Network layer does not match) " <<
- getErrorMessage(EINVALID_NETWORK_LAYER)<<
- " NeuralNetShapeRecognizer::initialiseNetwork()" << endl;
-
- LTKReturnError(EINVALID_NETWORK_LAYER);
- }
-
- int index;
-
- //initialised all the parameter which are need
- for(index = 0; index < (m_neuralnetNumHiddenLayers + 2); ++index)
- {
- doubleVector tempDoubleVec(((m_layerOutputUnitVec[index] + 1) * m_layerOutputUnitVec[index+1]));
-
- m_connectionWeightVec.push_back(tempDoubleVec);
-
- m_delW.push_back(tempDoubleVec);
-
- m_previousDelW.push_back(tempDoubleVec);
-
- tempDoubleVec.clear();
-
- doubleVector tempDoubleV((m_layerOutputUnitVec[index] + 1));
-
- outptr.push_back(tempDoubleV);
-
- errptr.push_back(tempDoubleV);
-
- tempDoubleV.clear();
- }
-
- for(index = 0; index < (m_neuralnetNumHiddenLayers + 1); ++index)
- {
- outptr[index][m_layerOutputUnitVec[index]] = 1.0;
- }
-
- if(!m_isNeuralnetWeightReestimate)
- {
- //For randomly initialised the weight of the network
- srand(m_neuralnetRandomNumberSeed);
-
- for(index = 0; index < (m_neuralnetNumHiddenLayers + 2); ++index)
- {
- for(int i = 0; i < ((m_layerOutputUnitVec[index] + 1) * m_layerOutputUnitVec[index+1]); ++i)
- {
- m_connectionWeightVec[index][i] = (double) ((double)rand()/((double)RAND_MAX) - 0.5);
- m_delW[index][i] = 0.0;
- m_previousDelW[index][i] = 0.0;
- }
- }
- }
- else
- {
- //Initialised neuralnet from previously train weight
- cout<<"Loading initial weight and acrhitecture from previously train data"<<endl;
- int returnStatus = loadModelData();
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NeuralNetShapeRecognizer::initialiseNetwork()" << endl;
-
- LTKReturnError(returnStatus);
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting NeuralNetShapeRecognizer::initialiseNetwork()" <<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : feedForward
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::feedForward(const vector<LTKShapeFeaturePtr>& shapeFeature,double2DVector& outptr,const int& currentIndex)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entaring " <<
- "NeuralNetShapeRecognizer::feedForward" << endl;
-
- if(shapeFeature.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR << "(Empty traning set) " <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::feedForward()" << endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- if(m_layerOutputUnitVec.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR << "(Empty network layer) " <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::feedForward()" << endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- if(m_connectionWeightVec.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR << "(Empty network weights) " <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::feedForward()" << endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- double normalizationFactor = m_neuralnetNormalizationFactor;
-
- if(normalizationFactor <= 0.0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ENON_POSITIVE_NUM <<"(Normalised factor should be posative)" <<
- getErrorMessage(ENON_POSITIVE_NUM)<<
- " NeuralNetShapeRecognizer::feedForward()" << endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
-
- int index;
-
- int offset;
-
- int lInddex; //Layer index
-
- int nodeIndex; // node index
-
- double net;
-
- //input level output calculation
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIter = shapeFeature.begin();
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIterEnd = shapeFeature.end();
-
- nodeIndex = 0;
-
- // assign content to input layer
- //itaretor through all the feature vector
- for(; shapeFeatureIter != shapeFeatureIterEnd; ++shapeFeatureIter)
- {
- floatVector floatFeatureVector;
-
- (*shapeFeatureIter)->toFloatVector(floatFeatureVector);
-
- int vectorSize = floatFeatureVector.size();
-
- for (int i=0; i< vectorSize; i++)
- {
- double floatValue = floatFeatureVector[i];
-
- // Normalised the feature, so that the feature value lies between 0 to 1
- floatValue /= normalizationFactor;
-
- outptr[0][nodeIndex++] = floatValue;
- }
- }
-
- // assign output(activation) value
- // to each neuron usng sigmoid func
- //hidden & output layer output calculation
- for (lInddex = 1; lInddex < m_neuralnetNumHiddenLayers + 2; lInddex++) // For each layer
- {
- // For each neuron in current layer
- for (nodeIndex = 0; nodeIndex < m_layerOutputUnitVec[lInddex]; nodeIndex++)
- {
- net=0.0;
-
- // For input from each neuron in preceeding layer
- for (index = 0; index < m_layerOutputUnitVec[lInddex - 1]+1; index++)
- {
- offset = (m_layerOutputUnitVec[lInddex - 1]+1) * nodeIndex + index;
-
- // Apply weight to inputs and add to net
- net += (m_connectionWeightVec[lInddex - 1][offset] * outptr[lInddex - 1][index]);
- }
-
- // Apply sigmoid function
- outptr[lInddex][nodeIndex] = calculateSigmoid(net);
- }
-
- }
-
- // returns currentIndex'th output of the net
- for (nodeIndex = 0; nodeIndex < m_layerOutputUnitVec[m_neuralnetNumHiddenLayers + 1]; nodeIndex++)
- {
- m_outputLayerContentVec[currentIndex][nodeIndex] = outptr[m_neuralnetNumHiddenLayers + 1][nodeIndex];
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::feedForward()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : introspective
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::introspective(const doubleVector& ep, const double currentError, const int& currentItr, int& outConvergeStatus)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entaring " <<
- "NeuralNetShapeRecognizer::introspective" << endl;
-
- if(ep.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR << "(Empty individual error set) " <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::introspective()" << endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- if(currentError < 0.0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ENEGATIVE_NUM << "(Current error can't be nagative) " <<
- getErrorMessage(ENEGATIVE_NUM)<<
- " NeuralNetShapeRecognizer::introspective()" << endl;
-
- LTKReturnError(ENEGATIVE_NUM);
- }
-
- if(currentItr < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ENEGATIVE_NUM << "(Itaretion can't be nagative) " <<
- getErrorMessage(ENEGATIVE_NUM)<<
- " NeuralNetShapeRecognizer::introspective()" << endl;
-
- LTKReturnError(ENEGATIVE_NUM);
- }
-
- bool isConverge;
-
- int index;
-
- int nsnew;
-
- int traningSetSize = m_trainSet.size();
-
- // reached max. iteration ?
- if (currentItr >= m_neuralnetMaximumIteration)
- {
- cout<<"Successfully complete traning (Maximum iteration reached)"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Successfully complete traning (Maximum iteration reached) : " <<
- currentItr << endl;
-
- outConvergeStatus = (EXIT_FAILURE);
- }
- else
- {
- // error for each pattern small enough?
- isConverge = true;
-
- for (index = 0; (index < traningSetSize) && (isConverge); index++)
- {
- if (ep[index] >= m_neuralnetIndividualError)
- isConverge = false;
- }
-
- if(isConverge)
- {
- cout<<"Successfully complete traning (individual error suficently small) : "<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Successfully complete traning (Individual error suficently small) : " << endl;
-
- outConvergeStatus = (EXIT_SUCCESSFULLY);
- }
- else
- {
- // system total error small enough?
- if (currentError <= m_neuralnetTotalError)
- {
- cout<<"Successfully complete traning (Total error suficently small) : "<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Successfully complete traning (Total error suficently small) : " << endl;
-
- outConvergeStatus = (EXIT_SUCCESSFULLY);
- }
- else
- {
- //Continue traning itaretion
- outConvergeStatus = (CONTINUE);
- }
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::introspective" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : adjustWeightByErrorBackpropagation
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::adjustWeightByErrorBackpropagation(double2DVector& outptr,double2DVector& errptr,doubleVector& ep)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entaring " <<
- "NeuralNetShapeRecognizer::adjustWeightByErrorBackpropagation()" << endl;
-
- if(outptr.size() == 0 || errptr.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::adjustWeightByErrorBackpropagation()" << endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- int totalNumberOfSample = m_trainSet.size();
-
- if(totalNumberOfSample == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_VECTOR << "(Empty traning set) " <<
- getErrorMessage(EEMPTY_VECTOR)<<
- " NeuralNetShapeRecognizer::adjustWeightByErrorBackpropagation()" << endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- int outResult;
-
- int nIndex; // node index
-
- int offset; // offfset index of the vector
-
- int layerIndex; //Layer index
-
- int nodeIndex; // node or neuron index
-
- int sampleIndex;
-
- int nsold = 0;
-
- int itaretorIndex = 0; // itaretorIndex
-
- double actualOutput;
-
- double currentError;
-
- ep = doubleVector( totalNumberOfSample ); //errror per sample // individual error
-
- cout<<"After preparing traning sequence" <<
- "(made all shape same number of traning sample" <<
- " as the highest number of sample present in orginal traning list) :"<<
- totalNumberOfSample << endl;
-
- /////////////////////////////////////////////////////
- outResult = CONTINUE;
-
- do
- {
- currentError = 0.0;
- //for each pattern
- for(sampleIndex = 0; sampleIndex < totalNumberOfSample; sampleIndex++)
- {
-
- vector<LTKShapeFeaturePtr> shapeFeature = m_trainSet[sampleIndex].getFeatureVector();
- //bottom_up calculation
- // update output values for each neuron
- int errorCode = feedForward(shapeFeature,outptr,sampleIndex);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::adjustWeightByErrorBackpropagation()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- shapeFeature.clear();
-
- //top_down error propagation output_level error
- // find error for output layer
- for(layerIndex = 0; layerIndex < m_layerOutputUnitVec[ (m_neuralnetNumHiddenLayers + 1) ]; layerIndex++)
- {
- actualOutput= outptr[ (m_neuralnetNumHiddenLayers+1)][layerIndex];
- errptr[(m_neuralnetNumHiddenLayers + 1)][layerIndex] = ((m_targetOutputVec[sampleIndex][layerIndex] - actualOutput) *
- (1 - actualOutput) * actualOutput);
- }
-
- // hidden & input layer errors
- for(layerIndex = (m_neuralnetNumHiddenLayers+1); layerIndex >= 1; layerIndex--)
- {
- for(nodeIndex = 0; nodeIndex < m_layerOutputUnitVec[layerIndex - 1]+1; nodeIndex++)
- {
- errptr[layerIndex-1][nodeIndex] = 0.0;
- for(nIndex = 0; nIndex < m_layerOutputUnitVec[layerIndex]; nIndex++)
- {
- offset = (m_layerOutputUnitVec[layerIndex-1]+1) * nIndex + nodeIndex;
-
- m_delW[layerIndex-1][offset] = m_neuralnetLearningRate * (errptr[layerIndex][nIndex]) *
- (outptr[layerIndex - 1][nodeIndex]) + m_neuralnetMomemtumRate *
- (m_previousDelW[layerIndex - 1][offset]);
-
- errptr[layerIndex-1][nodeIndex] += (errptr[layerIndex][nIndex]) *
- (m_connectionWeightVec[layerIndex - 1][offset]);
- }
-
- (errptr[layerIndex - 1][nodeIndex]) = (errptr[layerIndex - 1][nodeIndex]) *
- (1- (outptr[layerIndex - 1][nodeIndex])) *
- (outptr[layerIndex - 1][nodeIndex]);
- }
- }
-
- // connection weight changes
- // adjust weights usng steepest descent
- for(layerIndex = 1 ; layerIndex < (m_neuralnetNumHiddenLayers + 2); layerIndex++)
- {
- for(nodeIndex = 0; nodeIndex < m_layerOutputUnitVec[layerIndex]; nodeIndex++)
- {
- for(nIndex = 0; nIndex < m_layerOutputUnitVec[layerIndex-1]+1; nIndex++)
- {
- offset= (m_layerOutputUnitVec[layerIndex - 1] + 1) * nodeIndex + nIndex;
-
- (m_connectionWeightVec[layerIndex - 1][offset]) += (m_delW[layerIndex - 1][offset]);
- }
- }
- }
-
- //current modification amount saved
- for(layerIndex = 1; layerIndex < m_neuralnetNumHiddenLayers + 2; layerIndex++)
- {
- for(nodeIndex = 0; nodeIndex < m_layerOutputUnitVec[layerIndex]; nodeIndex++)
- {
- for(nIndex = 0; nIndex < m_layerOutputUnitVec[layerIndex - 1] + 1; nIndex++)
- {
- offset = (m_layerOutputUnitVec[layerIndex - 1] + 1) * nodeIndex + nIndex;
-
- (m_previousDelW[layerIndex - 1][offset]) = (m_delW[layerIndex - 1][offset]);
- }
- }
- }
-
- //update individula error for find mean square error
- ep[sampleIndex] = 0.0;
-
- for(layerIndex = 0; layerIndex < m_layerOutputUnitVec[m_neuralnetNumHiddenLayers+1]; layerIndex++)
- {
-
- ep[sampleIndex] += fabs((m_targetOutputVec[sampleIndex][layerIndex] -
- (outptr[m_neuralnetNumHiddenLayers+1][layerIndex])));
-
- }
-
- currentError +=ep[sampleIndex] * ep[sampleIndex];
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<sampleIndex <<" ->" <<currentError <<endl;
-
- }
-
- //mean square error
- currentError =0.5 * currentError / (double)( totalNumberOfSample * m_numShapes );
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"itaretion = "<<itaretorIndex<<"||"<<"Mean square error = "<<currentError<<endl;
-
- cout <<"Itaretion = " << itaretorIndex <<"||"
- <<"Mean square error = " << currentError << endl;
-
- itaretorIndex++;
-
- // check condition for terminating learning
- int errorCode = introspective(ep,currentError,itaretorIndex,outResult);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::adjustWeightByErrorBackpropagation()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- } while (outResult == CONTINUE);
-
- //update output with changed weights
- for (sampleIndex = 0; sampleIndex < totalNumberOfSample; sampleIndex++)
- {
- vector<LTKShapeFeaturePtr> shapeFeature = m_trainSet[sampleIndex].getFeatureVector();
-
- int errorCode = feedForward(shapeFeature,outptr,sampleIndex);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::adjustWeightByErrorBackpropagation()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- shapeFeature.clear();
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NeuralNetShapeRecognizer::adjustWeightByErrorBackpropagation()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : calculateSigmoid
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-double NeuralNetShapeRecognizer ::calculateSigmoid(double inNet)
-{
- return (double)(1/(1+exp(-inNet)));
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : addClass
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::addClass(const LTKTraceGroup& sampleTraceGroup, int& shapeID)
-{
- // Should be moved to nnInternal
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::addClass()" << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NeuralNetShapeRecognizer::addClass"<<endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : addSample
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::addSample(const LTKTraceGroup& sampleTraceGroup, int shapeID)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NeuralNetShapeRecognizer::addSample()" << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NeuralNetShapeRecognizer::addSample"<<endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tanmay Mondal
- * SUPERVISOR : Ujjwal Bhattacharya
- * OTHER PLP : Kalikinkar Das
- * ORGANIZATION : Indian Statistical Institute, Kolkata, India
- * DEPARTMENT : Computer Vision and Pattern Recognition Unit
- * DATE :
- * NAME : deleteClass
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : int:
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NeuralNetShapeRecognizer::deleteClass(int shapeID)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering NeuralNetShapeRecognizer::deleteClass" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting NeuralNetShapeRecognizer::deleteClass" <<endl;
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h
deleted file mode 100644
index 6e32002a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/NeuralNetShapeRecognizer.h
+++ /dev/null
@@ -1,1111 +0,0 @@
-#ifndef __NEURALNETSHAPERECOGNIZER_H
-#define __NEURALNETSHAPERECOGNIZER_H
-
-/** Include files */
-#include "LTKInc.h"
-#include "LTKTypes.h"
-#include "LTKMacros.h"
-#include "LTKShapeRecognizer.h"
-#include "LTKShapeRecoUtil.h"
-#include "LTKShapeSample.h"
-#include "LTKCheckSumGenerate.h"
-
-/** Forward declaration of classes */
-class LTKTraceGroup;
-class LTKPreprocessorInterface;
-class LTKShapeSample;
-class LTKShapeFeatureExtractor;
-class LTKShapeFeature;
-
-#define SUPPORTED_MIN_VERSION "3.0.0"
-
-typedef int (*FN_PTR_CREATELTKLIPIPREPROCESSOR)(const LTKControlInfo& , LTKPreprocessorInterface** );
-typedef int (*FN_PTR_DELETELTKLIPIPREPROCESSOR)(LTKPreprocessorInterface* );
-
-
-/**
- * @ingroup NeuralNetShapeRecognizer.h
- * @brief The Header file for the NeuralNetShapeRecognizer
- * @class NeuralNetShapeRecognizer
- *<p> Fully connected feedforward multilayer perceptron
- * backpropogation algorithm used for its training.
- *</p>
- */
-
-class NeuralNetShapeRecognizer: public LTKShapeRecognizer
-{
-
- /** @name private data members */
- //@{
- private:
-
- FN_PTR_DELETELTKLIPIPREPROCESSOR m_deleteLTKLipiPreProcessor;
- //Function pointer for deleteLTKLipiPreProcessor
-
- // preproc lib handle
- void *m_libHandler;
-
- // feature extractor lib handle
- void *m_libHandlerFE;
-
- unsigned short m_numShapes;
- /**< @brief Number of shapes
- * <p>
- * It Defines the number of shapes to be recognized
- *
- * DEFAULT: 0
- *
- * Note: If the project is dynamic, then this numShapes is set to 0
- * If the project is not dynamic, then the numShapes is read from project configuration file
- * </p>
- */
-
- string m_featureExtractorName;
- /**< @brief The Feature Extractor
- * <p>
- *
- * DEFAULT:PointFloat
- *
- * </p>
- */
-
- bool m_projectTypeDynamic;
- /**< @brief Project Dynamic
- * <p>
- * if projectTypeDynamic = true, then the project is dynamic i.e., the numShapes can take any number of value(s)
- * = false, then the project is not dynamic i.e., the numShapes take value from project.cfg file
- *
- * DEFAULT: false
- * </p>
- */
-
- LTKPreprocessorInterface *m_ptrPreproc;
- /**< @brief Pointer to preprocessor instance
- * <p>
- * Instance which is used to call the preprocessing methods before recognition
- *
- * DEFAULT: NULL
- * </p>
- */
-
- string m_neuralnetCfgFilePath;
- /**< @brief Full path of NeuralNet configuration file
- * <p>
- * Assigned value in the NeuralNetShapeRecognizer::initialize function
- * </p>
- */
-
- string m_neuralnetMDTFilePath;
- /**< @brief Full path of Model data file
- * <p>
- * Assigned value in the NeuralNetShapeRecognizer::initialize function
- * </p>
- */
-
- stringStringMap m_headerInfo;
- /**< @brief Header Information
- * <p>
- * </p>
- */
-
- LTKShapeRecoUtil m_shapeRecUtil;
- /**< @brief Pointer to LTKShapeRecoUtil class
- * <p>
- * Instance used to call Shape Recognizer Utility functions
- *
- * DEFAULT: NULL
- */
-
- string m_lipiRootPath;
- /**< @brief Path of the Lipi Root
- * <p>
- * DEFAULT: LipiEngine::getLipiPath()
- * </p>
- */
-
- string m_lipiLibPath;
- /**< @brief Path of the Lipi Libraries
- * <p>
- * DEFAULT: LipiEngine::getLipiPath()
- * </p>
- */
-
- LTKShapeFeatureExtractor *m_ptrFeatureExtractor;
- /**< @brief Pointer to LTKShapeFeatureExtractor class
- * <p>
- * DEFAULT: NULL
- * </p>
- */
-
- string m_preProcSeqn;
- /**< @brief Preprocessor Sequence
- * <p>
- * This string holds the sequence of preprocessor methods
- * </p>
- */
-
- vector<stringStringPair> m_preprocSequence;
- /**< @brief Preprocessor Sequence vector
- * <p>
- * This vector of string holds the sequence of preprocessor methods
- * </p>
- */
-
- vector<LTKShapeRecoResult> m_vecRecoResult;
- /**< @brief Store Recognize results
- * <p>
- * This vector hold shape ID and its confidance value
- * </p>
- */
-
- int m_neuralnetRandomNumberSeed;
- /**< @brief Store seed value for random number generator
- *
- * <p>
- * This integer variable hold the seed value of random number generator for initialization of network weights
- *
- * DEFAULT : NEURALNET_DEF_RANDOM_NUMBER_SEED
- * </p>
- */
-
- float m_neuralnetNormalizationFactor;
- /**< @brief Store the normalisation factor to normalise the input feature component value between (-1 to +1)
- * It is used during genaration of training / testing feature vector
- * <p>
- *
- * DEFAULT : NEURALNET_DEF_NORMALIZE_FACTOR
- * </p>
- */
-
- float m_neuralnetLearningRate;
- /**< @brief Learning rate of backpropagation algorithm
- *
- * <p>
- *
- * DEFAULT : NEURALNET_DEF_LEARNING_RATE
- * </p>
- */
-
- float m_neuralnetMomemtumRate;
- /**< @brief Momentum rate of backpropagation algorithm
- *
- * <p>
- *
- * DEFAULT : NEURALNET_DEF_MOMEMTUM_RATE
- * </p>
- */
-
- double m_neuralnetTotalError;
- /**< @brief Store the threshold value of the system error
- * (i.e total error of network response during an epoch)
- *
- * <p>
- * Used for training convergence criterion
- *
- * DEFAULT : NEURALNET_DEF_TOTAL_ERROR
- * </p>
- */
-
- double m_neuralnetIndividualError;
- /**< @brief Store the threshold value of the network response error per
- * inidividual sample
- *
- * <p>
- * Used for training convergence criterion
- *
- * DEFAULT : NEURALNET_DEF_INDIVIDUAL_ERROR
- * </p>
- */
-
- int m_neuralnetNumHiddenLayers;
- /**< @brief Number of hidden layers of the neural net
- *
- * <p>
- *
- * DEFAULT : NEURALNET_DEF_HIDDEN_LAYERS_SIZE
- * </p>
- */
-
- int m_neuralnetMaximumIteration;
- /**< @brief Number of iteration
- *
- * <p>
- * Used for upper bound of traning iteration
- *
- * DEFAULT : NEURALNET_DEF_MAX_ITR
- * </p>
- */
-
- bool m_isCreateTrainingSequence;
- /**< @brief If true generate input sequence of feature vectors for training
- *
- * <p>
- *
- * DEFAULT : true
- * </p>
- */
-
- double2DVector m_connectionWeightVec;
- /**< @brief Store network connection weight
- * <p>
- *
- * </p>
- */
-
- double2DVector m_delW;
- /**< @brief Store error derivatives with respect to network weights
- * <p>
- *
- * </p>
- */
-
- double2DVector m_previousDelW;
- /**< @brief Store values of m_delW during last but one iteration
- * <p>
- *
- * </p>
- */
-
- double2DVector m_outputLayerContentVec;
- /**< @brief Store values of output layer node
- * <p>
- *
- * </p>
- */
-
- double2DVector m_targetOutputVec;
- /**< @brief Store values of target output vactor components for each training sample
- * <p>
- *
- * </p>
- */
-
- intVector m_layerOutputUnitVec;
- /**< @brief Stores numbere of nodes at different layers of the network
- * <p>
- *
- * </p>
- */
-
- bool m_isNeuralnetWeightReestimate;
- /**< @brief If true the neural net is initialised using a previously trained network information
- * this information is obtained from neuralnet.mdt file
- * <p>
- *
- * </p>
- */
-
- float m_rejectThreshold;
- /**< @brief Threshold on the confidence to declare a test sample rejected
- * <p>
- * DEFAULT : 0.01
- * </p>
- */
-
- intVector m_sampleCountVec;
- /**< @brief Number of training samples present in each category
- * <p>
- *
- * </p>
- */
-
- LTKCaptureDevice m_captureDevice;
-
- LTKOSUtil* m_OSUtilPtr;
- /**< @brief Pointer to LTKOSUtil interface
- * <p>
- *
- * </p>
- */
-
- vector<LTKShapeSample> m_trainSet;
- /**< @brief Store ShapeSampleFeatures for all training samples
- * Used during neuralnet training
- * <p>
- *
- * DEFAULT : 0.01
- * </p>
- */
-
- string m_MDTFileOpenMode;
- /**< @brief Store the neuralnet.mdt file open mode (Ascii or Binary)
- * <p>
- * Used during open neuralnet.mdt file
- *
- * DEFAULT : Ascii
- * </p>
- */
-
- //@}
-
- string m_currentVersion;
-
- public:
-
- /** @name Constructors and Destructor */
- //@{
-
- NeuralNetShapeRecognizer(const LTKControlInfo& controlInfo);
-
- /**
- * Destructor
- */
- ~NeuralNetShapeRecognizer();
-
- //@}
-
- /**
- * This method initializes the NeuralNet shape recognizer
- * <p>
- * Semantics
- * - Set the project name in NeuralNetShapeRecognizer::headerInfo with the parameter passed <br>
- * m_headerInfo[PROJNAME] = strProjectName;
- *
- * - Initialize NeuralNetShapeRecognizer::m_neuralnetCfgFilePath <br>
- * m_neuralnetCfgFilePath = NeuralNetShapeRecognizer::m_lipiRootPath + LTKMacros::PROJECTS_PATH_STRING +
- * strProjectName + LTKMacros::PROFILE_PATH_STRING + strProfileName +
- * LTKInc::SEPARATOR + LTKInc::NEURALNET + LTKInc::CONFIGFILEEXT;
- *
- * - Initializes NeuralNetShapeRecognizer::m_neuralnetMDTFilePath <br>
- * m_neuralnetMDTFilePath = NeuralNetShapeRecognizer::m_lipiRootPath + LTKMacros::PROJECTS_PATH_STRING +
- * strProjectName + LTKMacros::PROFILE_PATH_STRING + strProfileName +
- * LTKInc::SEPARATOR + LTKInc::NEURALNET + LTKInc::DATFILEEXT;
- *
- * - Initializes NeuralNetShapeRecognizer::m_projectTypeDynamic with the value returned from LTKShapeRecoUtil::isProjectDynamic
- *
- * - Initialize the preprocessor using LTKShapeRecoUtil::initializePreprocessor and assign
- * default values for
- * -# Normalised size
- * -# Threshold size
- * -# Aspect ratio
- * -# Dot threshold
- *
- * - Initialize the instance variables of neuralnet recognizer with the values given in classifier config file
- *
- * </p>
- * @param strProjectName : string : Holds the name of the Project
- * @param strProfileName : string : Holds the name of the Profile
- *
- * @return int : LTKInc::SUCCESS if initialization done successfully
- * errorValues if initialization has some errors
- *
- * @exception LTKErrorList::ECONFIG_FILE_OPEN Could not open project.cfg
- * @exception LTKErrorList::EINVALID_NUM_OF_SHAPES Negative value for number of shapes
- * @exception LTKErrorList::ELOAD_PREPROC_DLL Could not load preprocessor DLL
- * @exception LTKErrorList::EDLL_FUNC_ADDRESS_CREATE Could not map createPreprocInst
- * @exception LTKErrorList::EDLL_FUNC_ADDRESS_DELETE Could not map destroyPreprocInst
- */
-
- /**
- * This method calls the train method of the NeuralNet classifier
- *
- */
- int train(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string &comment,const string &dataset,
- const string &trainFileType=INK_FILE) ;
-
- /**
- * This method loads the Training Data of the NeuralNet classifier
- * @param
- * @return LTKInc::SUCCESS : if the model data was loaded successfully
- * @exception
- */
- int loadModelData();
-
- /**
- * This method unloads all the training data
- * @param none
- * @return LTKInc::SUCCESS : if the model data was unloaded successfully
- * @exception none
- */
- int unloadModelData();
-
- /**
- * This method sets the device context for the recognition
- *
- * @param deviceInfo parameter to be set
- * @return
- * @exception
- */
- int setDeviceContext(const LTKCaptureDevice& deviceInfo);
-
- /**
- * Populates a vector of LTKShapeRecoResult consisting of top classes with their confidences
- *
- * Semantics
- *
- * - Validate the input arguments
- * - Extract the features from traceGroup
- * - Compute the confidences of the classes, call computeConfidence()
- * - Check if the first element of resultVector has confidence less than m_rejectThreshold, if so,
- empty the resultVector (reject the sample), log and return.
- * - If the confThreshold value was specified by the user (not equal to -1),
- delete the entries from resultVector with confidence values less than confThreshold
- * - If the numChoices value was specified by the user (not equal to -1),
- update the resultVector with top numChoices entries, delete other values
- *
- * @param traceGroup The co-ordinates of the shape which is to be recognized
- * @param screenContext Contains information about the input sample whether it is written inside a preprinted box
- * or unconstrained continuous writing
- * @param subSetOfClasses A subset of the entire class space which is to be used for
- * recognizing the input shape.
- * @param confThreshold Classes with confidence below this threshold are not returned,
- * valid range of confThreshold: (0,1)
- * @param numOfChoices Number of top choices to be returned in the result structure
- * @param resultVector The result of recognition
- *
- * @return SUCCESS: resultVector populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int recognize(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector);
-
-
- /* Overloaded the above function to take vector<LTKShapeFeaturePtr> as
- * input
- */
- int recognize(const vector<LTKShapeFeaturePtr>& shapeFeatureVec,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& resultVector);
-
- /**
- * This method add Class
- *
- * Semantics
- *
- *
- * @param sampleTraceGroup : LTKTraceGroup : Holds TraceGroup of sample to add
- * @param shapeID : int : Holds shapeID of new Class
- *
- * @return SUCCESS:Shape Class added successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
-
- int addClass(const LTKTraceGroup& sampleTraceGroup, int& shapeID);
-
- /**
- * This method add Sample Class for adapt
- *
- * Semantics
- *
- *
- * @param sampleTraceGroup : LTKTraceGroup : Holds TraceGroup of sample to Add
- * @param shapeID : int : Holds shapeID of new Class
- *
- * @return SUCCESS:Shape Class added successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int addSample(const LTKTraceGroup& sampleTraceGroup, int shapeID);
-
- /**
- * This method delete Class
- *
- * Semantics
- *
- * @param shapeID : int : Holds shapeID of Shape to be deleted
- *
- * @return SUCCESS: Shape Class deleted successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int deleteClass(int shapeID);
-
- /**
- * This method converts features to TraceGroup
- *
- * Semantics
- *
- *
- * @param shapeID : int : Holds shapeID
- * @param numberOfTraceGroups : int : Maximum number of Trace Groups to populate
- * @param outTraceGroups : vector<LTKTraceGroup> : TraceGroup
- *
- * @return SUCCESS:
- * FAILURE:
- * @exception none
- */
- int getTraceGroups(int shapeID, int numberOfTraceGroups, vector<LTKTraceGroup> &outTraceGroups);
-
-
- private:
- /**
- * This function is the method for generation of network architecture,
- * creation of training samples and learning of network weights
- *
- *
- * Semantics
- *
- * - Note the start time for computation of execution time
- *
- * - Call train method depending on the inFileType
- * - NeuralNetShapeRecognizer::trainFromListFile() if inFileType = LTKMacros::INK_FILE
- * - NeuralNetShapeRecognizer::trainFromFeatureFile() if inFileType = LTKMacros ::FEATURE_FILE
- *
- * - Call prepareNeuralNetTrainingSequence method depending on the m_isCreateTratningSequence
- * - NeuralNetShapeRecognizer::prepareNeuralNetTrainingSequence() if m_isCreateTrainingSequence = true
- *
- * - Call NeuralNetShapeRecognizer::prepareNetworkArchitecture()
- *
- * - Update the headerInfo with algorithm version and name using NeuralNetShapeRecognizer::updateHeaderWithAlgoInfo() method
- *
- * - Calculate the checksum.
- *
- * - Call NeuralNetShapeRecognizer::writePrototypeSetToMDTFile()
- *
- * - Note the termination time for execution time computation
- *
- *
- * @param inputFilePath :string : Path of trainListFile / featureFile
- * @param strModelDataHeaderInfoFile : string : Holds the Header information of Model Data File
- * @param inFileType : string : Possible values ink / featureFile
- *
- * @return LTKInc::SUCCESS : if the training done successfully
- * @return errorCode : if it contains some error training fails
- */
- int trainNetwork(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string& trainFileType);
-
-
- /**
- * This method maps between the module names and respective function names from the cfg file
- *
- * Semantics
- *
- * - Read the Preprocess Sequence from the neuralnet.cfg file
- *
- * - Split the sequence into tokens with delimiter LTKMacros::DELEMITER_SEQUENCE using LTKStringUtil::tokenizeString
- *
- * - Split each token with delimiter LTKMacrosDELEMITER_FUNC using LTKStringUtil::tokenizeString
- * to get the Module name and Function name
- *
- * - Store the Module name and the Function name into a structure
- *
- *
- * @param none
- * @return LTKInc::SUCCESS : if functions are successfully mapped,
- * @return errorCodes : if contains any error
- * @exception none
- */
- int mapPreprocFunctions();
-
- /**
- * This method will assign default values to the members
- *
- * Semantics
- *
- * - Assign Default values to all the data members
- *
- *
- * @param none
- *
- * @return none
- */
- void assignDefaultValues();
-
- /** Reads the NeuralNet.cfg and initializes the instance variable of the classifier with the user defined
- * values.
- *
- * Semantics
- *
- * - Open the NeuralNet.cfg using LTKConfigFileReader
- *
- * - In case of file open failure (NeuralNet.cfg), default values of the classifier parameters are used
- *
- * - The valid values of the classifier parameters are cached into the class data members
- * LTKConfigFileReader::getConfigValue is used to get the value for a key defined in the config file
- *
- * - Exception is thrown if the user has specified an invalid value for a parameter
- *
- *
- * @param none
- * @return SUCCESS : If the Config file is read successfully
- * @return errorCode : If it contains some error
- * @exception LTKErrorList::ECONFIG_FILE_RANGE The config file variable is not within the correct range
- */
- int readClassifierConfig();
-
- /**
- * This method creates a custom feature extractor instance and stores it's address in
- *
- * Semantics
- *
- *
- * - Intialize the NeuralNetShapeRecognizer::m_ptrFeatureExtractor with address of the feature extractor instance created
- * using LTKShapeFeatureExtractorFactory::createFeatureExtractor
- *
- * @param none
- *
- * @return 0 on LTKInc::SUCCESS and 1 on LTKInc::FAILURE
- *
- * @exception none
- */
- int initializeFeatureExtractorInstance(const LTKControlInfo& controlInfo);
-
- /**
- * This method trains the classifier from the file containing train list whose path is passed as a paramater
- *
- * Semantics
- *
- * - Open the trainListFile for reading
- *
- * - Open the mdt file for writing
- *
- * - Write header information to the mdt file
- * - NeuralNetShapeRecognizer::m_numShapes
- * - NeuralNetShapeRecognizer::m_traceDimension
- * - NeuralNetShapeRecognizer::m_flexibilityIndex
- *
- * - Get a valid line from the train list file
- * - Skip commented lines
- * - Skip lines where number_of_tokens != 2
- * - Throw error LTKErrorList::EINITSHAPE_NONZERO, if the first shape in the list file is not zero
- * - Throw error LTKErrorList::EINVALID_ORDER_LISTFILE if the shapes are not in sequential order
- *
- * - For every valid line get the ShapeSample from the ink file using NeuralNetShapeRecognizer::getShapeSampleFromInkFile
- * - Read ink from UNIPEN ink file
- * - Skip if the trace group is empty
- * - Pre process the trace group read from the ink file
- * - Extract features
- *
- * - Push all the ShapeSamples corresponding to a shape into a vector of ShapeSample ShapeSamplesVec
- *
- *
- * @param listFilePath : string : Holds the path for train list file
- *
- * @return none
- *
- * @exception LTKErrorList::EFILE_OPEN_ERROR : Error in Opening a file (may be mdt file or list file)
- * @exception LTKErrorList::EINVALID_NUM_OF_SHAPES : Invalid value for number of shapes
- * @exception LTKErrorList::EINVALID_ORDER_LISTFILE: Invalid order of shapeId in List file
- * @exception LTKErrorList::EINITSHAPE_NONZERO : Initial shapeId must not be zero
- */
- int trainFromListFile(const string& listFilePath);
-
- /**
- * This method trains the classifier from the feature file whose path is passed as paramater
- *
- * Semantics
- *
- *
- * @param featureFilePath : string : Holds the path of Feature file
- *
- * @return none
- */
- int trainFromFeatureFile(const string& featureFilePath);
-
- /**
- * This method is used to store the preprocess parameter for header of the .mdt file
- *
- * Semantics
- *
- *
- * @param headerSequence : stringStringMap : Holds header value of .mdt file
- *
- * @return none
- */
- int PreprocParametersForFeatureFile(stringStringMap& headerSequence);
-
- /**
- * This method returns the ShapeSample by using the ink file path as input
- *
- * Semantics
- *
- * - Call the LTKShapeRecoUtil::readInkFromFile() method (Utility Method) to read the ink file
- * By reading this file, an inTraceGroup is generated
- *
- * - Preprocess the inTraceGroup and get the preprocessed trace group
- * LTKTraceGroup preprocessedTraceGroup
- *
- * - Extract features from the preprocessed trace group to get the ShapeSamples.
- *
- *
- * @param path : string : The path for Ink file
- * @param ShapeSample : ShapeSample : The ShapeSample generated after feature extraction
- *
- * @return SUCCESS : If the ShapeSample is generated successfully
- * @return FAILURE : Empty traces group detected for current shape
- *
- * @exception LTKErrorList::EINKFILE_EMPTY : Ink file is empty
- * @exception LTKErrorList::EINK_FILE_OPEN : Unable to open unipen ink file
- * @exception LTKErrorList::EINKFILE_CORRUPTED : Incorrect or corrupted unipen ink file
- * @exception LTKErrorList::EEMPTY_TRACE : Number of points in the trace is zero
- * @exception LTKErrorList::EEMPTY_TRACE_GROUP : Number of traces in the trace group is zero
- */
- int getShapeFeatureFromInkFile(const string& inkFilePath,
- vector<LTKShapeFeaturePtr>& shapeFeatureVec);
-
- /**
- * This method will Update the Header information for the MDT file
- *
- * Semantics
- *
- * - Copy the version number to a string
- *
- * - Update the version info and algoName to NeuralNetShapeRecognizer::m_headerInfo, which specifies the
- * header information for MDT file
- *
- *
- * @param none
- *
- * @return none
-
- * @exception none
- */
- void updateHeaderWithAlgoInfo();
-
- /**
- * This method do preprocessing for input trace group
- *
- * Semantics
- *
- * @param inTraceGroup : LTKTraceGroup : Store unipen ink file
- outPreprocessedTraceGroup : LTKTraceGroup : Store preprocess ink of input ink
- * @return
- * @exception
- */
- int preprocess (const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outPreprocessedTraceGroup);
-
- /**
- * This method write training results to the mdt file
- *
- * Semantics
- *
- * - If mdt file open mode is ASCII
- * - Write the number of Shape
- * - Write the connection weight
- * - Write the derivative of connection weight
- *
- * - If mdt file open mode is BINARY
- * - Write the number of Shape
- * - Write the connection weight
- * - Write the connection weight vector size
- * - Write the derivative of connection weight
- *
- * @param none
- * @return
- * @exception
- */
- int writeNeuralNetDetailsToMDTFile();
-
- /**
- * This method will writes training results to the mdt file
- *
- * Semantics
- *
- * - If mdt file open mode is ASCII
- * - Write the number of Shape
- * - Write the connection weight
- * - Write the derivative of connection weight
- *
- * - If mdt file open mode is BINARY
- * - Write the number of Shape
- * - Write the connection weight
- * - Write the connection weight and derivative of connection weight vectors size
- * - Write the derivative of connection weight
- *
- *
- * @param resultVector : double2DVector : A vector of weight or weight derivative created as a result of training
- * mdtFileHandle : ofstream : Specifies the outut stream
- * isWeight : bool : If true then resultVector contain weight, if false then resultVector contain weight derivative
- *
- * @return none
- *
- * @exception none
- */
- int appendNeuralNetDetailsToMDTFile(const double2DVector& resultVector, const bool isWeight, ofstream & mdtFileHandle);
-
- int deleteFeatureExtractorInstance();
-
- /**
- * This method computes the confidences for underlying classes of a test sample
- *
- * Semantics
- *
- * - Compute the confidence based on the values of m_outputLayerContentVec (output layer value of each node)
- * - Populate the resultVector
- * - Sort the resultVector
- *
- * @param none
- *
- * @return SUCCESS: resultVector populated
- * FAILURE: return ErrorCode
- * @exception none
- */
-
- int computeConfidence();
-
- /**
- * The comparison function object of STL's sort() method, overloaded for class LTKShapeRecoResult, used to sort the vector of LTKShapeRecoResult based on the member variable confidence
- *
- * Semantics
- *
- * - Compare the values of two objects
- * - Return true or false
- * -
- *
- * @param x : LTKShapeRecoResult : First object for comparison
- * @param y : LTKShapeRecoResult : Second object for comparison
- *
- * @return true: If x.confidence > y.confidence
- * false: If x.confidence <= y.confidence
- * @exception none
- */
- static bool sortResultByConfidence(const LTKShapeRecoResult& x, const LTKShapeRecoResult& y);
-
- /** This method is used to initialize the PreProcessor
- *
- * Semantics
- *
- * - Load the preprocessor DLL using LTKLoadDLL().
- *
- * - Get the proc address for creating and deleting the preprocessor instance.
- *
- * - Create preprocessor instance.
- *
- * - Start the logging for the preprocessor module.
- *
- * @param preprocDLLPath : string : Holds the Path of the Preprocessor DLL,
- * @param errorStatus : int : Holds SUCCESS or Error Values, if occurs
- * @return preprocessor instance
- *
- * @exception ELOAD_PREPROC_DLL Could not load preprocessor DLL
- * @exception EDLL_FUNC_ADDRESS_CREATE Could not map createPreprocInst
- * @exception EDLL_FUNC_ADDRESS_DELETE Could not map destroyPreprocInst
- */
- int initializePreprocessor(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocInstance);
-
-
- /** This method is used to delete the PreProcessor instance
- *
- * Semantics
- *
- * - Call deleteLTKPreprocInst from the preproc.dll.
- *
- * - Unload the preprocessor DLL.
- *
- * @param ptrPreprocInstance : Holds the pointer to the LTKPreprocessorInterface
- * @return none
- * @exception none
- */
-
- int deletePreprocessor();
-
- /** This method is used to unload the preprocessor DLL.
- *
- * Semantics
- *
- * - If m_libHandler != NULL, unload the DLL
- * LTKUnloadDLL(m_libHandler);
- * m_libHandler = NULL;
- *
- * @param none
- * @return none
- * @exception none
- */
- int unloadPreprocessorDLL();
-
- /** This method is used to check the preprocess parameter are specified correcty in cfg file
- *
- * Semantics
- *
- *
- * @param headerSequence : stringStringMap :
- * @return
- * @exception
- */
- int validatePreprocParameters(stringStringMap& headerSequence);
-
- /**
- * MLP is trained by backpropagation algorithm. Training samples (feature vector representation) from underlying
- * classes are presented in an alternative sequence. Error for each such pattern is calculated at the output layer
- * Error is propagated backward for top-to-bottom layer weight adjustments
- *
- * Semantics
- *
- * - Call feedForward method for bottom-to-top propagation of training feature
- *
- * - Calculate the error at output layer for each nuron
- *
- * - Calculate weight adjustment amount for each sample presented
- *
- * @param : outptr : double2DVector : Hold the conteint of each node after forward propagation of a sample
- * errptr : double2DVector : Hold intermediate error values used for computation of error derivatives
- * at hidden & output layer
- * ep : doubleVector : Hold output layer absolute error for individual samples
- *
- * @return SUCCESS: successfully complete
- * FAILURE: return ErrorCode
- *
- * @exception LTKErrorList::EEMPTY_VECTOR Vector which are used in this method is empty
- */
- int adjustWeightByErrorBackpropagation(double2DVector& outptr,double2DVector& errptr,doubleVector& ep);
-
- /** This method is used to arrange training samples in an alternate sequence required for effective application of backpropagation algorithm
- *
- * Semantics
- *
- * - If the number of training samples for each class is unequal, then it repeats samples of those classes
- * which have fewer samples in the training set
- *
- * - If m_trainSet is empty it returns error and stop training process.
- *
- * @param none
- * @return SUCCESS: successfully complete
- * FAILURE: return ErrorCode
- * @exception
- */
- int prepareNeuralNetTrainingSequence();
-
- /** This method is used to prepare architecture of neural network
- *
- * Semantics
- *
- * - Call constractNeuralnetLayeredStructure method
- * - For creating input, hidden, and output layer structure
- *
- * - Call initialiseNetwork method.
- *
- * - Call adjustWeightByErrorBackpropagation method.
- * - For neuralnet training
- *
- * @param none
- * @return SUCCESS: successfully complete
- * FAILURE: return ErrorCode
- * @exception none
- */
- int prepareNetworkArchitecture();
-
- /** This method is used to initialise neuralnet parameters
- *
- * Semantics
- *
- * - Check specified network architecture during reestimation of network weights
- *
- * - Generally the network weights are initialised by random numbers
- *
- * - During reestimation of network (weights, prevDelW) neuralnet parameters are initialised by previously
- * train network
- * - Call loadModelData method
- *
- *
- * @param
- * @return SUCCESS: successfully complete
- * FAILURE: return ErrorCode
- *
- * @exception LTKErrorList::EINVALID_NETWORK_LAYER Network layer are not specified correctly
- */
- int initialiseNetwork(double2DVector& outptr,double2DVector& errptr);
-
- /**
- * Feedforward input training sample
- * Bottom up calculation of response at each node of network for a specific input pattern
- *
- * Semantics
- *
- * - It checks whether necessary vectors are empty
- *
- * - Normalise the featurte vector so that each feature component should be in the range 0 to 1
- *
- * - Calculate hidden and output layer node activation values using
- * calculateSigmoid method
- *
- * - Call NeuralNetShapeRecognizer::calculateSigmoid() method for sigmoid units, the output varies
- * continuously but not linearly as the input changes <br>
- * Sigmoid units bear a greater resemblance to real neurones than do linear or threshold units <br>
- * Also, sigmoidal transfer function being derivable, it is
- * useful for calculation of the error derivatives in backpropagation algorithm
- *
- * @param : shapeFeature : vector<LTKShapeFeaturePtr> : Hold feature representation of input sample
- outptr : double2DVector : Hold the output layer content
- * currentIndex : const int : Hold index of current sample
- *
- * @return SUCCESS: successfully complete
- * FAILURE: return ErrorCode
- *
- * @exception LTKErrorList::EEMPTY_VECTOR Vector which is used in this method is empty
- * LTKErrorList::ENON_POSITIVE_NUM Normalised factor should be positive
- */
- int feedForward(const vector<LTKShapeFeaturePtr>& shapeFeature,double2DVector& outptr,const int& currentIndex);
-
- /** This method is used to take dissection for terminating training process if network converge or maximum itaretion reach
- *
- * Semantics
- *
- * - Check if individual error set for each neuron are empty
- *
- * - Check if current error is negative
- *
- * - Check if training iteration is negative
- *
- * - If criteria for convergence or maximum training iteration is reached
- * - terminate else training process continue
- *
- * @param ep : const doubleVector : Hold output layer absolute error for individual neuron
- * currentError : const double : Hold the current error
- * currentItr : const int : Itaretion number
- * outConvergeStatus : int : Status of iterative learning after each iteration
- *
- * @return SUCCESS: successfully complete
- * FAILURE: return ErrorCode
- *
- * @exception LTKErrorList::EEMPTY_VECTOR Empty individual error set
- * @exception LTKErrorList::ENEGATIVE_NUM Current error can't be nagative
- * @exception LTKErrorList::ENEGATIVE_NUM Itaretion can't be nagative
- */
- int introspective(const doubleVector& ep, const double currentError,const int& currentItr, int& outConvergeStatus);
-
- /** This method is used to construct the layered structure of network.
- *
- * Semantics
- *
- * - It initialise input layer and output layer nodes
- *
- * @param none
- * @return SUCCESS: successfully complete
- *
- * @exception LTKErrorList::EEMPTY_VECTOR If the feature set is empty
- * LTKErrorList::EINVALID_NUM_OF_INPUT_NODE If input layer nodes are not correctly specified
- * LTKErrorList::EINVALID_NUM_OF_OUTPUT_NODE If output layer nodes are not correctly specified
- */
- int constractNeuralnetLayeredStructure();
-
- /** This method is used to check if the network architecture parameters are specified correctly or not
- *
- * Semantics
- *
- * - Check network cofig parameters
- *
- * @param none
- * @return SUCCESS: successfully complete
- * FAILURE: return ErrorCode
- * @exception
- */
- int validateNeuralnetArchitectureParameters(stringStringMap& headerSequence);
-
- /** This method is used to calculate sigmoid value of input value to a node
- *
- * Semantics
- *
- * @param
- * @return
- * @exception
- */
- double calculateSigmoid(double inNet);
-
- int getShapeSampleFromString(const string& inString, LTKShapeSample& outShapeSample);
-};
-
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg
deleted file mode 100644
index e52d3147..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.cfg
+++ /dev/null
@@ -1,407 +0,0 @@
-#------------------------------------------------------------------------------
-# neuralnet.cfg
-#
-# Configuration file for Neural Net Classification Method for
-# Lipi Toolkit 4.0.0
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# The standard format for the configuration entries is the name of the
-# configuration parameter seperated by an equal to sign and then the value of
-# the configuration parameter. For example:
-# ConfigurationEntryName = value
-#
-# Lines starting with a # are commnet lines
-#
-# A cfg entry is strictly a key value pair and leaving the key without the
-# value or specification of a value out of the range is not permitted
-#
-# If a cfg entry is not specified at all, then default values are used by the
-# recognizer
-#------------------------------------------------------------------------------
-
-#-------------------------------
-# PREPROCESSING
-#-------------------------------
-
-#-------------------------------------------------------------------------------
-# ResampTraceDimension
-#
-# Description: The number of target points for resampling. In other words,
-# each character will be resampled to this number of points. In case of
-# multistroke characters, this number of points will be distributed between
-# the strokes in proportion to their lengths in proportion to their initial
-# number of points.
-#
-# Valid values: Any integer > 0
-# Units: Points
-# Default value: 60
-# Typical value: Average number of points per character in the training data set.
-#-------------------------------------------------------------------------------
-ResampTraceDimension = 60
-
-
-#-------------------------------------------------------------------------------
-# ResampPointAllocation
-#
-# Description: Method to be used for point allocation among different strokes
-# during resampling. Two schemes have been implemented lengthbased and point
-# based. In lengthbased allocation scheme, the number of points allocated to
-# each stroke is proportional to the length of the stroke. Length of a stroke
-# is calculated as the sum of the distances between each point in the stroke.
-# In the pointbased allocation scheme, the target stroke point allocation is
-# proportional to the number of points in the initial stroke. In the
-# interpointdistbased scheme, the distance between consecutive points is fixed
-# resulting in variable number based on the length of the trajectory.
-#
-# Valid value: [lengthbased | pointbased | interpointdistbased]
-# Default value: lengthbased
-#-------------------------------------------------------------------------------
-ResampPointAllocation = lengthbased
-
-#-------------------------------------------------------------------------------
-# NormDotSizeThreshold
-#
-# Description: This threshold is used to determine whether a character is a dot.
-# It is expressed in real length terms (inches) and converted internally to
-# points using knowledge of the devices spatial resolution. If the width
-# and height are both less than this threshold, then all the points are replaced
-# with the center of the of the normalized character, basically to represent it
-# as a dot
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormDotSizeThreshold = 0.00001
-
-#-------------------------------------------------------------------------------
-# NormLineWidthThreshold
-#
-# Description: This threshold is used to detect whether the character is a
-# vertical or horizontal line. If only the height is less than this threshold
-# then the character is detected as a horizontal line and if only the width is
-# less than this threshold then the character is detected as a vertical line.
-# Assuming the height is along the y-dimension and width is along the x-
-# dimension, during normalization of a horizontal line only the x-coordinates
-# are scaled and the y-coordinates are translated to the center of the character,
-# with out scaling. Similarly for the vertical line only the y-coordinates are
-# normalized and the x-coordinates are translated to the center with out scaling
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormLineWidthThreshold = 0.01
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatio
-#
-# Description: This parameter is used to indicate whether the aspect ratio
-# has to be preserved during normalization. The aspect ratio is the calculated
-# as maximum of (height/width , width/height). The aspect ratio is preserved only
-# if the calculated aspect ratio is greater than the threshold value specified
-# through NormPreserveAspectRatioThreshold and this configuration variable is
-# set to true. If this configuration variable is set to false the aspect ratio
-# is not preserved during normalization.
-#
-# Valid value: [true | false]
-# Default value: true
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatio = true
-
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatioThreshold
-#
-# Description: Aspect ratio is preserved during normalization if the computed
-# aspect ratio (max(height/width, width/height)) is greater than this threshold
-# and the configuration value NormPreserveAspectRatio is set to true. During
-# aspect ratio preserving normalization, the larger of the two dimensions is
-# normalized to the standard size and the other dimension is normalized
-# proportional to the initial height and width ratio, so that the initial
-# aspect ratio is maintained.
-#
-# Valid values: Any real number >= 1
-# Default value: 3
-# Typical value: >= 1.5
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatioThreshold = 3
-
-#-------------------------------------------------------------------------------
-# NormPreserveRelativeYPosition
-#
-# Description: The relative Y position is the mean of the y-coordinates in the
-# input character. During normalization if this parameter is set to true, each
-# y-coordinate of the character point is translated by the initial y-mean value,
-# so that the mean of the y-coordinates remains the same before and after
-# normalization. This is typically used in the word recognition context where
-# each stroke of the character has to be normalized separately and the relative
-# position of the strokes should be maintained even after normalization.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NormPreserveRelativeYPosition = false
-
-#-------------------------------------------------------------------------------
-# SmoothWindowSize
-#
-# Description: The configuration value specifies the length of the moving
-# average filter (size of the window) for smoothing the character image.
-# If this value is set to N, then each point in the input character is replaced
-# by the average of value of this point, (N-1)/2 points on the right and (N-1)/2
-# on the left of this point.
-#
-# Valid value: Any integer > 0
-# Units: Points
-# Typical value: 5
-# Default value: 3
-#-------------------------------------------------------------------------------
-SmoothWindowSize = 3
-
-#-------------------------------------------------------------------------------
-# PreprocSequence
-#
-# Description: This variable is used to specify the sequence of preprocessing
-# operations to be carried out on the input character sample before extracting
-# the features. A valid preprocessing sequence can consist of combination of one
-# or more of the functions selected from the valid values set mentioned below.
-# The CommonPreProc prefix is used specify the default preprocessing module of
-# LipiTk. The user can add his own preprocessing functions in other modules and
-# specify them in the preprocessing sequence.
-#
-# Valid values: Any sequence formed from the following set
-# CommonPreProc::normalizeSize;
-# CommonPreProc::removeDuplicatePoints;
-# CommonPreProc::smoothenTraceGroup;
-# CommonPreProc::dehookTraces;
-# CommonPreProc::normalizeOrientation;
-# CommonPreProc::resampleTraceGroup;
-# Default value: {CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-#-------------------------------------------------------------------------------
-PreprocSequence={CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-
-#---------------------------------------
-# TRAINING
-#---------------------------------------
-
-#-------------------------------------------------------------------------------
-# SeedValueForRandomNumberGenaretor
-#
-# Description: The generation of pseudo-random numbers is a common task in computer
-# simulations. Computational algorithms (pseudorandom number generators) producing
-# pseudo-random numbers (sequences of apparently random numbers), are in fact
-# completely determined by a shorter initial value, called a seed or key. Any integer
-# value can be used for this seed. Different values of seed should produce different
-# sequences of pseudo-random numbers depending upon the periodicity of the generating
-# algorithm. This quantity is used to initialise the random number generator. Random
-# numbers are used to initialize connection weights of the network. Different seed
-# values should produce different sequences of pseudo-random numbers depending upon
-# the periodicity of the generating algorithm.
-#
-# Valid value: [Any integer > 0]
-# Default value: 426
-#-------------------------------------------------------------------------------
-SeedValueForRandomNumberGenaretor = 456
-
-#-------------------------------------------------------------------------------
-# NormalizationFactor
-#
-# Description: Input feature components are divided by this quatity because present
-# implementation of BackPropagation algorithm needs input feature vector components
-# in the range 0 to 1. Usually, this quantity is greater than or equal to the possible
-# maximum value of input feature components.
-#
-# Valid value: [Any real number grater then 0.0]
-# Default value: 10.0
-#-------------------------------------------------------------------------------
-NeuralNetNormalizationFactor = 10.0
-
-#-------------------------------------------------------------------------------
-# NeuralNetLearningRate
-#
-# Description: This is the parameter of the learning algorithm that controls step size along
-# the steepest descent in the error (system error) surface. Connection weights are adjusted
-# by adding the weight increment multiplied by this quantity to the previous weight. The
-# learning rate indicates how far in the direction of steepest descent the network weights are
-# shifted at each iteration. For example, if this value is 1.0, the shift amount will be equal
-# to the value of the resultant gradient. For parctical problem in which the error surface is
-# generally nonlinear, a smaller learning rate must be used to slowly and smoothly guide the
-# descent towards the optimum weights; therefore, this value is normally between 0 and 1, and
-# indicates the proportion of the gradient length that will be traversed in the direction of the
-# steepest descent.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.005
-#-------------------------------------------------------------------------------
-NeuralNetLearningRate = 0.005
-
-#-------------------------------------------------------------------------------
-# NeuralNetMomemtumRate
-#
-# Description: A quantity involving momentum rate was introduced in the weight modification
-# rule of BackPropagation algorithm for incorporating influence of the past iterations during
-# current updation of the connection weights. The momentum introduces a "damping" effect on
-# the search procedure, thus avoiding possible oscillations on the error surface by averaging
-# gradient components with opposite sign and accelerating the convergence in long flat areas.
-# Also, in situations of falling into local minima, it possibly helps to certain limit to avoid
-# the same. Momentum may be considered as an approximation to a second-order method, as it uses
-# information from the previous iterations.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.0025
-#-------------------------------------------------------------------------------
-NeuralNetMomemtumRate = 0.0025
-
-#-------------------------------------------------------------------------------
-# NeuralNetTotalError
-#
-# Description: After presentation of the complete set of training samples to the network
-# during training, the network computes the total error corresponding to this whole set. A
-# threshold for this error is set to decide when the training should be terminated.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.00001
-#-------------------------------------------------------------------------------
-NeuralNetTotalError = 0.00001
-
-#-------------------------------------------------------------------------------
-# NeuralNetIndividualError
-#
-# Description: After each presentation of a training sample to the network during its
-# training the system calculates the error value for the particular sample. A threshold
-# for this error is set to decide when the training should be terminated.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.00001
-#-------------------------------------------------------------------------------
-NeuralNetIndividualError = 0.00001
-
-#-------------------------------------------------------------------------------
-# NeuralNetHiddenLayersSize
-#
-# Description: In a full-connected, feed-forward, perceptron neural network the values
-#only move from input to hidden to output layers. All neural networks have an input layer
-#and an output layer, but the number of hidden layers may vary. When there is more than
-#one hidden layer, the output from one hidden layer is fed into the next hidden layer
-#and separate weights are applied to the sum going into each layer. For nearly all problems,
-#one hidden layer is sufficient. Two hidden layers may be helpful in a few cases such as
-#modeling data with discontinuities, e.g., a saw tooth wave pattern. Using two hidden layers
-#rarely improves the model, and it may introduce a greater risk of converging to a local
-#minima. There is no theoretical reason for using more than two hidden layers. Three layer
-#models with one hidden layer are recommended.
-#
-# Valid value: [any integer from 1-50]
-# Default value: 1
-#-------------------------------------------------------------------------------
-NeuralNetHiddenLayersSize = 1
-
-#-------------------------------------------------------------------------------
-# NeuralNetHiddenLayersUnitSize
-#
-# Description: One of the important issues of a MLP network is the choice of number of neurons
-# in the hidden layer(s). An inadequate number of neurons causes failure to model complex data,
-# and the final result is bound to be poor. If too many neurons are used, the training time may
-# become excessively long, and, worse, the network may over fit the data. When overfitting occurs,
-# the network will begin to model random noise in the data. Use of a validation set helps to
-# detect overfitting. There are several approaches in the literature for automatic selection of the
-# optimal number of neurons in the hidden layer. A better approach is to build models using varying
-# numbers of hidden neurons and measure the quality of training using cross validation or hold-out
-# data not used for training. This is a highly effective method for finding the optimal number of
-# neurons, but it is computationally expensive, because many models must be built, and each model
-# has to be validated.
-#
-# Valid value: [any integer]
-# Default value: 175:
-#-------------------------------------------------------------------------------
-NeuralNetHiddenLayersUnitSize = 175:
-
-#-------------------------------------------------------------------------------
-# ReestimateNeuralnetConnectionWeights
-#
-# Description: Training of MLP may be done in repeated sessions. For example, during the initial
-# session one may continue training for 100 iterations (presentation of the whole set of training
-# samples to the network). Check the network performance on the validation or test set. In the next
-# session the trained network may be further trained for some more iterations
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-ReestimateNeuralnetConnectionWeights = false
-
-#-------------------------------------------------------------------------------
-# NeuralnetTraningIteration
-#
-# Description: The number of training iterations is another important factor and it is
-# required to be chosen suitably to get best possible performance from the network. If
-# too many iterations are performed, the training time may become excessively long, and,
-# worse, the network may overfit the data. When overfitting occurs, the network will begin
-# to model random noise in the data. Use of a validation set helps to detect overfitting.
-#
-# Valid value: [any integer]
-# Default value: 600
-#-------------------------------------------------------------------------------
-NeuralnetTrainingIteration = 600
-
-#-------------------------------------------------------------------------------
-# PrepareTraningSequence
-#
-# Description:
-#
-# Valid value: [true | false]
-# Default value: true
-#-------------------------------------------------------------------------------
-PrepareTrainingSequence = true
-
-#-----------------------------------------
-# FEATURE EXTRACTION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# FeatureExtractor
-#
-# Description: The configuration value is used to specify the feature extraction
-# module to be used for feature extraction. The point float feature extraction
-# module extracts the x,y,cosine and sine angle features at every point of the
-# character.
-#
-# Valid value: [PointFloatShapeFeatureExtractor|L7ShapeFeatureExtractor|
-# NPenShapeFeatureExtractor|SubStrokeShapeFeatureExtractor]
-# Default value: PointFloatShapeFeatureExtractor
-#-------------------------------------------------------------------------------
-FeatureExtractor=PointFloatShapeFeatureExtractor
-
-#-----------------------------------------
-# RECOGNITION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNRecoRejectThreshold
-#
-# Description: Threshold to reject the test sample. If the confidence obtained
-# for the recognition of test sample is less than this threshold then the test
-# sample is rejected.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.001
-#-------------------------------------------------------------------------------
-NNRecoRejectThreshold =0.001
-
-#--------------------------------------------
-# COMMON FOR TRAINING AND RECOGNITION
-#--------------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the mode for
-# opening the mdt file.
-#
-# Valid values: ascii, binary
-# Default Value: ascii
-#-------------------------------------------------------------------------------
-
-NNMDTFileOpenMode=ascii
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro
deleted file mode 100644
index 8359a4f3..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/neuralnet/neuralnet.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-LIPILIBS = shaperecommon ltkcommon ltkutil featureextractorcommon
-include(../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../util/lib \
- ../featureextractor/common \
- ../common \
-
-HEADERS += \
- NeuralNet.h \
- NeuralNetShapeRecognizer.h \
-
-SOURCES += \
- NeuralNet.cpp \
- NeuralNetShapeRecognizer.cpp \
-
-win32 {
- DEFINES += NEURALNET_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = NeuralNet.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/.prev_CMakeLists.txt
deleted file mode 100644
index b03107fe..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Generated from nn.pro.
-
-#####################################################################
-## nn Generic Library:
-#####################################################################
-
-qt_add_cmake_library(nn
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- NN.cpp NN.h
- NNAdapt.cpp NNAdapt.h
- NNShapeRecognizer.cpp NNShapeRecognizer.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- ../featureextractor/common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(nn)
-
-#### Keys ignored in scope 1:.:.:nn.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(nn CONDITION WIN32
- DEFINES
- NN_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(nn CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(nn)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/CMakeLists.txt
deleted file mode 100644
index d82983d2..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Generated from nn.pro.
-
-#####################################################################
-## nn Generic Library:
-#####################################################################
-
-qt_add_cmake_library(nn
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- NN.cpp NN.h
- NNAdapt.cpp NNAdapt.h
- NNShapeRecognizer.cpp NNShapeRecognizer.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- ../featureextractor/common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(nn)
-
-#### Keys ignored in scope 1:.:.:nn.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "featureextractorcommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(nn CONDITION WIN32
- DEFINES
- NN_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(nn CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(nn)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp
deleted file mode 100644
index 167e7fed..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-18 15:41:43 +0530 (Tue, 18 Jan 2011) $
- * $Revision: 829 $
- * $Author: mnab $
- *
- ************************************************************************/
-// NN.cpp : Defines the entry point for the DLL application.
-//
-
-#include "NN.h"
-#include "LTKShapeRecognizer.h"
-#include "NNShapeRecognizer.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKOSUtil.h"
-
-#ifdef _WIN32
-#include <windows.h>
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif
-
-
-/**********************************************************************************
-* AUTHOR : Saravanan R
-* DATE : 23-Jan-2007
-* NAME : createShapeRecoginizer
-* DESCRIPTION : Creates instance of type NNShaperecongnizer and retuns of type
- LTKShapeRecognizer. (Acts as a Factory Method).
-* ARGUMENTS :
-* RETURNS : returns an instace of type LTKShapeRecoginzer.
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-*************************************************************************************/
-int createShapeRecognizer(const LTKControlInfo& controlInfo,
- LTKShapeRecognizer** ptrObj )
-{
- try
- {
- *ptrObj = new NNShapeRecognizer(controlInfo);
- return SUCCESS;
- }
- catch(LTKException e)
- {
- LTKReturnError(e.getErrorCode());
- }
-}
-
-/**********************************************************************************
-* AUTHOR : Saravanan R
-* DATE : 23-Jan-2007
-* NAME : deleteShapeRecoginzer
-* DESCRIPTION : Destroy the instance by taking the address as its argument.
-* ARGUMENTS : Address of LTKShapeRecognizer instance.
-* RETURNS : Returns 0 on Success
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description
-* Balaji MNA 18th Jan 2010 Receiving LTKShapeRecognizer as single pointer
-* instead of double pointer in deleteShapeRecognizer
-*************************************************************************************/
-int deleteShapeRecognizer(LTKShapeRecognizer *obj)
-{
- try
- {
- if (obj != NULL )
- {
- delete obj;
- obj = NULL;
- }
- }
- catch(LTKException e)
- {
- LTKReturnError(e.getErrorCode());
- }
-
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR :Tarun Madan
-* DATE :
-* NAME :
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int getTraceGroups(LTKShapeRecognizer *obj, int shapeId,
- int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups)
-{
- int errorCode = ((NNShapeRecognizer*)obj)->getTraceGroups(shapeId,
- numberOfTraceGroups, outTraceGroups);
-
- if ( errorCode != SUCCESS )
- {
- LTKReturnError(errorCode);
- }
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def
deleted file mode 100644
index 0a4f75c9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.def
+++ /dev/null
@@ -1,4 +0,0 @@
-EXPORTS
- createShapeRecognizer @1
- deleteShapeRecognizer @2
- getTraceGroups @3 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h
deleted file mode 100644
index 0241eb21..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NN.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-18 15:41:43 +0530 (Tue, 18 Jan 2011) $
- * $Revision: 829 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definitions for NN dll exporting functions.
- *
- * CONTENTS:
- *
- * AUTHOR: Vijayakumara M.
- *
- * DATE: 28-July-2005
- * CHANGE HISTORY:
- * Author Date Description
- ************************************************************************/
-#ifndef __NN_H__
-#define __NN_H__
-
-
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the NN_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// NN_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef _WIN32
-#ifdef NN_EXPORTS
-#define NN_API __declspec(dllexport)
-#else
-#define NN_API __declspec(dllimport)
-#endif //#ifdef NN_EXPORTS
-#else
-#define NN_API
-#endif //#ifdef _WIN32
-
-class LTKTraceGroup;
-class LTKShapeRecognizer;
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-
-/** @defgroup NNShapeRecognizer NNShapeRecognizer
-*@brief The NNShapeRecognizer
-*/
-
-/**
-* @ingroup NNShapeRecognizer
-* @file NN.cpp
-*/
-
-/**
- * Crates instance of type NNShapeRecognizer and returns of type
- * LTKShpeRecognizer. (Acts as a Factory Method).
- *
- * @param none
- *
- * @return LTKShapeRecognizer - an instance of type LTKShapeRecognizer.
- */
-extern "C" NN_API int createShapeRecognizer(const LTKControlInfo& controlInfo,
- LTKShapeRecognizer** pReco );
-
-/**
- * Destroy the instance by taking the address as its argument.
- *
- * @param obj - Address of LTKShapeRecognizer instance.
- *
- * @return 0 on Success
- */
-extern "C" NN_API int deleteShapeRecognizer(LTKShapeRecognizer *obj);
-
-extern "C" NN_API int getTraceGroups(LTKShapeRecognizer *obj, int shapeID, int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups);
-
-void unloadDLLs();
-
-#endif //#ifndef __NN_H__
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp
deleted file mode 100644
index 7e57252b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.cpp
+++ /dev/null
@@ -1,370 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2007-06-01 11:16:10 +0530 (Fri, 01 Jun 2007) $
- * $Revision: 105 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-#include "NNShapeRecognizer.h"
-#include "NNAdapt.h"
-#include "LTKLoggerUtil.h"
-#include "LTKConfigFileReader.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKPreprocDefaults.h"
-
-#define ALPHA_MORPH -0.1
-
-LTKAdapt* LTKAdapt::adaptInstance = NULL;
-int LTKAdapt::m_count = 0;
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-Aug-2007
-* NAME : Constructor
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-LTKAdapt::LTKAdapt(NNShapeRecognizer* ptrNNShapeReco)
-{
- m_nnShapeRecognizer = ptrNNShapeReco;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- << "Exit LTKAdapt::LTKAdapt()"<<endl;
-
- //Assign Default Values
- m_adaptSchemeName = NAME_ADD_LVQ_ADAPT_SCHEME;
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-Aug-2007
-* NAME : Destructor
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-LTKAdapt::~LTKAdapt()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 8-Oct-2007
-* NAME : deleteInstance
-* DESCRIPTION : delete AdaptInstance
-* ARGUMENTS :
-* RETURNS : None
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-void LTKAdapt::deleteInstance()
-{
- m_count = 0;
- if(adaptInstance)
- {
- delete adaptInstance;
- adaptInstance = NULL;
- }
-}
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-Aug-2007
-* NAME : getInstance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-LTKAdapt* LTKAdapt::getInstance(NNShapeRecognizer* ptrNNShapeReco)
-{
- if(adaptInstance == NULL)
- {
- adaptInstance = new LTKAdapt(ptrNNShapeReco);
- }
-
- return adaptInstance;
-
-}
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-Aug-2007
-* NAME : Process
-* DESCRIPTION : Performs adaptation
-* ARGUMENTS :
-* RETURNS : Success : If completed successfully
-* Failure : Error Code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int LTKAdapt::adapt(int shapeId)
-{
- int iErrorCode;
- if(m_count==0)
- {
- m_count = 1;
-
- iErrorCode = readAdaptConfig();
- if(iErrorCode !=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during LTKAdapt::readAdaptConfig()"<<endl;
- LTKReturnError(FAILURE);
- }
- }
-
- if(LTKSTRCMP(m_adaptSchemeName.c_str(),NAME_ADD_LVQ_ADAPT_SCHEME)==0)
- {
- iErrorCode = adaptAddLVQ(shapeId);
- if(iErrorCode!=SUCCESS)
- {
- LTKReturnError(iErrorCode);
- }
- }
- else
- {
- //Adapt Scheme not supported
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"AdaptScheme not supported: " <<m_adaptSchemeName
- <<endl;
- LTKReturnError(EADAPTSCHEME_NOT_SUPPORTED);
- }
-
- return(SUCCESS);
-}
-
-/******************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 07-06-2007
-* NAME : AdaptADDLVQ
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS : Success
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int LTKAdapt::adaptAddLVQ(int shapeId)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- <<"Enter NNShapeRecognizer::adaptAddLVQ"
- <<endl;
- int errorCode;
- try
- {
-
- //Check if Cached variables are valid
- if(m_nnShapeRecognizer->m_neighborInfoVec.size()==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"DistanceIndexPair is empty"<<endl;
-
- LTKReturnError(ENEIGHBOR_INFO_VECTOR_EMPTY );
- }
-
- //Check if Cached variables are valid
- //Comment to allow addition/adaptation if Resultvec is empty as sample rejected
- /*if(m_nnShapeRecognizer->m_vecRecoResult.size()==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Result Vector is empty"<<endl;
-
- LTKReturnError(ERECO_RESULT_EMPTY);
- }*/
-
- if(m_nnShapeRecognizer->m_cachedShapeSampleFeatures.getFeatureVector().size()>0)
- {
- m_nnShapeRecognizer->m_cachedShapeSampleFeatures.setClassID(shapeId);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Features of input TraceGroup is empty"<<endl;
-
- LTKReturnError(ESHAPE_SAMPLE_FEATURES_EMPTY);
- }
-
-
- //If mismatch,then add, else Morph with 0.1
- double alpha = ALPHA_MORPH;
- if(m_nnShapeRecognizer->m_vecRecoResult.size()==0 ||
- m_nnShapeRecognizer->m_vecRecoResult.at(0).getShapeId()
- != shapeId ||
- m_nnShapeRecognizer->m_shapeIDNumPrototypesMap[shapeId]
- < m_minNumberSamplesPerClass)
- {
- m_nnShapeRecognizer->insertSampleToPrototypeSet(
- m_nnShapeRecognizer->m_cachedShapeSampleFeatures
- );
- //Update m_shapeIDNumPrototypesMap
- m_nnShapeRecognizer->m_shapeIDNumPrototypesMap[shapeId]=
- m_nnShapeRecognizer->m_shapeIDNumPrototypesMap[shapeId] + 1;
- }
- else
- {
- LTKShapeSample recognizedClassNearestSample;
- int nearestSampleIndex = 0;
- NNShapeRecognizer::NeighborInfo distindexPairObj;
-
- // Morph with Nearest Sample of Recognized Class
- for(int index =0;index <m_nnShapeRecognizer->m_neighborInfoVec.size();index++)
- {
- distindexPairObj = m_nnShapeRecognizer->m_neighborInfoVec.at(index);
- if(distindexPairObj.classId ==m_nnShapeRecognizer->m_vecRecoResult.at(0).getShapeId())
- {
- nearestSampleIndex = distindexPairObj.prototypeSetIndex;
- recognizedClassNearestSample = m_nnShapeRecognizer->m_prototypeSet.at(nearestSampleIndex);
- break;
- }
- }
- errorCode = m_nnShapeRecognizer->morphVector(
- m_nnShapeRecognizer->m_cachedShapeSampleFeatures,
- alpha,
- recognizedClassNearestSample);
- if(errorCode!=0)
- {
- return(errorCode);
- }
-
- //Update PrototypeSet with Morph Vector
- const vector<LTKShapeFeaturePtr>& tempFeatVec = recognizedClassNearestSample.getFeatureVector();
- m_nnShapeRecognizer->m_prototypeSet.at(nearestSampleIndex).setFeatureVector(tempFeatVec);
- }
- //Update MDT File
- m_nnShapeRecognizer->writePrototypeSetToMDTFile();
-
- }
- catch(...)
- {
-// return FALSE;
- return false;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- <<"Exit NNShapeRecognizer::adaptAddLVQ"
- <<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 11-06-2007
-* NAME : readAdaptConfig
-* DESCRIPTION :
-*
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int LTKAdapt::readAdaptConfig()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Enter Adapt::readAdaptConfig"
- <<endl;
-
- LTKConfigFileReader *adaptConfigReader = NULL;
-
- adaptConfigReader = new LTKConfigFileReader(m_nnShapeRecognizer->m_nnCfgFilePath);
-
- //Don't throw Error as ShapeRecognizer might not support ADAPT
- string tempStringVar = "";
-
- int errorCode = adaptConfigReader->getConfigValue(ADAPT_SCHEME,tempStringVar);
- if(errorCode == SUCCESS)
- m_adaptSchemeName = tempStringVar;
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "AdaptScheme not specified. Assuming default(AddLVQ) " <<endl;
- }
-
- int tempIntegerVar = 0;
-
- errorCode =
- adaptConfigReader->getConfigValue(ADAPT_MIN_NUMBER_SAMPLES_PER_CLASS,tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
- if(tempIntegerVar > 0)
- {
- m_minNumberSamplesPerClass = tempIntegerVar;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< "Error: " << ECONFIG_FILE_RANGE
- <<ADAPT_MIN_NUMBER_SAMPLES_PER_CLASS << " is out of permitted range"
- << " LTKAdapt::readAdaptConfig()"<<endl;
-
- delete adaptConfigReader;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< "Error: " << ECONFIG_FILE_RANGE
- << ADAPT_MIN_NUMBER_SAMPLES_PER_CLASS << " is out of permitted range"
- << " LTKAdapt::readAdaptConfig()"<<endl;
-
- delete adaptConfigReader;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- m_minNumberSamplesPerClass = ADAPT_DEF_MIN_NUMBER_SAMPLES_PER_CLASS;
- LOG(LTKLogger::LTK_LOGLEVEL_INFO) << "Info: " <<
- "Using default value of MinimumNumerOfSamplesPerClass: "<<
- m_minNumberSamplesPerClass <<
- " LTKAdapt::readAdaptConfig()"<<endl;
- }
-
- if(adaptConfigReader)
- delete adaptConfigReader;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exit Adapt::readAdaptConfig"
- <<endl;
-
- return SUCCESS;
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h
deleted file mode 100644
index 2b78be50..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNAdapt.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2007-06-01 11:16:10 +0530 (Fri, 01 Jun 2007) $
- * $Revision: 105 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Implements NNShapeRecognizer::Adapt
- *
- * CONTENTS:
- *
- * AUTHOR: Tarun Madan
- *
- * DATE: 30-Aug-2007
- * CHANGE HISTORY:
- * Author Date Description
- ************************************************************************/
-
-class LTKAdapt
-{
-private:
- LTKAdapt(NNShapeRecognizer* ptrNNShapeReco);
- static LTKAdapt* adaptInstance;
- static int m_count;
-
-public:
- static LTKAdapt* getInstance(NNShapeRecognizer* ptrNNShapeReco);
- int adapt(int shapeId);
- ~LTKAdapt();
- void deleteInstance();
-
-private:
- /**< @brief Pointer to NNShapeRecognizer
- * <p>
- *
- * </p>
- */
- NNShapeRecognizer* m_nnShapeRecognizer;
-
- /**< @brief Adapt Scheme name
- * <p>
- *
- * </p>
- */
- string m_adaptSchemeName;
-
- /**< @brief Minimum number of samples required per class
- * <p>
- *
- * </p>
- */
-
- int m_minNumberSamplesPerClass;
-
-
- /**
- * This method reads Config variables related to Adapt from CFG
- *
- * Semantics
- *
- *
- * @param none
- *
- * @return SUCCESS:
- * FAILURE: return ErrorCode
- * @exception none
- */
- int readAdaptConfig();
-
- /**
- * This method implements AddLVQ scheme of Adaptation
- *
- * Semantics
- * - if wrong recognition or new style,
- * then
- * ADD
- * else
- * Morph
- * - Update Prototypeset and Update MDT File
- *
- * @param shapeId : int : Holds shapeId of adaptSampleTrace
- *
- * @return SUCCESS: return 0
- * FAILURE: return ErrorCode
- * @exception none
- */
- int adaptAddLVQ(int shapeId);
-};
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp
deleted file mode 100644
index 78b09e47..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.cpp
+++ /dev/null
@@ -1,5432 +0,0 @@
-/*****************************************************************************************
- * Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
- * Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 16:57:52 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 834 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation for NN Shape Recognition module
- *
- * CONTENTS:
- *
- * AUTHOR: Saravanan R.
- *
- w
- * DATE: January 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKConfigFileReader.h"
-
-#include "NNShapeRecognizer.h"
-
-#include "LTKPreprocDefaults.h"
-
-#include "LTKHierarchicalClustering.h"
-
-#include "LTKPreprocessorInterface.h"
-
-#include "LTKShapeFeatureExtractorFactory.h"
-
-#include "LTKShapeFeatureExtractor.h"
-
-#include "LTKShapeFeature.h"
-
-#include "LTKVersionCompatibilityCheck.h"
-
-#include "LTKInkFileWriter.h"
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKClassifierDefaults.h"
-#include "NNAdapt.h"
-#include "LTKLoggerUtil.h"
-#include "LTKShapeRecoUtil.h"
-#include "LTKTraceGroup.h"
-#include "LTKErrors.h"
-#include "LTKShapeSample.h"
-#include "LTKException.h"
-#include "LTKErrorsList.h"
-#include "LTKStringUtil.h"
-#include "LTKDynamicTimeWarping.h"
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : NNShapeRecognizer
- * DESCRIPTION : Default Constructor that initializes all data members
- * ARGUMENTS : none
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-
-void NNShapeRecognizer::assignDefaultValues()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::assignDefaultValues()" << endl;
-
- m_numShapes = 0;
- m_nnCfgFilePath = "";
- m_nnMDTFilePath = "";
- m_ptrPreproc = NULL;
- m_projectTypeDynamic=false;
- m_prototypeSelection=NN_DEF_PROTOTYPESELECTION;
- m_prototypeReductionFactor=NN_DEF_PROTOTYPEREDUCTIONFACTOR;
- m_prototypeDistance=NN_DEF_PROTOTYPEDISTANCE;
- m_nearestNeighbors=NN_DEF_NEARESTNEIGHBORS;
- m_dtwBanding=NN_DEF_BANDING;
- m_dtwEuclideanFilter=NN_DEF_DTWEUCLIDEANFILTER;
- m_preProcSeqn=NN_DEF_PREPROC_SEQ;
- m_ptrFeatureExtractor=NULL;
- m_featureExtractorName=NN_DEF_FEATURE_EXTRACTOR;
- m_numClusters=NN_NUM_CLUST_INITIAL; // just to check that this is not what is mentioned by the user
- m_MDTUpdateFreq=NN_DEF_MDT_UPDATE_FREQ;
- m_prototypeSetModifyCount=0;
- m_rejectThreshold=NN_DEF_REJECT_THRESHOLD;
- m_adaptivekNN=false;
- m_deleteLTKLipiPreProcessor=NULL;
- m_MDTFileOpenMode = NN_MDT_OPEN_MODE_ASCII;
- m_LVQIterationScale=NN_DEF_LVQITERATIONSCALE;
- m_LVQInitialAlpha=NN_DEF_LVQINITIALALPHA;
- m_LVQDistanceMeasure=NN_DEF_LVQDISTANCEMEASURE;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::assignDefaultValues()" << endl;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : initialize
- * DESCRIPTION : This method initializes the NN shape recognizer
- * ARGUMENTS : string Holds the Project Name
- * string Holds the Profile Name
- * RETURNS : integer Holds error value if occurs
- * Holds SUCCESS if no erros
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-NNShapeRecognizer::NNShapeRecognizer(const LTKControlInfo& controlInfo):
-m_OSUtilPtr(LTKOSUtilFactory::getInstance()),
-m_libHandler(NULL),
-m_libHandlerFE(NULL)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::NNShapeRecognizer()" << endl;
-
- try
- {
- LTKControlInfo tmpControlInfo=controlInfo;
-
- string strProjectName = "";
- string strProfileName = "";
-
-
- if( (tmpControlInfo.projectName).empty() )
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
- if( (tmpControlInfo.lipiRoot).empty() )
- {
- throw LTKException(ELIPI_ROOT_PATH_NOT_SET);
- }
-
- if( (tmpControlInfo.profileName).empty() )
- {
- strProfileName = DEFAULT_PROFILE;
- tmpControlInfo.profileName = strProfileName;
- }
-
- if ( tmpControlInfo.toolkitVersion.empty() )
- {
- throw LTKException(ENO_TOOLKIT_VERSION);
- }
-
- assignDefaultValues();
-
- m_lipiRootPath = tmpControlInfo.lipiRoot;
- m_lipiLibPath = tmpControlInfo.lipiLib;
- m_currentVersion = tmpControlInfo.toolkitVersion;
- strProjectName = tmpControlInfo.projectName;
- strProfileName = tmpControlInfo.profileName;
-
-
- //Model Data file Header Information
- m_headerInfo[PROJNAME] = strProjectName;
-
- //Holds the value of Number of Shapes in string format
- string strNumShapes = "";
-
- string strProfileDirectory = m_lipiRootPath + PROJECTS_PATH_STRING +
- strProjectName + PROFILE_PATH_STRING;
-
- //Holds the path of the Project.cfg
- string projectCFGPath = strProfileDirectory + PROJECT_CFG_STRING;
-
- // Config file
-
- m_nnCfgFilePath = m_lipiRootPath + PROJECTS_PATH_STRING +
- (tmpControlInfo.projectName) + PROFILE_PATH_STRING +
- (tmpControlInfo.profileName) + SEPARATOR +
- NN + CONFIGFILEEXT;
-
-
- //Set the path for nn.mdt
- m_nnMDTFilePath = strProfileDirectory + strProfileName + SEPARATOR + NN + DATFILEEXT;
-
-
- //To find whether the project was dynamic or not andto read read number of shapes from project.cfg
- int errorCode = m_shapeRecUtil.isProjectDynamic(projectCFGPath,
- m_numShapes, strNumShapes, m_projectTypeDynamic);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NNShapeRecognizer::NNShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
-
- //Set the NumShapes to the m_headerInfo
- m_headerInfo[NUMSHAPES] = strNumShapes;
-
- //Currently preproc cfg also present in NN
- tmpControlInfo.cfgFileName = NN;
- errorCode = initializePreprocessor(tmpControlInfo,
- &m_ptrPreproc);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NNShapeRecognizer::NNShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- //Reading NN configuration file
- errorCode = readClassifierConfig();
-
- if( errorCode != SUCCESS)
- {
- cout<<endl<<"Encountered error in readClassifierConfig"<<endl;
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NNShapeRecognizer::NNShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- //Writing Feature extractor name and version into the header
- m_headerInfo[FE_NAME] = m_featureExtractorName;
- m_headerInfo[FE_VER] = SUPPORTED_MIN_VERSION; //FE version
-
- //Writting mdt file open mode to the mdt header
- m_headerInfo[MDT_FOPEN_MODE] = m_MDTFileOpenMode;
-
- errorCode = initializeFeatureExtractorInstance(tmpControlInfo);
-
- if( errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- "NNShapeRecognizer::NNShapeRecognizer()" <<endl;
- throw LTKException(errorCode);
- }
-
- }
- catch(LTKException e)
- {
-
- deletePreprocessor();
- m_prototypeSet.clear();
-
- m_cachedShapeSampleFeatures.clearShapeSampleFeatures();
-
- //Unloading the feature Extractor instance
- deleteFeatureExtractorInstance();
-
- delete m_OSUtilPtr;
- throw e;
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::NNShapeRecognizer()" << endl;
-
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : readClassifierConfig
- * DESCRIPTION : Reads the NN.cfg and initializes the data members of the class
- * ARGUMENTS : none
- * RETURNS : SUCCESS - If config file read successfully
- * errorCode - If failure
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::readClassifierConfig()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::readClassifierConfig()" << endl;
- string tempStringVar = "";
- int tempIntegerVar = 0;
- float tempFloatVar = 0.0;
- LTKConfigFileReader *shapeRecognizerProperties = NULL;
- int errorCode = FAILURE;
-
- try
- {
- shapeRecognizerProperties = new LTKConfigFileReader(m_nnCfgFilePath);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<< "Info: " <<
- "Config file not found, using default values of the parameters" <<
- "NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- return FAILURE;
- }
-
- //Pre-processing sequence
- errorCode = shapeRecognizerProperties->getConfigValue(PREPROCSEQUENCE, m_preProcSeqn);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO) << "Info: " <<
- "Using default value of prerocessing sequence: "<< m_preProcSeqn <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- m_preProcSeqn = NN_DEF_PREPROC_SEQ;
- }
-
- m_headerInfo[PREPROC_SEQ] = m_preProcSeqn;
-
-
- if((errorCode = mapPreprocFunctions()) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<" Error: " << errorCode <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(errorCode);
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PROTOTYPESELECTION,
- tempStringVar);
-
- if (errorCode == SUCCESS)
- {
- if( (LTKSTRCMP(tempStringVar.c_str(), PROTOTYPE_SELECTION_CLUSTERING) == 0) || (LTKSTRCMP(tempStringVar.c_str(), PROTOTYPE_SELECTION_LVQ) == 0))
- {
- m_prototypeSelection = tempStringVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- PROTOTYPESELECTION << " = " << tempStringVar <<
- "NNShapeRecognizer::readClassifierConfig()"<<endl;
- }
-
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE << " " <<
- PROTOTYPESELECTION << " : " << tempStringVar
- << " method is not supported" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << PROTOTYPESELECTION << " : " <<
- m_prototypeSelection <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
- }
-
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PROTOREDFACTOR,
- tempStringVar);
-
- string tempStringVar1 = "";
- int errorCode1 = shapeRecognizerProperties->getConfigValue(NUMCLUSTERS,
- tempStringVar1);
-
- if(errorCode1 == SUCCESS && errorCode == SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE
- << " Cannot use both config parameters " <<
- PROTOREDFACTOR << " and " << NUMCLUSTERS << " at the same time "<<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- if(tempStringVar != "")
- {
- if(LTKSTRCMP(tempStringVar.c_str(), PROTO_RED_FACTOR_AUTOMATIC)==0)
- {
- //DEFINE MACRO DEF_PROTO_RED_FACTOR
- m_prototypeReductionFactor = -1;
- }
- else if(LTKSTRCMP(tempStringVar.c_str(), PROTO_RED_FACTOR_NONE)==0)
- {
- m_prototypeReductionFactor = 0;
- }
- else if(LTKSTRCMP(tempStringVar.c_str(), PROTO_RED_FACTOR_COMPLETE) == 0)
- {
- m_prototypeReductionFactor = 100;
- }
- else
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
- if(tempIntegerVar >= 0 && tempIntegerVar <=100)
- {
- m_prototypeReductionFactor = tempIntegerVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- << PROTOREDFACTOR << " is =" << tempStringVar<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- PROTOREDFACTOR << " is out of permitted range " <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- PROTOREDFACTOR << " is out of permitted range"<<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- }
- }
- else if(tempStringVar1 != "")
- {
- if(LTKSTRCMP(tempStringVar1.c_str(), PROTO_RED_FACTOR_AUTOMATIC) == 0)
- {
- m_prototypeReductionFactor = -1;
- }
- else
- {
- if ( LTKStringUtil::isInteger(tempStringVar1) )
- {
- tempIntegerVar = atoi((tempStringVar1).c_str());
- if(tempIntegerVar > 0)
- {
- m_numClusters = tempIntegerVar;
-
- // m_numClusters is used in this case
- m_prototypeReductionFactor = NN_NUM_CLUST_INITIAL;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NUMCLUSTERS << " is = " << tempStringVar << endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE <<
- NUMCLUSTERS << " is out of permitted range "<<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- " Error: " << ECONFIG_FILE_RANGE <<
- NUMCLUSTERS << " is out of permitted range"<<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Assuming default value of " NUMCLUSTERS << " : " <<
- m_numClusters << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PROTOTYPEDISTANCE,
- tempStringVar);
-
- if(errorCode == SUCCESS )
- {
- if((LTKSTRCMP(tempStringVar.c_str(), EUCLIDEAN_DISTANCE) == 0) ||
- (LTKSTRCMP(tempStringVar.c_str(), DTW_DISTANCE) == 0))
- {
- m_prototypeDistance = tempStringVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Prototype Distance Method = " <<tempStringVar<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << " " <<
- PROTOTYPEDISTANCE << " : " << tempStringVar <<
- " is not supported" <<
- "NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " PROTOTYPEDISTANCE " : " <<
- m_prototypeDistance << endl;
- }
-
- tempStringVar = "";
- shapeRecognizerProperties->getConfigValue(ADAPTIVE_kNN, tempStringVar);
- if(LTKSTRCMP(tempStringVar.c_str(), "true") ==0)
- {
- m_adaptivekNN = true;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Confidence computation method: " << ADAPTIVE_kNN << endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << ADAPTIVE_kNN << " : " <<
- m_adaptivekNN << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(NEARESTNEIGHBORS,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
-
- //Valid values of nearest neighbors: 1 or greater than MIN_NEARESTNEIGHBORS
- if(tempIntegerVar > 0)
- {
- // If the value of NearestNeighbors = 1, NN recognizer is used
- if(tempIntegerVar == 1)
- {
- m_adaptivekNN = false;
- }
-
- // If AdaptivekNN is set to false, simply assign the value to m_nearestNeighbors
- // If AdaptivekNN is set, NearestNeighbors should be greater than than the
- // minimum no.of nearest neighbors allowed (MIN_NEARESTNEIGHBORS defined as macro)
- if(!m_adaptivekNN || (m_adaptivekNN && tempIntegerVar >= MIN_NEARESTNEIGHBORS))
- {
- m_nearestNeighbors = tempIntegerVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- NEARESTNEIGHBORS << " = " <<m_nearestNeighbors<<endl;
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEARESTNEIGHBORS <<
- " is out of permitted range" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << NEARESTNEIGHBORS <<
- " is out of permitted range" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Debug: " << "Using default value for " << NEARESTNEIGHBORS <<
- " : " << m_nearestNeighbors << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(REJECT_THRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 && tempFloatVar < 1)
- {
- m_rejectThreshold = tempFloatVar;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- REJECT_THRESHOLD << " = " <<tempStringVar <<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << REJECT_THRESHOLD <<
- " should be in the range (0-1)" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << REJECT_THRESHOLD <<
- " should be in the range (0-1)" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << REJECT_THRESHOLD <<
- " : " << m_rejectThreshold << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(DTWBANDING,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- tempFloatVar = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if(tempFloatVar > 0 && tempFloatVar <= 1)
- {
- m_dtwBanding = tempFloatVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- DTWBANDING << " = " <<m_dtwBanding<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE << DTWBANDING <<
- " is out of permitted range" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: "<< ECONFIG_FILE_RANGE <<
- " DTWBANDING is out of permitted range" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << DTWBANDING << " : " <<
- m_dtwBanding << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(DTWEUCLIDEANFILTER,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- if(LTKSTRCMP(tempStringVar.c_str(), DTW_EU_FILTER_ALL) == 0)
- {
- m_dtwEuclideanFilter = EUCLIDEAN_FILTER_OFF;
- }
- else
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- tempIntegerVar = atoi((tempStringVar).c_str());
-
- if(tempIntegerVar > 0 && tempIntegerVar <= 100)
- {
- m_dtwEuclideanFilter = tempIntegerVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- DTWEUCLIDEANFILTER << " is = "<<
- m_dtwEuclideanFilter<<endl;
-
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE <<
- DTWEUCLIDEANFILTER << " is out of permitted range " <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << DTWEUCLIDEANFILTER <<
- " is out of permitted range"<<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << DTWEUCLIDEANFILTER <<
- " : " << m_dtwEuclideanFilter << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(FEATUREEXTRACTOR,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_featureExtractorName = tempStringVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- FEATUREEXTRACTOR << " = "<<tempStringVar<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << FEATUREEXTRACTOR << " : " <<
- m_featureExtractorName << endl;
- }
- //LVQ Paramaters
- //LVQ Iteration Scale
- errorCode = shapeRecognizerProperties->getConfigValue(LVQITERATIONSCALE,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_LVQIterationScale=atoi((tempStringVar).c_str());
-
- if(!((m_LVQIterationScale>0)&& LTKStringUtil::isInteger(tempStringVar)))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE <<
- LVQITERATIONSCALE << " should be a positive integer " <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- m_LVQIterationScale = NN_DEF_LVQITERATIONSCALE;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Using default value for LVQIterationScale: " << m_LVQIterationScale <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- }
- //LVQ Initial Alpha
- tempStringVar="";
- errorCode = shapeRecognizerProperties->getConfigValue(LVQINITIALALPHA,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_LVQInitialAlpha = LTKStringUtil::convertStringToFloat(tempStringVar);
-
- if((m_LVQInitialAlpha>1)||(m_LVQInitialAlpha<0))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE <<
- LVQINITIALALPHA << " is out of permitted range " <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- }
- else
- {
- m_LVQInitialAlpha = NN_DEF_LVQINITIALALPHA ;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Using default value for LVQInitialAlpha: " << m_LVQInitialAlpha <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
- }
- //LVQ Distance Measure
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(LVQDISTANCEMEASURE,
- tempStringVar);
-
- if(errorCode == SUCCESS )
- {
- if((LTKSTRCMP(tempStringVar.c_str(), EUCLIDEAN_DISTANCE) == 0) ||
- (LTKSTRCMP(tempStringVar.c_str(), DTW_DISTANCE) == 0))
- {
- m_LVQDistanceMeasure = tempStringVar;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "LVQ Prototype Distance Method = " <<tempStringVar<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << " " <<
- LVQDISTANCEMEASURE << " : " << tempStringVar <<
- " is not supported" <<
- "NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " LVQDISTANCEMEASURE " : " <<
- m_prototypeDistance << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(MDT_UPDATE_FREQUENCY,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- m_MDTUpdateFreq = atoi(tempStringVar.c_str());
- if(m_MDTUpdateFreq<=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << MDT_UPDATE_FREQUENCY <<
- " should be zero or a positive integer" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << MDT_UPDATE_FREQUENCY <<
- " should be zero or a positive integer" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << MDT_UPDATE_FREQUENCY <<
- " : " << m_MDTUpdateFreq << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(MDT_FILE_OPEN_MODE,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- if ( tempStringVar == NN_MDT_OPEN_MODE_ASCII ||
- tempStringVar == NN_MDT_OPEN_MODE_BINARY )
- {
- m_MDTFileOpenMode = tempStringVar;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE << MDT_FILE_OPEN_MODE <<
- " should be ascii or binary" <<
- " NNShapeRecognizer::readClassifierConfig()"<<endl;
-
- delete shapeRecognizerProperties;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Using default value for " << MDT_FILE_OPEN_MODE <<
- " : " << m_MDTFileOpenMode << endl;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SIZETHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[DOT_SIZE_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(ASPECTRATIOTHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[ASP_RATIO_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(DOTTHRESHOLD,
- tempStringVar);
- if(errorCode == SUCCESS)
- {
- m_headerInfo[DOT_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PRESERVERELATIVEYPOSITION,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[PRESER_REL_Y_POS] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(PRESERVEASPECTRATIO,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[PRESER_ASP_RATIO] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SIZETHRESHOLD,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[NORM_LN_WID_THRES] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(RESAMPLINGMETHOD,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[RESAMP_POINT_ALLOC] = tempStringVar;
- }
-
- tempStringVar = "";
- errorCode = shapeRecognizerProperties->getConfigValue(SMOOTHFILTERLENGTH,
- tempStringVar);
-
- if(errorCode == SUCCESS)
- {
- m_headerInfo[SMOOTH_WIND_SIZE] = tempStringVar;
- }
-
- tempStringVar = "";
- LTKStringUtil::convertIntegerToString(m_ptrPreproc->getTraceDimension(),
- tempStringVar);
-
- m_headerInfo[TRACE_DIM] = tempStringVar;
-
- delete shapeRecognizerProperties;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::readClassifierConfig()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R
- * DATE : 23-Jan-2007
- * NAME : mapPreprocFunctions
- * DESCRIPTION : Maps the module name and its function names in the preprocessing
- sequence.
- * ARGUMENTS : none
- * RETURNS : SUCCESS on successful,
- * errorNumbers on Failure.
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::mapPreprocFunctions()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::mapPreprocFunctions()" << endl;
-
- stringStringMap preProcSequence;
-
- stringStringPair tmpPair;
-
- stringVector moduleFuncNames;
- stringVector modFuncs;
- stringVector funcNameTokens;
-
- string module = "", funName = "", sequence = "";
- string::size_type indx;
-
- LTKTraceGroup local_inTraceGroup;
-
- LTKStringUtil::tokenizeString(m_preProcSeqn, DELEMITER_SEQUENCE, funcNameTokens);
-
- int numFunctions = funcNameTokens.size();
-
- if(numFunctions == 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- "Wrong preprocessor sequence in cfg file : " + m_preProcSeqn <<
- " NNShapeRecognizer::mapPreprocFunctions()"<<endl;
-
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
-
- for (indx = 0; indx < numFunctions ; indx++)
- {
- moduleFuncNames.push_back(funcNameTokens[indx]);
- }
-
- int numModuleFunctions = moduleFuncNames.size();
-
- for(indx=0; indx < numModuleFunctions ; indx++)
- {
- sequence = moduleFuncNames[indx];
-
- LTKStringUtil::tokenizeString(sequence, DELEMITER_FUNC, modFuncs);
-
- if(modFuncs.size() >= 2)
- {
- module = modFuncs.at(0);
-
- funName = modFuncs.at(1);
-
- if(!module.compare("CommonPreProc"))
- {
- FN_PTR_PREPROCESSOR pPreprocFunc = NULL;
- pPreprocFunc = m_ptrPreproc->getPreprocptr(funName);
- if(pPreprocFunc!= NULL)
- {
- tmpPair.first = module;
- tmpPair.second = funName;
- m_preprocSequence.push_back(tmpPair);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : " <<funName<<
- " NNShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : " << module<<
- " NNShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_PREPROC_SEQUENCE << " " <<
- "Wrong preprocessor sequence entry in cfg file : "<<module<<
- " NNShapeRecognizer::mapPreprocFunctions()"<<endl;
- LTKReturnError(EINVALID_PREPROC_SEQUENCE);
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::mapPreprocFunctions()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2004
- * NAME : ~NNShapeRecognizer
- * DESCRIPTION : destructor
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-NNShapeRecognizer::~NNShapeRecognizer()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::~NNShapeRecognizer()" << endl;
-
- deleteAdaptInstance();
-
- int returnStatus = SUCCESS;
- //To update MDT File
- if(m_prototypeSetModifyCount >0)
- {
- m_prototypeSetModifyCount = m_MDTUpdateFreq-1;
-
- returnStatus = writePrototypeSetToMDTFile();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::~NNShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
-
- }
- }
-
- m_neighborInfoVec.clear();
-
- returnStatus = deletePreprocessor();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::~NNShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
- }
-
- m_prototypeSet.clear();
-
- m_cachedShapeSampleFeatures.clearShapeSampleFeatures();
-
- //Unloading the feature Extractor instance
- returnStatus = deleteFeatureExtractorInstance();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::~NNShapeRecognizer()" << endl;
- throw LTKException(returnStatus);
- }
-
- delete m_OSUtilPtr;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::~NNShapeRecognizer()" << endl;
-
-
-}
-
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 25-Jan-2004
- * NAME : train
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::train(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string &comment,const string &dataset,
- const string &trainFileType)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::train()" << endl;
-
- int returnStatus = SUCCESS;
-
-
- if(comment.empty() != true)
- {
- m_headerInfo[COMMENT] = comment;
- }
-
- if(dataset.empty() != true)
- {
- m_headerInfo[DATASET] = dataset;
- }
-
- //Check the prototype Selection method and call accordingly
-
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_LVQ) == 0)
- {
- returnStatus = trainLVQ(trainingInputFilePath, mdtHeaderFilePath, trainFileType);
-
- if(returnStatus != SUCCESS)
- {
- LTKReturnError(returnStatus);
- }
-
- }
-
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_CLUSTERING) == 0)
- {
- returnStatus = trainClustering(trainingInputFilePath,
- mdtHeaderFilePath,
- trainFileType);
-
- if(returnStatus != SUCCESS)
- {
- LTKReturnError(returnStatus);
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::train()" << endl;
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : trainClustering
- * DESCRIPTION : This function is the train method using Clustering prototype
- * selection technique.
- * ARGUMENTS :
- * RETURNS : SUCCESS : if training done successfully
- * errorCode : if traininhas some errors
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::trainClustering(const string& trainingInputFilePath,
- const string &mdtHeaderFilePath,
- const string& inFileType)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::trainClustering()" << endl;
-
- //Time at the beginning of Train Clustering
- m_OSUtilPtr->recordStartTime();
-
- int returnStatus = SUCCESS;
-
- if(LTKSTRCMP(inFileType.c_str(), INK_FILE) == 0)
- {
- //If the Input file is UNIPEN Ink file
- returnStatus = trainFromListFile(trainingInputFilePath);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NNShapeRecognizer::trainClustering()" << endl;
- LTKReturnError(returnStatus);
- }
- }
- else if(LTKSTRCMP(inFileType.c_str(), FEATURE_FILE) == 0)
- {
- //If the Input file is Feature file
- returnStatus = trainFromFeatureFile(trainingInputFilePath);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NNShapeRecognizer::trainClustering()" << endl;
- LTKReturnError(returnStatus);
- }
-
- PreprocParametersForFeatureFile(m_headerInfo);
- }
-
- //Updating the Header Information
- updateHeaderWithAlgoInfo();
-
- //Adding header information and checksum generation
- LTKCheckSumGenerate cheSumGen;
-
- returnStatus = cheSumGen.addHeaderInfo(mdtHeaderFilePath,
- m_nnMDTFilePath,
- m_headerInfo);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NNShapeRecognizer::trainClustering()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- //Time at the end of Train Clustering
- m_OSUtilPtr->recordEndTime();
-
- string timeTaken = "";
- m_OSUtilPtr->diffTime(timeTaken);
-
- cout << "Time Taken = " << timeTaken << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::trainClustering()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : appendPrototypesToMDTFile
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::appendPrototypesToMDTFile(const vector<LTKShapeSample>& prototypeVec,
- ofstream & mdtFileHandle)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::appendPrototypesToMDTFile()" << endl;
-
- //iterators to iterate through the result vector
- vector<LTKShapeSample>::const_iterator sampleFeatureIter = prototypeVec.begin();
- vector<LTKShapeSample>::const_iterator sampleFeatureIterEnd = prototypeVec.end();
-
- string strFeature = "";
-
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_FILE_HANDLE << " " <<
- "Invalid file handle for MDT file"<<
- " NNShapeRecognizer::appendPrototypesToMDTFile()" << endl;
- LTKReturnError(EINVALID_FILE_HANDLE);
- }
-
-
- for(; sampleFeatureIter != sampleFeatureIterEnd; sampleFeatureIter++)
- {
- //Write the class Id
- int classId = (*sampleFeatureIter).getClassID();
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle << classId << " ";
- }
- else
- {
- mdtFileHandle.write((char*) &classId,sizeof(int));
- }
-
- const vector<LTKShapeFeaturePtr>& shapeFeatureVector = (*sampleFeatureIter).getFeatureVector();
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_BINARY )
- {
- int numberOfFeatures = shapeFeatureVector.size();
- int featureDimension = shapeFeatureVector[0]->getFeatureDimension();
-
- mdtFileHandle.write((char *)(&numberOfFeatures), sizeof(int));
- mdtFileHandle.write((char *)(&featureDimension), sizeof(int));
-
- floatVector floatFeatureVector;
- m_shapeRecUtil.shapeFeatureVectorToFloatVector(shapeFeatureVector,
- floatFeatureVector);
-
- int vectorSize = floatFeatureVector.size();
-
- for (int i=0; i< vectorSize; i++)
- {
- float floatValue = floatFeatureVector[i];
- mdtFileHandle.write((char *)(&floatValue), sizeof(float));
- }
- }
- else
- {
-
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIter = shapeFeatureVector.begin();
- vector<LTKShapeFeaturePtr>::const_iterator shapeFeatureIterEnd = shapeFeatureVector.end();
-
- for(; shapeFeatureIter != shapeFeatureIterEnd; ++shapeFeatureIter)
- {
- (*shapeFeatureIter)->toString(strFeature);
- mdtFileHandle << strFeature << FEATURE_EXTRACTOR_DELIMITER;
- }
-
- mdtFileHandle << "\n";
- }
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::appendPrototypesToMDTFile()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : preprocess
- * DESCRIPTION : calls the required pre-processing functions from the LTKPreprocessor library
- * ARGUMENTS : inTraceGroup - reference to the input trace group
- * outPreprocessedTraceGroup - pre-processed inTraceGroup
- * RETURNS : SUCCESS on successful pre-processing operation
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::preprocess (const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outPreprocessedTraceGroup)
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::preprocess()" << endl;
-
- int indx = 0;
-
- string module = "";
- string funName = "" ;
-
- LTKTraceGroup local_inTraceGroup;
-
- local_inTraceGroup = inTraceGroup;
-
- if(m_preprocSequence.size() != 0)
- {
- while(indx < m_preprocSequence.size())
- {
- module = m_preprocSequence.at(indx).first;
- funName = m_preprocSequence.at(indx).second;
-
- FN_PTR_PREPROCESSOR pPreprocFunc = NULL;
- pPreprocFunc = m_ptrPreproc->getPreprocptr(funName);
-
- if(pPreprocFunc!= NULL)
- {
- outPreprocessedTraceGroup.emptyAllTraces();
-
-
- if((errorCode = (m_ptrPreproc->*(pPreprocFunc))
- (local_inTraceGroup,outPreprocessedTraceGroup)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::preprocess()" << endl;
- LTKReturnError(errorCode);
- }
-
- local_inTraceGroup = outPreprocessedTraceGroup;
- }
- indx++;
- }
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting NNShapeRecognizer::preprocess()"<<endl;
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : calculateMedian
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-
-int NNShapeRecognizer::calculateMedian(const int2DVector& clusteringResult,
- const float2DVector& distanceMatrix, vector<int>& outMedianIndexVec)
-
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::calculateMedian()" << endl;
-
-
-
-
- int clusteringResultSize = clusteringResult.size();
-
- for (int clusterID = 0; clusterID < clusteringResultSize ; clusterID++)
- {
- double minDist = FLT_MAX;
- int medianIndex = -1;
- for (int clusMem = 0; clusMem < clusteringResult[clusterID].size(); clusMem++)// for each element of the cluster
- {
- double dist = 0;
- for(int otherClusMem = 0; otherClusMem < clusteringResult[clusterID].size(); otherClusMem++)
- {
- if(clusteringResult[clusterID][clusMem] != clusteringResult[clusterID][otherClusMem])
- {
- if(clusteringResult[clusterID][otherClusMem] > clusteringResult[clusterID][clusMem])
- {
- int tempi = clusteringResult[clusterID][clusMem];
- int tempj = clusteringResult[clusterID][otherClusMem];
- dist += distanceMatrix[tempi][tempj-tempi-1];
- }
- else
- {
- int tempi = clusteringResult[clusterID][otherClusMem];
- int tempj = clusteringResult[clusterID][clusMem];
- dist += distanceMatrix[tempi][tempj-tempi-1];
- }
- }
- }
- if(dist < minDist)
- {
- minDist = dist;
- medianIndex = clusteringResult[clusterID][clusMem];
-
- }
-
- }
- outMedianIndexVec.push_back(medianIndex);
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::calculateMedian()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Ramnath. K
- * DATE : 19-05-2005
- * NAME : computerDTWDistanceClusteringWrapper
- * DESCRIPTION : Wrapper function to the function whichcomputes DTW distance between
- two characters
- * ARGUMENTS : train character, test character
- * RETURNS : DTWDistance
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::computeDTWDistance(
- const LTKShapeSample& inFirstShapeSampleFeatures,
- const LTKShapeSample& inSecondShapeSampleFeatures,
- float& outDTWDistance)
-
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::computeDTWDistance()" << endl;
-
- const vector<LTKShapeFeaturePtr>& firstFeatureVec = inFirstShapeSampleFeatures.getFeatureVector();
- const vector<LTKShapeFeaturePtr>& secondFeatureVec = inSecondShapeSampleFeatures.getFeatureVector();
-
- int errorCode = m_dtwObj.computeDTW(firstFeatureVec, secondFeatureVec, getDistance,outDTWDistance,
- m_dtwBanding, FLT_MAX, FLT_MAX);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "DTWDistance: " <<
- outDTWDistance << endl;
-
- if (errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Error: "<<
- getErrorMessage(errorCode) <<
- " NNShapeRecognizer::computeDTWDistance()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::computeDTWDistance()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
- * AUTHOR : Sridhar Krishna
- * DATE : 24-04-2006
- * NAME : computeEuclideanDistance
- * DESCRIPTION : computes euclidean distance between two characters
- * ARGUMENTS : LTKShapeFeaturePtrtor - 2
- * RETURNS : euclidean distance
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::computeEuclideanDistance(
- const LTKShapeSample& inFirstShapeSampleFeatures,
- const LTKShapeSample& inSecondShapeSampleFeatures,
- float& outEuclideanDistance)
-{
- const vector<LTKShapeFeaturePtr>& firstFeatureVec = inFirstShapeSampleFeatures.getFeatureVector();
- const vector<LTKShapeFeaturePtr>& secondFeatureVec = inSecondShapeSampleFeatures.getFeatureVector();
-
- int firstFeatureVectorSize = firstFeatureVec.size();
- int secondFeatureVectorSize = secondFeatureVec.size();
-
- if(firstFeatureVectorSize != secondFeatureVectorSize)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EUNEQUAL_LENGTH_VECTORS << " " <<
- getErrorMessage(EUNEQUAL_LENGTH_VECTORS) <<
- " NNShapeRecognizer::computeEuclideanDistance()" << endl;
-
- LTKReturnError(EUNEQUAL_LENGTH_VECTORS);
- }
-
- for(int i = 0; i < firstFeatureVectorSize; ++i)
- {
- float tempDistance = 0.0f;
- getDistance(firstFeatureVec[i],
- secondFeatureVec[i],
- tempDistance);
- outEuclideanDistance += tempDistance;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::computeEuclideanDistance()" << endl;
- return SUCCESS;
-}
-
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 23-01-2007
- * NAME : loadModelData
- * DESCRIPTION : loads the reference model file into memory
- * ARGUMENTS :
- * RETURNS : SUCCESS on successful loading of the reference model file
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::loadModelData()
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::loadModelData()" << endl;
-
- int numofShapes = 0;
-
- // variable for shape Id
- int classId = -1;
-
- //Algorithm version
- string algoVersionReadFromMDT = "";
-
-// int iMajor, iMinor, iBugfix = 0;
-
- stringStringMap headerSequence;
- LTKCheckSumGenerate cheSumGen;
-
- if(errorCode = cheSumGen.readMDTHeader(m_nnMDTFilePath,headerSequence))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(errorCode);
- }
-
- // printing the headerseqn
- stringStringMap::const_iterator iter = headerSequence.begin();
- stringStringMap::const_iterator endIter = headerSequence.end();
-
- for(; iter != endIter; iter++)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Debug: header seqn"<<
- iter->first << " : " <<
- iter->second << endl;
- }
-
- string featureExtractor = headerSequence[FE_NAME];
-
- if(LTKSTRCMP(m_featureExtractorName.c_str(), featureExtractor.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of FeatureExtractor parameter in config file ("<<
- m_featureExtractorName<<") does not match with the value in MDT file ("<<
- featureExtractor<<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- string feVersion = headerSequence[FE_VER];
-
- // comparing the mdt open mode read from cfg file with value in the mdt header
- string mdtOpenMode = headerSequence[MDT_FOPEN_MODE];
-
- if (LTKSTRCMP(m_MDTFileOpenMode.c_str(), mdtOpenMode.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of NNMDTFileOpenMode parameter in config file ("<<
- m_MDTFileOpenMode <<") does not match with the value in MDT file ("<<
- mdtOpenMode<<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
- // validating preproc parameters
- int iErrorCode = validatePreprocParameters(headerSequence);
- if (iErrorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Values of NNMDTFileOpenMode parameter in config file does not match with "
- <<"the values in MDT file " << "NNShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- // Version comparison START
- algoVersionReadFromMDT = headerSequence[RECVERSION].c_str();
-
- LTKVersionCompatibilityCheck verTempObj;
- string supportedMinVersion(SUPPORTED_MIN_VERSION);
- string currentVersionStr(m_currentVersion);
-
- bool compatibilityResults = verTempObj.checkCompatibility(supportedMinVersion,
- currentVersionStr,
- algoVersionReadFromMDT);
-
- if(compatibilityResults == false)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINCOMPATIBLE_VERSION << " " <<
- " Incompatible version"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(EINCOMPATIBLE_VERSION);
- }
- // Version comparison END
-
- //Input Stream for Model Data file
- ifstream mdtFileHandle;
-
- if (m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::in);
- }
- else
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::in | ios::binary);
- }
-
- //If error while opening, return an error
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- " Unable to open model data file : " <<m_nnMDTFilePath<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- mdtFileHandle.seekg(atoi(headerSequence[HEADERLEN].c_str()),ios::beg);
-
- //Read the number of shapes
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle >> numofShapes;
- }
- else
- {
- mdtFileHandle.read((char*) &numofShapes,
- atoi(headerSequence[SIZEOFSHORTINT].c_str()));
- }
-
- if(!m_projectTypeDynamic && m_numShapes != numofShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_MDT_MISMATCH << " " <<
- " Value of NumShapes parameter in config file ("<<m_numShapes<<
- ") does not match with the value in MDT file ("<<numofShapes<<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- if(m_projectTypeDynamic)
- {
- m_numShapes = numofShapes;
- }
-
- // validating the header values
-
- stringVector tokens;
- stringVector classToken;
-
- string strFeatureVector = "";
-
- LTKShapeSample shapeSampleFeatures;
-
- int floatSize = atoi(headerSequence[SIZEOFFLOAT].c_str());
-
- int intSize = atoi(headerSequence[SIZEOFINT].c_str());
-
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- while(getline(mdtFileHandle, strFeatureVector, NEW_LINE_DELIMITER ))
- {
- LTKStringUtil::tokenizeString(strFeatureVector,
- CLASSID_FEATURES_DELIMITER, classToken);
-
- if(classToken.size() != 2)
- continue;
-
- classId = atoi((classToken[0]).c_str());
-
- if(classId == -1)
- continue;
-
- LTKStringUtil::tokenizeString(classToken[1], FEATURE_EXTRACTOR_DELIMITER, tokens);
-
- vector<LTKShapeFeaturePtr> shapeFeatureVector;
- LTKShapeFeaturePtr shapeFeature;
-
- for(int i = 0; i < tokens.size(); ++i)
- {
- shapeFeature = m_ptrFeatureExtractor->getShapeFeatureInstance();
-
- if (shapeFeature->initialize(tokens[i]) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_INPUT_FORMAT << " " <<
- "Number of features extracted from a trace is not correct"<<
- " NNShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
-
- shapeFeatureVector.push_back(shapeFeature);
- }
- //Set the feature vector and class id to the shape sample features
- shapeSampleFeatures.setFeatureVector(shapeFeatureVector);
- shapeSampleFeatures.setClassID(classId);
-
- //cout << "load mdt class id :" << classId << endl;
- //Adding all shape sample feature to the prototypeset
- m_prototypeSet.push_back(shapeSampleFeatures);
- //Add to Map
- if( m_shapeIDNumPrototypesMap.find(classId)==m_shapeIDNumPrototypesMap.end())
- {
- m_shapeIDNumPrototypesMap[classId] = 1;
- }
- else
- {
- ++(m_shapeIDNumPrototypesMap[classId]);
- }
-
-
- //Clearing the vectors
- shapeFeatureVector.clear();
- tokens.clear();
- classToken.clear();
- classId = -1;
- strFeatureVector = "";
-
-
- }
- }
-
- else
- {
- floatVector floatFeatureVectorBuffer;
-
- while(!mdtFileHandle.eof())
- {
- mdtFileHandle.read((char*) &classId, intSize);
-
- if ( mdtFileHandle.fail() )
- {
- break;
- }
-
- int numberOfFeatures;
- int featureDimension;
-
- mdtFileHandle.read((char*) &numberOfFeatures, intSize);
- mdtFileHandle.read((char*) &featureDimension, intSize);
-
- m_prototypeSet.push_back(shapeSampleFeatures);
- LTKShapeSample &shapeSampleFeaturesRef = m_prototypeSet.back();
- shapeSampleFeaturesRef.setClassID(classId);
-
- // Read all features in one batch
- size_t floatFeatureVectorElementCount = numberOfFeatures * featureDimension;
- floatFeatureVectorBuffer.resize(floatFeatureVectorElementCount);
- mdtFileHandle.read((char*) &floatFeatureVectorBuffer.front(), floatFeatureVectorElementCount * floatSize);
- if ( mdtFileHandle.fail() )
- {
- break;
- }
-
- int featureIndex = 0;
-
- vector<LTKShapeFeaturePtr>& shapeFeatureVector = shapeSampleFeaturesRef.getFeatureVectorRef();
- shapeFeatureVector.reserve(numberOfFeatures);
- floatVector::const_pointer floatFeatureVectorData = floatFeatureVectorBuffer.data();
- LTKShapeFeaturePtr shapeFeature;
-
- for ( ; featureIndex < numberOfFeatures ; featureIndex++)
- {
-
- shapeFeature = m_ptrFeatureExtractor->getShapeFeatureInstance();
-
- if (shapeFeature->initialize(floatFeatureVectorData + featureIndex * featureDimension, featureDimension) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- EINVALID_INPUT_FORMAT << " " <<
- "Number of features extracted from a trace is not correct"<<
- " NNShapeRecognizer::loadModelData()" << endl;
-
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
-
- shapeFeatureVector.push_back(shapeFeature);
-
- }
-
- //Add to Map
- intIntMap::iterator mapEntry;
- if( (mapEntry = m_shapeIDNumPrototypesMap.find(classId))==m_shapeIDNumPrototypesMap.end())
- {
- m_shapeIDNumPrototypesMap[classId] = 1;
- }
- else
- {
- ++mapEntry->second;
- }
- }
- }
-
- mdtFileHandle.close();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::loadModelData()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 2-Mar-2007
- * NAME : sortDist
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-bool NNShapeRecognizer::sortDist(const NeighborInfo& x, const NeighborInfo& y)
-{
- return (x.distance) < (y.distance);
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 23-01-2007
- * NAME : recognize
- * DESCRIPTION : recognizes the incoming tracegroup
- * ARGUMENTS : inTraceGroup - trace group to be recognized
- * screenContext - screen context
- * subSetOfClasses - subset of classes whose samples will be compared with traceGroup
- * confThreshold - classes with confidence below this threshold are not returned, valid range of confThreshold: (0,1)
- * numChoices - maximum number of choices to be returned
- * outResultVector - result of recognition
- * RETURNS : SUCCESS on successful running of the code
- * NOTES :
- * CHANGE HISTROY
- * Author : Date Description
- *************************************************************************************/
-int NNShapeRecognizer::recognize(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& inSubSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector)
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::recognize()" << endl;
-
-
- //Check for empty traces in traceGroup
-
- if(traceGroup.containsAnyEmptyTrace())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<EEMPTY_TRACE << " " <<
- " Input trace is empty"<<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(EEMPTY_TRACE);
- }
-
-
- //Contains TraceGroup after Preprocessing is done
- LTKTraceGroup preprocessedTraceGroup;
-
-
- //Preprocess the traceGroup
- if( preprocess(traceGroup, preprocessedTraceGroup) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- getErrorMessage(errorCode)<<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
- }
-
- //Extract the shapeSample from preprocessedTraceGroup
- if(!m_ptrFeatureExtractor)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ENULL_POINTER << " " <<
- " m_ptrFeatureExtractor is NULL"<<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(ENULL_POINTER);
- }
-
- vector<LTKShapeFeaturePtr> shapeFeatureVec;
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- shapeFeatureVec);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- // call recognize with featureVector
-
- if(recognize( shapeFeatureVec, inSubSetOfClasses, confThreshold,
- numChoices, outResultVector) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- getErrorMessage(errorCode)<<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
-
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::recognize()" << endl;
-
- return SUCCESS;
-
-}
-
-
-int NNShapeRecognizer::recognize(const vector<LTKShapeFeaturePtr>& shapeFeatureVector,
- const vector<int>& inSubSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector)
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::recognize()" << endl;
-
- m_cancelRecognition = false;
-
- m_cachedShapeSampleFeatures.setFeatureVector(shapeFeatureVector);
-
- //Creating a local copy of input inSubSetOfClasses, as it is const, STL's unique function modifies it!!!
- vector<int> subSetOfClasses = inSubSetOfClasses;
-
- int numPrototypes = m_prototypeSet.size();
-
- /*********Validation for m_prototypeSet ***************************/
- if ( numPrototypes == 0 )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROTOTYPE_SET_EMPTY << " " <<
- " getErrorMessage(EPROTOTYPE_SET_EMPTY) "<<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(EPROTOTYPE_SET_EMPTY); //modify
- }
-
- int dtwEuclideanFilter = (m_dtwEuclideanFilter == EUCLIDEAN_FILTER_OFF)?
- EUCLIDEAN_FILTER_OFF : (int)((m_dtwEuclideanFilter * numPrototypes) / 100);
-
- if(dtwEuclideanFilter == 0)
- dtwEuclideanFilter = EUCLIDEAN_FILTER_OFF;
-
- if( dtwEuclideanFilter != EUCLIDEAN_FILTER_OFF && dtwEuclideanFilter < m_nearestNeighbors)
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Error: " << ECONFIG_FILE_RANGE <<
- DTWEUCLIDEANFILTER << " is out of permitted range " <<
- " NNShapeRecognizer::recognize()"<<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- // dtwEuclideanFilter = EUCLIDEAN_FILTER_OFF;
- }
-
- /******************************************************************/
- /*******************VALIDATING INPUT ARGUMENTS*********************/
- /******************************************************************/
-
- // Validating numChoices: valid values: {-1, (0,m_numShapes]}
- if(numChoices <= 0 && numChoices != NUM_CHOICES_FILTER_OFF)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "numChoices ("<<numChoices<<")<=0, setting it to off (-1)"<<endl;
- numChoices = -1;
- }
-
- if(!m_projectTypeDynamic && numChoices > m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "numChoices ("<<numChoices<<") > numShapes ("<<
- m_numShapes<<"), using numShapes "<<m_numShapes<<" instead"<<endl;
- numChoices = m_numShapes;
- }
-
-
- //Validating confThreshold: valid values: [0,1]
- if(confThreshold > 1 || confThreshold < 0)
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
- "Invalid value of confThreshold, valid values are: [0,1]"<<endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
-
-
- /*****************************************************************************************/
- /*********************** DECLARING IMPORTANT LOCAL VARIABLES *****************************/
- /*****************************************************************************************/
-
- //Variable to store the DTW distance.
- float dtwDistance = 0.0f;
-
- //Variable to store the Euclidean distance.
- float euclideanDistance = 0.0f;
-
-
- // begin and end iterators for m_prototypeSet
- vector<LTKShapeSample>::iterator prototypeSetIter = m_prototypeSet.begin();
- vector<LTKShapeSample>::iterator prototypeSetIterEnd = m_prototypeSet.end();
-
- //iterator for iterating the input shape subset vector
-
- vector<int>::iterator subSetOfClassesIter;
-
- int prototypeIndexOffset=0;
-
- int numPrototypesForSubset=0;
-
- if(subSetOfClasses.size()>0)
- {
- sort(subSetOfClasses.begin(),subSetOfClasses.end());
- subSetOfClasses.erase(unique(subSetOfClasses.begin(),subSetOfClasses.end()),subSetOfClasses.end());
- }
-
- // Clearing cached Variables
- m_vecRecoResult.clear();
- m_neighborInfoVec.clear();
-
- //Temporary variable to be used to populate distIndexPairVector
- struct NeighborInfo tempPair;
-
-
- /***************End of declarations and initializations of variables**************/
-
-
-
- /***************************************************************/
- /*************** Computation of Distance ***********************/
- /***************************************************************/
-
-
- if(subSetOfClasses.size()>0)
- {
- vector<int>::iterator tempSubsetIter = subSetOfClasses.begin();
- vector<int>::iterator tempSubsetIterEnd = subSetOfClasses.end();
-
- for(; tempSubsetIter!= tempSubsetIterEnd; ++tempSubsetIter)
- {
- if(m_shapeIDNumPrototypesMap.find(*tempSubsetIter)==m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_SHAPEID << " " <<
- "Invalid class ID in the shape subset vector:"<<(*tempSubsetIter)<<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(EINVALID_SHAPEID);
- }
- else
- {
- numPrototypesForSubset = numPrototypesForSubset + m_shapeIDNumPrototypesMap[*tempSubsetIter];
- }
- }
-
- if(dtwEuclideanFilter!= EUCLIDEAN_FILTER_OFF)
- {
- if(numPrototypesForSubset < dtwEuclideanFilter)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Number of prototypes corresponding to subset of classes asked for is less than Euclidean filter size; switching Euclidean filter off" << endl;
- dtwEuclideanFilter = EUCLIDEAN_FILTER_OFF;
- }
- }
-
- subSetOfClassesIter=subSetOfClasses.begin();
- }
- // If Euclidean filter size >= size of the m_prototypeSet, do not use twEuclideanFilter
- else if(subSetOfClasses.size()==0 && dtwEuclideanFilter >= m_prototypeSet.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "dtwEuclideanFilter >= m_prototypeSet.size(), switching Euclidean filter off" << endl;
- dtwEuclideanFilter = EUCLIDEAN_FILTER_OFF;
- }
-
- // If the distance metric is Euclidean, compute the distances of test sample to all the samples in the prototype set
- if(LTKSTRCMP(m_prototypeDistance.c_str(), EUCLIDEAN_DISTANCE) == 0)
- {
- for (int j = 0; prototypeSetIter != prototypeSetIterEnd; )
- {
-
- if(subSetOfClasses.size()>0)
- {
- if((*prototypeSetIter).getClassID()<(*subSetOfClassesIter))
- {
- j=j + m_shapeIDNumPrototypesMap[(*prototypeSetIter).getClassID()];
- prototypeSetIter=prototypeSetIter +
- m_shapeIDNumPrototypesMap[(*prototypeSetIter).getClassID()];
-
- continue;
- }
-
-
- }
- if(subSetOfClasses.size()==0 || (*prototypeSetIter).getClassID()==(*subSetOfClassesIter))
- {
- while(subSetOfClasses.size()==0 || (*prototypeSetIter).getClassID()==(*subSetOfClassesIter))
- {
- euclideanDistance = 0.0f;
- errorCode = computeEuclideanDistance(*prototypeSetIter,
- m_cachedShapeSampleFeatures,
- euclideanDistance);
-
- if(errorCode == SUCCESS && m_cancelRecognition)
- return SUCCESS;
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
-
- }
-
- tempPair.distance = euclideanDistance;
- tempPair.classId = (*prototypeSetIter).getClassID();
- tempPair.prototypeSetIndex = j;
-
- m_neighborInfoVec.push_back(tempPair);
- ++prototypeSetIter;
- ++j;
-
- if(prototypeSetIter==m_prototypeSet.end())
- {
- break;
- }
- }
-
- if(subSetOfClasses.size()>0)
- {
- ++subSetOfClassesIter;
- if(subSetOfClassesIter==subSetOfClasses.end())
- {
- break;
- }
- }
- }
- }
- }
- // If the distance metric is DTW
- else if(LTKSTRCMP(m_prototypeDistance.c_str(), DTW_DISTANCE) == 0)
- {
- vector<bool> filterVector(m_prototypeSet.size(), true);
-
- // If Euclidean Filter is specified, find Euclidean distance to all the samples in the prototypeset,
- // choose the top dtwEuclideanFilter number of prototypes, to which the DTW distance will be computed.
- if(dtwEuclideanFilter != EUCLIDEAN_FILTER_OFF)
- {
- vector <struct NeighborInfo> eucDistIndexPairVector;
-
- filterVector.assign(m_prototypeSet.size(), false);
-
-
- for (int j = 0; prototypeSetIter != prototypeSetIterEnd;)
- {
- if(subSetOfClasses.size()>0)
- {
- if((*prototypeSetIter).getClassID()<(*subSetOfClassesIter))
- {
-
- j=j + m_shapeIDNumPrototypesMap[(*prototypeSetIter).getClassID()];
- prototypeSetIter = prototypeSetIter + m_shapeIDNumPrototypesMap
- [(*prototypeSetIter).getClassID()];
-
- continue;
- }
- }
- if(subSetOfClasses.size()==0 || (*prototypeSetIter).getClassID()==(*subSetOfClassesIter))
- {
- while(subSetOfClasses.size()==0 ||
- (*prototypeSetIter).getClassID()==(*subSetOfClassesIter))
- {
- euclideanDistance = 0.0f;
- errorCode = computeEuclideanDistance(*prototypeSetIter,
- m_cachedShapeSampleFeatures,
- euclideanDistance);
-
- if(errorCode == SUCCESS && m_cancelRecognition)
- return SUCCESS;
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
-
- tempPair.distance = euclideanDistance;
- tempPair.classId = (*prototypeSetIter).getClassID();
- tempPair.prototypeSetIndex = j;
-
- eucDistIndexPairVector.push_back(tempPair);
- ++prototypeSetIter;
- ++j;
-
- if(prototypeSetIter==m_prototypeSet.end())
- {
- break;
- }
- }
-
- if(subSetOfClasses.size()>0)
- {
- ++subSetOfClassesIter;
- if(subSetOfClassesIter==subSetOfClasses.end())
- {
- break;
- }
- }
- }
- }
-
- //Sort the eucDistIndexPairVector in ascending order of distance, and used only top dtwEuclideanFilter for DTW distance computation
- sort(eucDistIndexPairVector.begin(), eucDistIndexPairVector.end(), sortDist);
-
- for (int z = 0; z < dtwEuclideanFilter; ++z )
- {
- int prototypeSetIndex = eucDistIndexPairVector[z].prototypeSetIndex ;
- filterVector[prototypeSetIndex] = true;
- }
- }
- else
- {
- if(subSetOfClasses.size()>0)
- {
- filterVector.assign(m_prototypeSet.size(), false);
-
- for(map<int,int>::iterator shapeIDNumPrototypesMapIter=m_shapeIDNumPrototypesMap.begin();
- shapeIDNumPrototypesMapIter!=m_shapeIDNumPrototypesMap.end();)
- {
- if(shapeIDNumPrototypesMapIter->first<(*subSetOfClassesIter))
- {
-
- prototypeIndexOffset=prototypeIndexOffset +
- shapeIDNumPrototypesMapIter->second;
-
- ++shapeIDNumPrototypesMapIter;
-
- continue;
- }
- else if(shapeIDNumPrototypesMapIter->first==(*subSetOfClassesIter))
- {
- while(m_prototypeSet[prototypeIndexOffset].getClassID()==
- (*subSetOfClassesIter))
- {
- filterVector[prototypeIndexOffset]=true;
- ++prototypeIndexOffset;
- if( prototypeIndexOffset == m_prototypeSet.size()) break; }
- if(subSetOfClassesIter==subSetOfClasses.end()) { break; } //filterVector.assign(filterVector.begin()+prototypeIndexOffset,filterVector.begin()+prototypeIndexOffset+shapeIDNumPrototypesMapIter->second,true);
- ++shapeIDNumPrototypesMapIter;
- ++subSetOfClassesIter;
- if(subSetOfClassesIter==subSetOfClasses.end())
- {
- break;
- }
-
- }
- }
- }
- }
-
-
- //Iterate through all the prototypes, and compute DTW distance to the prototypes for which corresponding entry in filterVector is true
- for (int i = 0 ; i < m_prototypeSet.size(); ++i )
- {
-
- if(filterVector[i])
- {
- dtwDistance = 0.0f;
- errorCode = computeDTWDistance(m_prototypeSet[i],
- m_cachedShapeSampleFeatures,
- dtwDistance);
-
- if(errorCode == SUCCESS && m_cancelRecognition)
- return SUCCESS;
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::recognize()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- tempPair.distance = dtwDistance;
- tempPair.classId = (m_prototypeSet[i]).getClassID();
- tempPair.prototypeSetIndex = i;
- m_neighborInfoVec.push_back(tempPair);
- }
- }
-
- filterVector.clear();
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ECONFIG_FILE_RANGE << " " <<
- "The selected prototype distance method \""<<
- m_prototypeDistance<<"\" is not supported "<<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
-
- //Sort the distIndexPairVector based on distances, in ascending order.
- sort(m_neighborInfoVec.begin(), m_neighborInfoVec.end(), sortDist);
-
- //Reject the sample if the similarity of the nearest sample is lower than m_rejectThreshold specified by the user.
- if(SIMILARITY(m_neighborInfoVec[0].distance) <= m_rejectThreshold)
- {
-
- m_vecRecoResult.clear();
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<"Test sample too distinct, rejecting the sample"<<endl;
- return SUCCESS;
- }
-
- //Compute the confidences of the classes appearing in distIndexPairVector
- //outResultVector is an output argument, populated in computeConfidence()
- if((errorCode = computeConfidence()) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::recognize()" << endl;
- LTKReturnError(errorCode);
- }
-
- // Temporary result vector to store the results based on confThreshold and numChoices specified by the user.
- vector<LTKShapeRecoResult> tempResultVector;
-
- //If confThreshold is specified, get the entries from resultVector with confidence >= confThreshold
- if(confThreshold != CONF_THRESHOLD_FILTER_OFF)
- {
- for(int i = 0 ; i < m_vecRecoResult.size() ; i++)
- {
- if( m_vecRecoResult[i].getConfidence() >= confThreshold)
- {
- tempResultVector.push_back(m_vecRecoResult[i]);
- }
- }
- m_vecRecoResult.clear();
- m_vecRecoResult = tempResultVector;
- tempResultVector.clear();
- }
- //Check if outResultVector is empty, if so, log
- if(m_vecRecoResult.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO) <<
- "Size of the result vector is empty, could not satisfy confThreshold criteria"<<endl;
- }
-
- //If numChoices is specified, get the top numChoices entries from outResultVector
- if(numChoices != NUM_CHOICES_FILTER_OFF)
- {
- //Get the entries from outResultVector only if size of resultVector > numChoices
- if(m_vecRecoResult.size() > numChoices)
- {
- for( int i = 0 ; i < numChoices ; ++i)
- tempResultVector.push_back(m_vecRecoResult[i]);
- m_vecRecoResult.clear();
- m_vecRecoResult = tempResultVector;
- tempResultVector.clear();
- }
-
- }
-
- if(m_cancelRecognition)
- m_vecRecoResult.clear();
-
- outResultVector = m_vecRecoResult;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::recognize()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 23-Jan-2007
- * NAME : unloadModelData
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : SUCCESS
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::unloadModelData()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::unloadModelData()" << endl;
-
- int returnStatus = SUCCESS;
-
- //Update MDT file with any modification, if available in memory
- if(m_prototypeSetModifyCount >0)
- {
- m_prototypeSetModifyCount = m_MDTUpdateFreq-1;
-
- returnStatus = writePrototypeSetToMDTFile();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::unloadModelData()" << endl;
- }
- m_prototypeSetModifyCount = 0;
- }
-
- //Clearing the prototypSet
- m_prototypeSet.clear();
- m_shapeIDNumPrototypesMap.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::unloadModelData()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 27-Feb-2007
- * NAME : setDeviceContext
- * DESCRIPTION : New Function - Not yet added
- * ARGUMENTS :
- * RETURNS : SUCCESS
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::setDeviceContext(const LTKCaptureDevice& deviceInfo)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::setDeviceContext()" << endl;
-
- if(m_ptrPreproc == NULL)
- {
- int returnStatus = ECREATE_PREPROC;
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::setDeviceContext()" << endl;
- LTKReturnError(returnStatus);
- }
-
- m_ptrPreproc->setCaptureDevice(deviceInfo);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::setDeviceContext()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Nidhi sharma
- * DATE : 22-02-2007
- * NAME : peformClustering
- * DESCRIPTION : This method will do Custering for the given ShapeSamples
- * ARGUMENTS :
- * RETURNS : medianIndex
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::performClustering(const vector<LTKShapeSample> & shapeSamplesVec,
- vector<LTKShapeSample>& outClusteredShapeSampleVec)
-
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::performClustering()" << endl;
-
- intVector tempVec;
- int2DVector outputVector;
- float2DVector distanceMatrix;
- int sampleCount=shapeSamplesVec.size();
- int returnStatus = SUCCESS;
-
- if(m_prototypeReductionFactor == -1)
- {
- //find number of clusters automatically
- //this is done when either of NumClusters or PrototypeReducrion factor is set
- //to automatic
- LTKHierarchicalClustering<LTKShapeSample,NNShapeRecognizer> hc(shapeSamplesVec,AVERAGE_LINKAGE,AVG_SIL);
- if(LTKSTRCMP(m_prototypeDistance.c_str(), DTW_DISTANCE) == 0)
- {
- returnStatus = hc.cluster(this,&NNShapeRecognizer::computeDTWDistance);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::performClustering()" << endl;
- LTKReturnError(returnStatus);
- }
- }
- else if(LTKSTRCMP(m_prototypeDistance.c_str(), EUCLIDEAN_DISTANCE) == 0)
- {
- returnStatus = hc.cluster(this,&NNShapeRecognizer::computeEuclideanDistance);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::performClustering()" << endl;
- LTKReturnError(returnStatus);
- }
- }
-
- //Cluster results are populated in an outputVector
- hc.getClusterResult(outputVector);
- distanceMatrix = hc.getProximityMatrix();
-
- }
- else if(m_prototypeReductionFactor == 0|| m_numClusters >= sampleCount)
- {
- //case where clustering is not required every sample is a cluster by itself
- outClusteredShapeSampleVec = shapeSamplesVec;
- }
- else
- {
- //clustering has to be performed
- int numClusters;
- if(m_numClusters == NN_NUM_CLUST_INITIAL)
- {
- numClusters = (100-m_prototypeReductionFactor)*sampleCount/100;
- if(numClusters == 0)
- {
- numClusters = 1;
- }
- }
- else if(m_prototypeReductionFactor == NN_NUM_CLUST_INITIAL)
- {
- numClusters = m_numClusters;
- }
-
- try
- {
- LTKHierarchicalClustering<LTKShapeSample,NNShapeRecognizer>
- hc(shapeSamplesVec,numClusters, AVERAGE_LINKAGE);
-
-
- if(numClusters == 1)
- {
- int tempVar;
- if(LTKSTRCMP(m_prototypeDistance.c_str(), DTW_DISTANCE) == 0)
- {
- hc.computeProximityMatrix(this, &NNShapeRecognizer::computeDTWDistance);
- }
- else if(LTKSTRCMP(m_prototypeDistance.c_str(), EUCLIDEAN_DISTANCE) == 0)
- {
- hc.computeProximityMatrix(this, &NNShapeRecognizer::computeEuclideanDistance);
- }
-
- for(tempVar=0;tempVar<shapeSamplesVec.size();tempVar++)
- {
- tempVec.push_back(tempVar);
- }
-
- outputVector.push_back(tempVec);
- tempVec.clear();
- }
- else
- {
- if(LTKSTRCMP(m_prototypeDistance.c_str(), DTW_DISTANCE) == 0)
- {
- returnStatus = hc.cluster(this,&NNShapeRecognizer::computeDTWDistance);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::performClustering()" << endl;
- LTKReturnError(returnStatus);
- }
-
- }
- else if(LTKSTRCMP(m_prototypeDistance.c_str(), EUCLIDEAN_DISTANCE) == 0)
- {
- returnStatus = hc.cluster(this,&NNShapeRecognizer::computeEuclideanDistance);
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << returnStatus << " " <<
- " NNShapeRecognizer::performClustering()" << endl;
- LTKReturnError(returnStatus);
- }
-
-
- }
-
- //Cluster results are populated in an outputVector
- hc.getClusterResult(outputVector);
- }
- distanceMatrix = hc.getProximityMatrix();
- }
- catch(LTKException e)
- {
- errorCode = e.getErrorCode();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::performClustering()" << endl;
- LTKReturnError(errorCode);
- }
- }
-
- if((m_prototypeReductionFactor != 0 && m_prototypeReductionFactor != NN_NUM_CLUST_INITIAL)||
- (m_numClusters>0 && m_numClusters<sampleCount))
- {
-
- vector<int> medianIndexVec;
-
- errorCode = calculateMedian(outputVector, distanceMatrix, medianIndexVec);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode <<
- " NNShapeRecognizer::performClustering()" << endl;
- LTKReturnError(errorCode);
-
- }
-
- for(int numMedians = 0 ; numMedians < medianIndexVec.size() ; numMedians++)
- {
- outClusteredShapeSampleVec.push_back(shapeSamplesVec[medianIndexVec[numMedians]]);
- }
- /*
- int medianIndex = 0;
- for (int clusNum = 0; clusNum < outputVector.size(); clusNum++)
- {
-
- errorCode = calculateMedian(outputVector, distanceMatrix, clusNum,medianIndex);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- "Error computing median, calculateMedian()" <<
- " NNShapeRecognizer::performClustering()" << endl;
- LTKReturnError(errorCode);
-
- }
- outClusteredShapeSampleVec.push_back(shapeSamplesVec[medianIndex]);
- }
- */
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::performClustering()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Nidhi sharma
- * DATE : 22-02-2007
- * NAME : getShapeSampleFromInkFile
- * DESCRIPTION : This method will get the ShapeSample by giving the ink
- * file path as input
- * ARGUMENTS :
- * RETURNS : SUCCESS
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::getShapeFeatureFromInkFile(const string& inkFilePath,
- vector<LTKShapeFeaturePtr>& shapeFeatureVec)
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
-
- if ( inkFilePath.empty() )
- return FAILURE;
-
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
-
- LTKTraceGroup inTraceGroup, preprocessedTraceGroup;
- inTraceGroup.emptyAllTraces();
-
- int returnVal = m_shapeRecUtil.readInkFromFile(inkFilePath,
- m_lipiRootPath, inTraceGroup,
- captureDevice, screenContext);
-
- if (returnVal!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<returnVal<<
- " NNShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(returnVal);
- }
-
- m_ptrPreproc->setCaptureDevice(captureDevice);
- m_ptrPreproc->setScreenContext(screenContext);
-
- preprocessedTraceGroup.emptyAllTraces();
-
- //Preprocessing to be done for the trace group that was read
- if( preprocess(inTraceGroup, preprocessedTraceGroup) != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- shapeFeatureVec);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::getShapeFeatureFromInkFile()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Saravanan
- * DATE : 22-02-2007
- * NAME : trainFromListFile
- * DESCRIPTION : This method will do the training by giving the Train List
- * file as input
- * ARGUMENTS :
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::trainFromListFile(const string& listFilePath)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::trainFromListFile()" << endl;
-
-
- //Count for the no. of samples read for a shape
- int sampleCount = 0;
-
- //Count of the no. of shapes read so far
- int shapeCount = 0;
-
- //Flag to skip reading a newline in the list file, when a new class starts
- bool lastshapeIdFlag = false;
-
- //Ink File Path
- string path = "";
-
- //Line from the list file
- string line = "";
-
- //Line is split into tokens
- stringVector tokens;
-
- //Flag is set when EOF is reached
- bool eofFlag = false;
-
- //ID for each shapes
- int shapeId = -1;
-
- //classId of the character
- int prevClassId = -1;
-
- //Indicates the first class
- bool initClassFlag = false;
-
- LTKShapeSample shapeSampleFeatures;
-
- vector<LTKShapeSample> shapeSamplesVec;
-
- vector<LTKShapeSample> clusteredShapeSampleVec;
-
- ofstream mdtFileHandle;
- ifstream listFileHandle;
-
- vector<LTKShapeFeaturePtr> shapeFeature;
-
- //Get the Instance of LTKShapeFeatureExtractor
- //initializeFeatureExtractorInstance();
-
- //Opening the train list file for reading mode
- listFileHandle.open(listFilePath.c_str(), ios::in);
-
- //Throw an error if unable to open the training list file
- if(!listFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< ETRAINLIST_FILE_OPEN << " " <<
- getErrorMessage(ETRAINLIST_FILE_OPEN)<<
- " NNShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(ETRAINLIST_FILE_OPEN);
- }
-
- //Open the Model data file for writing mode
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::out);
- }
- else
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(),ios::out|ios::binary);
- }
-
- //Throw an error if unable to open the Model data file
- if(!mdtFileHandle)
- {
- listFileHandle.close();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- getErrorMessage(EMODEL_DATA_FILE_OPEN)<<
- " NNShapeRecognizer::trainFromListFile()" << endl;
-
- listFileHandle.close();
-
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- //Write the number of Shapes
- mdtFileHandle << m_numShapes << endl;
- }
- else
- {
- mdtFileHandle.write((char*) &m_numShapes, sizeof(unsigned short));
- }
-
- int errorCode = SUCCESS;
- while(!listFileHandle.eof())
- {
- // Not a sample of a new class
- if( lastshapeIdFlag == false )
- {
- //Get the line from the list file
- getline(listFileHandle, line, NEW_LINE_DELIMITER);
-
- path = "";
-
- //Check if EOF is reached
- if( listFileHandle.eof() )
- {
- eofFlag = true;
- }
-
- //Skip commented line
- if ( line[0] == COMMENTCHAR )
- {
- continue;
- }
-
- if (eofFlag == false)
- {
- //Tokenize the string
- errorCode = LTKStringUtil::tokenizeString(line, LIST_FILE_DELIMITER, tokens);
-
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainFromListFile()" << endl;
-
- listFileHandle.close();
- mdtFileHandle.close();
-
- LTKReturnError(errorCode);
- }
-
-
- //Tokens must be of size 2, one is pathname and other is shapeId
- //If the end of file not reached then continue the looping
- if( tokens.size() != 2 && eofFlag == false )
- continue;
-
- //Tokens[0] indicates the path name
- path = tokens[0];
-
- //Tokens[1] indicates the shapeId
- shapeId = atoi( tokens[1].c_str() );
-
- if(shapeId < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "The NNShapeRecognizer requires training file class Ids to be positive integers and listed in the increasing order"<<
- " NNShapeRecognizer::trainFromListFile()" << endl;
- errorCode = EINVALID_SHAPEID;
- break;
- }
- else if(shapeId < prevClassId)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "Shape IDs in the train list file should be in the increasing order. Please use scripts/validateListFile.pl to generate list files." <<
- " NNShapeRecognizer::trainFromListFile()" << endl;
- errorCode = EINVALID_ORDER_LISTFILE;
- break;
- }
-
-
- //This condition is used to handle the first sample in the file
- if( initClassFlag == false )
- {
- initClassFlag = true;
- prevClassId=shapeId;
- }
- }
- }
- else //Sample of a new class; do not read the next line during this iteration
- {
- //flag unset to read next line during the next iteration
- lastshapeIdFlag = false;
- }
-
- // Sample from the same class, extract features, and push the extracted features to shapeSamplesVec
- if( shapeId == prevClassId && ! path.empty())
- {
- if( getShapeFeatureFromInkFile(path, shapeFeature) != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<
- "Error extracting features from the ink file: " <<
- path << ", extracting features from the next sample."<<
- " NNShapeRecognizer::trainFromListFile()" << endl;
- continue;
- }
-
- shapeSampleFeatures.setFeatureVector(shapeFeature);
- shapeSampleFeatures.setClassID(shapeId);
-
- ++sampleCount;
- shapeSamplesVec.push_back(shapeSampleFeatures);
-
- shapeFeature.clear();
-
- //All the samples are pushed to m_trainSet used only for trainLVQ
-
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_LVQ)
- == 0 && m_prototypeReductionFactor != 0)
- m_trainSet.push_back(shapeSampleFeatures);
- }
-
- // Sample of new class seen, or end of list file reached; train all the samples of previous class ID
- if( shapeId != prevClassId || eofFlag == true )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Training for class : " << prevClassId << endl;
-
- //Increase shape count only if there are atleast one sample per class
- if( sampleCount > 0 )
- shapeCount++;
-
- //check that shapecount must not be greater than specified number
- //of shapes, if projecttype was not dynamic
- if( !m_projectTypeDynamic && shapeCount > m_numShapes )
- {
- errorCode = EINVALID_NUM_OF_SHAPES;
- break;
- }
-
- if( shapeCount > 0 && sampleCount > 0 )
- {
- // No LVQ training being done?
- errorCode = performClustering(shapeSamplesVec,
- clusteredShapeSampleVec);
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainFromListFile()" << endl;
-
- listFileHandle.close();
- mdtFileHandle.close();
- LTKReturnError(errorCode);
- }
-
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_LVQ) == 0)
- {
- //Push all the samples after clustering into prototypeSet
- for( int i = 0; i < clusteredShapeSampleVec.size(); ++i )
- {
- m_prototypeSet.push_back(clusteredShapeSampleVec[i]);
- }
- }
- else if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_CLUSTERING) == 0)
- {
- //Writing results to the MDT file
- errorCode = appendPrototypesToMDTFile(clusteredShapeSampleVec, mdtFileHandle);
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<<errorCode << " " <<
- " NNShapeRecognizer::trainFromListFile()" << endl;
-
- listFileHandle.close();
- mdtFileHandle.close();
- LTKReturnError(errorCode);
- }
-
- }
-
- //Clearing the shapeSampleVector and clusteredShapeSampleVector
- clusteredShapeSampleVec.clear();
- shapeSamplesVec.clear();
-
- //Resetting sampleCount for the next class
- sampleCount = 0;
-
- //Set the flag so that the already read line of next class in the list file is not lost
- lastshapeIdFlag = true;
-
- prevClassId = shapeId;
-
- }
- }
- }//End of while
-
- //Closing the Train List file and Model Data file
- listFileHandle.close();
- mdtFileHandle.close();
-
- if(!m_projectTypeDynamic && shapeCount != m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NUM_OF_SHAPES << " " <<
- getErrorMessage(EINVALID_NUM_OF_SHAPES)<<
- " NNShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(EINVALID_NUM_OF_SHAPES);
- }
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainFromListFile()" << endl;
- LTKReturnError(errorCode);
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::trainFromListFile()" << endl;
-
- return SUCCESS;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : Saravanan
-* DATE : 23-03-2007
-* NAME : getShapeSampleFromString
-* DESCRIPTION : This method get the Shape Sample Feature from a given line
-* ARGUMENTS :
-* RETURNS : none
-* NOTES : w
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int NNShapeRecognizer::getShapeSampleFromString(const string& inString, LTKShapeSample& outShapeSample)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::getShapeSampleFromString()" << endl;
-
-
- //Line is split into tokens
- stringVector tokens;
-
- //Class Id
- int classId = -1;
-
- //Feature Vector string
- string strFeatureVector = "";
-
- //Tokenize the string
- int errorCode = LTKStringUtil::tokenizeString(inString, EMPTY_STRING, tokens);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::getShapeSampleFromString()" << endl;
- LTKReturnError(errorCode);
- }
-
-
- //Tokens must be of size 2, one is classId and other is Feature Vector
- if( tokens.size() != 2)
- return FAILURE;
-
- //Tokens[0] indicates the path name
- classId = atoi(tokens[0].c_str());
-
- //Tokens[1] indicates the shapeId
- strFeatureVector = tokens[1];
-
- errorCode = LTKStringUtil::tokenizeString(strFeatureVector, FEATURE_EXTRACTOR_DELIMITER, tokens);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::getShapeSampleFromString()" << endl;
- LTKReturnError(errorCode);
- }
-
-
-
- vector<LTKShapeFeaturePtr> shapeFeatureVector;
- LTKShapeFeaturePtr shapeFeature;
-
- for(int i = 0; i < tokens.size(); ++i)
- {
- shapeFeature = m_ptrFeatureExtractor->getShapeFeatureInstance();
- if(shapeFeature->initialize(tokens[i]) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: "<< EINVALID_INPUT_FORMAT << " " <<
- "Number of features extracted from a trace is not correct" <<
- " NNShapeRecognizer::getShapeSampleFromString()" << endl;
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
- shapeFeatureVector.push_back(shapeFeature);
- }
-
- //Set the feature vector and class id to the shape sample features
- outShapeSample.setFeatureVector(shapeFeatureVector);
- outShapeSample.setClassID(classId);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::getShapeSampleFromString()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Saravanan
-* DATE : 22-02-2007
-* NAME : initializeFeatureExtractorInstance
-* DESCRIPTION : This method get the Instance of the Feature Extractor
-* from LTKShapeFeatureExtractorFactory
-* ARGUMENTS :
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int NNShapeRecognizer::initializeFeatureExtractorInstance(const LTKControlInfo& controlInfo)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
-
-
- LTKShapeFeatureExtractorFactory factory;
- int errorCode = factory.createFeatureExtractor(m_featureExtractorName,
- m_lipiRootPath,
- m_lipiLibPath,
- &m_libHandlerFE,
- controlInfo,
- &m_ptrFeatureExtractor);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EFTR_EXTR_NOT_EXIST << " " <<
- " NNShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
- LTKReturnError(errorCode);
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::initializeFeatureExtractorInstance()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Saravanan
-* DATE : 26-03-2007
-* NAME : deleteFeatureExtractorInstance
-* DESCRIPTION : This method unloads the Feature extractor instance
-* ARGUMENTS : none
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int NNShapeRecognizer::deleteFeatureExtractorInstance()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- if (m_ptrFeatureExtractor != NULL)
- {
- typedef int (*FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR)(LTKShapeFeatureExtractor *obj);
- FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR deleteFeatureExtractor;
- void * functionHandle = NULL;
-
- // Map createpreprocessor and deletePreprocessor functions
- int returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandlerFE,
- DELETE_SHAPE_FEATURE_EXTRACTOR,
- &functionHandle);
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: "<< EDLL_FUNC_ADDRESS_DELETE_FEATEXT << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_DELETE_FEATEXT) <<
- " NNShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS_DELETE_FEATEXT);
- }
-
- deleteFeatureExtractor = (FN_PTR_DELETE_SHAPE_FEATURE_EXTRACTOR)functionHandle;
-
- deleteFeatureExtractor(m_ptrFeatureExtractor);
-
- m_ptrFeatureExtractor = NULL;
-
- // unload feature extractor dll
- if(m_libHandlerFE != NULL)
- {
- //Unload the DLL
- m_OSUtilPtr->unloadSharedLib(m_libHandlerFE);
- m_libHandlerFE = NULL;
-
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::deleteFeatureExtractorInstance()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
-* AUTHOR : Saravanan
-* DATE : 22-02-2007
-* NAME : updateHeaderWithAlgoInfo
-* DESCRIPTION : This method will Update the Header information for the MDT file
-* ARGUMENTS :
-* RETURNS : none
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-void NNShapeRecognizer::updateHeaderWithAlgoInfo()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::updateHeaderWithAlgoInfo()" << endl;
-
- m_headerInfo[RECVERSION] = m_currentVersion;
- string algoName = NN;
- m_headerInfo[RECNAME] = algoName;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::updateHeaderWithAlgoInfo()" << endl;
-
-}
-
-
-/******************************************************************************
-* AUTHOR : Saravanan
-* DATE : 19-03-2007
-* NAME : getDistance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-void NNShapeRecognizer::getDistance(const LTKShapeFeaturePtr& f1,
- const LTKShapeFeaturePtr& f2,
- float& distance)
-{
- f1->getDistance(f2, distance);
-}
-
-/******************************************************************************
- * AUTHOR : Tarun Madan
- * DATE : 11-06-2007
- * NAME : getFeaturesFromTraceGroup
- * DESCRIPTION : 1. PreProcess 2. Extract Features 3.Add to PrototypeSet
- * 4. Add to MDT
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::extractFeatVecFromTraceGroup(const LTKTraceGroup& inTraceGroup,
- vector<LTKShapeFeaturePtr>& featureVec)
-{
- int errorCode;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
-
- LTKTraceGroup preprocessedTraceGroup; //TraceGroup after Preprocessing
-
- //Check for empty traces in inTraceGroup
- if(inTraceGroup.containsAnyEmptyTrace())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EEMPTY_TRACE << " " <<
- getErrorMessage(EEMPTY_TRACE) <<
- " NNShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- LTKReturnError(EEMPTY_TRACE);
- }
-
- //Preprocess the inTraceGroup
- if(preprocess(inTraceGroup, preprocessedTraceGroup) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- LTKReturnError(errorCode);
- }
-
- errorCode = m_ptrFeatureExtractor->extractFeatures(preprocessedTraceGroup,
- featureVec);
-
- if (errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NNShapeRecognizer::extractFeatVecFromTraceGroup()" << endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tarun Madan
- * DATE : 07-06-2007
- * NAME : addClass
- * DESCRIPTION : 1. PreProcess 2. Extract Features 3.Add to PrototypeSet
- * 4. Add to MDT
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::addClass(const LTKTraceGroup& sampleTraceGroup, int& shapeID)
-{
- // Should be moved to nnInternal
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::addClass()" << endl;
-
- LTKShapeSample shapeSampleFeatures;
-
- if(!m_projectTypeDynamic)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROJ_NOT_DYNAMIC << " " <<
- "Not allowed to ADD shapes to a project with fixed number of shapes"<<
- " NNShapeRecognizer::addClass()" << endl;
-
- LTKReturnError(EPROJ_NOT_DYNAMIC);
- }
-
- //Compute ClassID
- int tempShapeID;
- if(m_shapeIDNumPrototypesMap.size()>0)
- {
- map<int,int>::reverse_iterator m_shapeIDNumPrototypesMapIter;
- m_shapeIDNumPrototypesMapIter = m_shapeIDNumPrototypesMap.rbegin();
- tempShapeID = m_shapeIDNumPrototypesMapIter->first;
- shapeID = tempShapeID+1;
- }
- else
- {
- shapeID = LTK_START_SHAPEID;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< "New ShapeID = "<<shapeID<<endl;
- //Calculate Features
- int errorCode = SUCCESS;
- vector<LTKShapeFeaturePtr> tempFeatureVec;
-
- errorCode = extractFeatVecFromTraceGroup(sampleTraceGroup,tempFeatureVec);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::addClass()" << endl;
- LTKReturnError(errorCode);
- }
-
- shapeSampleFeatures.setFeatureVector(tempFeatureVec);
-
- shapeSampleFeatures.setClassID(shapeID);
-
- //Update m_prototypeSet
- errorCode = insertSampleToPrototypeSet(shapeSampleFeatures);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::addClass()" << endl;
- LTKReturnError(errorCode);
- }
-
- //Update m_shapeIDNumPrototypesMap
- m_shapeIDNumPrototypesMap[shapeID]= 1;
-
-
- //Update MDT File
- errorCode = writePrototypeSetToMDTFile();
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::addClass()" << endl;
- LTKReturnError(errorCode);
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NNShapeRecognizer::addClass"<<endl;
- return SUCCESS;
-}
-/******************************************************************************
-* AUTHOR : Anish Kumar
-* DATE : 07-06-2007
-* NAME : addSample
-* DESCRIPTION : Add Sample to given class
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-******************************************************************************/
-int NNShapeRecognizer::addSample(const LTKTraceGroup& sampleTraceGroup, int shapeID)
-{
- // Should be moved to nnInternal
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::addSample()" << endl;
-
- LTKShapeSample shapeSampleFeatures;
-
- if(!m_projectTypeDynamic)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROJ_NOT_DYNAMIC << " " <<
- "Not allowed to ADD shapes to a project with fixed number of shapes"<<
- " NNShapeRecognizer::addSample()" << endl;
-
- LTKReturnError(EPROJ_NOT_DYNAMIC);
- }
-
- //Calculate Features
- int errorCode = SUCCESS;
- vector<LTKShapeFeaturePtr> tempFeatureVec;
-
- errorCode = extractFeatVecFromTraceGroup(sampleTraceGroup,tempFeatureVec);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::addSample()" << endl;
- LTKReturnError(errorCode);
- }
-
- shapeSampleFeatures.setFeatureVector(tempFeatureVec);
-
- shapeSampleFeatures.setClassID(shapeID);
-
- //Update m_prototypeSet
- errorCode = insertSampleToPrototypeSet(shapeSampleFeatures);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::addSample()" << endl;
- LTKReturnError(errorCode);
- }
-
- //Update m_shapeIDNumPrototypesMap
- int currentNum = m_shapeIDNumPrototypesMap[shapeID];
- m_shapeIDNumPrototypesMap[shapeID]= currentNum+1;
-
- //Update MDT File
- errorCode = writePrototypeSetToMDTFile();
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::addSample()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NNShapeRecognizer::addSample"<<endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tarun Madan
- * DATE : 07-06-2007
- * NAME : deleteClass
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::deleteClass(int shapeID)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering NNShapeRecognizer::deleteClass" <<endl;
-
- LTKShapeSample shapeSampleFeatures;
- vector<LTKShapeSample>::iterator prototypeSetIter;
-
- int prototypeSetSize = m_prototypeSet.size();
-
- if(!m_projectTypeDynamic)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EPROJ_NOT_DYNAMIC << " " <<
- "Not allowed to delete shapes to a project with fixed number of Shapes"<<
- " NNShapeRecognizer::deleteClass()" << endl;
-
- LTKReturnError(EPROJ_NOT_DYNAMIC);
- }
-
- //Validate Input Parameters - shapeID
- if(m_shapeIDNumPrototypesMap.find(shapeID) ==m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EINVALID_SHAPEID << " " <<
- "shapeID is not valid"<<
- " NNShapeRecognizer::deleteClass()" << endl;
-
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- //Update m_prototypeSet
- int k =0;
- for (int i=0;i<prototypeSetSize;i++)
- {
- prototypeSetIter = m_prototypeSet.begin() + k;
- int classId = (*prototypeSetIter).getClassID();
-
- if(classId == shapeID)
- {
- m_prototypeSet.erase(prototypeSetIter);
- continue;
- }
- k++;
- prototypeSetIter++;
- }
- //Update m_shapeIDNumPrototypesMap
- m_shapeIDNumPrototypesMap.erase(shapeID);
-
- //Update MDT File
- int returnStatus = writePrototypeSetToMDTFile();
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: " << returnStatus << " " <<
- "Exiting NNShapeRecognizer::deleteClass" <<endl;
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting NNShapeRecognizer::deleteClass" <<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tarun Madan
- * DATE : 09-06-2007
- * NAME : writePrototypeSetToMDTFile
- * DESCRIPTION : Creates a MDTFile with updated m_prototypeSet
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::writePrototypeSetToMDTFile()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::writePrototypeSetToMDTFile()" << endl;
-
- int returnStatus = SUCCESS;
-
- //Flush to MDT only after m_MDTUpdateFreq modifications
- m_prototypeSetModifyCount++;
- if(m_prototypeSetModifyCount == m_MDTUpdateFreq)
- {
- m_prototypeSetModifyCount = 0;
-
- ofstream mdtFileHandle;
- vector<LTKShapeSample> vecShapeSampleFeatures;
- LTKShapeSample shapeSampleFeatures;
-
- vector<LTKShapeSample>::iterator prototypeSetIter;
-
- int prototypeSetSize = m_prototypeSet.size();
-
- //Open the Model data file for writing mode
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::out);
- }
- else
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(),ios::out|ios::binary);
- }
-
-
- //Throw an error if unable to open the Model data file
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- getErrorMessage(EMODEL_DATA_FILE_OPEN) <<
- " NNShapeRecognizer::writePrototypeSetToMDTFile()" << endl;
-
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
-
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- //Write the number of Shapes
- mdtFileHandle << 0 << endl; //Representing Dynamic
- }
- else
- {
- int numShapes = 0;
- mdtFileHandle.write((char*) &numShapes, sizeof(unsigned short));
- }
- prototypeSetIter = m_prototypeSet.begin();
-
- for (int i=0;i<prototypeSetSize;i++)
- {
- int classId = (*prototypeSetIter).getClassID();
- shapeSampleFeatures.setClassID(classId);
- shapeSampleFeatures.setFeatureVector((*prototypeSetIter).getFeatureVector());
-
- vecShapeSampleFeatures.push_back(shapeSampleFeatures);
- prototypeSetIter++;
- }
-
- returnStatus = appendPrototypesToMDTFile(vecShapeSampleFeatures,mdtFileHandle);
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::writePrototypeSetToMDTFile()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- mdtFileHandle.close();
-
- //Updating the Header Information
- updateHeaderWithAlgoInfo();
-
- //Adding header information and checksum generation
- string strModelDataHeaderInfoFile = "";
- LTKCheckSumGenerate cheSumGen;
-
- returnStatus = cheSumGen.addHeaderInfo(
- strModelDataHeaderInfoFile,
- m_nnMDTFilePath,
- m_headerInfo
- );
-
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< returnStatus << " " <<
- " NNShapeRecognizer::writePrototypeSetToMDTFile()" << endl;
-
- LTKReturnError(returnStatus);
- }
-
- vecShapeSampleFeatures.clear();
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NNShapeRecognizer::writePrototypeSetToMDTFile"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Tarun Madan
- * DATE : 09-06-2007
- * NAME : Add Sample to m_prototypeSet
- * DESCRIPTION : Add LTKShapeSample to m_prototypeSet
- *
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::insertSampleToPrototypeSet(const LTKShapeSample &shapeSampleFeatures)
-{
- //Error??
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering NNShapeRecognizer::insertSampleToPrototypeSet"<<endl;
-
- vector<LTKShapeSample>::iterator prototypeSetIter;
- int classID = shapeSampleFeatures.getClassID();
- int maxClassID;
-
- int prototypeSize = m_prototypeSet.size();
- if(prototypeSize > 0)
- {
- maxClassID = m_prototypeSet.at(prototypeSize-1).getClassID();
- }
- else
- {
- maxClassID = LTK_START_SHAPEID;
- }
-
- prototypeSetIter = m_prototypeSet.begin();
-
- if(classID >= maxClassID)
- {
- m_prototypeSet.push_back(shapeSampleFeatures);
- }
- else
- {
- for(;prototypeSetIter!=m_prototypeSet.end();)
- {
- int currentClassId = (*prototypeSetIter).getClassID();
-
- if(currentClassId >= classID)
- {
- m_prototypeSet.insert(prototypeSetIter,shapeSampleFeatures);
- break;
- }
- int count = m_shapeIDNumPrototypesMap[currentClassId];
- prototypeSetIter = prototypeSetIter + count; //To point to first sample of next classID
- }
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting NNShapeRecognizer::insertSampleToPrototypeSet"<<endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Vandana Roy
- * DATE : 05-07-2007
- * NAME : computeConfidence
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::computeConfidence()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::computeConfidence()" << endl;
-
- /******************************************************************/
- /*******************VALIDATING INPUT ARGUMENTS*********************/
- /******************************************************************/
- if(m_neighborInfoVec.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ENEIGHBOR_INFO_VECTOR_EMPTY << " " <<
- getErrorMessage(ENEIGHBOR_INFO_VECTOR_EMPTY) <<
- " NNShapeRecognizer::computeConfidence()" << endl;
-
- LTKReturnError(ENEIGHBOR_INFO_VECTOR_EMPTY);
- }
- // Temporary vector to store the recognition results
- LTKShapeRecoResult outResult;
- vector<pair<int,float> > classIdSimilarityPairVec;
- pair<int, float> classIdSimilarityPair;
-
- // Temporary vector to store the distinct classes appearing in distIndexPairVector
- intVector distinctClassVector;
- intVector::iterator distinctClassVectorIter;
-
- vector <LTKShapeRecoResult>::iterator resultVectorIter = m_vecRecoResult.begin();
- vector <LTKShapeRecoResult>::iterator resultVectorIterEnd = m_vecRecoResult.end();
-
- // Variable to store sum of distances to all the prototypes in distIndexPairVector
- float similaritySum = 0.0f;
- // Temporary variable to store the confidence value.
- float confidence = 0.0f;
-
- // Confidence computation for the NN (1-NN) Classifier
- if(m_nearestNeighbors == 1)
- {
- vector <struct NeighborInfo>::iterator distIndexPairIter = m_neighborInfoVec.begin();
- vector <struct NeighborInfo>::iterator distIndexPairIterEnd = m_neighborInfoVec.end();
-
-
- for(; distIndexPairIter != distIndexPairIterEnd; ++distIndexPairIter)
- {
- //Check if the class is already present in distinctClassVector
- //The complexity of STL's find() is linear, with atmost last-first comparisons for equality
- distinctClassVectorIter = find(distinctClassVector.begin(), distinctClassVector.end(), (*distIndexPairIter).classId);
-
- //The distinctClassVectorIter will point to distinctClassVector.end() if the class is not present in distinctClassVector
- if(distinctClassVectorIter == distinctClassVector.end())
- {
- //outResult.setShapeId( (*distIndexPairIter).classId );
- classIdSimilarityPair.first = (*distIndexPairIter).classId ;
- float similarityValue = SIMILARITY((*distIndexPairIter).distance);
- //outResult.setConfidence(similarityValue);
- classIdSimilarityPair.second = similarityValue;
- similaritySum += similarityValue;
- //m_vecRecoResult.push_back(outResult);
- classIdSimilarityPairVec.push_back(classIdSimilarityPair);
- distinctClassVector.push_back((*distIndexPairIter).classId);
- }
- }
-
- int classIdSimilarityPairVecSize = classIdSimilarityPairVec.size();
- for( int i = 0 ; i < classIdSimilarityPairVecSize ; ++i)
- {
- int classID = classIdSimilarityPairVec[i].first;
- confidence = classIdSimilarityPairVec[i].second;
- confidence /= similaritySum;
- outResult.setConfidence(confidence);
- outResult.setShapeId(classID);
- if(confidence > 0)
- m_vecRecoResult.push_back(outResult);
-
- }
- classIdSimilarityPairVec.clear();
-
- }
- // Computing confidence for k-NN classifier, implementation of the confidence measure described in paper (cite)
- else
- {
- if(m_nearestNeighbors >= m_neighborInfoVec.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "m_nearestNeighbors >= m_prototypeSet.size(), using distIndexPairVector.size() for m_nearestNeighbors instead" << endl;
- m_nearestNeighbors = m_neighborInfoVec.size();
- }
-// vector<pair<int,float> > classIdSimilarityPairVec;
- // pair<int, float> classIdSimilarityPair;
-
- // Variable to store the maximum of the number of samples per class.
- int maxClassSize = (max_element(m_shapeIDNumPrototypesMap.begin(), m_shapeIDNumPrototypesMap.end(), &compareMap))->second;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "maxClassSize: " <<maxClassSize<< endl;
-
- // Vector to store the cumulative similarity values
- vector<float> cumulativeSimilaritySum;
-
- // Populate the values in cumulativeSimilaritySum vector for the top m_nearestNeighbors prototypes
- // Assumption is m_nearestNeighbors >= MIN_NEARESTNEIGHBORS and
- // m_nearestNeighbors < dtwEuclideanFilter, validation done in recognize()
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Displaying cumulativeSimilaritySum..." << endl;
- int i = 0;
- for( i = 0 ; i < m_nearestNeighbors ; ++i)
- {
- //outResult.setShapeId(m_neighborInfoVec[i].classId);
- classIdSimilarityPair.first = m_neighborInfoVec[i].classId;
- float similarityValue = SIMILARITY((m_neighborInfoVec[i]).distance);
-// outResult.setConfidence(similarityValue);
- classIdSimilarityPair.second = similarityValue;
-// classIdSimilarityPairVector.push_back(outResult);
- classIdSimilarityPairVec.push_back(classIdSimilarityPair);
- similaritySum += similarityValue;
- cumulativeSimilaritySum.push_back(similaritySum);
-
- // Logging the cumulative similarity values for debugging
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "classID:" <<
- m_neighborInfoVec[i].classId << " confidence:" <<
- similarityValue << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << i << ": " << similaritySum << endl;
- }
-
-// for(i = 0 ; i < classIdSimilarityPairVector.size() ; ++i)
- for(i = 0 ; i < classIdSimilarityPairVec.size() ; ++i)
- {
-// int classID = classIdSimilarityPairVector[i].getShapeId();
- int classID = classIdSimilarityPairVec[i].first;
-
- int finalNearestNeighbors = 0;
-
- //Check if the class is already present in distinctClassVector
- distinctClassVectorIter = find(distinctClassVector.begin(), distinctClassVector.end(), classID);
-
- //The distinctClassVectorIter will point to distinctClassVector.end() if the class is not present in distinctClassVector
- if(distinctClassVectorIter == distinctClassVector.end())
- {
- distinctClassVector.push_back(classID);
- confidence = 0.0f;
-
- //If the confidence is based on Adaptive k-NN scheme,
- //Computing number of nearest neighbours for the class to be used for computation of confidence
- if(m_adaptivekNN == true )
- {
-
- int sizeProportion = (int)ceil(1.0*m_nearestNeighbors*m_shapeIDNumPrototypesMap[classID]/maxClassSize);
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"sizeProportion of class " <<classID<<" is "<<sizeProportion<<endl;
-
- // Computing min(sizeProportion, m_shapeIDNumPrototypesMap[classID])
- int upperBound = (sizeProportion < m_shapeIDNumPrototypesMap[classID]) ? sizeProportion:m_shapeIDNumPrototypesMap[classID];
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"upperBound: " <<upperBound<<endl;
-
- // Computing max(upperBound, MIN_NEARESTNEIGHBORS)
- finalNearestNeighbors = (MIN_NEARESTNEIGHBORS > upperBound) ? MIN_NEARESTNEIGHBORS:upperBound;
- }
- //Else, compute kNN based confidence
- else if(m_adaptivekNN == false)
- {
- finalNearestNeighbors = m_nearestNeighbors;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Error: " << ECONFIG_FILE_RANGE << " " <<
- "m_adaptivekNN should be true or false" <<
- " NNShapeRecognizer::computeConfidence()" << endl;
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"finalNearestNeighbors: " <<finalNearestNeighbors<<endl;
-
- for( int j = 0 ; j < finalNearestNeighbors ; ++j)
- {
- if(classID == classIdSimilarityPairVec[j].first)
- {
- confidence += classIdSimilarityPairVec[j].second;
- }
- }
- confidence /= cumulativeSimilaritySum[finalNearestNeighbors-1];
-
- outResult.setShapeId(classID);
- outResult.setConfidence(confidence);
-
- if(confidence > 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"classId: " <<classID<<" confidence: "<<confidence<<endl;
-
- m_vecRecoResult.push_back(outResult);
- }
- }
- }
- classIdSimilarityPairVec.clear();
- }
-
- //Sort the result vector in descending order of confidence
- sort(m_vecRecoResult.begin(), m_vecRecoResult.end(), sortResultByConfidence);
-
- //Logging the results at info level
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Printing the Classes and respective Confidences" <<endl;
-
- for( int i=0; i < m_vecRecoResult.size() ; i++)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Class ID: " <<m_vecRecoResult[i].getShapeId()
- <<" Confidence: "<<m_vecRecoResult[i].getConfidence()
- <<endl;
- }
-
- distinctClassVector.clear();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::computeConfidence()" << endl;
-
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : Vandana Roy
- * DATE : 05-07-2007
- * NAME : sortResultByConfidence
- * DESCRIPTION : Sort the LTKShapeRecoResult vector based on the Confidence value
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-bool NNShapeRecognizer::sortResultByConfidence(const LTKShapeRecoResult& x, const LTKShapeRecoResult& y)
-{
- return (x.getConfidence()) > (y.getConfidence());
-}
-/******************************************************************************
- * AUTHOR : Vandana Roy
- * DATE : 05-07-2007
- * NAME : compareMap
- * DESCRIPTION : Sort the STL's map based on the 'value'(second) field
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-bool NNShapeRecognizer::compareMap( const map<int, int>::value_type& lhs, const map<int, int>::value_type& rhs )
-{
- return lhs.second < rhs.second;
-}
-
-/******************************************************************************
- * AUTHOR : Tarun Madan
- * DATE : 08-07-2007
- * NAME : getTraceGroup
- * DESCRIPTION :
- *
- * ARGUMENTS :
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int NNShapeRecognizer::getTraceGroups(int shapeID, int numberOfTraceGroups,
- vector<LTKTraceGroup> &outTraceGroups)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering NNShapeRecognizer::getTraceGroups"
- <<endl;
-
- if(m_shapeIDNumPrototypesMap.find(shapeID) == m_shapeIDNumPrototypesMap.end())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_SHAPEID << " " <<
- getErrorMessage(EINVALID_SHAPEID) <<
- " NNShapeRecognizer::getTraceGroups()" << endl;
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- if(m_shapeIDNumPrototypesMap[shapeID] < numberOfTraceGroups)
- {
- numberOfTraceGroups = m_shapeIDNumPrototypesMap[shapeID];
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Number of TraceGroup in PrototypeSet is less than specified."
- << "Returning all TraceGroups :"
- << numberOfTraceGroups <<endl;
- }
-
- vector<LTKShapeSample>::iterator prototypeSetIter = m_prototypeSet.begin();
- int counter =0;
- for(;prototypeSetIter!=m_prototypeSet.end();)
- {
- int currentShapeId = (*prototypeSetIter).getClassID();
-
- if(currentShapeId == shapeID)
- {
- LTKTraceGroup traceGroup;
-
- int errorCode = m_ptrFeatureExtractor->convertFeatVecToTraceGroup(
- (*prototypeSetIter).getFeatureVector(),
- traceGroup);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::getTraceGroups()" << endl;
-
- LTKReturnError(errorCode);
- }
- outTraceGroups.push_back(traceGroup);
-
- counter++;
- if(counter==numberOfTraceGroups)
- break;
-
- prototypeSetIter++;
- }
- else
- {
- //To point to first sample of next classID
- int offset = m_shapeIDNumPrototypesMap[currentShapeId];
- prototypeSetIter = prototypeSetIter + offset;
- }
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting NNShapeRecognizer::getTraceGroups"
- <<endl;
- return SUCCESS;
-}
-
-/***********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 19-01-2007
- * NAME : initializePreprocessor
- * DESCRIPTION : This method is used to initialize the PreProcessor
- * ARGUMENTS : preprocDLLPath : string : Holds the Path of the Preprocessor DLL,
- * returnStatus : int : Holds SUCCESS or Error Values, if occurs
- * RETURNS : preprocessor instance
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::initializePreprocessor(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocInstance)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::initializePreprocessor()" << endl;
-
- FN_PTR_CREATELTKLIPIPREPROCESSOR createLTKLipiPreProcessor = NULL;
- int errorCode;
-
- // Load the DLL with path=preprocDLLPath
- void* functionHandle = NULL;
-
- int returnVal = m_OSUtilPtr->loadSharedLib(controlInfo.lipiLib, PREPROC, &m_libHandler);
-
-
- if(returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ELOAD_PREPROC_DLL << " " <<
- getErrorMessage(ELOAD_PREPROC_DLL) <<
- " NNShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(ELOAD_PREPROC_DLL);
- }
-
- // Map createpreprocessor and deletePreprocessor functions
- returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandler,
- CREATEPREPROCINST,
- &functionHandle);
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- //Unload the dll
- unloadPreprocessorDLL();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EDLL_FUNC_ADDRESS_CREATE << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_CREATE) <<
- " NNShapeRecognizer::initializePreprocessor()" << endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS_CREATE);
- }
-
- createLTKLipiPreProcessor = (FN_PTR_CREATELTKLIPIPREPROCESSOR)functionHandle;
-
- functionHandle = NULL;
-
- // Map createpreprocessor and deletePreprocessor functions
- returnVal = m_OSUtilPtr->getFunctionAddress(m_libHandler,
- DESTROYPREPROCINST,
- &functionHandle);
- // Could not map the createLipiPreprocessor function from the DLL
- if(returnVal != SUCCESS)
- {
- //Unload the dll
- unloadPreprocessorDLL();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EDLL_FUNC_ADDRESS_CREATE << " " <<
- getErrorMessage(EDLL_FUNC_ADDRESS_CREATE) <<
- " NNShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(EDLL_FUNC_ADDRESS_CREATE);
- }
-
- m_deleteLTKLipiPreProcessor = (FN_PTR_DELETELTKLIPIPREPROCESSOR)functionHandle;
-
- // Create preprocessor instance
- errorCode = createLTKLipiPreProcessor(controlInfo, preprocInstance);
-
- if(errorCode!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(errorCode);
- }
-
- // Could not create a LTKLipiPreProcessor
- if(*preprocInstance == NULL)
- {
- // Unload the DLL
- unloadPreprocessorDLL();
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< ECREATE_PREPROC << " " <<
- getErrorMessage(ECREATE_PREPROC) <<
- " NNShapeRecognizer::initializePreprocessor()" << endl;
- LTKReturnError(ECREATE_PREPROC);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::initializePreprocessor()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
- * AUTHOR : Saravanan R.
- * DATE : 23-Jan-2007
- * NAME : trainLvq
- * DESCRIPTION : This function is the train method using LVQ
- * ARGUMENTS :
- * RETURNS : SUCCESS : if training done successfully
- * errorCode : if traininhas some errors
- * NOTES :
- * CHANGE HISTROY
- * Author Naveen Sundar G Date Description
- * Balaji MNA 13th Jan, 2011 Prototype set must be emptied before
- * returning from call to LVQ train
- *************************************************************************************/
-int NNShapeRecognizer::trainLVQ(const string& inputFilePath,
- const string &strModelDataHeaderInfoFile,
- const string& inFileType)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::trainLVQ()" << endl;
- //Time calculation requirements
-
- int errorCode = SUCCESS;
- m_OSUtilPtr->recordStartTime();
-
- //Time at the beginning of Train LVQ
- if(LTKSTRCMP(inFileType.c_str(), INK_FILE) == 0)
- {
- //If the Input file is UNIPEN Ink file
- errorCode = trainFromListFile(inputFilePath);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainLVQ()" << endl;
-
- LTKReturnError(errorCode);
- }
- }
- else if(LTKSTRCMP(inFileType.c_str(), FEATURE_FILE) == 0)
- {
- //If the Input file is Feature file
- errorCode = trainFromFeatureFile(inputFilePath);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainLVQ()" << endl;
-
- LTKReturnError(errorCode);
- }
- PreprocParametersForFeatureFile(m_headerInfo);
-
- }
-
- // Now the Clustered ShapeSamples are stored in "prototypeSet"
- // Already computed "trainVec" contains all of the training data
-
- //Learning Part
- if(m_prototypeReductionFactor != 0)
- {
- errorCode = processPrototypeSetForLVQ();
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainLVQ()" << endl;
-
- LTKReturnError(errorCode);
- }
- }
-
- ofstream mdtFileHandle;
-
- //Open the model data file
- if (m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::app);
- }
- else
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::app | ios::binary);
- }
-
- //If file not opened throw an exception
- if(!mdtFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- " Unable to open model data file : " <<m_nnMDTFilePath<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
- //Writing results to the Model Data file
- errorCode = appendPrototypesToMDTFile(m_prototypeSet,mdtFileHandle);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainLVQ()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- //Close the Model Data file
- mdtFileHandle.close();
-
- //Updating the Header Information
- updateHeaderWithAlgoInfo();
-
- //Adding header information and checksum generation
- LTKCheckSumGenerate cheSumGen;
- errorCode = cheSumGen.addHeaderInfo(strModelDataHeaderInfoFile, m_nnMDTFilePath, m_headerInfo);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainLVQ()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- //Time at the end of LVQ training
- m_OSUtilPtr->recordEndTime();
-
- m_prototypeSet.clear();
-
- string timeTaken = "";
- m_OSUtilPtr->diffTime(timeTaken);
-
- cout << "Time Taken = " << timeTaken << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::trainLVQ()" << endl;
- return SUCCESS;
-}
-/******************************************************************************
- * AUTHOR : Saravanan
- * DATE : 22-02-2007
- * NAME : processPrototypeSetForLVQ
- * DESCRIPTION :
- * ARGUMENTS :
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Naveen Sundar G. Date 11-Oct-2007 Description
- ******************************************************************************/
-int NNShapeRecognizer::processPrototypeSetForLVQ()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::processPrototypeSetForLVQ()" << endl;
- //Reference : http://www.cis.hut.fi/research/lvq_pak/lvq_doc.txt
- LTKShapeSample bestShapeSample;
-
- int codeVecIndex = 5;
- int trainSize = m_trainSet.size() ;
- int train_index = 0;
-
- //Number of iterations for LVQ
- long length = m_prototypeSet.size() * m_LVQIterationScale;
- long iter ;
- long index;
- // learning parameter
- double c_alpha=m_LVQInitialAlpha;
-
- int errorCode = SUCCESS;
-
- // initialize random seed
- unsigned int randSeedVal ;
-
- #ifdef WINCE
- char szTime[10] ;
- SYSTEMTIME st ;
- GetLocalTime(&st) ;
- sprintf(szTime, "%d%d%d", st.wHour, st.wMinute, st.wSecond) ;
- randSeedVal = atoi(szTime);
- #else
- randSeedVal = time(NULL);
- #endif
- srand(randSeedVal) ;
-
- for (iter=0; iter < length; ++iter )
- {
-
-
- cout<<"\n Amount of LVQ Training Completed = "<<(double)iter*100/length<<" %\n\n Current Value of Alpha \t = "<<c_alpha<<"\n";
- //To take the train vector at a random index
- index = rand()%trainSize;
- errorCode = trainRecognize(m_trainSet.at(index), bestShapeSample, codeVecIndex);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::morphVector()" << endl;
-
- LTKReturnError(errorCode);
- }
-
-
- if(bestShapeSample.getClassID() == m_trainSet.at(index).getClassID())
- {
- //Move the codeVec closer (Match)
- c_alpha = linearAlpha(iter,length,m_LVQInitialAlpha,c_alpha,+1);
- errorCode = morphVector(m_trainSet.at(index), -c_alpha, bestShapeSample);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::morphVector()" << endl;
-
- LTKReturnError(errorCode);
- }
- }
- else
- {
- //Move the codeVec away (No Match)
- c_alpha = linearAlpha(iter,length,m_LVQInitialAlpha,c_alpha,-1);
- errorCode = morphVector(m_trainSet.at(index), c_alpha, bestShapeSample);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::morphVector()" << endl;
-
- LTKReturnError(errorCode);
- }
- }
-
- //Now update the prototypeSet with the morphed vector
-
- const vector<LTKShapeFeaturePtr>& tempFeatVec = (bestShapeSample).getFeatureVector();
- m_prototypeSet.at(codeVecIndex).setFeatureVector(tempFeatVec);
- }
-
- m_trainSet.clear();
-
- cout<<"\n Amount of LVQ Training Completed = "<<(double) 100<<" %\n\n Current Value of Alpha \t = "<<c_alpha<<"\n\n\n";
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::processPrototypeSetForLVQ()" << endl;
- return SUCCESS;
-}
-
-/******************************************************************************
- * AUTHOR : N. Sridhar Krishna
- * DATE : 24-03-2006
- * NAME : linearAlpha
- * DESCRIPTION : this function is called from trainLVQ - linearly decreasing learning parameter in learing vector quantization
- * ARGUMENTS :
- * RETURNS : learning parameter (alpha)
- * NOTES :
- * CHANGE HISTROY
- * Author Naveen Sundar G. Date 11-Oct-2007 Description
- ******************************************************************************/
-float NNShapeRecognizer:: linearAlpha(long iter, long length, double& initialAlpha, double lastAlpha,int correctDecision)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::linearAlpha()" << endl;
- // return ( (initialAlpha * ( ( (double) (length - iter)) / (double) length )));
- // return (alpha *( (double ) 1/iter));
-
- // Reference : http://www.cis.hut.fi/research/lvq_pak/lvq_doc.txt
-
- float currentAlpha;
- currentAlpha=lastAlpha/(1+correctDecision*lastAlpha);
-
- if (currentAlpha >initialAlpha)
- currentAlpha=initialAlpha;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::linearAlpha()" << endl;
-
- return currentAlpha;
-
-}
-
-/**********************************************************************************
-* AUTHOR : N. Sridhar Krishna
-* DATE : 24-03-2006
-* NAME : morphVector
-* DESCRIPTION : This function does the reshaping of prototype vector (called from trainLVQ)
-* ARGUMENTS : The input parameters are the code vector, data vector (learning example in the context of LVQ), and alpha (learning parameter)
-* @param bestcodeVec is the character which we are trying to morph
-* the function modifies the character bestcodeVec
-* RETURNS : SUCCESS on successful training
-* NOTES :
-* CHANGE HISTROY
-* Author Naveen Sundar G. Date Description
-*************************************************************************************/
-int NNShapeRecognizer::morphVector(const LTKShapeSample& dataShapeSample,
- double talpha, LTKShapeSample& bestShapeSample)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Enter NNShapeRecognizer::morphVector"<<endl;
-
- vector<LTKShapeFeaturePtr> bestFeatureVector = bestShapeSample.getFeatureVector();
- const vector<LTKShapeFeaturePtr>& dataFeatureVector = dataShapeSample.getFeatureVector();
-
- int index=0;
- int bestFVSize = bestFeatureVector.size();
- int dataFVSize = dataFeatureVector.size();
-
- int errorCode = SUCCESS;
-
- if(bestFVSize !=dataFVSize)
- {
- LTKReturnError(EMORPH_FVEC_SIZE_MISMATCH);
- }
-
- float temp1 = 0;
-
-
-
- for(index=0; index < bestFVSize ; ++index)
- {
- LTKShapeFeaturePtr temp1;
- LTKShapeFeaturePtr temp2;
- LTKShapeFeaturePtr temp3;
-
-
- errorCode = bestFeatureVector[index]->subtractFeature(dataFeatureVector[index],temp1);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::morphVector()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- errorCode = temp1->scaleFeature(talpha,temp2);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::morphVector()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- errorCode = bestFeatureVector[index]->addFeature(temp2,temp3);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::morphVector()" << endl;
-
- LTKReturnError(errorCode);
- }
-
- bestFeatureVector[index] = temp3;
-
- }
-
- bestShapeSample.setFeatureVector(bestFeatureVector);
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exit NNShapeRecognizer::morphVector"<<endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
- * AUTHOR : N. Sridhar Krishna
- * DATE : 23-03-2006
- * NAME : trainRecognize (overloaded with 4 args)
- * DESCRIPTION : This function does the recognition function required for training phase (called from trainLVQ)
- * ARGUMENTS : The input parameter are the inFeatureVector, which is compared with the existing set of prototypes and then the matched code vector and along with its index (and also the shape id) is returned
- * @param inFeatureVector is the character which we are trying to recognise.
- * @param returnshapeID is the value of the matched character which is returned, codeCharacter is the matched prototype (code vector) vector, and codeVecIndex is the matched prototype (code vector) index
- * RETURNS : SUCCESS on successful reading of the allocation statistics
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-int NNShapeRecognizer::trainRecognize(LTKShapeSample& inShapeSample,
- LTKShapeSample& bestShapeSample,int& codeVecIndex)
-
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::trainRecognize()" << endl;
- //Variable to store the Euclidean distance.
- float localDistance = 0.0;
-
- //Iterator for prototypeSet
- vector <LTKShapeSample>::const_iterator prototypeSetIter = m_prototypeSet.begin();
- vector <LTKShapeSample>::const_iterator prototypeSetIterEnd = m_prototypeSet.end();
-
- //The top choice index
- int bestIndex = 0;
-
- //The top choice distance (FLT_MAX indicates the maximum value for float)
- float bestMinDist = FLT_MAX;
-
- int errorCode = SUCCESS;
-
- for(int j = 0; prototypeSetIter != prototypeSetIterEnd; ++prototypeSetIter, j++)
- {
- localDistance=0;
- if(LTKSTRCMP(m_LVQDistanceMeasure.c_str(), EUCLIDEAN_DISTANCE) == 0)
- {
- errorCode = computeEuclideanDistance(*prototypeSetIter,
- inShapeSample,
- localDistance);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::trainRecognize()" << endl;
-
- LTKReturnError(errorCode);
- }
- }
- if(LTKSTRCMP(m_LVQDistanceMeasure.c_str(), DTW_DISTANCE) == 0)
- {
- errorCode = computeDTWDistance(*prototypeSetIter,
- inShapeSample,
- localDistance);
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << errorCode << " " <<
- " NNShapeRecognizer::trainRecognize()" << endl;
-
- LTKReturnError(errorCode);
- }
- }
-
- //BestSofar Value for BSF computation using Euclidean distance
- if(bestMinDist > localDistance )
- {
- //bestMinDist is the Minimum Distance
- bestMinDist = localDistance;
- //bestIndex is the best match for the given character
- bestIndex = j;
- }
- }
-
- //Get the shape id of the best match from the prototypeSet
- bestShapeSample.setClassID((m_prototypeSet.at(bestIndex)).getClassID());
-
- //Get the Feature vector of the best match from the prototypeSet
- const vector<LTKShapeFeaturePtr>& tempFeatureVector =
- (m_prototypeSet.at(bestIndex)).getFeatureVector();
- bestShapeSample.setFeatureVector(tempFeatureVector);
-
- codeVecIndex = bestIndex ;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::trainRecognize()" << endl;
- return SUCCESS;
-}
-
-
-/**********************************************************************************
- * AUTHOR : Saravanan. R
- * DATE : 25-01-2007
- * NAME : deletePreprocessor
- * DESCRIPTION : This method is used to deletes the PreProcessor instance
- * ARGUMENTS : ptrPreprocInstance : Holds the pointer to the LTKPreprocessorInterface
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *************************************************************************************/
-
-//int NNShapeRecognizer::deletePreprocessor(LTKPreprocessorInterface *ptrPreprocInstance)
-int NNShapeRecognizer::deletePreprocessor()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::deletePreprocessor()" << endl;
-
- //deleting the preprocessor instance
- if(m_ptrPreproc != NULL)
- {
- m_deleteLTKLipiPreProcessor(m_ptrPreproc);
- m_ptrPreproc = NULL;
- }
-
- //Unload the dll
- int returnStatus = unloadPreprocessorDLL();
- if(returnStatus != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
- getErrorMessage(returnStatus) <<
- " NNShapeRecognizer::deletePreprocessor()" << endl;
- LTKReturnError(returnStatus);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::deletePreprocessor()" << endl;
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-01-2007
- * NAME : unloadPreprocessorDLL
- * DESCRIPTION : This method is used to Unloads the preprocessor DLL.
- * ARGUMENTS : none
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ****************************************************************************/
-int NNShapeRecognizer::unloadPreprocessorDLL()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::unloadPreprocessorDLL()" << endl;
-
-
- //Check the preprocessor DLL was loaded already
- if(m_libHandler != NULL)
- {
- //Unload the DLL
- m_OSUtilPtr->unloadSharedLib(m_libHandler);
- m_libHandler = NULL;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::unloadPreprocessorDLL()" << endl;
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Srinivasa Vithal, Ch
- * DATE : 20-06-2008
- * NAME : validatePreprocParameters
- * DESCRIPTION : This method is used to validate the preproc parameters with
- * mdt header values
- * ARGUMENTS : none
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ****************************************************************************/
-int NNShapeRecognizer::validatePreprocParameters(stringStringMap& headerSequence)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::validatePreprocParameters()" << endl;
- string tempStrVar = "";
- string headerValue = "";
- int headerValueInt = 0;
- float headerValueFloat = 0.0f;
- int tempIntegerValue = 0;
- float tempFloatValue = 0.0f;
-
- //preproc sequence
- string mdtPreprocSeqn = headerSequence[PREPROC_SEQ];
- if(LTKSTRCMP(m_preProcSeqn.c_str(), mdtPreprocSeqn.c_str()) != 0 &&
- LTKSTRCMP("NA", mdtPreprocSeqn.c_str()) != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preprocSeqn in config file ("<<
- m_preProcSeqn <<") does not match with the value in MDT file ("<<
- mdtPreprocSeqn <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- //ResampTraceDimension
- headerValue = "";
- if(LTKSTRCMP("NA", headerSequence[TRACE_DIM].c_str()) != 0)
- {
- headerValueInt = atoi(headerSequence[TRACE_DIM].c_str());
- tempIntegerValue = m_ptrPreproc->getTraceDimension();
-
- if(headerValueInt != tempIntegerValue )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of TraceDimension in config file ("<<
- tempIntegerValue<<") does not match with the value in MDT file ("<<
- headerValueInt <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
- // preserve aspect ratio
- bool preProcPreserveAspectRatio = m_ptrPreproc->getPreserveAspectRatio();
- tempStrVar = "false";
- if (preProcPreserveAspectRatio == true)
- {
- tempStrVar = "true";
- }
-
- if(LTKSTRCMP((headerSequence[PRESER_ASP_RATIO]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[PRESER_ASP_RATIO]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcPreserveAspectRatio in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[PRESER_ASP_RATIO] <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- //NormPreserveRelativeYPosition
- bool preProcNormPreserveRelativeYPosition = m_ptrPreproc->getPreserveRealtiveYPosition();
- tempStrVar = "false";
- if (preProcNormPreserveRelativeYPosition == true)
- {
- tempStrVar = "true";
- }
-
- if(LTKSTRCMP((headerSequence[PRESER_REL_Y_POS]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[PRESER_REL_Y_POS]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormPreserveRelativeYPosition in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[PRESER_REL_Y_POS] <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
- // NormPreserveAspectRatioThreshold
- tempFloatValue = m_ptrPreproc->getAspectRatioThreshold();
- if(LTKSTRCMP((headerSequence[ASP_RATIO_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[ASP_RATIO_THRES]);
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcPreserveAspectRatioThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
- // NormLineWidthThreshold
- if(LTKSTRCMP((headerSequence[DOT_SIZE_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[DOT_SIZE_THRES]);
- tempFloatValue = m_ptrPreproc->getSizeThreshold();
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormLineWidthThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
-
- // NormDotSizeThreshold
- if(LTKSTRCMP((headerSequence[DOT_THRES]).c_str(), "NA") != 0)
- {
- headerValueFloat = LTKStringUtil::convertStringToFloat(headerSequence[DOT_THRES]);
- tempFloatValue = m_ptrPreproc->getDotThreshold();
-
- if(headerValueFloat != tempFloatValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcNormDotSizeThreshold in config file ("<<
- tempFloatValue<<") does not match with the value in MDT file ("<<
- headerValueFloat <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
- //ResampPointAllocation
- tempStrVar = "";
- tempStrVar = m_ptrPreproc->getResamplingMethod();
- if(LTKSTRCMP((headerSequence[RESAMP_POINT_ALLOC]).c_str(), tempStrVar.c_str()) != 0 &&
- LTKSTRCMP((headerSequence[RESAMP_POINT_ALLOC]).c_str(), "NA") != 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcResampPointAllocation in config file ("<<
- tempStrVar<<") does not match with the value in MDT file ("<<
- headerSequence[RESAMP_POINT_ALLOC] <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
-
-
- //SmoothWindowSize
- if(LTKSTRCMP((headerSequence[SMOOTH_WIND_SIZE]).c_str(), "NA") != 0)
- {
- headerValueInt = atoi(headerSequence[SMOOTH_WIND_SIZE].c_str());
- tempIntegerValue = m_ptrPreproc->getFilterLength();
-
- if(headerValueInt != tempIntegerValue)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< ECONFIG_MDT_MISMATCH << " " <<
- "Value of preProcSmoothWindowSize in config file ("<<
- tempIntegerValue<<") does not match with the value in MDT file ("<<
- headerValueInt <<")"<<
- " NNShapeRecognizer::loadModelData()" << endl;
- LTKReturnError(ECONFIG_MDT_MISMATCH);
- }
- }
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::validatePreprocParameters()" << endl;
- return SUCCESS;
-
-}
-/******************************************************************************
- * AUTHOR : Saravanan
- * DATE : 22-02-2007
- * NAME : trainFromFeatureFile
- * DESCRIPTION : This method will do the training by giving the Feature
- * file as input
- * ARGUMENTS :
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-
-int NNShapeRecognizer::trainFromFeatureFile(const string& featureFilePath)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::trainFromFeatureFile()" << endl;
-
- //Count for the no. of samples read for a shape
- int sampleCount = 0;
-
- //Count of the no. of shapes read so far
- int shapeCount = 0;
-
- //ID for each shapes
- int shapeId = -1;
-
- //classId of the character
- int prevClassId = -1;
-
- //Flag to skip reading a newline in the list file, when a new class starts
- bool lastshapeIdFlag = false;
-
- //Flag is set when EOF is reached
- bool eofFlag = false;
-
- //Line from the list file
- string line = "";
-
- //Indicates the first class
- bool initClassFlag = false;
-
- //Output Stream for MDT file
- ofstream mdtFileHandle;
-
- //Input Stream for feature file
- ifstream featureFileHandle;
-
- LTKShapeSample shapeSampleFeatures;
-
- vector<LTKShapeSample> shapeSamplesVec;
-
- vector<LTKShapeSample> clusteredShapeSampleVec;
-
-
- //Opening the feature file for reading mode
- featureFileHandle.open(featureFilePath.c_str(), ios::in);
-
- //Throw an error if unable to open the training list file
- if(!featureFileHandle)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EFEATURE_FILE_OPEN << " " <<
- getErrorMessage(EFEATURE_FILE_OPEN) <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(EFEATURE_FILE_OPEN);
-
- }
- //Open the Model data file for writing mode
- if ( m_MDTFileOpenMode == NN_MDT_OPEN_MODE_ASCII )
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::out);
- }
- else
- {
- mdtFileHandle.open(m_nnMDTFilePath.c_str(), ios::out|ios::binary);
- }
-
- //Return error if unable to open the Model data file
- if(!mdtFileHandle)
- {
- featureFileHandle.close();
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< EMODEL_DATA_FILE_OPEN << " " <<
- getErrorMessage(EMODEL_DATA_FILE_OPEN) <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- //Reading feature file header
- getline(featureFileHandle, line, NEW_LINE_DELIMITER);
- stringStringMap headerSequence;
- int errorCode = SUCCESS;
- errorCode = m_shapeRecUtil.convertHeaderToStringStringMap(line, headerSequence);
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(errorCode);
- }
-
-
-
- //Write the number of Shapes
- mdtFileHandle << m_numShapes << endl;
-
- //write Trace Dimension of input vector into the file
- // mdtFileHandle << m_traceDimension << endl;
-
-
- while(!featureFileHandle.eof())
- {
- if( lastshapeIdFlag == false )
- {
- //Get a line from the feature file
- getline(featureFileHandle, line, NEW_LINE_DELIMITER);
-
- if( featureFileHandle.eof() )
- {
- eofFlag = true;
- }
-
- if((getShapeSampleFromString(line, shapeSampleFeatures) != SUCCESS) && (eofFlag == false) )
- continue;
-
- shapeId = shapeSampleFeatures.getClassID();
-
- if(eofFlag == false)
- {
- if(shapeId < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "The NN Shape recognizer requires training file class Ids to be positive integers and listed in the increasing order" <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- errorCode = EINVALID_SHAPEID;
- break;
- }
- else if(shapeId < prevClassId)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<<
- "Shape IDs in the train list file should be in the increasing order. Please use scripts/validateListFile.pl to generate list files." <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- errorCode = EINVALID_ORDER_LISTFILE;
- break;
- }
- }
-
- if( initClassFlag == false )
- {
- initClassFlag = true;
- prevClassId=shapeId;
- }
-
- }
- else //Do not read next line during this iteration
- {
- //flag unset to read next line during the next iteration
- lastshapeIdFlag = false;
- }
- // Sample of the same class seen, keep pushing to the shapeSamplesVec
- if( shapeId == prevClassId )
- {
- shapeSamplesVec.push_back(shapeSampleFeatures);
- ++sampleCount;
- //All the samples are pushed to trainSet used only for trainLVQ
- //trainSet was NULL for Clustering and not NULL for LVQ
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_LVQ)
- == 0 && m_prototypeReductionFactor != 0)
- m_trainSet.push_back(shapeSampleFeatures);
-
- shapeSampleFeatures.clearShapeSampleFeatures();
- }
- // Sample of a new class seen, or end of feature file reached, train the recognizer on the samples of the previous class
- if( shapeId != prevClassId || eofFlag == true )
- {
- //Increase shape count only if there are atleast one sample per class
- if( sampleCount > 0 )
- shapeCount++;
-
- //check that shapecount must not be greater than specified number
- //of shapes, if projecttype was not dynamic
- if( !m_projectTypeDynamic && shapeCount > m_numShapes )
- {
- errorCode = EINVALID_NUM_OF_SHAPES;
- break;
- }
-
- if( shapeCount > 0 && sampleCount > 0 )
- {
- errorCode = performClustering(shapeSamplesVec, clusteredShapeSampleVec);
-
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(errorCode);
- }
-
-
- if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_LVQ) == 0)
- {
- //Push all the samples after clustering into prototypeSet
- for( int i = 0; i < clusteredShapeSampleVec.size(); ++i )
- {
- m_prototypeSet.push_back(clusteredShapeSampleVec[i]);
- }
- }
- else if(LTKSTRCMP(m_prototypeSelection.c_str(), PROTOTYPE_SELECTION_CLUSTERING) == 0)
- {
- //Writing results to the MDT file
- errorCode = appendPrototypesToMDTFile(clusteredShapeSampleVec, mdtFileHandle);
- if( errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(errorCode);
- }
- }
-
- //Clearing the shapeSampleVector and clusteredShapeSampleVector
-
- clusteredShapeSampleVec.clear();
- shapeSamplesVec.clear();
- //Resetting sampleCount for the next class
- sampleCount = 0;
-
- //Set the flag so that the already read line of next class in the list file is not lost
- lastshapeIdFlag = true;
-
- prevClassId = shapeId;
- }
- }
- }
-
- featureFileHandle.close();
- mdtFileHandle.close();
-
- if(!m_projectTypeDynamic && shapeCount != m_numShapes)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< EINVALID_NUM_OF_SHAPES << " " <<
- getErrorMessage(EINVALID_NUM_OF_SHAPES) <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(EINVALID_NUM_OF_SHAPES);
- }
-
- if(errorCode != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "<< errorCode << " " <<
- " NNShapeRecognizer::trainFromFeatureFile()" << endl;
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::trainFromFeatureFile()" << endl;
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Balaji MNA
- * DATE : 01-DEC-2008
- * NAME : validatePreprocParameters
- * DESCRIPTION : This method is used to update the preproc parameters for
- * featurefile
- * ARGUMENTS : none
- * RETURNS : none
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ****************************************************************************/
-int NNShapeRecognizer::PreprocParametersForFeatureFile(stringStringMap& headerSequence)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
- "NNShapeRecognizer::PreprocParametersForFeatureFile()" << endl;
-
- //preproc sequence
- headerSequence[PREPROC_SEQ] = "NA";
- //ResampTraceDimension
- headerSequence[TRACE_DIM] = "NA";
- // preserve aspect ratio
- headerSequence[PRESER_ASP_RATIO] = "NA";
- //NormPreserveRelativeYPosition
- headerSequence[PRESER_REL_Y_POS] = "NA";
- // NormPreserveAspectRatioThreshold
- headerSequence[ASP_RATIO_THRES] = "NA";
- // NormLineWidthThreshold
- headerSequence[DOT_SIZE_THRES] = "NA";
- // NormDotSizeThreshold
- headerSequence[DOT_THRES] = "NA";
- //ResampPointAllocation
- headerSequence[RESAMP_POINT_ALLOC] = "NA";
- //SmoothWindowSize
- headerSequence[SMOOTH_WIND_SIZE] = "NA";
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
- "NNShapeRecognizer::PreprocParametersForFeatureFile()" << endl;
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-Aug-2007
-* NAME : adapt
-* DESCRIPTION : adapt recent recognized sample
-* ARGUMENTS : shapeID : True shapeID of sample
-* RETURNS : Success : If sample was adapted successfully
-* Failure : Returns Error Code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int NNShapeRecognizer::adapt(int shapeId)
-{
- try{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Enter NNShapeRecognizer::adapt()"<<endl;
-
- //Validate shapeID
- map<int,int>::iterator m_shapeIDNumPrototypesMapIter;
- if(m_shapeIDNumPrototypesMap.find(shapeId) == m_shapeIDNumPrototypesMap.end())
- {
- LTKReturnError(EINVALID_SHAPEID);
- }
-
- //Adaptation Code
- LTKAdapt* adaptObj = LTKAdapt::getInstance(this);
-
- int nErrorCode;
- nErrorCode = adaptObj->adapt(shapeId);
- if(nErrorCode !=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during NNShapeRecognizer::adapt()"<<endl;
- LTKReturnError(nErrorCode);
- }
-
- //Clear Variables cached
- m_neighborInfoVec.clear();
- m_vecRecoResult.clear();
-
- }
- catch(...)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during NNShapeRecognizer::adapt()"<<endl;
- return FAILURE;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Exit NNShapeRecognizer::adapt()"<<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 30-Aug-2007
-* NAME : adapt
-* DESCRIPTION : adapt sample passed as argument
-* ARGUMENTS : sampleTraceGroup : TraceGroup of sample to be adapted
-* shapeID : True shapeID of sample
-* RETURNS : Success : If sample was adapted successfully
-* Failure : Returns Error Code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int NNShapeRecognizer::adapt(const LTKTraceGroup& sampleTraceGroup, int shapeId )
-{
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Enter NNShapeRecognizer::Adapt()"<<endl;
-
- vector<int> vecSubSet;
- vector<LTKShapeRecoResult> vecRecoResult;
- LTKScreenContext objScreenContext;
- int nErrorCode;
- nErrorCode = recognize(
- sampleTraceGroup,
- objScreenContext,
- vecSubSet,
- CONF_THRESHOLD_FILTER_OFF,
- NN_DEF_RECO_NUM_CHOICES,
- vecRecoResult
- );
-
- if(nErrorCode !=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during call to recognize in NNShapeRecognizer::Adapt()"<<endl;
- LTKReturnError(nErrorCode);
- }
-
- nErrorCode = adapt(shapeId);
- if(nErrorCode !=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- << "Error during NNShapeRecognizer::Adapt()"<<endl;
- LTKReturnError(nErrorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Exit NNShapeRecognizer::Adapt()"<<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Tarun Madan
-* DATE : 8-Oct-2007
-* NAME : deleteAdaptInstance
-* DESCRIPTION : delete AdaptInstance
-* ARGUMENTS :
-* RETURNS : None
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int NNShapeRecognizer::deleteAdaptInstance()
-{
- //Implemented as deleteAdaptInstance is called by ~NNShapeRecognizer
- //and adaptObj object is not available in NN.cpp
-
- LTKAdapt *adaptInstance = LTKAdapt::getInstance(this);
- if(adaptInstance)
- {
- adaptInstance->deleteInstance();
- }
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h
deleted file mode 100644
index cce1baf0..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/NNShapeRecognizer.h
+++ /dev/null
@@ -1,1178 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-08-23 13:31:44 +0530 (Tue, 23 Aug 2011) $
- * $Revision: 865 $
- * $Author: jitender $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for NN Shape Recognition module
- *
- * CONTENTS:
- *
- * AUTHOR: Saravanan R.
- *
- * DATE: January 23, 2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __NNSHAPERECOGNIZER_H
-#define __NNSHAPERECOGNIZER_H
-
-/** Include files */
-#include "LTKInc.h"
-#include "LTKTypes.h"
-#include "LTKTrace.h"
-#include "LTKMacros.h"
-#include "LTKShapeRecognizer.h"
-#include "LTKShapeRecoUtil.h"
-#include "LTKShapeSample.h"
-#include "LTKCheckSumGenerate.h"
-#include "LTKDynamicTimeWarping.h"
-
-/** Forward declaration of classes */
-class LTKTraceGroup;
-class LTKPreprocessorInterface;
-class LTKShapeSample;
-class LTKShapeFeatureExtractor;
-class LTKShapeFeature;
-
-#define SIMILARITY(distance) (1 / (distance + EPS ))
-#define SUPPORTED_MIN_VERSION "3.0.0"
-
-class LTKAdapt;
-
-typedef int (*FN_PTR_LOCAL_DISTANCE)(LTKShapeFeaturePtr, LTKShapeFeaturePtr,float&);
-typedef int (*FN_PTR_CREATELTKLIPIPREPROCESSOR)(const LTKControlInfo& , LTKPreprocessorInterface** );
-typedef int (*FN_PTR_DELETELTKLIPIPREPROCESSOR)(LTKPreprocessorInterface* );
-
-
-/**
- * @ingroup NNShapeRecognizer.h
- * @brief The Header file for the NNShapeRecognizer
- * @class NNShapeRecognizer
- *<p> <p>
- */
-
-class NNShapeRecognizer: public LTKShapeRecognizer
-{
-
- public:
- friend class LTKAdapt;
- int adapt(int shapeID );
- int adapt(const LTKTraceGroup& sampleTraceGroup, int shapeID );
-
- private:
-
- int deleteAdaptInstance();
-
-
- /** @name private data members */
- //@{
- private:
-
- FN_PTR_DELETELTKLIPIPREPROCESSOR m_deleteLTKLipiPreProcessor;
- //Function pointer for deleteLTKLipiPreProcessor
-
- // preproc lin handle
- void *m_libHandler;
-
- // feature extractor lin handle
- void *m_libHandlerFE;
-
- unsigned short m_numShapes;
- /**< @brief Number of shapes
- * <p>
- * It Defines the number of shapes to be recognized
- *
- * DEFAULT: 0
- *
- * Note: If the project is dynamic, then this numShapes was set to 0
- * If the project is not dynamic, then the numShapes was read from project configuration file
- * </p>
- */
-
- string m_prototypeSelection;
- /**< @brief The Prototype Selection
- * <p>
- * if Prototype Selection = clustering, the training method used was clustering
- * = lvq, the training method used was LVQ
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_PROTOTYPESELECTION
- * Possible values are "clustering" and "lvq"
- * </p>
- */
-
- int m_prototypeReductionFactor;
- /**< @brief The prototype Reduction factor
- * <p>
- * if PrototypeReductionFactor = 0 every training sample is cluster on its own
- * = 100 all training samples are represented by one prototype
- * = 80 then all samples are represented by 20% of the training samples
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_PROTOTYPEREDUCTIONFACTOR
- * RANGE: 0 TO 100
- * </p>
- */
-
- int m_numClusters;
- /**< @brief The number of clusters
- * <p>
- * if NumClusters = k, then k clusters are found from the training samples
- *
- *
- *
- * DEFAULT: There is no default as this and prototype reduction factor are dependent
- * RANGE:
- * </p>
- */
-
-
- string m_prototypeDistance;
- /**< @brief The Prototype Distance
- * <p>
- * if PrototypeDistance = eu, then the distance between the samples can be calculated using the Euclidean distance method
- * = dtw, then the distance between the samples can be calculated using the DTW method
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_PROTOTYPEDISTANCE
- * Possible values are LTKMacros::DTW_DISTANCE and LTKMacros::EUCLIDEAN_DISTANCE.
- * </p>
- */
-
- int m_nearestNeighbors;
- /**< @brief Nearest Neighbors
- * <p>
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_NEARESTNEIGHBORS
- * </p>
- */
-
-
-// int m_dtwBanding;
- float m_dtwBanding;
- /**< @brief DTW Banding
- * <p>
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_BANDING
- * </p>
- */
-
- int m_dtwEuclideanFilter;
- /**< @brief DTW Euclidean Filter
- * <p>
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_DTWEUCLIDEANFILTER
- * </p>
- */
-
- string m_featureExtractorName;
- /**< @brief The Feature Extractor
- * <p>
- *
- * DEFAULT:
- *
- * </p>
- */
-
- bool m_projectTypeDynamic;
- /**< @brief Project Dynamic
- * <p>
- * if projectTypeDynamic = true, then the project is dynamic ie, the numShapes can take any number of value
- * = false, then the project is not dynamic ie, the numShape can take value specified in project.cfg file
- *
- * DEFAULT: false
- * </p>
- */
-
- LTKPreprocessorInterface *m_ptrPreproc;
- /**< @brief Pointer to preprocessor instance
- * <p>
- * Instance which is used to call the preprocessing methods before recognition
- *
- * DEFAULT: NULL
- * </p>
- */
-
- string m_nnCfgFilePath;
- /**< @brief Full path of NN configuration file
- * <p>
- * Assigned value in the NNShapeRecognizer::initialize function
- * </p>
- */
-
- string m_nnMDTFilePath;
- /**< @brief Full path of Model data file
- * <p>
- * Assigned value in the NNShapeRecognizer::initialize function
- * </p>
- */
-
- stringStringMap m_headerInfo;
- /**< @brief Header Information
- * <p>
- * </p>
- */
-
- LTKShapeRecoUtil m_shapeRecUtil;
- /**< @brief Pointer to LTKShapeRecoUtil class
- * <p>
- * Instance which used to call Shape Recognizer Utility functions
- *
- * DEFAULT: NULL
- */
-
- string m_lipiRootPath;
- /**< @brief Path of the Lipi Root
- * <p>
- * DEFAULT: LipiEngine::getLipiPath()
- * </p>
- */
-
- string m_lipiLibPath;
- /**< @brief Path of the Lipi Libraries
- * <p>
- * DEFAULT: LipiEngine::getLipiLibPath()
- * </p>
- */
-
- LTKShapeFeatureExtractor *m_ptrFeatureExtractor;
- /**< @brief Pointer to LTKShapeFeatureExtractor class
- * <p>
- * DEFAULT: NULL
- * </p>
- */
-
- string m_preProcSeqn;
- /**< @brief Preprocessor Sequence
- * <p>
- * This string will holds what sequence the preprocessor methods to be executed
- * </p>
- */
-
- vector<LTKShapeSample> m_prototypeSet;
- /**< @brief Prototype Set for LVQ
- * <p>
- * It contains the Vector of Clustered ShapeSamples
- * </p>
- */
-
- LTKCaptureDevice m_captureDevice;
-
- struct NeighborInfo
- {
- int classId;
- float distance;
- int prototypeSetIndex;
- };
-
- /*
- struct MapModFunc
- {
- string moduleName;
- string funcName;
- };
- */
-
- vector<stringStringPair> m_preprocSequence;
-
- intIntMap m_shapeIDNumPrototypesMap;
- /**< @brief Map of shapeID and Number of Samples per shape
- * <p>
- *
- * </p>
- */
-
- int m_prototypeSetModifyCount;
- /**< @brief
- * <p>
- * Used to count number of modifications done to m_prototypeSet.
- * Write to MDT after m_prototypeModifyCntCFG such modifications or at Exit.
- * </p>
- */
-
- int m_MDTUpdateFreq;
- /**< @brief Update MDT after a specified number of modifications to m_prototypeSet
- * <p>
- * Specified in NN.cfg
- *
- * </p>
- */
-
- //Cache Parameters used by Adapt
- vector<LTKShapeRecoResult> m_vecRecoResult;
- /**< @brief Store Recognize results
- * used by subsequent call to Adapt
- * <p>
- *
- *
- * </p>
- */
-
-
- vector <struct NeighborInfo> m_neighborInfoVec;
- /**< @brief Vector to store the distances of test sample to each of the samples in prototypeSet,
- * classIDs and indices within the prototypeset
- * Used during subsequent call to Adapt
- * <p>
- *
- *
- * </p>
- */
-
- LTKShapeSample m_cachedShapeSampleFeatures;
- /**< @brief Store ShapeSampleFeatures of the last inTraceGroup to Recognize
- * Used during subsequent call to Adapt
- * <p>
- *
- *
- * </p>
- */
-
- float m_rejectThreshold;
- /**< @brief Threshold on the confidence to reject a test sample
- * <p>
- *
- * </p>
- */
-
- bool m_adaptivekNN;
- /**< @brief Adaptive kNN method to compute confidence
- * <p>
- * If m_adaptivekNN = true, the adaptive kNN method is used for confidence computation
- * false, NN or kNN method is used, based on the value of m_nearestNeighbors
- * </p>
- */
-
- //@}
-
- string m_currentVersion;
-
- string m_MDTFileOpenMode;
-
- DynamicTimeWarping<LTKShapeFeaturePtr, float> m_dtwObj;
-
- public:
-
- /** @name Constructors and Destructor */
- //@{
-
- NNShapeRecognizer(const LTKControlInfo& controlInfo);
-
- /**
- * Destructor
- */
- ~NNShapeRecognizer();
-
- //@}
-
- /**
- * This method initializes the NN shape recognizer
- * <p>
- * Semantics
- * - Set the project name in NNShapeRecognizer::headerInfo with the parameter passed.<br>
- * m_headerInfo[PROJNAME] = strProjectName;
- *
- * - Initialize NNShapeRecognizer::m_nnCfgFilePath <br>
- * m_nnCfgFilePath = NNShapeRecognizer::m_lipiRootPath + LTKMacros::PROJECTS_PATH_STRING +
- * strProjectName + LTKMacros::PROFILE_PATH_STRING + strProfileName +
- * LTKInc::SEPARATOR + LTKInc::NN + LTKInc::CONFIGFILEEXT;
- *
- * - Initializes NNShapeRecognizer::m_nnMDTFilePath <br>
- * m_nnMDTFilePath = NNShapeRecognizer::m_lipiRootPath + LTKMacros::PROJECTS_PATH_STRING +
- * strProjectName + LTKMacros::PROFILE_PATH_STRING + strProfileName +
- * LTKInc::SEPARATOR + LTKInc::NN + LTKInc::DATFILEEXT;
- *
- * - Initializes NNShapeRecognizer::m_projectTypeDynamic with the value returned from LTKShapeRecoUtil::isProjectDynamic
- *
- * - Initialize the preprocessor using LTKShapeRecoUtil::initializePreprocessor and assign
- * default values for
- * -# Normalised size
- * -# Threshold size
- * -# Aspect ratio
- * -# Dot threshold
- *
- * - Initialize the recognizers instance variables with the values given in classifier config file.
- *
- * </p>
- * @param strProjectName : string : Holds the name of the Project
- * @param strProfileName : string : Holds the name of the Profile
- *
- * @return int : LTKInc::SUCCESS if initialization done successfully
- * errorValues if initialization has some errors
- *
- * @exception LTKErrorList::ECONFIG_FILE_OPEN Could not open project.cfg
- * @exception LTKErrorList::EINVALID_NUM_OF_SHAPES Negative value for number of shapes
- * @exception LTKErrorList::ELOAD_PREPROC_DLL Could not load preprocessor DLL
- * @exception LTKErrorList::EDLL_FUNC_ADDRESS_CREATE Could not map createPreprocInst
- * @exception LTKErrorList::EDLL_FUNC_ADDRESS_DELETE Could not map destroyPreprocInst
- */
-
- /**
- * This method calls the train method of the NN classifier.
- *
- */
- int train(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string &comment,const string &dataset,
- const string &trainFileType=INK_FILE) ;
-
- /**
- * This method loads the Training Data of the NN classifier.
- * @param
- * @return LTKInc::SUCCESS : if the model data was loaded successfully
- * @exception
- */
- int loadModelData();
-
- /**
- * This method unloads all the training data
- * @param none
- * @return LTKInc::SUCCESS : if the model data was unloaded successfully
- * @exception none
- */
- int unloadModelData();
-
- /**
- * This method sets the device context for the recognition
- *
- * @param deviceInfo The parameter to be set
- * @return
- * @exception
- */
- int setDeviceContext(const LTKCaptureDevice& deviceInfo);
-
- /**
- * Populates a vector of LTKShapeRecoResult consisting of top classes with their confidences.
- *
- * Semantics
- *
- * - Validate the input arguments
- * - Extract the features from traceGroup
- * - If the distance method (m_prototypeDistance) is Euclidean (EUCLIDEAN_DISTANCE),
- * populate the distIndexPairVector with the distance of the test sample to all the
- samples in the prototype set
- * - If the distance method is DTW, compute the DTW distance of the test sample to the
- samples in the prototype set which passed the Euclidean filter. Populate the
- distIndexPairVector
- * - Sort the distIndexPairVector based on the distances in ascending order
- * - Compute the confidences of the classes appearing in distIndexPairVector, call computeConfidence()
- * - Check if the first element of resultVector has confidence less than m_rejectThreshold, if so,
- empty the resultVector (reject the sample), log and return.
- * - If the confThreshold value was specified by the user (not equal to -1),
- delete the entries from resultVector with confidence values less than confThreshold.
- * - If the numChoices value was specified by the user (not equal to -1),
- update the resultVector with top numChoices entries, delete the other values.
- *
- * @param traceGroup The co-ordinates of the shape which is to be recognized
- * @param screenContext Contains information about the input field like whether it is boxed input
- * or continuous writing
- * @param subSetOfClasses A subset of the entire class space which is to be used for
- * recognizing the input shape.
- * @param confThreshold Classes with confidence below this threshold are not returned,
- * valid range of confThreshold: (0,1)
- * @param numOfChoices Number of top choices to be returned in the result structure
- * @param resultVector The result of recognition
- *
- * @return SUCCESS: resultVector populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int recognize(const LTKTraceGroup& traceGroup,
- const LTKScreenContext& screenContext,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& outResultVector);
-
-
- /* Overloaded the above function to take vector<LTKShapeFeaturePtr> as
- * input
- */
- int recognize(const vector<LTKShapeFeaturePtr>& shapeFeatureVec,
- const vector<int>& subSetOfClasses,
- float confThreshold,
- int numChoices,
- vector<LTKShapeRecoResult>& resultVector);
-
- /**
- * This method add Class
- *
- * Semantics
- *
- * - Check if project is Dynamic, if not return ErrorCode
- * - Calculate Features
- * - Update PrototypeSet
- * - Update MDTFile
- * - return shapeID of new class added
- *
- * @param sampleTraceGroup : LTKTraceGroup : Holds TraceGroup of sample to Add
- * @param shapeID : int : Holds shapeID of new Class
- * shapeID = m_prototypeSet.at(prototypeSetSize-1).getClassID()+1
- *
- * @return SUCCESS:Shape Class added successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
-
- int addClass(const LTKTraceGroup& sampleTraceGroup, int& shapeID);
-
- /**
- * This method add Sample Class for adapt
- *
- * Semantics
- *
- * - Check if project is Dynamic, if not return ErrorCode
- * - Calculate Features
- * - Update PrototypeSet
- * - Update MDTFile
- * - return shapeID of new class added
- *
- * @param sampleTraceGroup : LTKTraceGroup : Holds TraceGroup of sample to Add
- * @param shapeID : int : Holds shapeID of new Class
- * shapeID = m_prototypeSet.at(prototypeSetSize-1).getClassID()+1
- *
- * @return SUCCESS:Shape Class added successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int addSample(const LTKTraceGroup& sampleTraceGroup, int shapeID);
-
- /**
- * This method delete Class
- *
- * Semantics
- *
- * - Check if shapeID is valid, if not return error code
- * - Check if project is Dynamic, if not return ErrorCode
- * - Update PrototypeSet
- * - Update MDTFile
- *
- * @param shapeID : int : Holds shapeID of Shape to be deleted
- *
- * @return SUCCESS: Shape Class deleted successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int deleteClass(int shapeID);
-
- /**
- * This method converts features to TraceGroup
- *
- * Semantics
- *
- * - Check if shapeID is valid, if not return error code
- * - Check if project is Dynamic, if not return ErrorCode
- * - Update PrototypeSet
- * - Update MDTFile
- *
- * @param shapeID : int : Holds shapeID
- * @param numberOfTraceGroups : int : Maximum number of Trace Groups to populate
- * @param outTraceGroups : vector<LTKTraceGroup> : TraceGroup
- *
- * @return SUCCESS: TraceGroup is populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int getTraceGroups(int shapeID, int numberOfTraceGroups, vector<LTKTraceGroup> &outTraceGroups);
-
- /**
- * This function does the recognition function required for training phase (called from trainLVQ)
- * The input parameter are the incharacter, which is compared with the existing
- * set of prototypes and then the matched code vector and along with its index (and also the shape id) is returned
- * @param incharacter is the character which we are trying to recognise.
- * @param returnshapeID is the value of the matched character which is returned, codeCharacter is the matched prototype (code vector) vector, and codeVecIndex is the matched prototype (code vector) index
- */
- int trainRecognize(LTKShapeSample& inShapeSample, LTKShapeSample& bestShapeSample, int& codeVecIndex);
-
- private:
- /**
- * This function is the train method using Clustering prototype selection technique.
- *
- *
- * Semantics
- *
- * - Note the start time for time calculations.
- *
- * - Create an instance of the feature extractor using NNShapeRecognizer::initializeFeatureExtractorInstance() method
- *
- * - Call train method depending on the inFileType
- * - NNShapeRecognizer::trainFromListFile() if inFileType = LTKMacros::INK_FILE
- * - NNShapeRecognizer::trainFromFeatureFile() if inFileType = LTKMacros ::FEATURE_FILE
- *
- * - Update the headerInfo with algorithm version and name using NNShapeRecognizer::updateHeaderWithAlgoInfo() method
- *
- * - Calculate the checksum.
- *
- * - Note the finish time for time calculations.
- *
- *
- * @param inputFilePath :string : Path of trainListFile / featureFile
- * @param strModelDataHeaderInfoFile : string : Holds the Header information of Model Data File
- * @param inFileType : string : Possible values ink / featureFile
- *
- * @return LTKInc::SUCCESS : if the training done successfully
- * @return errorCode : if it contains some errors
- */
- int trainClustering(const string& trainingInputFilePath,
- const string& mdtHeaderFilePath,
- const string& trainFileType);
-
-
- /**
- * This method do the map between the module name and function names from the cfg file
- *
- * Semantics
- *
- * - Read the Preprocess Sequence from the nn.cfg
- *
- * - Split the sequence into tokens with delimiter LTKMacros::DELEMITER_SEQUENCE using LTKStringUtil::tokenizeString
- *
- * - Split each token with delimiter LTKMacrosDELEMITER_FUNC using LTKStringUtil::tokenizeString
- * to get the Module name and Function name
- *
- * - Store the Module name and the Function name into a structure
- *
- *
- * @param none
- * @return LTKInc::SUCCESS : if functions are successfully mapped,
- * @return errorCodes : if contains any errors
- * @exception none
- */
- int mapPreprocFunctions();
-
- /**
- * This method will assign default values to the members
- *
- * Semantics
- *
- * - Assign Default values to all the data members
- *
- *
- * @param none
- *
- * @return none
- */
- void assignDefaultValues();
-
- /** Reads the NN.cfg and initializes the instance variable of the classifier with the user defined
- * values.
- *
- * Semantics
- *
- * - Open the nn.cfg using LTKConfigFileReader
- *
- * - Incase of file open failure (nn.cfg), default values of the classifier parameters are used.
- *
- * - The valid values of the classifier parameters are cached in to the class data members.
- * LTKConfigFileReader::getConfigValue is used to get the value fora key defined in the config file
- *
- * - Exception is thrown if the user has specified an invalid valid for a parameter
- *
- *
- * @param none
- * @return SUCCESS : If the Config file read successfully
- * @return errorCode : If it contains some errors
- * @exception LTKErrorList::ECONFIG_FILE_RANGE The config file variable is not within the correct range
- */
- int readClassifierConfig();
-
- /**
- * This function serves as wrapper function to the Dtw distance computation function
- * (for use by clustering prototype selection)
- * @param train This is an input parameter and corresponds to the training character.
- * @param test This is an input parameter and corresponds to the testing character.
- */
- int computeDTWDistance(const LTKShapeSample& inFirstShapeSampleFeatures,
- const LTKShapeSample& inSecondShapeSampleFeatures,
- float& outDTWDistance);
-
-
-
-
- /**
- * This function computes the eucildean distance between the two points.
- * @param train X and Y coordinate of the first point.
- * @param test X and Y coordinate of the second point.
- */
-
- /*int computeEuclideanDistance(const LTKShapeSample& inFirstShapeSampleFeatures,
- const LTKShapeSample& inSecondShapeSampleFeatures,
- float& outEuclideanDistance);*/
-
- int computeEuclideanDistance(const LTKShapeSample& inFirstShapeSampleFeatures,
- const LTKShapeSample& inSecondShapeSampleFeatures,
- float& outEuclideanDistance);
-
- int calculateMedian(const int2DVector& clusteringResult,
- const float2DVector& distanceMatrix, vector<int>& outMedianIndexVec);
-
-
-
- /**
- * This method creates a custom feature extractor instance and stores it's address in
- * NNShapeRecognizer::m_ltkFE. The local distance function pointer is also initialized.
- *
- * Semantics
- *
- *
- * - Intialize the NNShapeRecognizer::m_ptrFeatureExtractor with address of the feature extractor instance created
- * using LTKShapeFeatureExtractorFactory::createFeatureExtractor
- *
- * - Cache the address of LTKShapeFeatureExtractor::getLocalDistance() in an instance variable
- *
- * @param none
- *
- * @return 0 on LTKInc::SUCCESS and 1 on LTKInc::FAILURE
- *
- * @exception none
- */
- int initializeFeatureExtractorInstance(const LTKControlInfo& controlInfo);
-
- /**
- * This method trains the classifier from the train list file whose path is passed as paramater.
- *
- * Semantics
- *
- * - Open the trainListFile for reading.
- *
- * - Open the mdt file for writing.
- *
- * - Write header information to the mdt file
- * - NNShapeRecognizer::m_numShapes
- * - NNShapeRecognizer::m_traceDimension
- * - NNShapeRecognizer::m_flexibilityIndex
- *
- * - Get a valid line from the train list file
- * - Skip commented lines
- * - Skip lines where number_of_tokens != 2
- * - Throw error LTKErrorList::EINITSHAPE_NONZERO, if the first shape in the list file is not zero
- * - Throw error LTKErrorList::EINVALID_ORDER_LISTFILE if the shapes are not in sequential order
- *
- * - For every valid line get the ShapeSample from the ink file using NNShapeRecognizer::getShapeSampleFromInkFile
- * - Read ink from UNIPEN ink file
- * - Skip if the trace group is empty
- * - Pre process the trace group read from the ink file
- * - Extract features
- *
- * - Push all the ShapeSamples corresponding to a shape into a vector of ShapeSample ShapeSamplesVec.
- *
- * - When all the ShapeSamples corresponding to a Shape have been collected, cluster them using NNShapeRecognizer::performClustering
- *
- * - performClustering results in vector of clustered ShapeSamples.
- *
- * - Append these clustered vector<ShapeSample> to the mdt file.
- *
- *
- * @param listFilePath : string : Holds the path for train list file
- *
- * @return none
- *
- * @exception LTKErrorList::EFILE_OPEN_ERROR : Error in Opening a file (may be mdt file or list file)
- * @exception LTKErrorList::EINVALID_NUM_OF_SHAPES : Invalid value for number of shapes
- * @exception LTKErrorList::EINVALID_ORDER_LISTFILE: Invalid order of shapeId in List file
- * @exception LTKErrorList::EINITSHAPE_NONZERO : Initial shapeId must not be zero
- */
- int trainFromListFile(const string& listFilePath);
-
- /**
- * This method trains the classifier from the feature file whose path is passed as paramater
- *
- * Semantics
- *
- *
- * @param featureFilePath : string : Holds the path of Feature file
- *
- * @return none
- */
- int trainFromFeatureFile(const string& featureFilePath);
-
- int PreprocParametersForFeatureFile(stringStringMap& headerSequence);
-
- /**
- * This method will get the ShapeSample by giving the ink file path as input
- *
- * Semantics
- *
- * - Call the LTKShapeRecoUtil::readInkFromFile() method (Utility Method) to read the ink file
- * By reading this file, an inTraceGroup was generated
- *
- * - Preprocess the inTraceGroup and get the preprocessed trace group
- * LTKTraceGroup preprocessedTraceGroup
- *
- * - Extract features from the preprocessed trace group to get the ShapeSamples.
- *
- *
- * @param path : string : The path for Ink file
- * @param ShapeSample : ShapeSample : The ShapeSample generated after feature extraction
- *
- * @return SUCCESS : If the ShapeSample was got successfully
- * @return FAILURE : Empty traces group detected for current shape
- *
- * @exception LTKErrorList::EINKFILE_EMPTY : Ink file is empty
- * @exception LTKErrorList::EINK_FILE_OPEN : Unable to open unipen ink file
- * @exception LTKErrorList::EINKFILE_CORRUPTED : Incorrect or corrupted unipen ink file.
- * @exception LTKErrorList::EEMPTY_TRACE : Number of points in the trace is zero
- * @exception LTKErrorList::EEMPTY_TRACE_GROUP : Number of traces in the trace group is zero
- */
- int getShapeFeatureFromInkFile(const string& inkFilePath,
- vector<LTKShapeFeaturePtr>& shapeFeatureVec);
-
- /**
- * This method will do Custering for the given ShapeSamples
- *
- * Semantics
- *
- * - If the NNShapeRecognizer::m_prototypeReductionFactor is -1 means Automatic clustering could be done
- *
- * - If the NNShapeRecognizer::m_prototypeReductionFactor is 0 means No clustering was needed
- *
- * - Otherwise clustering is needed based on the value of NNShapeRecognizer::m_prototypeReductionFactor
- *
- * - Calculate Median if NNShapeRecognizer::m_prototypeReductionFactor is not equal to zero
- *
- *
- * @param ShapeSamplesVec : ShapeSampleVector : Holds all the ShapeSample for a single class
- * @param resultVector : ShapeSampleVector : Holds all the ShapeSample after clustering
- * @param sampleCount : int : Holds the number of shapes for a sample
- *
- * @return none
- * @exception none
- */
- int performClustering(const vector<LTKShapeSample> & shapeSamplesVec,
- vector<LTKShapeSample>& outClusteredShapeSampleVec);
-
- /**
- * This method will Update the Header information for the MDT file
- *
- * Semantics
- *
- * - Copy the version number to a string
- *
- * - Update the version info and algoName to NNShapeRecognizer::m_headerInfo, which specifies the
- * header information for MDT file
- *
- *
- * @param none
- *
- * @return none
-
- * @exception none
- */
- void updateHeaderWithAlgoInfo();
-
- int preprocess (const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outPreprocessedTraceGroup);
-
- /**
- * This method will writes training results to the mdt file
- *
- * Semantics
- *
- * - If the feature representation was float then
- * - Iterate through the shape model
- * - Write the feature Dimension
- * - Write the feature vector size
- * - Write all the feature vector
- * - Write the class ID
- *
- * - If the feature representation was custom then
- * - Iterate through the shape model
- * - Write the feature Size
- * - Call the writeFeatureVector() to write all the feature vector
- * - Write the class ID
- *
- *
- * @param resultVector : ShapeSampleVector : A vector of ShapeSamples created as a result of training
- * mdtFileHandle : ofstream : Specifies the outut stream
- *
- * @return none
- *
- * @exception none
- */
-
- int appendPrototypesToMDTFile(const vector<LTKShapeSample>& prototypeVec, ofstream & mdtFileHandle);
-
- static bool sortDist(const NeighborInfo& x, const NeighborInfo& y);
-
- static void getDistance(const LTKShapeFeaturePtr& f1,const LTKShapeFeaturePtr& f2, float& distance);
-
- int getShapeSampleFromString(const string& inString, LTKShapeSample& outShapeSample);
-
- int mapFeatureExtractor();
-
- int deleteFeatureExtractorInstance();
- /**
- * This method extracts shape features from given TraceGroup
- *
- * Semantics
- *
- * - PreProcess tracegroup
- * - Extract Features
- *
- * @param inTraceGroup : LTKTraceGroup : Holds TraceGroup of sample
- *
- * @return SUCCESS: if shapeFeatures is populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
-
- int extractFeatVecFromTraceGroup(const LTKTraceGroup& traceGroup,
- vector<LTKShapeFeaturePtr>& featureVec);
-
- /**
- * This method create MDTFile
- *
- * Semantics
- *
- *
- * @param None
- *
- * @return None
- *
- * @exception none
- */
- int writePrototypeSetToMDTFile();
-
- /**
- * This method adds Sample To Prototype
- *
- * Semantics
- *
- * - Add data in ascending order to ShapeID
- * -
- *
- * @param shapeSampleFeatures : LTKShapeSample : Holds features of sample to be added to PrototypeSet
- *
- * @return SUCCESS: if shapeSampleFeatures is populated successfully
- * FAILURE: return ErrorCode
- * @exception none
- */
- int insertSampleToPrototypeSet(const LTKShapeSample &shapeSampleFeatures);
-
- /**
- * This method computes the confidences of test sample belonging to various classes
- *
- * Semantics
- *
- * - Compute the confidence based on the values of m_nearestNeighbors and m_adaptiveKNN
- * - Populate the resultVector
- * - Sort the resultVector
- * -
- *
- * @param distIndexPairVector : vector<struct NeighborInfo>: Holds the samples, classIDs and distances to the test sample
- * @param resultVector : vector<LTKShapeRecoResult> : Holds the classIDs and the respective confidences
- *
- * @return SUCCESS: resultVector populated
- * FAILURE: return ErrorCode
- * @exception none
- */
-
- int computeConfidence();
-
- /**
- * The comparison function object of STL's sort() method, overloaded for class LTKShapeRecoResult, used to sort the vector of LTKShapeRecoResult based on the member variable confidence
- *
- * Semantics
- *
- * - Check if the first object's confidence value is greater than the second object's confidence value
- * - Return true or false
- * -
- *
- * @param x : LTKShapeRecoResult : First object for comparison
- * @param y : LTKShapeRecoResult : Second object for comparison
- *
- * @return true: If x.confidence > y.confidence
- * false: If x.confidence <= y.confidence
- * @exception none
- */
- static bool sortResultByConfidence(const LTKShapeRecoResult& x, const LTKShapeRecoResult& y);
-
- /**
- * The comparison function object of STL's max_element() method, overloaded for the map<int, int>, used to retrieve the maximum of the value field (second element) of map
- *
- * Semantics
- *
- * - Check if the first object's second value is greater than the second object's second value
- * - Return true or false
- * -
- *
- * @param lhs : map<int, int>::value_type : First object for comparison
- * @param rhs : map<int, int>::value_type : Second object for comparison
- *
- * @return true: If lhs.second > rhs.second
- * false: If lhs.second <= rhs.second
- * @exception none
- */
-
- static bool compareMap( const map<int, int>::value_type& lhs, const map<int, int>::value_type& rhs );
-
- /** This method is used to initialize the PreProcessor
- *
- * Semantics
- *
- * - Load the preprocessor DLL using LTKLoadDLL().
- *
- * - Get the proc address for creating and deleting the preprocessor instance.
- *
- * - Create preprocessor instance.
- *
- * - Start the logging for the preprocessor module.
- *
- * @param preprocDLLPath : string : Holds the Path of the Preprocessor DLL,
- * @param errorStatus : int : Holds SUCCESS or Error Values, if occurs
- * @return preprocessor instance
- *
- * @exception ELOAD_PREPROC_DLL Could not load preprocessor DLL
- * @exception EDLL_FUNC_ADDRESS_CREATE Could not map createPreprocInst
- * @exception EDLL_FUNC_ADDRESS_DELETE Could not map destroyPreprocInst
- */
- int initializePreprocessor(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocInstance);
-
-
- /** This method is used to deletes the PreProcessor instance
- *
- * Semantics
- *
- * - Call deleteLTKPreprocInst from the preproc.dll.
- *
- * - Unload the preprocessor DLL.
- *
- * @param ptrPreprocInstance : Holds the pointer to the LTKPreprocessorInterface
- * @return none
- * @exception none
- */
-
- int deletePreprocessor();
-
- /** This method is used to Unloads the preprocessor DLL.
- *
- * Semantics
- *
- * - If m_libHandler != NULL, unload the DLL
- * LTKUnloadDLL(m_libHandler);
- * m_libHandler = NULL;
- *
- * @param none
- * @return none
- * @exception none
- */
- int unloadPreprocessorDLL();
-
- /**
- * This function is the train method using LVQ
- *
- * Semantics
- *
- * - Note the start time for time calculations.
- *
- * - Create an instance of the feature extractor using NNShapeRecognizer::initializeFeatureExtractorInstance() method
- *
- * - Call train method depending on the inFileType
- * - NNShapeRecognizer::trainFromListFile if inFileType() = LTKMacros::INK_FILE
- * - tNNShapeRecognizer::rainFromFeatureFile if inFileType() = LTKMacros::FEATURE_FILE
- *
- * NOTE :
- * The NNShapeRecognizer::trainFromListFile populates the following data structures
- *
- * - NNShapeRecognizer::m_prototypeSet : Vector of clustered ShapeSample and
- *
- * - Process the prototype set using NNShapeRecognizer::processPrototypeSetForLVQ()
- *
- * - Update the headerInfo with algorithm version and name using NNShapeRecognizer::updateHeaderWithAlgoInfo()
- *
- * - Calculate the checksum.
- *
- * - Note the finish time for time calculations.
- *
- *
- * @param inputFilePath :string : Path of trainListFile / featureFile
- * @param strModelDataHeaderInfoFile : string : Holds the Header information of Model Data File
- * @param inFileType : string : Possible values ink / featureFile
- *
- * @return LTKInc::SUCCESS : if the training done successfully
- * @return errorCode : if it contains some errors
- */
- int trainLVQ(const string& inputFilePath,
- const string& mdtHeaderFilePath,
- const string& inFileType);
-
- /**
- * This function is used to compute the learning parameter that is used in Learning Vector Quantization (called from trainLVQ)
- * The input parameters are the iteration number, number of iterations, and the start value of the learning parameter (alpha)
- * the function returns the value of the learning parameter (linearly decreasing)
- */
- float linearAlpha(long iter, long length, double& initialAlpha,
- double lastAlpha,int correctDecision);
-
- /**
- * This function does the reshaping of prototype vector (called from trainLVQ)
- * The input parameters are the code vector, data vector (learning example in the context of LVQ), and alpha (learning parameter)
- * @param bestcodeVec is the character which we are trying to morph
- * the function modifies the character bestcodeVec
- */
- int morphVector(const LTKShapeSample& dataShapeSample,
- double talpha, LTKShapeSample& bestShapeSample);
-
- int processPrototypeSetForLVQ();
-
- int validatePreprocParameters(stringStringMap& headerSequence);
-
-
- /**< @brief LVQ Iteration Scale
- * <p>
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_LVQITERATIONSCALE
- * </p>
- */
- int m_LVQIterationScale;
-
- /**< @brief LVQ Initial Alpha
- * <p>
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_LVQINITIALALPHA
- * </p>
- */
- double m_LVQInitialAlpha;
-
- /**< @brief LVQ Distance Measure
- * <p>
- *
- * DEFAULT: LTKPreprocDefaults::NN_DEF_LVQDISTANCEMEASURE
- * </p>
- */
- string m_LVQDistanceMeasure;
-
- /**< @brief Pointer to LTKOSUtil interface
- * <p>
- *
- * </p>
- */
- LTKOSUtil* m_OSUtilPtr;
-
- vector<LTKShapeSample> m_trainSet;
-
-};
-
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg
deleted file mode 100644
index c20803b7..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.cfg
+++ /dev/null
@@ -1,362 +0,0 @@
-#------------------------------------------------------------------------------
-# nn.cfg
-#
-# Configuration file for Nearest Neighbor Classification Method for
-# Lipi Toolkit 4.0.0
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# The standard format for the configuration entries is the name of the
-# configuration parameter seperated by an equal to sign and then the value of
-# the configuration parameter. For example:
-# ConfigurationEntryName = value
-#
-# Lines starting with a # are commnet lines
-#
-# A cfg entry is strictly a key value pair and leaving the key without the
-# value or specification of a value out of the range is not permitted
-#
-# If a cfg entry is not specified at all, then default values are used by the
-# recognizer
-#------------------------------------------------------------------------------
-
-#-------------------------------
-# PREPROCESSING
-#-------------------------------
-
-#-------------------------------------------------------------------------------
-# ResampTraceDimension
-#
-# Description: The number of target points for resampling. In other words,
-# each character will be resampled to this number of points. In case of
-# multistroke characters, this number of points will be distributed between
-# the strokes in proportion to their lengths in proportion to their initial
-# number of points.
-#
-# Valid values: Any integer > 0
-# Units: Points
-# Default value: 60
-# Typical value: Average number of points per character in the training data set.
-#-------------------------------------------------------------------------------
-ResampTraceDimension = 60
-
-
-
-#-------------------------------------------------------------------------------
-# ResampPointAllocation
-#
-# Description: Method to be used for point allocation among different strokes
-# during resampling. Two schemes have been implemented lengthbased and point
-# based. In lengthbased allocation scheme, the number of points allocated to
-# each stroke is proportional to the length of the stroke. Length of a stroke
-# is calculated as the sum of the distances between each point in the stroke.
-# In the pointbased allocation scheme, the target stroke point allocation is
-# proportional to the number of points in the initial stroke. In the
-# interpointdistbased scheme, the distance between consecutive points is fixed
-# resulting in variable number based on the length of the trajectory.
-#
-# Valid value: [lengthbased | pointbased | interpointdistbased]
-# Default value: lengthbased
-#-------------------------------------------------------------------------------
-ResampPointAllocation = lengthbased
-
-
-#-------------------------------------------------------------------------------
-# NormDotSizeThreshold
-#
-# Description: This threshold is used to determine whether a character is a dot.
-# It is expressed in real length terms (inches) and converted internally to
-# points using knowledge of the devices spatial resolution. If the width
-# and height are both less than this threshold, then all the points are replaced
-# with the center of the of the normalized character, basically to represent it
-# as a dot
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormDotSizeThreshold = 0.01
-
-#-------------------------------------------------------------------------------
-# NormLineWidthThreshold
-#
-# Description: This threshold is used to detect whether the character is a
-# vertical or horizontal line. If only the height is less than this threshold
-# then the character is detected as a horizontal line and if only the width is
-# less than this threshold then the character is detected as a vertical line.
-# Assuming the height is along the y-dimension and width is along the x-
-# dimension, during normalization of a horizontal line only the x-coordinates
-# are scaled and the y-coordinates are translated to the center of the character,
-# with out scaling. Similarly for the vertical line only the y-coordinates are
-# normalized and the x-coordinates are translated to the center with out scaling
-#
-# Valid values: Any real number > 0
-# Units: inches
-# Default value: 0.01
-# Typical value: < 0.1
-#-------------------------------------------------------------------------------
-NormLineWidthThreshold = 0.01
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatio
-#
-# Description: This parameter is used to indicate whether the aspect ratio
-# has to be preserved during normalization. The aspect ratio is the calculated
-# as maximum of (height/width , width/height). The aspect ratio is preserved only
-# if the calculated aspect ratio is greater than the threshold value specified
-# through NormPreserveAspectRatioThreshold and this configuration variable is
-# set to true. If this configuration variable is set to false the aspect ratio
-# is not preserved during normalization.
-#
-# Valid value: [true | false]
-# Default value: true
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatio = true
-
-
-#-------------------------------------------------------------------------------
-# NormPreserveAspectRatioThreshold
-#
-# Description: Aspect ratio is preserved during normalization if the computed
-# aspect ratio (max(height/width, width/height)) is greater than this threshold
-# and the configuration value NormPreserveAspectRatio is set to true. During
-# aspect ratio preserving normalization, the larger of the two dimensions is
-# normalized to the standard size and the other dimension is normalized
-# proportional to the initial height and width ratio, so that the initial
-# aspect ratio is maintained.
-#
-# Valid values: Any real number >= 1
-# Default value: 3
-# Typical value: >= 1.5
-#-------------------------------------------------------------------------------
-NormPreserveAspectRatioThreshold = 3
-
-#-------------------------------------------------------------------------------
-# NormPreserveRelativeYPosition
-#
-# Description: The relative Y position is the mean of the y-coordinates in the
-# input character. During normalization if this parameter is set to true, each
-# y-coordinate of the character point is translated by the initial y-mean value,
-# so that the mean of the y-coordinates remains the same before and after
-# normalization. This is typically used in the word recognition context where
-# each stroke of the character has to be normalized separately and the relative
-# position of the strokes should be maintained even after normalization.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NormPreserveRelativeYPosition = false
-
-#-------------------------------------------------------------------------------
-# SmoothWindowSize
-#
-# Description: The configuration value specifies the length of the moving
-# average filter (size of the window) for smoothing the character image.
-# If this value is set to N, then each point in the input character is replaced
-# by the average of value of this point, (N-1)/2 points on the right and (N-1)/2
-# on the left of this point.
-#
-# Valid value: Any integer > 0
-# Units: Points
-# Typical value: 5
-# Default value: 3
-#-------------------------------------------------------------------------------
-SmoothWindowSize = 3
-
-#-------------------------------------------------------------------------------
-# PreprocSequence
-#
-# Description: This variable is used to specify the sequence of preprocessing
-# operations to be carried out on the input character sample before extracting
-# the features. A valid preprocessing sequence can consist of combination of one
-# or more of the functions selected from the valid values set mentioned below.
-# The CommonPreProc prefix is used specify the default preprocessing module of
-# LipiTk. The user can add his own preprocessing functions in other modules and
-# specify them in the preprocessing sequence.
-#
-# Valid values: Any sequence formed from the following set
-# CommonPreProc::normalizeSize;
-# CommonPreProc::removeDuplicatePoints;
-# CommonPreProc::smoothenTraceGroup;
-# CommonPreProc::dehookTraces;
-# CommonPreProc::normalizeOrientation;
-# CommonPreProc::resampleTraceGroup;
-# Default value: {CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-#-------------------------------------------------------------------------------
-PreprocSequence={CommonPreProc::normalizeSize,CommonPreProc::resampleTraceGroup,CommonPreProc::normalizeSize}
-
-#---------------------------------------
-# TRAINING
-#---------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeSelectionMethod
-#
-# Description: This is used to specify the prototype selection method to be used
-# while training the shape recognizer. When set to hier-clustering, the
-# prototypes are selected using hierarchical clustering method.
-#
-# Valid value: [hier-clustering]
-# Default value: hier-clustering
-#-------------------------------------------------------------------------------
-NNTrainPrototypeSelectionMethod=hier-clustering
-
-
-#-------------------------------------------------------------------------------
-# NNTrainPrototypeReductionFactorPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This config parameter is used to specify the amount of the
-# initial prototypes to be excluded during prototype selection.
-# Set it to automatic if the number of clusters is to be determined
-# automatically. Set it to none if no prototype selection is required. If the
-# value of this parameter is set to a number between 1-100, say 25, then 75%
-# (i.e 100-25) of the initial training data are retained as prototypes.
-# This parameter can be specified only if the NNTrainNumPrototypesPerClass
-# is not specified.
-#
-# Valid value: [automatic | none | any real number from 0-100]
-# Default value: automatic
-#-------------------------------------------------------------------------------
-NNTrainPrototypeReductionFactorPerClass = none
-
-#-------------------------------------------------------------------------------
-# NNTrainNumPrototypesPerClass
-#
-# Description: This config parameter is used only when the prototype selection
-# is clustering. This is used to specify the number of prototypes to be selected
-# from the training data. This parameter can be specified only if
-# PrototypeReductionFactor is not specified. This config entry is commented as
-# only one of NNTrainPrototypeReductionFactorPerClass or
-# NNTrainNumPrototypesPerClass can be active in a valid cfg file.
-#
-# Valid value: [automatic | none | any integer from 1-N]
-# (N is the number of samples # per class)
-# Default value: automatic
-#-------------------------------------------------------------------------------
-#NNTrainNumPrototypesPerClass=automatic
-
-# Note: Only one of either PrototypeReductionFactor or NumClusters can be
-# enabled at any particular instance
-
-#-----------------------------------------
-# FEATURE EXTRACTION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# FeatureExtractor
-#
-# Description: The configuration value is used to specify the feature extraction
-# module to be used for feature extraction. The point float feature extraction
-# module extracts the x,y,cosine and sine angle features at every point of the
-# character.
-#
-# Valid value: [PointFloatShapeFeatureExtractor]
-# Default value: PointFloatShapeFeatureExtractor
-#-------------------------------------------------------------------------------
-FeatureExtractor=PointFloatShapeFeatureExtractor
-
-#-----------------------------------------
-# RECOGNITION
-#-----------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNRecoDTWEuFilterOutputSize
-#
-# Description: This config parameter is used to set the number of nearest
-# neighbours (filtered based on euclidean distance)to be considered for
-# calculating dtw distance. The value is specified as fraction of total number
-# of prototypes.
-# Set to all if all samples are to be considered for
-# calculating dtw distance. This is mainly used to increase the speed of
-# recognition.
-#
-# Valid value: [all| any integer from 1-100]
-# Default Value: all
-#-------------------------------------------------------------------------------
-NNRecoDTWEuFilterOutputSize = all
-
-#-------------------------------------------------------------------------------
-# NNRecoRejectThreshold
-#
-# Description: Threshold to reject the test sample. If the confidence obtained
-# for the recognition of test sample is less than this threshold then the test
-# sample is rejected.
-#
-# Valid value: Any real number from 0-1
-# Default value: 0.001
-#-------------------------------------------------------------------------------
-NNRecoRejectThreshold = 0.001
-
-#-------------------------------------------------------------------------------
-# NNRecoNumNearestNeighbors
-#
-# Description: Number of nearest neighbors to be considered during recognition
-# and computation of confidence. If the value is set to 1, nearest neighbor
-# classifier is used, otherwise k-nearest neighbor or Adaptive k-nearest
-# neighbor classifiers are used. By default, nearest neighbor classifier is used.
-#
-# Valid value: Any integer >= 1
-# Default value: 1
-#-------------------------------------------------------------------------------
-NNRecoNumNearestNeighbors = 1
-
-#-------------------------------------------------------------------------------
-# NNRecoUseAdaptiveKNN
-#
-# Description: This parameter is used to specify whether Adaptive k-nearest
-# neighbor recognizer (A-kNN) is to be used. If set to true, A-kNN recognizer is
-# used, otherwise kNN recognizer is used. The A-kNN recognizer automatically
-# determines the number of nearest neighbors to be considered for recognition in
-# each class. If NNRecoNumNearestNeighbors is set to 1, this parameter is
-# automatically set to false and the manually set value will not be considered.
-# The confidence values obtained do not add to 1 for all classes when
-# Adaptive-kNN is used.
-#
-# Valid value: [true | false]
-# Default value: false
-#-------------------------------------------------------------------------------
-NNRecoUseAdaptiveKNN = false
-
-#--------------------------------------------
-# COMMON FOR TRAINING AND RECOGNITION
-#--------------------------------------------
-
-#-------------------------------------------------------------------------------
-# NNPrototypeDistanceMeasure
-#
-# Description: This configuration parameter is used to specify the distance
-# measure to be used in clustering and recognition. DTW or Euclidean distance
-# measures can be used.
-#
-# Valid value [dtw | eu]
-# Default value: dtw
-#-------------------------------------------------------------------------------
-NNPrototypeDistanceMeasure = dtw
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the banding radius
-# to be used for DTW computation. This is used to speed up the computation
-# process. If this value is zero no banding is done. The value is specified as
-# fraction of ResampTraceDimension to be used while computing the DTW
-# distance.
-#
-# Valid values: Any real number > 0 and <= 1
-# Default Value: 0.33
-#-------------------------------------------------------------------------------
-NNDTWBandingRadius=0.33
-
-#-------------------------------------------------------------------------------
-# NNDTWBandingRadius
-#
-# Description: This configuration parameter specifies the mode for
-# opening the mdt file.
-#
-# Valid values: ascii, binary
-# Default Value: ascii
-#-------------------------------------------------------------------------------
-
-NNMDTFileOpenMode=ascii
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro
deleted file mode 100644
index 0b7046db..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/nn/nn.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-LIPILIBS = shaperecommon ltkcommon ltkutil featureextractorcommon
-include(../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../util/lib \
- ../featureextractor/common \
- ../common \
-
-HEADERS += \
- NN.h \
- NNAdapt.h \
- NNShapeRecognizer.h \
-
-SOURCES += \
- NN.cpp \
- NNAdapt.cpp \
- NNShapeRecognizer.cpp \
-
-win32 {
- DEFINES += NN_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = NN.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/.prev_CMakeLists.txt
deleted file mode 100644
index a3e265c5..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Generated from preprocessing.pro.
-
-#####################################################################
-## preproc Generic Library:
-#####################################################################
-
-qt_add_cmake_library(preproc
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- LTKPreprocessor.cpp
- preprocessing.cpp preprocessing.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(preproc)
-
-#### Keys ignored in scope 1:.:.:preprocessing.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(preproc CONDITION WIN32
- DEFINES
- PREPROCESSING_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(preproc CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(preproc)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/CMakeLists.txt
deleted file mode 100644
index 739a886f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Generated from preprocessing.pro.
-
-#####################################################################
-## preproc Generic Library:
-#####################################################################
-
-qt_add_cmake_library(preproc
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- LTKPreprocessor.cpp
- preprocessing.cpp preprocessing.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(preproc)
-
-#### Keys ignored in scope 1:.:.:preprocessing.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(preproc CONDITION WIN32
- DEFINES
- PREPROCESSING_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(preproc CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(preproc)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp
deleted file mode 100644
index a3eae6cd..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/LTKPreprocessor.cpp
+++ /dev/null
@@ -1,3353 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 11:00:11 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 832 $
- * $Author: dineshm $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKPreprocessor which is a library of standard pre-processing functions
- *
- * CONTENTS:
- * LTKPreprocessor
- * ~LTKPreprocessor
- * normalizeSize
- * normalizeOrientation
- * resampleTrace
- * smoothenTraceGroup
- * setFilterLength
- * centerTraces
- * dehookTraces
- * orderTraces
- * reverseTrace
- * duplicatePoints
- * getNormalizedSize
- * getSizeThreshold
- * getLoopThreshold
- * getAspectRatioThreshold
- * getDotThreshold
- * setNormalizedSize
- * setSizeThreshold
- * setLoopThreshold
- * setAspectRatioThreshold
- * setDotThreshold
- * setHookLengthThreshold1
- * setHookLengthThreshold2
- * setHookAngleThreshold
- * calculateSlope
- * calculateEuclidDist
- * getQuantisedSlope
- * determineDominantPoints
- * computeTraceLength
- * removeDuplicatePoints
- * calculateSweptAngle
- * initFunAddrMap
- * getPreprocptr
- * setPreProcAttributes
- * initPreprocFactoryDefaults
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKTypes.h"
-
-#include "LTKPreprocessor.h"
-
-#include "LTKStringUtil.h"
-
-#include "LTKLoggerUtil.h"
-
-#include "LTKPreprocDefaults.h"
-
-#include "LTKTraceGroup.h"
-
-#include "LTKShapeRecoConfig.h"
-
-#include "LTKInkUtils.h"
-
-#include "LTKTrace.h"
-
-#include "LTKErrors.h"
-
-#include "LTKErrorsList.h"
-
-#include "LTKConfigFileReader.h"
-
-#include "LTKException.h"
-
-#include "LTKChannel.h"
-
-#include "LTKClassifierDefaults.h"
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKPreprocessor
-* DESCRIPTION : Copy Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKPreprocessor:: LTKPreprocessor(const LTKPreprocessor& preprocessor)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered copy constructor of LTKPreprocessor" <<endl;
-
- initFunAddrMap();
- initPreprocFactoryDefaults();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting copy constructor of LTKPreprocessor" <<endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKPreprocessor
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKPreprocessor:: ~LTKPreprocessor()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered destructor of LTKPreprocessor" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting destructor of LTKPreprocessor" <<endl;
-}
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 13-Oct-2006
-* NAME : getCaptureDevice
-* DESCRIPTION : get the value of the member variable m_captureDevice
-* ARGUMENTS :
-* RETURNS : returns m_captureDevice
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-const LTKCaptureDevice& LTKPreprocessor::getCaptureDevice() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<"Entered getCaptureDevice" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting getCaptureDevice" <<endl;
-
- return m_captureDevice;
-
-}
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 13-Oct-2006
-* NAME : getScreenContext
-* DESCRIPTION : get the value of the member variable m_screenContext
-* ARGUMENTS :
-* RETURNS : returns m_screenContext
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-const LTKScreenContext& LTKPreprocessor::getScreenContext() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered getScreenContext" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting getScreenContext" <<endl;
-
- return m_screenContext;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 13-Oct-2006
-* NAME : setCaptureDevice
-* DESCRIPTION : sets the member variable m_captureDevice
-* ARGUMENTS :
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void LTKPreprocessor::setCaptureDevice(const LTKCaptureDevice& captureDevice)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered setCaptureDevice" <<endl;
-
- m_captureDevice = captureDevice;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting setCaptureDevice" <<endl;
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 13-Oct-2006
-* NAME : setScreenContext
-* DESCRIPTION : sets the member variable m_screenContext
-* ARGUMENTS :
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-void LTKPreprocessor::setScreenContext(const LTKScreenContext& screenContext)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered setScreenContext" <<endl;
-
- m_screenContext = screenContext;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting setScreenContext" <<endl;
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 24-Aug-2006
-* NAME : normalizeSize
-* DESCRIPTION : normalizes the size of the incoming trace group
-* ARGUMENTS : inTraceGroup - incoming tracegroup which is to be size normalized
-* outTraceGroup - size noramlized inTraceGroup
-* RETURNS : SUCCESS on successful size normalization
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::normalizeSize(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::normalizeSize" <<endl;
-
- float xScale; // scale factor along the x direction
-
- float yScale; // scale factor along the y direction
-
- float aspectRatio; // aspect ratio of the trace group
-
- vector<LTKTrace> normalizedTracesVec; // holds the normalized traces
-
- LTKTrace trace; // a trace of the trace group
-
- floatVector xVec; // x channel values of a trace
-
- floatVector yVec; // y channel values of a trace
-
- floatVector normalizedXVec; // normalized x channel values of a trace
-
- floatVector normalizedYVec; // normalized y channel values of a trace
-
- float scaleX, scaleY, offsetX, offsetY;
-
- float xMin,yMin,xMax,yMax;
-
- int errorCode;
-
- // getting the bounding box information of the input trace group
-
- if( (errorCode = inTraceGroup.getBoundingBox(xMin,yMin,xMax,yMax)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeSize"<<endl;
- LTKReturnError(errorCode);
- }
-
- outTraceGroup = inTraceGroup;
-
-
- // width of the bounding box at scalefactor = 1
-
- xScale = ((float)fabs(xMax - xMin))/inTraceGroup.getXScaleFactor();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "xScale = " << xScale <<endl;
-
- // height of the bounding box at scalefactor = 1
-
- yScale = ((float)fabs(yMax - yMin))/inTraceGroup.getYScaleFactor();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "yScale = " << yScale <<endl;
-
- if(m_preserveAspectRatio)
- {
- if(yScale > xScale)
- {
- aspectRatio = (xScale > EPS) ? (yScale/xScale) : m_aspectRatioThreshold + EPS;
- }
- else
- {
- aspectRatio = (yScale > EPS) ? (xScale/yScale) : m_aspectRatioThreshold + EPS;
- }
- if(aspectRatio > m_aspectRatioThreshold)
- {
- if(yScale > xScale)
- xScale = yScale;
- else
- yScale = xScale;
- }
- }
-
-
- offsetY = 0.0f;
- if(m_preserveRelativeYPosition )
- {
- offsetY = (yMin+yMax)/2.0f;
- }
-
- if(xScale <= (m_dotThreshold * m_captureDevice.getXDPI()) && yScale <= (m_dotThreshold * m_captureDevice.getYDPI()))
- {
-
- offsetX = PREPROC_DEF_NORMALIZEDSIZE/2;
- offsetY += PREPROC_DEF_NORMALIZEDSIZE/2;
-
- outTraceGroup.emptyAllTraces();
-
- for(int traceIndex=0;traceIndex<inTraceGroup.getNumTraces();++traceIndex)
- {
- LTKTrace tempTrace;
-
- inTraceGroup.getTraceAt(traceIndex,tempTrace);
-
- vector<float> newXChannel(tempTrace.getNumberOfPoints(),offsetX);
- vector<float> newYChannel(tempTrace.getNumberOfPoints(),offsetY);
-
- tempTrace.reassignChannelValues(X_CHANNEL_NAME, newXChannel);
- tempTrace.reassignChannelValues(Y_CHANNEL_NAME, newYChannel);
-
- outTraceGroup.addTrace(tempTrace);
-
- }
-
- return SUCCESS;
- }
-
-
- // finding the final scale and offset values for the x channel
- if((!m_preserveAspectRatio )&&(xScale < (m_sizeThreshold*m_captureDevice.getXDPI())))
- {
- scaleX = 1.0f;
- offsetX = PREPROC_DEF_NORMALIZEDSIZE/2.0 ;
- }
- else
- {
- scaleX = PREPROC_DEF_NORMALIZEDSIZE / xScale ;
- offsetX = 0.0;
- }
-
- // finding the final scale and offset values for the y channel
-
-
-
- if((!m_preserveAspectRatio )&&(yScale < (m_sizeThreshold*m_captureDevice.getYDPI())))
- {
- offsetY += PREPROC_DEF_NORMALIZEDSIZE/2;
- scaleY = 1.0f;
- }
- else
- {
- scaleY = PREPROC_DEF_NORMALIZEDSIZE / yScale ;
- }
-
-
- //scaling the copy of the inTraceGroup in outTraceGroup according to new scale factors
- //and translating xmin_ymin of the trace group bounding box to the point (offsetX,offsetY).
- //Even though absolute location has to be specified for translateToX and translateToY,
- //since offsetX and offsetY are computed with respect to origin, they serve as absolute values
-
- if( (errorCode = outTraceGroup.affineTransform(scaleX,scaleY,offsetX,offsetY,XMIN_YMIN)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeSize"<<endl;
- LTKReturnError(errorCode);
- }
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : normalizeOrientation
-* DESCRIPTION : normalizes the orientation of the incoming trace group
-* ARGUMENTS : inTraceGroup - incoming tracegroup which is to be orientation normalized
-* outTraceGroup - orientation noramlized inTraceGroup
-* RETURNS : SUCCESS on successful orientation normalization
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::normalizeOrientation(const LTKTraceGroup& inTraceGroup, LTKTraceGroup& outTraceGroup)
-{
- int traceIndex;
-
- int numTraces;
-
- float bboxDiagonalLength;
-
- float initialXCoord, finalXCoord;
-
- float initialYCoord, finalYCoord;
-
- float deltaX;
-
- float deltaY;
-
- float sweptAngle;
-
- int errorCode;
-
- vector<LTKTrace> tracesVec;
-
- tracesVec = inTraceGroup.getAllTraces();
-
- numTraces = tracesVec.size();
-
- vector<string> channelNames;
-
- channelNames.push_back(X_CHANNEL_NAME);
-
- channelNames.push_back(Y_CHANNEL_NAME);
-
- floatVector maxValues, minValues;
-
- vector<LTKTrace> tempTraceVector;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "numTraces = " << numTraces <<endl;
-
- for(traceIndex=0; traceIndex < numTraces; ++traceIndex)
- {
- const LTKTrace& trace = tracesVec.at(traceIndex);
-
- if( (errorCode = LTKInkUtils::computeChannelMaxMin(trace, channelNames, maxValues, minValues)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeOrientation"<<endl;
- LTKReturnError(errorCode);
- }
-
- bboxDiagonalLength = calculateEuclidDist(minValues[0], maxValues[0], minValues[1], maxValues[1]);
-
- minValues.clear();
-
- maxValues.clear();
-
- if(bboxDiagonalLength == 0)
- {
- tempTraceVector.push_back(trace);
- continue;
- }
-
- floatVector xVec, yVec;
-
- if( (errorCode = trace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeOrientation"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = trace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeOrientation"<<endl;
- LTKReturnError(errorCode);
- }
-
- if(xVec.size()==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_VECTOR <<":"<< getErrorMessage(EEMPTY_VECTOR)
- <<"LTKPreprocessor::normalizeOrientation" <<endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- if(yVec.size()==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_VECTOR <<":"<< getErrorMessage(EEMPTY_VECTOR)
- <<"LTKPreprocessor::normalizeOrientation" <<endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
-
- initialXCoord = xVec[0];
-
- finalXCoord = xVec[xVec.size() - 1];
-
- initialYCoord = yVec[0];
-
- finalYCoord = yVec[yVec.size() - 1];
-
- deltaX = fabs((finalXCoord - initialXCoord) / bboxDiagonalLength);
-
- deltaY = fabs((finalYCoord - initialYCoord) / bboxDiagonalLength);
-
- if( (errorCode = calculateSweptAngle(trace, sweptAngle)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeOrientation"<<endl;
- LTKReturnError(errorCode);
- }
-
- if((deltaX > m_loopThreshold && deltaY < m_loopThreshold && finalXCoord < initialXCoord) ||
- (deltaY > m_loopThreshold && deltaX < m_loopThreshold && finalYCoord < initialYCoord) ||
- (deltaX > m_loopThreshold && deltaY > m_loopThreshold && finalYCoord < initialYCoord) )
- {
-
- LTKTrace revTrace;
-
- if( (errorCode = reverseTrace(trace, revTrace)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeOrientation"<<endl;
- LTKReturnError(errorCode);
- }
-
- tempTraceVector.push_back(revTrace);
- }
- else if(sweptAngle < 0.0)
- {
- LTKTrace revTrace;
-
- if( (errorCode = reverseTrace(trace, revTrace)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::normalizeOrientation"<<endl;
- LTKReturnError(errorCode);
- }
-
- tempTraceVector.push_back(revTrace);
- }
- else
- {
- tempTraceVector.push_back(trace);
- }
- }
- outTraceGroup.setAllTraces(tempTraceVector,
- inTraceGroup.getXScaleFactor(),
- inTraceGroup.getYScaleFactor());
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : resampleTrace
-* DESCRIPTION : spatially resamples the given trace to a given number of points
-* ARGUMENTS : inTrace - trace to be resampled
-* resamplePoints - number of points required after resampling
-* outTrace - resampled trace
-* RETURNS : SUCCESS on successful resample operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::resampleTrace(const LTKTrace& inTrace, int resamplePoints, LTKTrace& outTrace)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::resampleTrace" <<endl;
-
- int pointIndex; // a variable to loop over the points of a trace
-
- int currentPointIndex =0; // index of the current point
-
- float xSum = 0.0f; // sum of the x coordinate values
-
- float ySum = 0.0f; // sum of the y coordinate values
-
- int numTracePoints; // number of points in a trace
-
- int ptIndex = 0; // index of point in a trace
-
- float x; // an x coord value
-
- float y; // an y coord value
-
- float xDiff; // differenc in x direction
-
- float yDiff; // diference in y direction
-
- float xTemp; // temp x storage
-
- float yTemp; // temp y storage
-
- float unitLength = 0; // estimated length of each segment after resampling
-
- float pointDistance;
-
- float balanceDistance = 0; // distance between the last resampled point and
- // the next raw sample point
-
- float measuredDistance;
-
- float m1,m2;
-
- int errorCode;
-
- floatVector xVec, yVec;
-
- floatVector resampledXVec;
-
- floatVector resampledYVec;
-
- floatVector distanceVec;
-
- numTracePoints = inTrace.getNumberOfPoints();
-
- if(numTracePoints==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_TRACE <<":"<< getErrorMessage(EEMPTY_TRACE)
- <<"LTKPreprocessor::resampleTrace" <<endl;
-
- LTKReturnError(EEMPTY_TRACE);
- }
-
- if( (errorCode = inTrace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = inTrace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "resamplePoints = " << resamplePoints <<endl;
-
- if(resamplePoints < 1)
- {
- resamplePoints = 1;
- }
-
- if(resamplePoints == 1)
- {
- xSum = accumulate(xVec.begin(), xVec.end(), 0.0f);
- ySum = accumulate(yVec.begin(), yVec.end(), 0.0f);
-
- x = xSum/ numTracePoints; //As only 1 point is required, this ratio is computed.
-
- y = ySum/ numTracePoints;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "x mean = " << x <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "y mean = " << y <<endl;
-
- resampledXVec.push_back(x);
-
- resampledYVec.push_back(y);
-
- float2DVector allChannelValuesVec;
- allChannelValuesVec.push_back(resampledXVec);
- allChannelValuesVec.push_back(resampledYVec);
-
- if( (errorCode = outTrace.setAllChannelValues(allChannelValuesVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
-
- /*if( (errorCode = outTrace.setChannelValues(X_CHANNEL_NAME, resampledXVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
- if( (errorCode = outTrace.setChannelValues(Y_CHANNEL_NAME, resampledYVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }*/
-
- }
- else if(numTracePoints <= 1)
- {
- x = xVec.at(0);
-
- y = yVec.at(0);
-
- for(pointIndex = 0; pointIndex < resamplePoints; ++pointIndex)
- {
- resampledXVec.push_back(x);
-
- resampledYVec.push_back(y);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "resampled point " << x << y <<endl;
- }
-
- float2DVector allChannelValuesVec;
- allChannelValuesVec.push_back(resampledXVec);
- allChannelValuesVec.push_back(resampledYVec);
-
- if( (errorCode = outTrace.setAllChannelValues(allChannelValuesVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
-
- /*if( (errorCode = outTrace.setChannelValues(X_CHANNEL_NAME, resampledXVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
- if( (errorCode = outTrace.setChannelValues(Y_CHANNEL_NAME, resampledYVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }*/
- }
- else
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Point distances" <<endl;
-
- for( pointIndex = 0; pointIndex < (numTracePoints-1); ++pointIndex)
- {
- xDiff = xVec.at(pointIndex) - xVec.at(pointIndex+1);
-
- yDiff = yVec.at(pointIndex) - yVec.at(pointIndex+1);
-
- pointDistance = (float) (sqrt(xDiff*xDiff + yDiff*yDiff)); //distance between 2 points.
-
- unitLength += pointDistance; // finding the length of trace.
-
- distanceVec.push_back(pointDistance); //storing distances between every 2 consecutive points.
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "point distance: " << pointDistance <<endl;
- }
-
- unitLength /= (resamplePoints -1);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "unitLength = " << unitLength <<endl;
-
- x = xVec.at(0); // adding x of first point;
-
- y = yVec.at(0); // adding y of first point;
-
- resampledXVec.push_back(x);
-
- resampledYVec.push_back(y);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "resampled point " << x << y <<endl;
-
- for(pointIndex = 1; pointIndex < (resamplePoints-1); ++pointIndex)
- {
- measuredDistance = balanceDistance;
-
- while(measuredDistance < unitLength)
- {
- measuredDistance += distanceVec.at(ptIndex++);
-
- if(ptIndex == 1)
- {
- currentPointIndex = 1;
- }
- else
- {
- currentPointIndex++;
- }
- }
-
- if(ptIndex < 1) ptIndex = 1;
-
- m2 = measuredDistance - unitLength;
-
- m1 = distanceVec.at(ptIndex -1) - m2;
-
- if( fabs(m1+m2) > EPS)
- {
- xTemp = (m1* xVec.at(currentPointIndex) + m2* xVec.at(currentPointIndex -1))/(m1+m2);
-
- yTemp = (m1* yVec.at(currentPointIndex) + m2* yVec.at(currentPointIndex -1))/(m1+m2);
- }
- else
- {
- xTemp = xVec.at(currentPointIndex);
-
- yTemp = yVec.at(currentPointIndex);
- }
-
- resampledXVec.push_back(xTemp);
-
- resampledYVec.push_back(yTemp);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "resampled point " << xTemp << yTemp <<endl;
-
- balanceDistance = m2;
- }
-
- x = xVec.at(xVec.size() - 1); // adding x of last point;
-
- y = yVec.at(yVec.size() - 1); // adding y of last point;
-
- resampledXVec.push_back(x);
-
- resampledYVec.push_back(y);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "resampled point " << x << y <<endl;
-
- float2DVector allChannelValuesVec;
- allChannelValuesVec.push_back(resampledXVec);
- allChannelValuesVec.push_back(resampledYVec);
-
- if( (errorCode = outTrace.setAllChannelValues(allChannelValuesVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
-
- /*if( (errorCode = outTrace.setChannelValues(X_CHANNEL_NAME, resampledXVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }
- if( (errorCode = outTrace.setChannelValues(Y_CHANNEL_NAME, resampledYVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTrace"<<endl;
- LTKReturnError(errorCode);
- }*/
-
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::resampleTrace" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Mehul Patel
-* DATE : 04-APR-2005
-* NAME : smoothenTraceGroup
-* DESCRIPTION : smoothens the given tracegroup using moving average
-* ARGUMENTS : inTraceGroup - tracegroup to be smoothened
-* m_filterLength - configurable parameter used for filtering
-* outTraceGroup - smoothened TraceGroup
-* RETURNS : SUCCESS on successful smoothening operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKPreprocessor::smoothenTraceGroup(const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup)
-{
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entered LTKPreprocessor::smoothenTrace" << endl;
-
- int loopIndex; // Index used for looping
-
- int pointIndex; // Index over all the points in the trace
-
- int traceIndex; // Index over all the traces of a tracegroup
-
- int numTraces = inTraceGroup.getNumTraces();
-
- int actualIndex; //
-
- float sumX, sumY; //partial sum
-
- vector<LTKTrace> tempTraceVector;
-
-
- for(traceIndex = 0; traceIndex < numTraces; ++traceIndex)
- {
-
- LTKTrace inTrace;
- inTraceGroup.getTraceAt(traceIndex, inTrace);
-
- int numPoints = inTrace.getNumberOfPoints(); // total number of points in the trace
-
- floatVector newXChannel, newYChannel; // temp vector to store the channelValues of outTrace
-
- //Retrieving the channels
-
- floatVector xChannel, yChannel;
-
- if( (errorCode = inTrace.getChannelValues(X_CHANNEL_NAME, xChannel))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::smoothenTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = inTrace.getChannelValues(Y_CHANNEL_NAME, yChannel)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::smoothenTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
-
- //iterating through the points
-
- for(pointIndex = 0; pointIndex < numPoints ; ++pointIndex)
- {
- sumX = sumY = 0;
-
- for(loopIndex = 0; loopIndex < m_filterLength; ++loopIndex)
- {
- actualIndex = (pointIndex-loopIndex);
-
- //checking for bounding conditions
- if (actualIndex <0 )
- {
- actualIndex = 0;
- }
- else if (actualIndex >= numPoints )
- {
- actualIndex = numPoints -1;
- }
-
- //accumulating values
- sumX += xChannel[actualIndex];
- sumY += yChannel[actualIndex];
- }
-
- //calculating average value
- sumX /= m_filterLength;
- sumY /= m_filterLength;
-
-
- //adding the values to the pre processed channels
- newXChannel.push_back(sumX);
- newYChannel.push_back(sumY);
- }
-
- /*outTrace.reassignChannelValues(X_CHANNEL_NAME, newXChannel);
- outTrace.reassignChannelValues(Y_CHANNEL_NAME, newYChannel);*/
-
- float2DVector allChannelValuesVec;
- allChannelValuesVec.push_back(newXChannel);
- allChannelValuesVec.push_back(newYChannel);
-
- LTKTrace outTrace;
- if( (errorCode = outTrace.setAllChannelValues(allChannelValuesVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::removeDuplicatePoints"<<endl;
- LTKReturnError(errorCode);
- }
-
- //adding the smoothed trace to the output trace group
-
- tempTraceVector.push_back(outTrace);
- } //traceIndex
-
-
- outTraceGroup.setAllTraces(tempTraceVector,
- inTraceGroup.getXScaleFactor(),
- inTraceGroup.getYScaleFactor());
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::smoothenTrace" <<endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : centerTraces
-* DESCRIPTION : centers the traces of a trace group to the center of its bounding box
-* ARGUMENTS : inTraceGroup - trace group whose traces are to be centered
-* outTraceGroup - trace group after its traces are centered
-* RETURNS : SUCCESS on successful centering operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::centerTraces (const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entered LTKPreprocessor::centerTraces" <<endl;
-
- int traceIndex; // a variable to loop over the traces of the trace group
-
- int pointIndex; // a variable to loop over the points of a trace
-
- int numTraces; // number of traces in the trace group
-
- int numTracePoints; // number of points in a trace
-
- LTKTrace trace; // a trace of the trace group
-
- vector<LTKTrace> centeredTracesVec; // centered traces of the trace group
-
- float xAvg,yAvg; // average x and y co-ordinate values
-
- floatVector xVec; // x coords of a trace
-
- floatVector yVec; // y coords of a trace
-
- int errorCode;
-
- vector<LTKTrace> tempTraceVector;
-
- /* calculating the average x and y coordinate values and
- using them to center the traces of the trace group */
-
- numTraces = inTraceGroup.getNumTraces();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "numTraces = " << numTraces <<endl;
-
- for(traceIndex=0; traceIndex< numTraces; traceIndex++)
- {
- inTraceGroup.getTraceAt(traceIndex, trace);
-
- numTracePoints = trace.getNumberOfPoints();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "numTracePoints = " << numTracePoints <<endl;
-
- if( (errorCode = trace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::centerTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = trace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::centerTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- for(pointIndex=0; pointIndex< numTracePoints; pointIndex++)
- {
- xAvg += xVec.at(pointIndex);
-
- yAvg += yVec.at(pointIndex);
- }
-
- xAvg /= numTracePoints;
-
- yAvg /= numTracePoints;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "xAvg = " << xAvg <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "yAvg = " << yAvg <<endl;
-
- for(pointIndex=0; pointIndex< numTracePoints; pointIndex++)
- {
- xVec.at(pointIndex) -= xAvg;
-
- yVec.at(pointIndex) -= yAvg;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "centered point " << xVec.at(pointIndex) << yVec.at(pointIndex) <<endl;
- }
-
- if( (errorCode = trace.reassignChannelValues(X_CHANNEL_NAME,xVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::centerTraces"<<endl;
- LTKReturnError(errorCode);
- }
- if( (errorCode = trace.reassignChannelValues(Y_CHANNEL_NAME,yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::centerTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- tempTraceVector.push_back(trace);
- }
-
- outTraceGroup.setAllTraces(tempTraceVector,
- inTraceGroup.getXScaleFactor(),
- inTraceGroup.getYScaleFactor());
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::centerTraces" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : dehookTraces
-* DESCRIPTION : dehooks the traces of the tracegroup
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful dehooking operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::dehookTraces(const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup)
-{
- int traceIndex;
-
- float numTraces;
-
- float dPX1, dPY1;
-
- float dPX2, dPY2;
-
- float dPX3, dPY3;
-
- float dPX4, dPY4;
-
- float L0;
-
- float angle;
-
- int firstPoint, lastPoint;
-
- int numDominantPoints;
-
- vector<int> quantizedSlopes;
-
- vector<int> dominantPoints;
-
- vector<string> channelNames;
-
- channelNames.push_back(X_CHANNEL_NAME);
-
- channelNames.push_back(Y_CHANNEL_NAME);
-
- floatVector maxValues, minValues;
-
- float scale;
-
- int errorCode;
-
- numTraces = inTraceGroup.getNumTraces();
-
- vector<LTKTrace> tempTraceVector;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "numTraces = " << numTraces <<endl;
-
- for(traceIndex=0; traceIndex< numTraces; traceIndex++)
- {
- LTKTrace trace;
-
- inTraceGroup.getTraceAt(traceIndex, trace);
-
- if( (errorCode = LTKInkUtils::computeChannelMaxMin(trace, channelNames, maxValues, minValues)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = computeTraceLength(trace, 0, trace.getNumberOfPoints() - 1,scale)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- floatVector xVec, yVec;
-
- if( (errorCode = trace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = trace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = getQuantisedSlope(trace, quantizedSlopes)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = determineDominantPoints(quantizedSlopes, 3, dominantPoints)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- numDominantPoints = dominantPoints.size();
-
- if(numDominantPoints > 2)
- {
-
- dPX1 = xVec[dominantPoints[0]];
-
- dPY1 = yVec[dominantPoints[0]];
-
- dPX2 = xVec[dominantPoints[1]];
-
- dPY2 = yVec[dominantPoints[1]];
-
- dPX3 = xVec[dominantPoints[1] + 1];
-
- dPY3 = yVec[dominantPoints[1] + 1];
-
- dPX4 = xVec[dominantPoints[1] - 1];
-
- dPY4 = yVec[dominantPoints[1] - 1];
-
- if( (errorCode = computeTraceLength(trace, dominantPoints[0], dominantPoints[1],L0))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
-
- angle = ( acos(((dPX1 - dPX2) * (dPX3 - dPX2) + (dPY1 - dPY2) * (dPY3 - dPY2)) /
- (calculateEuclidDist(dPX2, dPX1, dPY2, dPY1) * calculateEuclidDist(dPX2, dPX3, dPY2, dPY3))) ) * 180 / 3.14;
-
- if((L0/scale) < this->m_hookLengthThreshold1 || (((L0/scale) < this->m_hookLengthThreshold2) &&
- (angle < this->m_hookAngleThreshold)))
- {
- firstPoint = dominantPoints[1];
- }
- else
- {
- firstPoint = dominantPoints[0];
- }
-
- dPX1 = xVec[dominantPoints[numDominantPoints - 1]];
-
- dPY1 = yVec[dominantPoints[numDominantPoints - 1]];
-
- dPX2 = xVec[dominantPoints[numDominantPoints - 2]];
-
- dPY2 = yVec[dominantPoints[numDominantPoints - 2]];
-
- dPX3 = xVec[dominantPoints[numDominantPoints - 2] - 1];
-
- dPY3 = yVec[dominantPoints[numDominantPoints - 2] - 1];
-
- dPX4 = xVec[dominantPoints[numDominantPoints - 2] + 1];
-
- dPY4 = yVec[dominantPoints[numDominantPoints - 2] + 1];
-
- if( (errorCode = computeTraceLength(trace, dominantPoints[numDominantPoints - 2], dominantPoints[numDominantPoints - 1],L0))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- angle = (acos(((dPX1 - dPX2) * (dPX3 - dPX2) + (dPY1 - dPY2) * (dPY3 - dPY2)) /
- (calculateEuclidDist(dPX2, dPX1, dPY2, dPY1) * calculateEuclidDist(dPX2, dPX3, dPY2, dPY3)))) * 180 / 3.14;
-
- if((L0/scale) < this->m_hookLengthThreshold1 || (((L0/scale) < this->m_hookLengthThreshold2) &&
- (angle < this->m_hookAngleThreshold)))
- {
- lastPoint = dominantPoints[numDominantPoints - 2];
- }
- else
- {
- lastPoint = dominantPoints[numDominantPoints - 1];
- }
-
- floatVector newXVec(xVec.begin() + firstPoint, xVec.begin() + lastPoint + 1);
-
- floatVector newYVec(yVec.begin() + firstPoint, yVec.begin() + lastPoint + 1);
-
-
- float2DVector allChannelValuesVec;
- allChannelValuesVec.push_back(newXVec);
- allChannelValuesVec.push_back(newYVec);
-
- LTKTrace newTrace;
- if( (errorCode = newTrace.setAllChannelValues(allChannelValuesVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- tempTraceVector.push_back(newTrace);
-
- }
- else
- {
- tempTraceVector.push_back(trace);
-
- /*
- if( (errorCode = outTraceGroup.addTrace(trace)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::dehookTraces"<<endl;
- LTKReturnError(errorCode);
- }
- */
- }
-
- outTraceGroup.setAllTraces(tempTraceVector,
- inTraceGroup.getXScaleFactor(),
- inTraceGroup.getYScaleFactor());
-
- quantizedSlopes.clear();
-
- dominantPoints.clear();
-
- maxValues.clear();
-
- minValues.clear();
-
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : orderTraces
-* DESCRIPTION : reorders the traces to a pre-defined empirical order
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful reordering operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::orderTraces (const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entered LTKPreprocessor::orderTraces" <<endl;
-
- // yet to be implemented
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKPreprocessor::orderTraces" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : reorientTraces
-* DESCRIPTION : reorients the traces to a pre-defined empirical direction
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful reorientation operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::reverseTrace(const LTKTrace& inTrace, LTKTrace& outTrace)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::reverseTrace" <<endl;
-
- int pointIndex;
-
- floatVector revXVec, revYVec;
-
- floatVector xVec, yVec;
-
- int errorCode;
-
- if( (errorCode = inTrace.getChannelValues(X_CHANNEL_NAME, xVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::reverseTrace"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = inTrace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::reverseTrace"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- // reversing the trace
-
- for(pointIndex = xVec.size() - 1; pointIndex >= 0 ; --pointIndex)
- {
- revXVec.push_back(xVec[pointIndex]);
-
- revYVec.push_back(yVec[pointIndex]);
- }
-
-
- outTrace = inTrace;
-
- outTrace.reassignChannelValues(X_CHANNEL_NAME, revXVec);
- outTrace.reassignChannelValues(Y_CHANNEL_NAME, revYVec);
-
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::reverseTrace" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : duplicatePoints
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful duplication of points operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::duplicatePoints (const LTKTraceGroup& traceGroup, int traceDimension)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::duplicatePoints" <<endl;
-
- // yet to be implemented
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)<< "LTKPreprocessor::duplicatePoints - method not implemented" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::duplicatePoints" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 24-Aug-2006
-* NAME : getPreserveAspectRatio
-* DESCRIPTION : gets the value of the m_preserveAspectRatio member variable
-* ARGUMENTS :
-* RETURNS : true or false
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-bool LTKPreprocessor::getPreserveAspectRatio() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getPreserveAspectRatio" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getPreserveAspectRatio with return value " << m_preserveAspectRatio <<endl;
-
- return m_preserveAspectRatio;
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 24-Aug-2006
-* NAME : getPreserveRealtiveYPosition
-* DESCRIPTION : gets the value of the m_preserveAspectRatio member variable
-* ARGUMENTS :
-* RETURNS : true or false
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-bool LTKPreprocessor::getPreserveRealtiveYPosition() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getPreserveRealtiveYPosition" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getPreserveRealtiveYPosition with return value " << m_preserveRelativeYPosition <<endl;
-
- return m_preserveRelativeYPosition;
-}
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getSizeThreshold
-* DESCRIPTION : gets the size threshold below which traces will not be rescaled
-* ARGUMENTS :
-* RETURNS : size threshold below which traces will not be rescaled
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-float LTKPreprocessor::getSizeThreshold () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getSizeThreshold" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getSizeThreshold with return value " << m_sizeThreshold <<endl;
-
- return m_sizeThreshold;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getLoopThreshold
-* DESCRIPTION : gets the threshold below which the trace would considered a loop
-* ARGUMENTS :
-* RETURNS : threshold below which the trace would considered a loop
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-float LTKPreprocessor::getLoopThreshold () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getLoopThreshold" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getLoopThreshold with return value " << m_loopThreshold <<endl;
-
- return m_loopThreshold;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getAspectRatioThreshold
-* DESCRIPTION : returns threshold below which aspect ration will be maintained
-* ARGUMENTS :
-* RETURNS : threshold below which aspect ration will be maintained
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-float LTKPreprocessor::getAspectRatioThreshold () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getAspectRatioThreshold" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getAspectRatioThreshold with return value " << m_aspectRatioThreshold <<endl;
-
- return m_aspectRatioThreshold;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getDotThreshold
-* DESCRIPTION : returns threshold to detect dots
-* ARGUMENTS :
-* RETURNS : threshold to detect dots
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-float LTKPreprocessor::getDotThreshold () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getDotThreshold" <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getDotThreshold with return value " << m_dotThreshold <<endl;
-
- return m_dotThreshold;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 31-May-2007
-* NAME : getQuantizationStep
-* DESCRIPTION : returns the value of the quantization step used in resampling
-* ARGUMENTS :
-* RETURNS : return the m_quantizationStep of the preprocessor
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKPreprocessor::getQuantizationStep() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::getQuantizationStep" <<endl;
-
- return m_quantizationStep;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::getQuantizationStep with return value " << m_quantizationStep <<endl;
-
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 31-May-2007
-* NAME : getResamplingMethod
-* DESCRIPTION : returns the type of resampling method being used in preprocessing
-* ARGUMENTS :
-* RETURNS : the m_resamplingMethod value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-string LTKPreprocessor::getResamplingMethod() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Entered LTKPreprocessor::getResamplingMethod" <<endl;
-
- return m_resamplingMethod;
-
- LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting LTKPreprocessor::getResamplingMethod" <<endl;
-}
-/**********************************************************************************
-* AUTHOR : Srinivasa Vithal, Ch.
-* DATE : 18-Jun-2008
-* NAME : getTraceDimension
-* DESCRIPTION : returns the value of resamplingTraceDimension
-* ARGUMENTS :
-* RETURNS : the m_traceDimension value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-const int LTKPreprocessor::getTraceDimension() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Entered LTKPreprocessor::getTraceDimension" <<endl;
-
- return m_traceDimension;
-
- LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting LTKPreprocessor::getTraceDimension" <<endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Srinivasa Vithal, Ch.
-* DATE : 18-Jun-2008
-* NAME : getFilterLength
-* DESCRIPTION : returns the value of m_filterLength
-* ARGUMENTS :
-* RETURNS : the m_filterLength value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-const int LTKPreprocessor::getFilterLength() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Entered LTKPreprocessor::getFilterLength" <<endl;
-
- return m_filterLength;
-
- LOG( LTKLogger::LTK_LOGLEVEL_INFO)<< "Exiting LTKPreprocessor::getFilterLength" <<endl;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 24-AUG-2006
-* NAME : setPreserveAspectRatio
-* DESCRIPTION : sets the m_preserveAspectRatio member variable to the given flag
-* ARGUMENTS : flag - true or false
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-void LTKPreprocessor::setPreserveAspectRatio(bool flag)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::setPreserveAspectRatio" <<endl;
-
- this->m_preserveAspectRatio = flag;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "m_preserveAspectRatio = " << m_preserveAspectRatio <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::setPreserveAspectRatio" <<endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 24-AUG-2006
-* NAME : setPreserveRelativeYPosition
-* DESCRIPTION : sets the m_preserveRelativeYPosition member variable to the given flag
-* ARGUMENTS : flag - true or false
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-void LTKPreprocessor::setPreserveRelativeYPosition(bool flag)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::setPreserveRelativeYPosition" <<endl;
-
- this->m_preserveRelativeYPosition = flag;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "m_preserveRelativeYPosition = " << m_preserveRelativeYPosition <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::setPreserveRelativeYPosition" <<endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setSizeThreshold
-* DESCRIPTION : sets the size threshold below which traces will not be rescaled
-* ARGUMENTS : sizeThreshold - size threshold below which traces will not be rescaled
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Nidhi Sharma 13-Sept-2007 Added check on input parameter
-*************************************************************************************/
-
-int LTKPreprocessor::setSizeThreshold (float sizeThreshold)
-{
- if(sizeThreshold < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<"LTKPreprocessor::setNormalizedSize" <<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
- }
-
- if(sizeThreshold > PREPROC_DEF_NORMALIZEDSIZE/100)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ECONFIG_FILE_RANGE <<":"<< getErrorMessage(ECONFIG_FILE_RANGE)
- <<"LTKPreprocessor::setNormalizedSize" <<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- this->m_sizeThreshold = sizeThreshold;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setLoopThreshold
-* DESCRIPTION : sets the threshold below which the trace would considered a loop
-* ARGUMENTS : loopThreshold - the threshold below which the trace would considered a loop
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::setLoopThreshold (float loopThreshold)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::setLoopThreshold" <<endl;
-
- this->m_loopThreshold = loopThreshold;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "m_loopThreshold = " << m_loopThreshold <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::setLoopThreshold" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setAspectRatioThreshold
-* DESCRIPTION : sets the threshold below which aspect ratio will be maintained
-* ARGUMENTS : aspectRatioThreshold - threshold below which aspect ratio will be maintained
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Nidhi Sharma 13-Sept-2007 Added check on input parameter
-*************************************************************************************/
-
-int LTKPreprocessor::setAspectRatioThreshold (float aspectRatioThreshold)
-{
- if(aspectRatioThreshold < 1)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
- <<"LTKPreprocessor::setAspectRatioThreshold" <<endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
-
- this->m_aspectRatioThreshold = aspectRatioThreshold;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setDotThreshold
-* DESCRIPTION : sets the threshold to detect dots
-* ARGUMENTS : dotThreshold - threshold to detect dots
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Nidhi Sharma 13-Sept-2007 Added a check on input parameter
-*************************************************************************************/
-
-int LTKPreprocessor::setDotThreshold (float dotThreshold)
-{
- if(dotThreshold <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
- <<"LTKPreprocessor::setDotThreshold" <<endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
- this->m_dotThreshold = dotThreshold;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Vijayakumara M.
-* DATE : 25-OCT-2005
-* NAME : setFilterLength
-* DESCRIPTION : sets the fileter length
-* ARGUMENTS : filterLength - filter Length
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKPreprocessor::setFilterLength (int filterLength)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::setFilterLength" <<endl;
-
- if(filterLength <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
- <<"LTKPreprocessor::setFilterLength" <<endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
- this->m_filterLength = filterLength;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "m_filterLength = " + m_filterLength <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::setFilterLength" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setHookLengthThreshold1
-* DESCRIPTION : sets the length threshold to detect hooks
-* ARGUMENTS : hookLengthThreshold1 - length threshold to detect hooks
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKPreprocessor::setHookLengthThreshold1(float hookLengthThreshold1)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::setHookLengthThreshold1" <<endl;
-
- if(hookLengthThreshold1 < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<"LTKPreprocessor::setHookLengthThreshold1" <<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
- }
-
- this->m_hookLengthThreshold1 = hookLengthThreshold1;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "m_hookLengthThreshold1 = " << m_hookLengthThreshold1 <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::setHookLengthThreshold1" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setHookLengthThreshold2
-* DESCRIPTION : sets the length threshold to detect hooks
-* ARGUMENTS : hookLengthThreshold2 - length threshold to detect hooks
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::setHookLengthThreshold2(float hookLengthThreshold2)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::setHookLengthThreshold2" <<endl;
- if(hookLengthThreshold2 < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<"LTKPreprocessor::setHookLengthThreshold2" <<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
- }
-
- this->m_hookLengthThreshold2 = hookLengthThreshold2;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "m_hookLengthThreshold2 = " << m_hookLengthThreshold2 <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::setHookLengthThreshold2" <<endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setHookAngleThreshold
-* DESCRIPTION : sets the angle threshold to detect hooks
-* ARGUMENTS : hookAngleThreshold - angle threshold to detect hooks
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::setHookAngleThreshold(float hookAngleThreshold)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::setHookAngleThreshold" <<endl;
-
- if(hookAngleThreshold < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<"LTKPreprocessor::setHookAngleThreshold" <<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
- }
-
- this->m_hookAngleThreshold = hookAngleThreshold;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "m_hookAngleThreshold = " << m_hookAngleThreshold <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::setHookAngleThreshold" <<endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 31-May-2007
-* NAME : setQuantizationStep
-* DESCRIPTION : sets the value of the quantization step used in resampling
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*Nidhi Sharma 13-Sept-2007 Added a check on input parameter
-*************************************************************************************/
-
-
-int LTKPreprocessor::setQuantizationStep(int quantizationStep)
-{
- if(quantizationStep < 1)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ECONFIG_FILE_RANGE <<":"<< getErrorMessage(ECONFIG_FILE_RANGE)
- <<"LTKPreprocessor::setQuantizationStep" <<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
-
- m_quantizationStep = quantizationStep;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 31-May-2007
-* NAME : setResamplingMethod
-* DESCRIPTION : sets the type of resampling method being used in preprocessing
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Nidhi Sharma 13-Sept-2007 Added a check on input parameter
-*************************************************************************************/
-int LTKPreprocessor::setResamplingMethod(const string& resamplingMethod)
-{
- int returnVal = FAILURE;
-
- if ( LTKSTRCMP(resamplingMethod.c_str(), LENGTHBASED) == 0 ||
- LTKSTRCMP(resamplingMethod.c_str(), POINTBASED ) == 0 ||
- LTKSTRCMP(resamplingMethod.c_str(), INTERPOINTDISTBASED) == 0)
- {
- m_resamplingMethod = resamplingMethod;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Resampling Method = " << m_resamplingMethod << endl;
-
- return SUCCESS;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ECONFIG_FILE_RANGE <<":"<< getErrorMessage(ECONFIG_FILE_RANGE)
- <<"LTKPreprocessor::setResamplingMethod" <<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : calculateSlope
-* DESCRIPTION : calculates the slope of the line joining two 2-d points
-* ARGUMENTS : x1 - x co-ordinate of point 1
-* y1 - y co-ordinate of point 1
-* x2 - x co-ordinate of point 2
-* y2 - y co-ordinate of point 2
-* RETURNS : slope of the line joining the two 2-d points
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-float LTKPreprocessor::calculateSlope (float x1,float y1,float x2,float y2)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::calculateSlope" <<endl;
-
- // yet to be implemented
-
- float slope=0.0f;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::calculateSlope" <<endl;
-
- return slope;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : calculateEuclidDist
-* DESCRIPTION : calculates the euclidean distance between two 2-d points
-* ARGUMENTS : x1 - x co-ordinate of point 1
-* x2 - x co-ordinate of point 2
-* y1 - y co-ordinate of point 1
-* y2 - y co-ordinate of point 2
-* RETURNS : euclidean distance between the two 2-d points
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-float LTKPreprocessor::calculateEuclidDist(float x1,float x2,float y1,float y2)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::calculateEuclidDist" <<endl;
-
- float euclidDistance;
-
- euclidDistance = sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::calculateEuclidDist" <<endl;
-
- return euclidDistance;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 19-MAR-2005
-* NAME : GetQuantisedSlope
-* DESCRIPTION : Extracts the quantised Slope values from the input trace group.
-* ARGUMENTS : Input trace group
-* RETURNS : Quantised Slope Vector
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::getQuantisedSlope(const LTKTrace& trace, vector<int>& qSlopeVector)
-{
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered DTWFeatureExtractor::GetQuantisedSlope" <<endl;
-
- floatVector slope; //Is a temporary variable which stores the slope values computed at each coordinate.
-
- int dimension; //Stores the dimension of the CoordinatePoints
-
- float dx,dy; //Temporary variales.
-
- int pointIndex;
-
- floatVector xVec, yVec;
-
- if( (errorCode = trace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::centerTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = trace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::centerTraces"<<endl;
- LTKReturnError(errorCode);
- }
-
- qSlopeVector.clear();
-
- dimension = trace.getNumberOfPoints(); //character.size();
-
- for(pointIndex=0; pointIndex < dimension-1; ++pointIndex)
- {
- dx = xVec[pointIndex+1] - xVec[pointIndex];
-
- dy = yVec[pointIndex+1] - yVec[pointIndex];
-
- if(fabs(dx) < EPS && fabs(dy) < EPS)
- {
- slope.push_back(1000.0);
- }
- else if(fabs(dx) < EPS)
- {
- if(dy > 0.0)
- {
- slope.push_back(90.0);
- }
- else
- {
- slope.push_back(-90.0);
- }
- }
- else
- {
- slope.push_back((float)atan((double)(dy/dx))*(180/3.14));
- }
- }
-
- slope.push_back(1000.0);
-
- for(pointIndex = 0; pointIndex < dimension - 1; ++pointIndex)
- {
- if(slope[pointIndex] == 1000.0)
- {
- qSlopeVector.push_back(-1);
- }
- else if((xVec[pointIndex+1] >= xVec[pointIndex]) && (slope[pointIndex]< 22.5) && (slope[pointIndex]>= -22.5))
- {
- qSlopeVector.push_back(1);
- }
-
- else if((xVec[pointIndex+1] >= xVec[pointIndex]) && (yVec[pointIndex+1] >= yVec[pointIndex]) && (slope[pointIndex] < 67.5) && (slope[pointIndex]>=22.5))
- {
- qSlopeVector.push_back(2);
- }
-
- else if((yVec[pointIndex+1] >= yVec[pointIndex]) && ((slope[pointIndex]>= 67.5) || (slope[pointIndex] < -67.5)) )
- {
- qSlopeVector.push_back(3);
- }
-
- else if((xVec[pointIndex+1] < xVec[pointIndex]) && (yVec[pointIndex+1] >= yVec[pointIndex]) && (slope[pointIndex]< -22.5 ) && (slope[pointIndex]>= -67.5))
- {
- qSlopeVector.push_back(4);
- }
-
- else if((xVec[pointIndex+1] < xVec[pointIndex]) && (slope[pointIndex] >= -22.5) && (slope[pointIndex] < 22.5))
- {
- qSlopeVector.push_back(5);
- }
-
- else if((xVec[pointIndex+1] < xVec[pointIndex]) && (yVec[pointIndex+1] < yVec[pointIndex]) && (slope[pointIndex]>=22.5) && (slope[pointIndex]< 67.5))
- {
- qSlopeVector.push_back(6);
- }
-
- else if((yVec[pointIndex+1] < yVec[pointIndex]) && ((slope[pointIndex]>= 67.5) || (slope[pointIndex]< -67.5)))
- {
- qSlopeVector.push_back(7);
- }
-
- else if((xVec[pointIndex+1] >= xVec[pointIndex]) && (yVec[pointIndex+1] < yVec[pointIndex]) && (slope[pointIndex]>= -67.5) && (slope[pointIndex]< -22.5))
- {
- qSlopeVector.push_back(8);
- }
- }
-
- if(dimension >= 2)
- {
- qSlopeVector.push_back(qSlopeVector[dimension-2]);
- }
- else
- {
- qSlopeVector.push_back(-1);
- }
-
- slope.clear();
-
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 19-MAR-2005
-* NAME : DetermineDominantPoints
-* DESCRIPTION : Identify the dominant points in the trace group based on the quantised slope information
-* ARGUMENTS : QSlopeVector,flexibility Index
-* RETURNS : Dominant Points
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::determineDominantPoints(const vector<int>& qSlopeVector, int flexibilityIndex, vector<int>& dominantPts)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered DTWFeatureExtractor::DetermineDominantPoints" <<endl;
-
- int initSlope; //Temporary Variable to store the slope value at the previous point.
-
- dominantPts.clear();
-
- dominantPts.push_back(0); //adding the first point
-
- initSlope = qSlopeVector[0];
-
- int pointIndex;
-
- for(pointIndex = 1; pointIndex < qSlopeVector.size() - 1; ++pointIndex)
- {
- if(initSlope == -1)
- {
- initSlope = qSlopeVector[pointIndex];
-
- continue;
- }
-
- if(qSlopeVector[pointIndex] != -1)
- {
- if((qSlopeVector[pointIndex] - initSlope + 8) % 8 >= flexibilityIndex && (initSlope - qSlopeVector[pointIndex] + 8) % 8 >= flexibilityIndex)
- {
- dominantPts.push_back(pointIndex);
- }
-
- initSlope = qSlopeVector[pointIndex];
- }
-
- }
-
- dominantPts.push_back(qSlopeVector.size() - 1); //adding the last point
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting DTWFeatureExtractor::DetermineDominantPoints" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 19-MAR-2005
-* NAME : computeTraceLength
-* DESCRIPTION : computes the length of the given trace between two given point indices
-* ARGUMENTS : trace - trace whose total/partial length is required
-* : fromPoint - point from which the trace length has to be computed
-* : toPoint - point to which the trace length has to be computed
-* RETURNS : total/partial length of the trace
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Balaji MNA 4-Aug-2008 Check for argument point index.
-*************************************************************************************/
-
-int LTKPreprocessor::computeTraceLength(const LTKTrace& trace, int fromPoint, int toPoint, float& outLength)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::computeTraceLength" <<endl;
-
- int NoOfPoints = trace.getNumberOfPoints();
-
- if( (fromPoint < 0 || fromPoint > (NoOfPoints-1))
- || (toPoint < 0 || toPoint > (NoOfPoints-1)))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EPOINT_INDEX_OUT_OF_BOUND <<":"<< getErrorMessage(EPOINT_INDEX_OUT_OF_BOUND)
- <<"LTKPreprocessor::computeTraceLength" <<endl;
-
- LTKReturnError(EPOINT_INDEX_OUT_OF_BOUND);
- }
-
- int pointIndex;
-
- float xDiff, yDiff;
-
- float pointDistance;
-
- outLength = 0;
-
- floatVector xVec, yVec;
-
- int errorCode;
-
- if( (errorCode = trace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::computeTraceLength"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = trace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::computeTraceLength"<<endl;
- LTKReturnError(errorCode);
- }
-
- for(pointIndex = fromPoint; pointIndex < toPoint; ++pointIndex)
- {
- xDiff = xVec[pointIndex] - xVec[pointIndex+1];
-
- yDiff = yVec[pointIndex] - yVec[pointIndex+1];
-
- pointDistance = (float) (sqrt(xDiff*xDiff + yDiff*yDiff)); //distance between 2 points.
-
- outLength += pointDistance; // finding the length of trace.
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "point distance: " << pointDistance <<endl;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::computeTraceLength" <<endl;
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 19-MAR-2005
-* NAME : removeDuplicatePoints
-* DESCRIPTION : remove consecutively repeating x, y coordinates (thinning)
-* ARGUMENTS : inTraceGroup - trace group which has to be thinned
-* : outTraceGroup - thinned trace group
-* RETURNS : SUCCESS on successful thinning operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKPreprocessor::removeDuplicatePoints(const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup)
-{
- int errorCode;
- int numTraces;
-
- int traceIndex;
-
- int pointIndex;
-
- int numPoints;
-
- floatVector newXVec, newYVec;
-
- numTraces = inTraceGroup.getNumTraces();
-
- vector<LTKTrace> tempTraceVector;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "numTraces = " << numTraces <<endl;
-
- for(traceIndex = 0; traceIndex < numTraces; ++traceIndex)
- {
- LTKTrace trace;
-
- inTraceGroup.getTraceAt(traceIndex, trace);
-
- floatVector xVec, yVec;
-
- if( (errorCode = trace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::removeDuplicatePoints"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = trace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::removeDuplicatePoints"<<endl;
- LTKReturnError(errorCode);
- }
-
- numPoints = trace.getNumberOfPoints();
-
- if(numPoints > 0)
- {
- newXVec.push_back(xVec[0]);
-
- newYVec.push_back(yVec[0]);
- }
-
- for(pointIndex = 1; pointIndex < numPoints; ++pointIndex)
- {
- if((xVec[pointIndex] != xVec[pointIndex - 1]) || (yVec[pointIndex] != yVec[pointIndex - 1]))
- {
- newXVec.push_back(xVec[pointIndex]);
-
- newYVec.push_back(yVec[pointIndex]);
- }
- }
-
- float2DVector allChannelValuesVec;
- allChannelValuesVec.push_back(newXVec);
- allChannelValuesVec.push_back(newYVec);
-
- LTKTrace newTrace;
- if( (errorCode = newTrace.setAllChannelValues(allChannelValuesVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::removeDuplicatePoints"<<endl;
- LTKReturnError(errorCode);
- }
-
- tempTraceVector.push_back(newTrace);
-
- newXVec.clear();
-
- newYVec.clear();
- }
-
-
- LTKTraceGroup tempTraceGroup(tempTraceVector,
- inTraceGroup.getXScaleFactor(),
- inTraceGroup.getYScaleFactor());
-
- outTraceGroup = tempTraceGroup;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 19-MAR-2005
-* NAME : calculateSweptAngle
-* DESCRIPTION : calculates the swept angle of the curve.
-* ARGUMENTS : Input trace
-* RETURNS : Swept angle of the trace
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Balaji MNA 4-Aug-2008 Define new error code ESINGLE_POINT_TRACE.
-*************************************************************************************/
-
-int LTKPreprocessor::calculateSweptAngle(const LTKTrace& trace, float& outSweptAngle)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered DTWFeatureExtractor::calculateSweptAngle" <<endl;
-
- outSweptAngle = 0.0;
-
- float prevSlope;
-
- float slope; //Is a temporary variable which stores the slope values computed at each coordinate.
-
- int dimension; //Stores the dimension of the CoordinatePoints
-
- float dx,dy; //Temporary variales.
-
- int pointIndex;
-
- floatVector xVec, yVec;
-
- int errorCode;
-
- if( (errorCode = trace.getChannelValues(X_CHANNEL_NAME, xVec))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::calculateSweptAngle"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- if( (errorCode = trace.getChannelValues(Y_CHANNEL_NAME, yVec)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::calculateSweptAngle"<<endl;
- LTKReturnError(errorCode);
- }
-
- dimension = trace.getNumberOfPoints(); //character.size();
-
- if(dimension < 2)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ESINGLE_POINT_TRACE <<":"<< getErrorMessage(ESINGLE_POINT_TRACE)
- <<"LTKPreprocessor::calculateSweptAngle" <<endl;
- LTKReturnError(ESINGLE_POINT_TRACE);
- }
-
-
- dx = xVec[1] - xVec[0];
-
- dy = yVec[1] - yVec[0];
-
- prevSlope = (float)atan2(dy, dx)*(180/3.14);
-
- for(pointIndex=1; pointIndex < dimension-1; ++pointIndex)
- {
- dx = xVec[pointIndex+1] - xVec[pointIndex];
-
- dy = yVec[pointIndex+1] - yVec[pointIndex];
-
- slope = (float)atan2(dy, dx)*(180/3.14);
-
- outSweptAngle = slope - prevSlope;
-
- prevSlope = slope;
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Vijayakumara M.
-* DATE : 13-JULY-2005
-* NAME : LTKPreprocessor
-* DESCRIPTION : This function will add the function name and its address to the
-* maping variable.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-void LTKPreprocessor::initFunAddrMap ()
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered default constructor of LTKPreprocessor" <<endl;
-
- string normalizeSize = NORMALIZE_FUNC;
- string removeDuplicatePoints = REMOVE_DUPLICATE_POINTS_FUNC;
- string smoothenTraceGroup = SMOOTHEN_TRACE_GROUP_FUNC;
- string dehookTraces = DEHOOKTRACES_FUNC;
- string normalizeOrientation = NORMALIZE_ORIENTATION_FUNC;
- string resampleTraceGroup = RESAMPLE_TRACE_GROUP_FUNC;
-
- m_preProcMap[normalizeSize]=&LTKPreprocessorInterface::normalizeSize;
- m_preProcMap[removeDuplicatePoints]=&LTKPreprocessorInterface::removeDuplicatePoints;
- m_preProcMap[smoothenTraceGroup]=&LTKPreprocessorInterface::smoothenTraceGroup;
- m_preProcMap[dehookTraces]=&LTKPreprocessorInterface::dehookTraces;
- m_preProcMap[normalizeOrientation]=&LTKPreprocessorInterface::normalizeOrientation;
- m_preProcMap[resampleTraceGroup]=&LTKPreprocessorInterface::resampleTraceGroup;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting default constructor of LTKPreprocessor" <<endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Vijayakumara M.
-* DATE : 13-JULY-2005
-* NAME : getPreprocptr
-* DESCRIPTION : This function returs the preprocessor function pointer.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-FN_PTR_PREPROCESSOR LTKPreprocessor::getPreprocptr(const string &funName)
-{
- return m_preProcMap[funName];
-}
-
-/**********************************************************************************
-* AUTHOR : Thanigai
-* DATE : 20-SEP-2005
-* NAME : initPreprocFactoryDefaults
-* DESCRIPTION : This function assigns the factory default values for the
-* preprocessor attributes
-* ARGUMENTS : void
-* RETURNS : 0 on success
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void LTKPreprocessor::initPreprocFactoryDefaults()
-{
- m_sizeThreshold = PREPROC_DEF_SIZE_THRESHOLD;
- m_aspectRatioThreshold = PREPROC_DEF_ASPECTRATIO_THRESHOLD;
- m_dotThreshold = PREPROC_DEF_DOT_THRESHOLD;
- m_loopThreshold = PREPROC_DEF_LOOP_THRESHOLD;
- m_hookLengthThreshold1 = PREPROC_DEF_HOOKLENGTH_THRESHOLD1;
- m_hookLengthThreshold2 = PREPROC_DEF_HOOKLENGTH_THRESHOLD2;
- m_hookAngleThreshold = PREPROC_DEF_HOOKANGLE_THRESHOLD;
- m_filterLength = PREPROC_DEF_FILTER_LENGTH;
- m_preserveAspectRatio = PREPROC_DEF_PRESERVE_ASPECT_RATIO;
- m_preserveRelativeYPosition = PREPROC_DEF_PRESERVE_RELATIVE_Y_POSITION;
- m_quantizationStep = PREPROC_DEF_QUANTIZATIONSTEP;
- m_resamplingMethod = PREPROC_DEF_RESAMPLINGMETHOD;
- m_traceDimension = PREPROC_DEF_TRACE_DIMENSION;
-
- m_interPointDist = (float)PREPROC_DEF_NORMALIZEDSIZE/(float)PREPROC_DEF_INTERPOINT_DIST_FACTOR;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 30-May-2007
-* NAME : resampleTraceGroup
-* DESCRIPTION : This function resamples the tracegroup
-* ARGUMENTS : Input tracegroup, Output tracegroup
-* RETURNS : 0 on success
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKPreprocessor::resampleTraceGroup(const LTKTraceGroup& inTraceGroup,
- LTKTraceGroup& outTraceGroup)
-{
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::resampleTraceGroup1" <<endl;
- int total = 0;
- float totalLength = 0;
- int totalPoints = 0;
-
- const vector<LTKTrace>& tracesVector = inTraceGroup.getAllTraces();
- vector<LTKTrace> tempTraceVector;
-
- int numberOfTraces = tracesVector.size();
-
- if(numberOfTraces==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_TRACE_GROUP <<" : "<<
- getErrorMessage(EEMPTY_TRACE_GROUP)
- <<"LTKPreprocessor::resampleTraceGroup" <<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
- vector<int> pointsPerTrace(numberOfTraces, 0);
-
- if(m_resamplingMethod == LENGTHBASED)
- {
- int maxIndex = 0;
- float maxLength = 0.0;
-
- floatVector lengthsVec(numberOfTraces, 0.0f);
-
- for(int j=0; j < numberOfTraces; ++j)
- {
- float length;
- const LTKTrace& trace = tracesVector[j];
- if( (errorCode = computeTraceLength(trace, 0, trace.getNumberOfPoints() - 1,length))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
- lengthsVec[j] = length;
- if(fabs(lengthsVec[j]) < EPS)
- {
- lengthsVec[j] = EPS;
- }
- totalLength += lengthsVec[j];
- if(lengthsVec[j] > maxLength)
- {
- maxLength = lengthsVec[j];
- maxIndex = j;
- }
- }
-
-
- if(m_quantizationStep == 1)
- {
- for(int i = 0; i < numberOfTraces; ++i)
- {
- if( i == (numberOfTraces -1))
- pointsPerTrace[i] = ((m_traceDimension - numberOfTraces) - total);
- else
- {
- pointsPerTrace[i] = int(floor((m_traceDimension - numberOfTraces) *
- lengthsVec[i] / totalLength));
- }
-
- total += pointsPerTrace[i];
-
- }
- }
- else
- {
- for(int i = 0; i < numberOfTraces; ++i)
- {
- if(i != maxIndex)
- {
- pointsPerTrace[i] = m_quantizationStep * int(floor((m_traceDimension * lengthsVec[i] / (m_quantizationStep * totalLength)) + 0.5f));
-
- if(pointsPerTrace[i] <= 0)
- {
- pointsPerTrace[i] = 1;
- }
-
- total += pointsPerTrace[i];
- }
- }
- pointsPerTrace[maxIndex] = m_traceDimension - total;
-
- }
- int sum =0;
- for(int temp =0; temp < pointsPerTrace.size(); ++temp)
- {
- sum+=pointsPerTrace[temp];
- }
-
- }
- else if(m_resamplingMethod == POINTBASED)
- {
- for(int j=0; j < numberOfTraces; ++j)
- totalPoints += tracesVector[j].getNumberOfPoints();
-
- if(totalPoints==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_TRACE_GROUP <<":"<< getErrorMessage(EEMPTY_TRACE_GROUP)
- <<"LTKPreprocessor::resampleTraceGroup" <<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
- for(int i=0; i < numberOfTraces; ++i)
- {
- const LTKTrace& trace = tracesVector.at(i);
- if( i == (numberOfTraces - 1))
- pointsPerTrace[i] = ((m_traceDimension - numberOfTraces) - total);
- else
- {
- pointsPerTrace[i] = int(floor((m_traceDimension - numberOfTraces) * trace.getNumberOfPoints() / float(totalPoints) ));
- }
-
- total += pointsPerTrace[i];
-
- }
-
- }
- else if(m_resamplingMethod == INTERPOINTDISTBASED)
- {
-
-
- for(int j=0; j < numberOfTraces; ++j)
- {
- float length;
- LTKTrace trace = tracesVector[j];
-
- LTKTraceGroup tempTraceGroup(trace,inTraceGroup.getXScaleFactor(),inTraceGroup.getYScaleFactor());
-
- if(isDot(tempTraceGroup))
- {
- pointsPerTrace[j] = -1;
- }
- else
- {
-
- if( (errorCode = computeTraceLength(trace, 0, trace.getNumberOfPoints() - 1,length))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
-
- pointsPerTrace[j] = ((int)floor((length/m_interPointDist)+0.5f)) + 1; //0.5f is for rounding the result to the nearest integer
-
-
-
- }
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ECONFIG_FILE_RANGE <<":"<< getErrorMessage(ECONFIG_FILE_RANGE)
- <<"LTKPreprocessor::resampleTraceGroup" <<endl;
-
- LTKReturnError(ECONFIG_FILE_RANGE);
-
- }
-
- for(int i=0; i < numberOfTraces; ++i)
- {
- LTKTrace newTrace;
- const LTKTrace& trace = tracesVector.at(i);
- if(m_resamplingMethod == "lengthbased" && m_quantizationStep != 1)
- {
- if( (errorCode = resampleTrace(trace,pointsPerTrace[i], newTrace))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
- }
- else if(m_resamplingMethod == "interpointdistbased")
- {
- if(pointsPerTrace[i] == -1) //if the trace corresponds to a dot
- {
- vector<float> avgPoint;
-
-
- if( (errorCode = resampleTrace(trace,1, newTrace))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
-
- if( (errorCode = newTrace.getPointAt(0,avgPoint))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
-
- //Adding the average point 5 times in the new trace
- for(int p=0;p<4;++p)
- {
- newTrace.addPoint(avgPoint);
- }
-
-
-
- }
- else
- {
- if( (errorCode = resampleTrace(trace,pointsPerTrace[i]+1, newTrace))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
- }
- }
- else
- {
- if( (errorCode = resampleTrace(trace,pointsPerTrace[i]+1, newTrace))!= SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::resampleTraceGroup"<<endl;
- LTKReturnError(errorCode);
- }
- }
- tempTraceVector.push_back(newTrace);
- }
-
-
- outTraceGroup.setAllTraces(tempTraceVector,
- inTraceGroup.getXScaleFactor(),
- inTraceGroup.getYScaleFactor());
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::resampleTraceGroup1" <<endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 13-Sept-2007
-* NAME : setTraceDimension
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Nidhi Sharma 13-Sept-2007 Added a check on function parameter, assignment happens
-* only if input parameter is on zero
-*************************************************************************************/
-int LTKPreprocessor::setTraceDimension(int traceDimension)
-{
- if(traceDimension <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
- <<"LTKPreprocessor::setTraceDimension" <<endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
- m_traceDimension = traceDimension;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 13-Sept-2007
-* NAME : initialize
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKPreprocessor::readConfig(const string& cfgFilePath)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Entering LTKPreprocessor::readConfig" <<endl;
-
- LTKConfigFileReader* configurableProperties = NULL;
- string tempStringVar = "";
-
-
- try
- {
- configurableProperties = new LTKConfigFileReader(cfgFilePath);
- }
- catch(LTKException e)
- {
- delete configurableProperties;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: "
- << e.getErrorCode() <<" LTKPreprocessor::readConfig()"<<endl;
-
- LTKReturnError(e.getErrorCode());
- }
-
- // Read the key-values pairs defined in the cfg file
-
- /*
- * Trace Dimension
- */
- int errorCode = FAILURE;
-
- try
- {
- errorCode = configurableProperties->getConfigValue(TRACEDIMENSION,
- tempStringVar);
- if( errorCode == SUCCESS )
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- if (setTraceDimension(atoi((tempStringVar).c_str())) != SUCCESS)
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << ECONFIG_FILE_RANGE
- <<" LTKPreprocessor::readConfig()"<<endl;
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE << " : " << TRACEDIMENSION <<
- " is out of permitted range" <<
- " LTKPreprocessor::readConfig()"<<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
-
- /*
- * Size Threshold
- */
- tempStringVar = "";
- errorCode = configurableProperties->getConfigValue(SIZETHRESHOLD,
- tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- if (setSizeThreshold(LTKStringUtil::convertStringToFloat(tempStringVar)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << SIZETHRESHOLD <<
- " should be atleast less than 1/100'th of NORMALIZEDSIZE"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << ECONFIG_FILE_RANGE
- <<" LTKPreprocessor::readConfig()"<<endl;
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- " Invalid value " << tempStringVar << " for " << SIZETHRESHOLD <<
- " LTKPreprocessor::readConfig()" << endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
-
- /*
- * Aspect ratio threshold
- */
-
- tempStringVar = "";
- errorCode = configurableProperties->getConfigValue(ASPECTRATIOTHRESHOLD,
- tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- if (setAspectRatioThreshold(LTKStringUtil::convertStringToFloat(tempStringVar)) != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- ASPECTRATIOTHRESHOLD << " should be positive" << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE
- <<" LTKPreprocessor::readConfig()"<<endl;
- throw LTKException(ECONFIG_FILE_RANGE);
-
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE << " Invalid value " <<
- tempStringVar << "for " << ASPECTRATIOTHRESHOLD <<
- " LTKPreprocessor::readConfig()" << endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
-
- /*
- * Dot Threshold
- */
-
- tempStringVar = "";
- errorCode = configurableProperties->getConfigValue(DOTTHRESHOLD,
- tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isFloat(tempStringVar) )
- {
- if (setDotThreshold(LTKStringUtil::convertStringToFloat(tempStringVar)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << DOTTHRESHOLD <<
- " should be positive" << endl ;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- " LTKPreprocessor::readConfig()"<<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- " Invalid value " << tempStringVar << " for " << DOTTHRESHOLD <<
- " LTKPreprocessor::readConfig()"<<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
-
- /*
- * Preserve relative y position
- */
-
- tempStringVar = "";
- configurableProperties->getConfigValue(PRESERVERELATIVEYPOSITION,
- tempStringVar);
-
- if(LTKSTRCMP(tempStringVar.c_str(), "true") == 0)
- {
- m_preserveRelativeYPosition = true;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< PRESERVERELATIVEYPOSITION <<
- " turned on during normalization"<<endl;
- }
- else if(LTKSTRCMP(tempStringVar.c_str(), "false") == 0)
- {
- m_preserveRelativeYPosition = false;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< PRESERVERELATIVEYPOSITION <<
- " turned on during normalization"<<endl;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- " Invalid value " << tempStringVar << " for " << PRESERVERELATIVEYPOSITION <<
- " LTKPreprocessor::readConfig()"<<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
-
- /*
- * Preserve aspect ratio
- */
-
- tempStringVar = "";
- configurableProperties->getConfigValue(PRESERVEASPECTRATIO,
- tempStringVar);
-
- if(LTKSTRCMP(tempStringVar.c_str(), "false") ==0)
- {
- setPreserveAspectRatio(false);
- }
- else if (LTKSTRCMP(tempStringVar.c_str(), "true") ==0)
- {
- setPreserveAspectRatio(true);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- " Invalid value " << tempStringVar << " for " << PRESERVEASPECTRATIO <<
- " LTKPreprocessor::readConfig()"<<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
-
- /*
- * Resampling method
- */
- tempStringVar = "";
- errorCode = configurableProperties->getConfigValue(RESAMPLINGMETHOD,
- tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if (setResamplingMethod(tempStringVar) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<< "ERROR: " <<
- " Invalid value " << tempStringVar << " for " <<
- RESAMPLINGMETHOD << " LTKPreprocessor::readConfig()" << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE
- <<" LTKPreprocessor::readConfig()"<<endl;
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
-
- /*
- * Quantation step, needed only f the resampling method is length based
- */
- if ( LTKSTRCMP(m_resamplingMethod.c_str(), LENGTHBASED) == 0 )
- {
- tempStringVar = "";
- errorCode = configurableProperties->getConfigValue(QUANTIZATIONSTEP,
- tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- if (setQuantizationStep(atoi((tempStringVar).c_str())) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- QUANTIZATIONSTEP << " greater than one "<< endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE
- <<" LTKPreprocessor::readConfig()"<<endl;
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- " Invalid value " << tempStringVar << "for " <<
- QUANTIZATIONSTEP <<
- " LTKPreprocessor::readConfig()"<<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- }
-
- /*
- * SmoothWindowSize method
- */
- tempStringVar = "";
- errorCode = configurableProperties->getConfigValue(SMOOTHFILTERLENGTH,
- tempStringVar);
-
- if( errorCode == SUCCESS)
- {
- if ( LTKStringUtil::isInteger(tempStringVar) )
- {
- if (setFilterLength(atoi((tempStringVar).c_str())) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- SMOOTHFILTERLENGTH << " greater than one "<< endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE
- <<" LTKPreprocessor::readConfig()"<<endl;
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Error: " << ECONFIG_FILE_RANGE <<
- " Invalid value " << tempStringVar << "for " <<
- SMOOTHFILTERLENGTH <<
- " LTKPreprocessor::readConfig()"<<endl;
-
- throw LTKException(ECONFIG_FILE_RANGE);
- }
- }
- }
- catch(LTKException e)
- {
- delete configurableProperties;
- LTKReturnError(e.getErrorCode());
- }
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<<
- "Exiting LTKPreprocessor::initialize" <<endl;
-
- delete configurableProperties;
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 13-Sept-2007
-* NAME : initialize
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKPreprocessor::LTKPreprocessor(const LTKControlInfo& controlInfo)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered default constructor of LTKPreprocessor" <<endl;
-
- initFunAddrMap();
- initPreprocFactoryDefaults();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting default constructor of LTKPreprocessor" <<endl;
-
- string cfgFilePath = "";
-
- // Config file
- if ( ! ((controlInfo.lipiRoot).empty()) &&
- ! ((controlInfo.projectName).empty()) &&
- ! ((controlInfo.profileName).empty()) &&
- ! ((controlInfo.cfgFileName).empty()))
- {
- // construct the cfg path using project and profile name
- cfgFilePath = (controlInfo.lipiRoot) + PROJECTS_PATH_STRING +
- (controlInfo.projectName) + PROFILE_PATH_STRING +
- (controlInfo.profileName) + SEPARATOR +
- (controlInfo.cfgFileName) + CONFIGFILEEXT;
- }
- else if ( ! ((controlInfo.cfgFilePath).empty() ))
- {
- cfgFilePath = controlInfo.cfgFilePath;
- }
- else
- {
- return;
- }
-
- int returnVal = readConfig(cfgFilePath);
- if (returnVal != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::LTKPreprocessor"<<endl;
- throw LTKException(returnVal);
- }
-}
-
-bool LTKPreprocessor::isDot(const LTKTraceGroup& inTraceGroup)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Entered LTKPreprocessor::isDot" <<endl;
-
- float xMin,yMin,xMax,yMax;
-
- float xScale; // scale along the x direction
-
- float yScale; // scale along the y direction
-
- int errorCode;
-
- // getting the bounding box information of the input trace group
-
- if( (errorCode = inTraceGroup.getBoundingBox(xMin,yMin,xMax,yMax)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKPreprocessor::isDot"<<endl;
- LTKReturnError(errorCode);
- }
-
-
- // width of the bounding box at scalefactor = 1
-
- xScale = ((float)fabs(xMax - xMin))/inTraceGroup.getXScaleFactor();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< "xScale = " << xScale <<endl;
-
- // height of the bounding box at scalefactor = 1
-
- yScale = ((float)fabs(yMax - yMin))/inTraceGroup.getYScaleFactor();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< "yScale = " << yScale <<endl;
-
-
- if(xScale <= (m_dotThreshold * m_captureDevice.getXDPI()) && yScale <= (m_dotThreshold * m_captureDevice.getYDPI()))
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::isDot" <<endl;
- return true;
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<< "Exiting LTKPreprocessor::isDot" <<endl;
- return false;
- }
-
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp
deleted file mode 100644
index b6f4fa28..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-01 09:48:58 +0530 (Fri, 01 Aug 2008) $
- * $Revision: 583 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Defines the entry point for the DLL application.
- *
- * CONTENTS:
- * DllMain
- * createPreprocInst
- * destroyPreprocInst
- *
- * AUTHOR: Vijayakumara M.
- *
- * DATE: July 28, 2005.
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "preprocessing.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-
-#ifdef _WIN32
-#include <windows.h>
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-
-#endif
-/**********************************************************************************
-* AUTHOR : Vijayakumara M.
-* DATE : 13-JULY-2005
-* NAME : create
-* DESCRIPTION : This function creates the object of LTKPreprocessor class and returns
- the address of the object.
-* ARGUMENTS : - N0 -
-* RETURNS : Address of the created object
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int createPreprocInst(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocPtr)
-{
-
- try
- {
- *preprocPtr = new LTKPreprocessor(controlInfo);
- }
- catch(LTKException e)
- {
- *preprocPtr = NULL;
- LTKReturnError(e.getErrorCode());
- }
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Vijayakumara M.
-* DATE : 13-JULY-2005
-* NAME : destroy
-* DESCRIPTION : Deletes the object,
-* ARGUMENTS : Address of the object of type LTKPreprocessorInterface
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void destroyPreprocInst(LTKPreprocessorInterface* p)
-{
- delete p;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def
deleted file mode 100644
index ca038d78..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- createPreprocInst @1
- destroyPreprocInst @2 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h
deleted file mode 100644
index 5d052153..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: This file includes exporting function definitons.
- *
- * CONTENTS:
- *
- * AUTHOR: Vijayakumara M.
- *
- * DATE: 28-July-2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef __PREPROCESSING_H_
-#define __PREPROCESSING_H_
-
-#ifdef _WIN32
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the PREPROCESSING_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// PREPROCESSING_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef PREPROCESSING_EXPORTS
-#define PREPROCESSING_API __declspec(dllexport)
-#else
-#define PREPROCESSING_API __declspec(dllimport)
-#endif
-#else
-#define PREPROCESSING_API
-#endif // #ifdef _WIN32
-
-
-#include "LTKPreprocessor.h"
-#include "LTKLoggerUtil.h"
-
-/**
- * This function creates the object of type LTKPreprocessor and returns the adderss
- * of type LTKPreprocessorInterface ( base class of LTKPreprocessor).
- *
- * @return the address of the new object create of type LTKPreprocessorInterface.
- */
-
-extern "C" PREPROCESSING_API int createPreprocInst(const LTKControlInfo& controlInfo,
- LTKPreprocessorInterface** preprocPtr);
-
-
-/**
- * This function destroys the object of type LTKPreprocessorInterface by taking
- * address of the instance.
- *
- * @param Address of the destroying object of type LTKPreprocessorInterface.
- */
-
-extern "C" PREPROCESSING_API void destroyPreprocInst(LTKPreprocessorInterface* p);
-
-#endif //#ifndef __PREPROCESSING_H_
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro
deleted file mode 100644
index 8251f3e4..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/preprocessing/preprocessing.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-BASE_TARGET_NAME = preproc
-LIPILIBS = shaperecommon ltkcommon ltkutil
-include(../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../util/lib \
- ../common \
-
-HEADERS += \
- preprocessing.h \
-
-SOURCES += \
- LTKPreprocessor.cpp \
- preprocessing.cpp \
-
-win32 {
- DEFINES += PREPROCESSING_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = preprocessing.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro
deleted file mode 100644
index 8b5d5e3b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/shaperec/shaperec.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- common \
- featureextractor \
- activedtw \
- neuralnet \
- nn \
- preprocessing
-
-activedtw.depends = common featureextractor
-neuralnet.depends = common featureextractor
-nn.depends = common featureextractor
-preprocessing.depends = common
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/CMakeLists.txt
deleted file mode 100644
index d3453a5a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from wordrec.pro.
-
-add_subdirectory(common)
-add_subdirectory(boxfld)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/.prev_CMakeLists.txt
deleted file mode 100644
index 0e95bebe..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Generated from boxfld.pro.
-
-#####################################################################
-## boxfld Generic Library:
-#####################################################################
-
-qt_add_cmake_library(boxfld
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- BoxFieldRecognizer.cpp BoxFieldRecognizer.h
- boxfld.cpp boxfld.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(boxfld)
-
-#### Keys ignored in scope 1:.:.:boxfld.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "wordreccommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(boxfld CONDITION WIN32
- DEFINES
- BOXFLD_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(boxfld CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(boxfld)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp
deleted file mode 100644
index dbcdca58..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.cpp
+++ /dev/null
@@ -1,1336 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE US E OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 16:57:52 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 834 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of BoxedFieldRecognizer
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: March 23, 2005
- * CHANGE HISTORY:
- * Author Date Description of
- ************************************************************************/
-
-#include "BoxFieldRecognizer.h"
-#include "LTKLoggerUtil.h"
-#include "LTKTrace.h"
-#include "LTKInc.h"
-#include "LTKTypes.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKTraceGroup.h"
-#include "LTKWordRecoConfig.h"
-
-#include "LTKShapeRecognizer.h"
-#include "LTKRecognitionContext.h"
-
-#include "LTKScreenContext.h"
-#include "LTKCaptureDevice.h"
-#include "LTKConfigFileReader.h"
-#include "LTKMacros.h"
-#include "LTKStrEncoding.h"
-#include "LTKException.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKOSUtil.h"
-#include "LTKStringUtil.h"
-
-#include <functional>
-
-extern void *m_hAlgoDLLHandle;
-
-
-
-/*****************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : initializeWordRecognizer
-* DESCRIPTION : Initialization of Boxed word Recognizer. This function performs
-* -Create & initialize shape recognizer
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*****************************************************************************/
-BoxedFieldRecognizer::BoxedFieldRecognizer(const LTKControlInfo& controlInfo)
-:LTKWordRecognizer(BOXFLD),
-m_shapeRecognizer(NULL),
-m_numShapeRecoResults(DEFAULT_SHAPE_RECO_CHOICES),
-m_shapeRecoMinConfidence(DEFAULT_SHAPE_RECO_MIN_CONFID),
-m_module_createShapeRecognizer(NULL),
-m_module_deleteShapeRecognizer(NULL),
-m_numCharsProcessed(0),
-m_numTracesProcessed(0),
-m_boxedShapeProject(""),
-m_boxedShapeProfile(""),
-m_lipiRoot(""),
-m_lipiLib(""),
-m_boxedConfigFile(""),
-m_logFile(""),
-m_logLevel(LTKLogger::LTK_LOGLEVEL_ERR),
-m_toolkitVersion(""),
-m_OSUtilPtr(LTKOSUtilFactory::getInstance())
-{
-
- string boxedShapeProfile; //profile name
-
- int errorCode = 0;
-
- LTKControlInfo tempControlInfo = controlInfo;
-
- if ( tempControlInfo.lipiRoot.empty() )
- {
- throw LTKException(ELIPI_ROOT_PATH_NOT_SET);
- }
-
- if ( tempControlInfo.projectName.empty() )
- {
- throw LTKException(EINVALID_PROJECT_NAME);
- }
-
- if( (tempControlInfo.profileName).empty() )
- {
- tempControlInfo.profileName = DEFAULT_PROFILE;
- }
-
- if ( tempControlInfo.toolkitVersion.empty() )
- {
- throw LTKException(ENO_TOOLKIT_VERSION);
- }
-
- // initialize the data members
- m_lipiRoot = tempControlInfo.lipiRoot;
- m_lipiLib = tempControlInfo.lipiLib;
- m_toolkitVersion = tempControlInfo.toolkitVersion;
-
-
- //constructing the boxed Config filename
- m_boxedConfigFile = m_lipiRoot + PROJECTS_PATH_STRING +
- tempControlInfo.projectName + PROFILE_PATH_STRING +
- tempControlInfo.profileName + SEPARATOR + BOXFLD + CONFIGFILEEXT;
-
- readClassifierConfig();
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::BoxedFieldRecognizer(const LTKControlInfo& )"
- <<endl;
-
- //Creating the shape recognizer object
- if((errorCode = createShapeRecognizer(m_boxedShapeProject, m_boxedShapeProfile,&m_shapeRecognizer)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::BoxedFieldRecognizer(const LTKControlInfo&)"<<endl;
-
- throw LTKException(errorCode);
- }
-
- if(m_shapeRecognizer == NULL)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ECREATE_SHAPEREC <<":"<< getErrorMessage(ECREATE_SHAPEREC)
- <<" BoxedFieldRecognizer::BoxedFieldRecognizer(const LTKControlInfo&)" <<endl;
-
- throw LTKException(ECREATE_SHAPEREC);
- }
-
- //loading the model data file
- if( (errorCode = (m_shapeRecognizer->loadModelData())) != SUCCESS )
- {
- m_module_deleteShapeRecognizer(m_shapeRecognizer);
- m_shapeRecognizer = NULL;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::BoxedFieldRecognizer(const LTKControlInfo&)"<<endl;
-
- throw LTKException(errorCode);
- }
-
- m_numCharsProcessed = 0; //initializing number of characters processed
- m_numTracesProcessed = 0; //initializing number of traces processed
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::BoxedFieldRecognizer(const LTKControlInfo&)"
- <<endl;
-}
-
-/******************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 28-Sept-2007
- * NAME : readClassifierConfig
- * DESCRIPTION : Reads the boxfld.cfg and initializes the data members of the class
- * ARGUMENTS : none
- * RETURNS : SUCCESS - If config file read successfully
- * errorCode - If failure
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ******************************************************************************/
-int BoxedFieldRecognizer::readClassifierConfig()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::readClassifierConfig"
- <<endl;
-
- LTKConfigFileReader* boxedFldConfigMap = NULL;
- string cfgFileValue = "";
- int errorCode = FAILURE;
-
- try
- {
- boxedFldConfigMap = new LTKConfigFileReader(m_boxedConfigFile);
- }
- catch(LTKException fofe)
- {
- delete boxedFldConfigMap;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::readClassifierConfig"<<endl;
-
- LTKReturnError(ECONFIG_FILE_OPEN); // Error while reading project.cfg
- }
-
- //initializing the number of shape recognition choices required from the file
-
- errorCode = boxedFldConfigMap->getConfigValue(NUMSHAPECHOICES, cfgFileValue);
-
- if ( errorCode == SUCCESS )
- {
- m_numShapeRecoResults = atoi(cfgFileValue.c_str());
-
- if(m_numShapeRecoResults <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
- <<" BoxedFieldRecognizer::readClassifierConfig" <<endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- <<"Assuming default value for number of shape recognizer choices:"
- <<m_numShapeRecoResults<<endl;
- }
-
-
-
- //initializing the minimum confidence threshold
-
- cfgFileValue = "";
- errorCode = boxedFldConfigMap->getConfigValue(MINSHAPECONFID, cfgFileValue);
-
- if ( errorCode == SUCCESS )
- {
- m_shapeRecoMinConfidence = LTKStringUtil::convertStringToFloat(cfgFileValue);
-
- if(m_shapeRecoMinConfidence < 0 || m_shapeRecoMinConfidence > 1)
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_CONFIDENCE_VALUE <<":"<< getErrorMessage(EINVALID_CONFIDENCE_VALUE)
- <<" BoxedFieldRecognizer::readClassifierConfig" <<endl;
-
-
- LTKReturnError(EINVALID_CONFIDENCE_VALUE);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- <<"Assuming default value for minimum shape recognizer confidence:"
- <<m_shapeRecoMinConfidence<<endl;
-
- }
-
- //retrieving the boxed shape project and profile
- cfgFileValue = "";
- errorCode = boxedFldConfigMap->getConfigValue(BOXEDSHAPEPROJECT, cfgFileValue);
-
- if ( errorCode == SUCCESS )
- {
- m_boxedShapeProject = cfgFileValue;
-
- if(m_boxedShapeProject.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_PROJECT_NAME <<":"<< getErrorMessage(EINVALID_PROJECT_NAME)
- <<" BoxedFieldRecognizer::readClassifierConfig" <<endl;
-
- LTKReturnError(EINVALID_PROJECT_NAME);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENO_SHAPE_RECO_PROJECT <<":"<< getErrorMessage(ENO_SHAPE_RECO_PROJECT)
- <<" BoxedFieldRecognizer::readClassifierConfig" <<endl;
-
- LTKReturnError(ENO_SHAPE_RECO_PROJECT);
- }
-
-
- //retrieving the boxed shape project and profile
- cfgFileValue = "";
- errorCode = boxedFldConfigMap->getConfigValue(BOXEDSHAPEPROFILE, cfgFileValue);
-
- if( errorCode == SUCCESS )
- {
- m_boxedShapeProfile = cfgFileValue;
-
- if(m_boxedShapeProfile.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- <<"No profile specified for shape recognizer project.Assuming 'default' profile"<<endl;
-
- m_boxedShapeProfile = DEFAULT_PROFILE;
- }
-
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- <<"No profile specified for shape recognizer project. Assuming 'default' profile"<<endl;
-
- m_boxedShapeProfile = DEFAULT_PROFILE;
-
- }
-
- delete boxedFldConfigMap;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::readClassifierConfig"
- <<endl;
-
- return SUCCESS;
-}
-
-/*****************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : processInk
-* DESCRIPTION : This method is called from recognition context whenever new traces
-* : are added to it. The Recognizer need to process the new traces
-* : in this methods and updates the internal state.
-* ARGUMENTS : rc - The recognition context for the current recognition
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-******************************************************************************/
-int BoxedFieldRecognizer::processInk (LTKRecognitionContext& rc)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::processInk"
- <<endl;
-
- string tempStr = REC_UNIT_INFO;
-
- int tempFlagValue=0;
-
- int errorCode=0;
-
- if((errorCode=rc.getFlag(tempStr,tempFlagValue))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::processInk"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- //give an error if the Ink is not segmented into characters
- if(tempFlagValue != REC_UNIT_CHAR)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_SEGMENT <<":"<< getErrorMessage(EINVALID_SEGMENT)
- <<" BoxedFieldRecognizer::processInk" <<endl;
-
- LTKReturnError(EINVALID_SEGMENT);
- }
-
- tempStr = REC_MODE;
-
-
- if((errorCode=rc.getFlag(tempStr,tempFlagValue))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::processInk"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- //if the recognizer mode is correct
- if (tempFlagValue == REC_MODE_STREAMING)
- {
- //recognize the newly added strokes
- recognizeTraces(rc);
- }
- else
- {
- //give an error otherwise
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_REC_MODE <<":"<< getErrorMessage(EINVALID_REC_MODE)
- <<" BoxedFieldRecognizer::processInk" <<endl;
-
-
- LTKReturnError(EINVALID_REC_MODE);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::processInk"
- <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : endRecoUnit
-* DESCRIPTION : This function notifies the recognizer that end of current ink is
-* : the end of a logic segment. This information could be used in
-* : constraining the recognizer choices
-* ARGUMENTS :
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
-void BoxedFieldRecognizer::endRecoUnit ()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::endRecoUnit"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::endRecoUnit"
- <<endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : recognize
-* DESCRIPTION : This is the recognize call
-* : The results of the recognition is set on the Recognition context
-* : object. In case of BATCH_MODE recognition recognition of every
-* : character is performed. otherwise the recognizer updates the outputs
-* : with the recognized results
-* ARGUMENTS : rc - The recognition context for the current recognition
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
-int BoxedFieldRecognizer::recognize (LTKRecognitionContext& rc)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::recognize"
- <<endl;
-
- string tempStr = REC_UNIT_INFO; //temp string required to pass the arguments to set/get Flags
-
- int tempFlagValue = 0; //temp int to hold flag values
-
- int errorCode = 0;
-
- vector <LTKWordRecoResult>::iterator resultIter,resultEnd; //iterates through decoded recognition results
-
- int numWordRecoResults ; //Number of results required by the application
-
- int resultIndex ; //index to iterate through the results
-
- vector<unsigned short> resultString; //result
-
- float normConf; //normalized confidence
-
- //Returning FAILURE if the recognition context
- //is not segmented into characters
-
- if((errorCode=rc.getFlag(tempStr,tempFlagValue))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::recognize"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- if( tempFlagValue != REC_UNIT_CHAR)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_SEGMENT <<":"<< getErrorMessage(EINVALID_SEGMENT)
- <<" BoxedFieldRecognizer::recognize" <<endl;
-
- LTKReturnError(EINVALID_SEGMENT);
- }
-
- tempStr =REC_MODE;
-
- if((errorCode=rc.getFlag(tempStr,tempFlagValue))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::recognize"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- if(tempFlagValue == REC_MODE_BATCH)
- {
- //clear all the recognizer state
- clearRecognizerState();
- recognizeTraces(rc);
- }
- else if (tempFlagValue == REC_MODE_STREAMING)
- {
- recognizeTraces(rc);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_REC_MODE <<":"<< getErrorMessage(EINVALID_REC_MODE)
- <<" BoxedFieldRecognizer::recognize" <<endl;
-
- LTKReturnError(EINVALID_REC_MODE);
- }
-
- /* Now all the recognized results are in
- * m_decodedResults.
- */
-
- resultEnd = m_decodedResults.end();
-
- for(resultIter = m_decodedResults.begin(); resultIter != resultEnd ; ++resultIter)
- {
- normConf = (*resultIter).getResultConfidence();
-
- normConf /= ((*resultIter).getResultWord()).size();
-
- (*resultIter).setResultConfidence(normConf);
-
- }
-
- //number of requested results
- numWordRecoResults = rc.getNumResults();
-
- //checking with existing recognition results' size
- if(numWordRecoResults > m_decodedResults.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_INFO)
- << "Don't have enough results to populate. Num of results available = "
- << m_decodedResults.size() <<", however, results asked for ="
- << numWordRecoResults <<endl;
- }
-
- resultEnd = m_decodedResults.end();
- for(resultIndex =0,resultIter = m_decodedResults.begin();(resultIndex <numWordRecoResults)&&(resultIter != resultEnd); ++resultIndex,++resultIter)
- {
- //map the shape ids to unicode IDs
- if((errorCode = LTKStrEncoding::shapeStrToUnicode(m_boxedShapeProject,(*resultIter).getResultWord(),resultString)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::recognize"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- //adding the recognition result to recognition context
- rc.addRecognitionResult(LTKWordRecoResult(resultString,
- (*resultIter).getResultConfidence()));
-
- resultString.clear();
-
- }
-
- //clearing state of the recognizer
- clearRecognizerState();
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::recognize"
- <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : recognize
-* DESCRIPTION : This method reset the recognizer
-* ARGUMENTS : resetParam - This parameter could specify what to reset
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
- int BoxedFieldRecognizer::reset (int resetParam)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::reset"<<endl;
-
- clearRecognizerState();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::reset"
- <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : recognize
-* DESCRIPTION : This method reset the recognizer
-* ARGUMENTS : resetParam - This parameter could specify what to reset
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
- int BoxedFieldRecognizer::unloadModelData()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::unloadModelData"
- <<endl;
-
- //clear the recognition state
- clearRecognizerState();
-
- int errorCode=FAILURE;
-
- //unload the model data and
- //delete the shape recognizer
- if( m_shapeRecognizer && (m_module_deleteShapeRecognizer != NULL) )
- {
-
- if((errorCode = m_shapeRecognizer->unloadModelData()) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::unloadModelData"<<endl;
-
-
- LTKReturnError(errorCode);
- }
-
- if((errorCode = m_module_deleteShapeRecognizer(m_shapeRecognizer)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::unloadModelData"<<endl;
-
-
- LTKReturnError(errorCode);
- }
-
- m_shapeRecognizer = NULL;
- }
-
- //Freeing the shape recognition library
- if(m_hAlgoDLLHandle)
- {
- m_OSUtilPtr->unloadSharedLib(m_hAlgoDLLHandle);
- m_hAlgoDLLHandle = NULL;
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::unloadModelData"
- <<endl;
-
- return SUCCESS;
-}
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : ~BoxedFieldRecognizer
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
-
-BoxedFieldRecognizer::~BoxedFieldRecognizer()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::~BoxedFieldRecognizer"
- <<endl;
-
- //unload the model data
-
- int errorCode = FAILURE;
- if((errorCode = unloadModelData()) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::~BoxedFieldRecognizer"<<endl;
-
- throw LTKException(errorCode);
- }
-
- delete m_OSUtilPtr;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::~BoxedFieldRecognizer"
- <<endl;
-
-
-}
-
-
-//PRIVATE FUNCTIONS
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : clearRecognizerState
-* DESCRIPTION : Erase the state information of the recognizer
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
-
-void BoxedFieldRecognizer::clearRecognizerState()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::clearRecognizerState"
- <<endl;
-
- m_numCharsProcessed = 0; //initializing number of characters processed
- m_numTracesProcessed = 0; //initializing number of traces processed
- m_decodedResults.clear(); //clearing all the partially decoded results
- m_boxedChar = LTKTraceGroup(); //assigning a new empty LTKTraceGroup
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::clearRecognizerState"
- <<endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : recognizeTraces
-* DESCRIPTION : performs the recognition of the new strokes added to rc
-* : pre condition - markers are present in this vector
-* : - m_numTracesProcessed and m_numCharsProcessed
-* : set to proper value
-* ARGUMENTS : rc - The recognitino context
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
-int BoxedFieldRecognizer::recognizeTraces(LTKRecognitionContext& rc )
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::recognizeTraces"
- <<endl;
-
- vector<LTKTrace>::const_iterator traceIter,traceEnd,traceBegin;
- //iterator for the traces
-
- int errorCode = FAILURE;
-
- int recUnit; //unit for recognition (should be char)
-
- LTKTraceGroup emptyChar;
- //TraceGroup object that buffers
- //all ink corresponding to a character
-
- vector<int> subSet;
- //passing a null arguement for shape subset
-
- vector<LTKShapeRecoResult> shapeRecoResults;
- //The object to hold the output from shape recognizer
-
- LTKScreenContext screenContext = rc.getScreenContext();
- //retrieving the screen context
-
- LTKCaptureDevice captureDevice = rc.getDeviceContext();
- //retrieving the device context
-
- const LTKTraceVector & traces = rc.getAllInk();
- //retrieving the traces from recognition context
-
- string tempStr; //temporary string object
-
-
- if(m_shapeRecognizer == NULL)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) <<"Shape recognizer not initialized" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENULL_POINTER <<":"<< getErrorMessage(ENULL_POINTER)
- <<" BoxedFieldRecognizer::recognizeTraces" <<endl;
-
- LTKReturnError(ENULL_POINTER);
-
- }
- else if( (errorCode = m_shapeRecognizer->setDeviceContext(captureDevice)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Unable to set device context in shape rec : " << getErrorMessage(errorCode) <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::recognizeTraces"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- shapeRecoResults.reserve(m_numShapeRecoResults+1);//reserving memory
-
-
- if(m_numTracesProcessed > traces.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Invalid number of traces processed. "
- << "Traces processed = " << m_numTracesProcessed
- << " > total number of traces" << traces.size() <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_NUM_OF_TRACES <<":"<< getErrorMessage(EINVALID_NUM_OF_TRACES)
- <<" BoxedFieldRecognizer::recognizeTraces" <<endl;
-
- LTKReturnError(EINVALID_NUM_OF_TRACES);
- }
- //Start processing from the number of traces processed.
- traceBegin = traces.begin() + m_numTracesProcessed;
- traceEnd = traces.end();int r=0;
-
- for(traceIter = traceBegin; traceIter != traceEnd; ++traceIter)
- {
- /* Marker strokes are inserted to detect
- * end of segment. The marker strokes are
- * identified by 9number of channels == 0)
- */
- if((*traceIter).getNumberOfPoints() == 0)
- {
- tempStr = REC_UNIT_INFO;
- if((errorCode = rc.getFlag(tempStr,recUnit)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::recognizeTraces"<<endl;
-
- LTKReturnError(errorCode);
- }
- switch(recUnit)
- {
-
- /* The segment is character
- * This algorithm recognizes
- * only character segments
- */
- case REC_UNIT_CHAR:
- shapeRecoResults.clear();
- //calling the shape recognizer's recognize method.
-
- if(m_boxedChar.getNumTraces() == 0)
- {
- LTKShapeRecoResult T;
- T.setShapeId(SHRT_MAX);
- T.setConfidence(1.0);
- shapeRecoResults.push_back(T);
- }
- else if( (errorCode = m_shapeRecognizer->recognize(m_boxedChar,screenContext,subSet,
- m_shapeRecoMinConfidence, m_numShapeRecoResults, shapeRecoResults ))!= SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Shape recognition failed : " << getErrorMessage(errorCode) <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::recognizeTraces"<<endl;
-
- LTKReturnError(errorCode);
- }
-
-
- //This updates the recognition results using
- //current shape recognition results
-
- if((errorCode = updateRecognitionResults(shapeRecoResults,rc)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::recognizeTraces"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- for(r=0;r<shapeRecoResults.size();++r)
- {
- LTKShapeRecoResult& tempResult=shapeRecoResults[r];
-
- }
-
- m_boxedChar = emptyChar;//making the trace group empty again
- break;
-
- default:
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Unsupported reccognizer mode by Box Field" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_RECOGNITION_MODE <<":"<< getErrorMessage(EINVALID_RECOGNITION_MODE)
- <<" BoxedFieldRecognizer::recognizeTraces" <<endl;
-
- LTKReturnError(EINVALID_RECOGNITION_MODE);
-
- }
- ++m_numCharsProcessed; //incrementing number of characters processed
- }
- else
- {
- m_boxedChar.addTrace(*traceIter); //buffering the trace to the temp TraceGroup for recognition
- }
- ++m_numTracesProcessed; //incrementing the number of traces processed
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::recognizeTraces"
- <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-AUG-2005
-* NAME : updateRecognitionResults
-* DESCRIPTION : This function tries to update the
-* : shape recognition choices with new shape recognition results
-* ARGUMENTS : results - new results for updating the results
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
-int BoxedFieldRecognizer::updateRecognitionResults(const vector<LTKShapeRecoResult>& results, LTKRecognitionContext& rc)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::updateRecognitionResults"
- <<endl;
-
- multimap< float, pair<int,int>, greater<float> >backTrace;
- //A multi map is used for finding best N paths
- multimap< float, pair<int,int>, greater<float> >::iterator iter, iterend;
- //Iterator for accessing elements of the map
- pair<int,int> combination;
- //Temporary variable that keeps a (int,int) pair
- int wordResultIndex, shapeResultIndex;
- //loop index variables
- float wordConfidence, shapeConfidence;
- //word level and shape level confidences
- unsigned short newSymbol;
- //temporary storage for shape recognizer id
- float newConf; //temporary storage for shape recognizer confidence
-
- vector<LTKWordRecoResult> newResultVector;
- //new results after finding the best N paths
-
- int numWordRecoResults = rc.getNumResults();
- //number of word recognition results requested
- int numShapeRecoResults = results.size();
- //number of choices from the shape recognizer
- vector<unsigned short>initVec;
- //for initializing the trellis
-
-
-
- //If there is no decoded results (First shape recognition in the word)
- if(m_decodedResults.empty())
- {
- //Initializing the results vector
- m_decodedResults.assign(numShapeRecoResults,LTKWordRecoResult());
-
- //iterating through different word recognition choices
- for(wordResultIndex = 0; (wordResultIndex<numShapeRecoResults); ++wordResultIndex)
- {
- //Retrieving the shape recognition choices
-
- newSymbol = results.at(wordResultIndex).getShapeId();
- newConf = results.at(wordResultIndex).getConfidence();
-
- //updating the results
-
- initVec.assign(1,newSymbol);
- m_decodedResults.at(wordResultIndex).setWordRecoResult(initVec,newConf);
-
- }
- }
-
- else
- {
- //initializing a temporary result vector
- //newResultVector.assign(smallerResultNumber,LTKWordRecoResult());
-
- //iterating through each word recognition result
- for(wordResultIndex=0; wordResultIndex<m_decodedResults.size(); ++wordResultIndex)
- {
- wordConfidence = (m_decodedResults.at(wordResultIndex)).getResultConfidence();
-
- //iterating through each shape recognition results
- for(shapeResultIndex =0; shapeResultIndex<numShapeRecoResults; ++shapeResultIndex )
- {
- //adding total confidence to the map. so that later they
- //can be retrieved in the sorted order
- shapeConfidence = (results.at(shapeResultIndex)).getConfidence();
- backTrace.insert( pair<float, pair<int,int> >( (shapeConfidence+wordConfidence),
- pair<int,int>(wordResultIndex,shapeResultIndex)));
- }
- }
-
- iterend = backTrace.end();
-
- //iterating through the map to retrieve the largest confidences.
- for(wordResultIndex = 0,iter = backTrace.begin(); (wordResultIndex<numWordRecoResults)&&(iter!= iterend); ++wordResultIndex,++iter)
- {
-
- //confidence
- wordConfidence = (*iter).first;
-
- //the combination that gave this
- //confidence
- combination = (*iter).second;
-
- //copying the word reco result corresponding to
- //the combination to new result vector
- //newResultVector.at(wordResultIndex) = m_decodedResults.at(combination.first);
- LTKWordRecoResult tempWordRecoResult = m_decodedResults.at(combination.first);
-
- //retrieving the shape recognition result id
- //and confidence corresponding to the combination
- newSymbol = results.at(combination.second).getShapeId();
- newConf = results.at(combination.second).getConfidence();
-
- //updating the word reco result with new id and confidence
- //newResultVector.at(wordResultIndex).updateWordRecoResult(newSymbol, newConf);
-
- tempWordRecoResult.updateWordRecoResult(newSymbol,newConf);
- newResultVector.push_back(tempWordRecoResult);
- }
-
- //assigning the newly created result vector
- m_decodedResults = newResultVector;
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::updateRecognitionResults"
- <<endl;
-
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : createShapeRecognizer
-* DESCRIPTION : create an instance of shape recognizer object and call initialize
-* function. Also loads the model data.
-* ARGUMENTS : strProjectName - project name; strProfileName - profile name
-* RETURNS : handle to the recognizer on success & NULL on error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
- int BoxedFieldRecognizer::createShapeRecognizer(const string& strProjectName, const string& strProfileName,LTKShapeRecognizer** outShapeRecPtr)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::createShapeRecognizer"
- <<endl;
-
-
- LTKConfigFileReader* projectCfgFileEntries = NULL;
- LTKConfigFileReader* profileCfgFileEntries = NULL;
-
- string cfgFilePath = "";
- string shapeRecDllPath = "";
- int iResult = 0;
- string recognizerName = "";
- string strLocalProfileName(strProfileName);
-
-
- /* invalid or no entry for project name */
- if(strProjectName == "")
- {
-
- *outShapeRecPtr = NULL;
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Invalid or no entry for project name" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_PROJECT_NAME <<":"<< getErrorMessage(EINVALID_PROJECT_NAME)
- <<" BoxedFieldRecognizer::createShapeRecognizer" <<endl;
-
- LTKReturnError(EINVALID_PROJECT_NAME);
- }
-
- if(strProfileName == "")
- {
- strLocalProfileName = DEFAULT_PROFILE; /* assume the "default" profile */
- }
-
- cfgFilePath = m_lipiRoot + PROJECTS_PATH_STRING + strProjectName +
- PROFILE_PATH_STRING + PROJECT_CFG_STRING;
-
- try
- {
- projectCfgFileEntries = new LTKConfigFileReader(cfgFilePath);
- }
- catch(LTKException e)
- {
- delete projectCfgFileEntries;
-
- *outShapeRecPtr = NULL; // Error exception thrown...
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::createShapeRecognizer"<<endl;
-
- LTKReturnError(e.getErrorCode());
-
-
- }
-
- // Read the project.cfg and ensure this is a shaperecognizer; i.e. ProjectType = SHAPEREC;
- string projectType = "";
- projectCfgFileEntries->getConfigValue(PROJECT_TYPE_STRING, projectType);
-
- /* Invalid configuration entry for ProjectType */
- if(projectType != PROJECT_TYPE_SHAPEREC)
- {
- *outShapeRecPtr = NULL;
-
- int errorCode = EINVALID_CONFIG_ENTRY;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_CONFIG_ENTRY <<":"<< getErrorMessage(EINVALID_CONFIG_ENTRY)
- <<" BoxedFieldRecognizer::createShapeRecognizer" <<endl;
-
- LTKReturnError(errorCode);
-
- }
-
- // Read the profile.cfg and find out the recognition module to load;
- cfgFilePath = m_lipiRoot + PROJECTS_PATH_STRING + strProjectName +
- PROFILE_PATH_STRING + strLocalProfileName +
- SEPARATOR + PROFILE_CFG_STRING;
- try
- {
- profileCfgFileEntries = new LTKConfigFileReader(cfgFilePath);
- }
- catch(LTKException e)
- {
- *outShapeRecPtr = NULL;
-
- delete profileCfgFileEntries;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::createShapeRecognizer"<<endl;
-
- LTKReturnError(e.getErrorCode());
-
- }
-
- int errorCode = profileCfgFileEntries->getConfigValue(SHAPE_RECOGNIZER_STRING, recognizerName);
-
- /* No recognizer specified. */
- if(errorCode != SUCCESS)
- {
-
- *outShapeRecPtr = NULL;
-
- errorCode = ENO_SHAPE_RECOGNIZER;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENO_SHAPE_RECOGNIZER <<":"<< getErrorMessage(ENO_SHAPE_RECOGNIZER)
- <<" BoxedFieldRecognizer::createShapeRecognizer" <<endl;
-
- delete projectCfgFileEntries;
- delete profileCfgFileEntries;
-
- LTKReturnError(errorCode);
- }
-
- m_hAlgoDLLHandle = NULL;
- errorCode = m_OSUtilPtr->loadSharedLib(m_lipiLib, recognizerName, &m_hAlgoDLLHandle);
-
- // Unable to load dll
- if(errorCode != SUCCESS)
- {
- *outShapeRecPtr = NULL;
-
- errorCode = ELOAD_SHAPEREC_DLL;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ELOAD_SHAPEREC_DLL <<":"<< getErrorMessage(ELOAD_SHAPEREC_DLL)
- <<" BoxedFieldRecognizer::createShapeRecognizer" <<endl;
-
- delete projectCfgFileEntries;
- delete profileCfgFileEntries;
-
- LTKReturnError(errorCode);
-
- }
-
- // Map Algo DLL functions...
-
- // Unable to map the functions
- if((errorCode = mapShapeAlgoModuleFunctions()) != SUCCESS)
- {
- *outShapeRecPtr = NULL;
- delete projectCfgFileEntries;
- delete profileCfgFileEntries;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: BoxedFieldRecognizer::createShapeRecognizer"<<endl;
-
- LTKReturnError(errorCode)
- }
-
- // Construct LTKControlInfo object
- LTKControlInfo controlInfo;
- controlInfo.projectName = strProjectName;
- controlInfo.profileName = strLocalProfileName;
- controlInfo.lipiRoot = m_lipiRoot;
- controlInfo.lipiLib = m_lipiLib;
- controlInfo.toolkitVersion = m_toolkitVersion;
-
- *outShapeRecPtr = NULL;
-
- /* Error, unable to create shape recognizer instance */
- if((errorCode = m_module_createShapeRecognizer(controlInfo,outShapeRecPtr)) != SUCCESS)
- {
-
- *outShapeRecPtr = NULL;
-
- delete projectCfgFileEntries;
- delete profileCfgFileEntries;
-
- errorCode = ECREATE_SHAPEREC;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ECREATE_SHAPEREC <<":"<< getErrorMessage(ECREATE_SHAPEREC)
- <<" BoxedFieldRecognizer::createShapeRecognizer" <<endl;
-
-
-
- LTKReturnError(errorCode);
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting BoxedFieldRecognizer::createShapeRecognizer" << endl;
-
- delete projectCfgFileEntries;
- delete profileCfgFileEntries;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::createShapeRecognizer"
- <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Thanigai
-* DATE : 29-JUL-2005
-* NAME : mapShapeAlgoModuleFunctions
-* DESCRIPTION : To map function addresses of the methods exposed by
-* the shape recognition modules
-* ARGUMENTS : None
-* RETURNS : 0 on success and other values on error
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of
-*************************************************************************************/
-int BoxedFieldRecognizer::mapShapeAlgoModuleFunctions()
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Entering: BoxedFieldRecognizer::mapShapeAlgoModuleFunctions"
- <<endl;
-
- int returnVal = SUCCESS;
- m_module_createShapeRecognizer = NULL;
-
- void* functionHandle = NULL;
- returnVal = m_OSUtilPtr->getFunctionAddress(m_hAlgoDLLHandle,
- CREATESHAPERECOGNIZER_FUNC_NAME,
- &functionHandle);
-
- if(returnVal != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Exported function not found in module : createShapeRecognizer "<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EDLL_FUNC_ADDRESS <<":"<< getErrorMessage(EDLL_FUNC_ADDRESS)
- <<" BoxedFieldRecognizer::mapShapeAlgoModuleFunctions" <<endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS);
- // ERROR: Unable to link with createShapeRecognizer function in module */
- }
-
- m_module_createShapeRecognizer = (FN_PTR_CREATESHAPERECOGNIZER)functionHandle;
-
- functionHandle = NULL;
-
-
- // map delete shape recognizer function
- returnVal = m_OSUtilPtr->getFunctionAddress(m_hAlgoDLLHandle,
- DELETESHAPERECOGNIZER_FUNC_NAME,
- &functionHandle);
-
- if(returnVal != SUCCESS)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Exported function not found in module : deleteShapeRecognizer " << endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EDLL_FUNC_ADDRESS <<":"<< getErrorMessage(EDLL_FUNC_ADDRESS)
- <<" BoxedFieldRecognizer::mapShapeAlgoModuleFunctions" <<endl;
-
- LTKReturnError(EDLL_FUNC_ADDRESS);
- }
-
- m_module_deleteShapeRecognizer = (FN_PTR_DELETESHAPERECOGNIZER)functionHandle;
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Exiting: BoxedFieldRecognizer::mapShapeAlgoModuleFunctions"
- <<endl;
-
- return SUCCESS;
-}
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h
deleted file mode 100644
index e0703b5a..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/BoxFieldRecognizer.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-* THE SOFTWARE.
-******************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for DP word recognizer
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: August 17, 2005
- * CHANGE HISTORY:
- * Author Date Description of
- ************************************************************************/
-
-#ifndef __BOXFIELDRECOGNIZER_H
-#define __BOXFIELDRECOGNIZER_H
-
-#include "LTKWordRecognizer.h"
-#include "LTKLoggerUtil.h"
-#include "LTKWordRecoResult.h"
-#include "LTKShapeRecoResult.h"
-
-class LTKShapeRecognizer;
-class LTKWordRecoConfig;
-class LTKOSUtil;
-
-typedef int (*FN_PTR_CREATESHAPERECOGNIZER)(const LTKControlInfo&,
- LTKShapeRecognizer**);
-
-typedef int (*FN_PTR_DELETESHAPERECOGNIZER)(LTKShapeRecognizer*);
-
-
-/**
-* @class BoxedFieldWordRecognizer
-* <p> This class contains the implementation of the Boxed Field
-* word recognizer</p>
-*/
-
-class BoxedFieldRecognizer : public LTKWordRecognizer
-{
-private:
-
- /** Boxed Field Recognizer config file name */
- string m_boxedConfigFile;
-
- /** Lipi root */
- string m_lipiRoot;
-
- /** Lipi libraries */
- string m_lipiLib;
-
- /** Isolated shape recognizer project used for recognizing each box */
- string m_boxedShapeProject;
-
- /** Profile for the shape recognition project */
- string m_boxedShapeProfile;
-
- /**
- * @name shape recognizer related
- */
-
- // @{
- LTKShapeRecognizer *m_shapeRecognizer; // shape recognizer
-
- /** Number of results from shape recognizer */
- int m_numShapeRecoResults;
-
- /** The confidence parameter input to shape recognizer */
- float m_shapeRecoMinConfidence;
-
- /** Temporary trace group that holds the strokes for recognition */
- LTKTraceGroup m_boxedChar;
-
- string m_logFile;
-
- LTKLogger::EDebugLevel m_logLevel;
-
- string m_toolkitVersion;
-
- LTKOSUtil* m_OSUtilPtr;
- // @}
-
- /**
- * @name Shape recognizer loading
- */
-
- /** Factory method to create the shape recognizer */
- FN_PTR_CREATESHAPERECOGNIZER m_module_createShapeRecognizer;
-
- /** Factory method to delete the shape recognizer */
- FN_PTR_DELETESHAPERECOGNIZER m_module_deleteShapeRecognizer;
-
- //void * m_hAlgoDLLHandle; //handle to the wordrecognition algorithm
-
- /**
- * @name state of recognizer
- */
- // @{
-
- /** Number of characters processed so far */
- int m_numCharsProcessed;
-
- /** Number of traces processed so far */
- int m_numTracesProcessed;
-
- /** maintains decoded recognition results after each trace, upto max style length */
- vector <LTKWordRecoResult> m_decodedResults;
-
- // @}
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
-
- /**
- * Parameterized Constructor
- */
-
- BoxedFieldRecognizer(const LTKControlInfo& controlInfo);
- /**
- * Destructor
- */
-
- virtual ~BoxedFieldRecognizer();
- // @}
-
-
- /**
- * This method is called from recognition context whenever new traces
- * are added to it. The Recognizer need to process the new traces
- * in this methods and updates the internal state.
- * @param rc The recognition context for the current recognition
- */
- int processInk (LTKRecognitionContext& rc);
-
- /**
- * This function notifies the recognizer that end of current ink is
- * the end of a logic segment. This information could be used in
- * constraining the recognizer choices
- */
- void endRecoUnit () ;
-
- /**
- * This is the recognize call. In case of trace by trace recognition
- * The results of the recognition is set on the Recognition context
- * object.
- * @param rc The recognition context for the current recognition
- */
- int recognize (LTKRecognitionContext& rc) ;
-
- /**
- * This method unloads all the training data
- * To re-initialize the recognizer call the
- * API initialize again
- */
- int unloadModelData();
-
-
- /**
- * This method reset the recognizer.
- * @param resetParam This parameter could specify what to reset
- */
- int reset (int resetParam = 0) ;
- // @}
-private:
-
- /**
- * performs the recognition of the new strokes added to recognition context
- * @param rc The recognitino context
- */
-
- int recognizeTraces(LTKRecognitionContext& rc);
-
- /**
- * Erase the state information of the recognizer
- */
- void clearRecognizerState();
-
- /**
- * This function tries to update the
- * shape recognition choices with new shape recognition results
- * @param results New results for updating the results
- */
- int updateRecognitionResults(const vector<LTKShapeRecoResult>& results, LTKRecognitionContext& rc);
-
- /**
- * This function loads and create a shape recognizer
- * from DLL/shared object
- **/
- int createShapeRecognizer(const string& strProjectName, const string& strProfileName,LTKShapeRecognizer** outShapeRecPtr);
-
- /**
- * This function loads functions pointers
- * from the shape recognizer DLL/SO
- **/
- int mapShapeAlgoModuleFunctions();
-
-
- int readClassifierConfig();
-
-};
-#endif //#ifndef __BOXFIELDRECOGNIZER_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/CMakeLists.txt
deleted file mode 100644
index aec7e19d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Generated from boxfld.pro.
-
-#####################################################################
-## boxfld Generic Library:
-#####################################################################
-
-qt_add_cmake_library(boxfld
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- BoxFieldRecognizer.cpp BoxFieldRecognizer.h
- boxfld.cpp boxfld.h
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- ../common
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(boxfld)
-
-#### Keys ignored in scope 1:.:.:boxfld.pro:<TRUE>:
-# LIPILIBS = "shaperecommon" "ltkcommon" "ltkutil" "wordreccommon"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(boxfld CONDITION WIN32
- DEFINES
- BOXFLD_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(boxfld CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(boxfld)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg
deleted file mode 100644
index b727da97..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cfg
+++ /dev/null
@@ -1,13 +0,0 @@
-#Number of characters per field
-MaxBoxCount = 30
-
-#The shaperecognizer project and profile name
-BoxedShapeProject = numerals
-BoxedShapeProfile = default
-
-#Min confidence from shape recognizer
-MinShapeConfid = 0
-
-#Number of choices requested from the shape recognizer
-NumShapeChoices = 3
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp
deleted file mode 100644
index 45969652..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
- * $Revision: 827 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of boxfld dll exported functions.
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: Aug 23, 2005
- * CHANGE HISTORY:
- * Author Date Description of
- ************************************************************************/
-#include "boxfld.h"
-#include "LTKMacros.h"
-#include "LTKException.h"
-
-
-#ifdef _WIN32
-
-//DLL MAIN for Windows
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-
-#endif
-
-/**********************************************************************************
-* AUTHOR : Deepu V
-* DATE : 23-Aug-2005
-* NAME : createWordRecognizer
-* DESCRIPTION : Crates instance of type BoxField Recongnizer and retuns of type
- LTKWordRecongizer. (Acts as a Factory Method).
-* ARGUMENTS :
-* RETURNS : returns an instace of type LTKWordRecoginzer.
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description of
-*************************************************************************************/
-int createWordRecognizer(const LTKControlInfo& controlInfo,LTKWordRecognizer** boxFldRecoPtr)
-{
-
- try
- {
- *boxFldRecoPtr = (LTKWordRecognizer*) new BoxedFieldRecognizer(controlInfo);
- }
- catch(LTKException e)
- {
- *boxFldRecoPtr = NULL;
- LTKReturnError(e.getErrorCode());
- }
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V
-* DATE : 23-Aug-2005
-* NAME : deleteWordRecognizer
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS : returns an instace of type LTKWordRecoginzer.
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description of
-*************************************************************************************/
-//Destroys the instance by taking its addess as its argument.
-int deleteWordRecognizer(LTKWordRecognizer* obj)
-{
- /*delete obj;
-
- obj = NULL;
-
- return SUCCESS;*/
-
- try
- {
- if (obj != NULL )
- {
- delete obj;
- obj = NULL;
- }
- }
- catch(LTKException e)
- {
- LTKReturnError(e.getErrorCode());
- }
-
-
- return SUCCESS;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def
deleted file mode 100644
index 452b6dd6..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- createWordRecognizer @1
- deleteWordRecognizer @2
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h
deleted file mode 100644
index f44d2ab3..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for boxfld dll exporting functions.
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: Aug 23, 2005
- * CHANGE HISTORY:
- * Author Date Description of
- ************************************************************************/
-#ifndef __BOXFLD_H__
-#define __BOXFLD_H__
-
-#ifdef _WIN32
-#include <windows.h>
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the DTW_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// DTW_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-#ifdef BOXFLD_EXPORTS
-#define BOXFLD_API __declspec(dllexport)
-#else
-#define BOXFLD_API __declspec(dllimport)
-#endif
-#else
-#define BOXFLD_API
-#endif //#ifdef _WIN32
-
-
-#include "LTKWordRecognizer.h"
-#include "BoxFieldRecognizer.h"
-#include "LTKLoggerUtil.h"
-#include "LTKErrors.h"
-
-void *m_hAlgoDLLHandle;
-
-/**
- * Crates instance of type PCAShaperecongnizer and retuns of type
- * LTKShpeRecongizer. (Acts as a Factory Method).
- *
- * @param void - No argument
- *
- * @return LTKShapeRecognizer - an instace of type LTKShapeRecoginzer.
- */
-
-//Creates Instance of the Box Field recognizer and returns base class (LTKWordRecognizer) pointer
-extern "C" BOXFLD_API int createWordRecognizer(const LTKControlInfo& controlInfo,LTKWordRecognizer** boxFldRecoPtr);
-
-/**
- * Destry the instance by taking the address as its argument.
- *
- * @param obj - Address of LTKShapeRecognizer instnace.
- *
- * @return 0 on Success
- */
-
-//Destroys the instance by taking its addess as its argument.
-extern "C" BOXFLD_API int deleteWordRecognizer(LTKWordRecognizer* obj);
-
-#endif //#ifndef __BOXFLD_H__
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro
deleted file mode 100644
index 5d16d041..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/boxfld/boxfld.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-LIPILIBS = shaperecommon ltkcommon ltkutil wordreccommon
-include(../../../lipiplugin.pri)
-
-INCLUDEPATH += \
- ../../../util/lib \
- ../common \
-
-HEADERS += \
- BoxFieldRecognizer.h \
- boxfld.h \
-
-SOURCES += \
- BoxFieldRecognizer.cpp \
- boxfld.cpp \
-
-win32 {
- DEFINES += BOXFLD_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = boxfld.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/CMakeLists.txt
deleted file mode 100644
index 5eee1368..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated from common.pro.
-
-#####################################################################
-## wordreccommon Generic Library:
-#####################################################################
-
-qt_add_cmake_library(wordreccommon
- STATIC
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/lib"
- SOURCES
- LTKRecognitionContext.cpp
- LTKWordRecoConfig.cpp
- LTKWordRecoResult.cpp
- INCLUDE_DIRECTORIES
- ../../../include
- ../../../util/lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(wordreccommon)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(wordreccommon CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp
deleted file mode 100644
index 4fc45305..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKRecognitionContext.cpp
+++ /dev/null
@@ -1,1065 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate$
- * $Revision$
- * $Author$
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKRecognitionContext that holds the context
- * for recognition
- *
- * CONTENTS:
- * addTrace
- * addTraceGroup
- * beginRecoUnit
- * endRecoUnit
- * getAllInk
- * getConfidThreshold
- * getDeviceContext
- * getFlag
- * getLanguageModel
- * getNextBestResults
- * getNumResults
- * getScreenContext
- * getTopResult
- * setConfidThreshold
- * setDeviceContext
- * setFlag
- * setLanguageModel
- * setNumResults
- * setScreenContext
- * addRecognitionResult
- * recognize
- * reset
- *
- * AUTHOR: Deepu V.
- *
- * DATE: February 22, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- * Thanigai 3-AUG-2005 Added default constructor and setWordRecoEngine
- * methods.
- *
- * Deepu 30-AUG-2005 Replaced LTKWordRecoEngine with LTKWordRecognizer
- * Changed the representation of m_recognitionFlags
- * since there was a problem with dlls
-************************************************************************/
-
-#include "LTKRecognitionContext.h"
-#include "LTKMacros.h"
-#include "LTKErrors.h"
-#include "LTKTrace.h"
-
-#include "LTKErrorsList.h"
-
-#include "LTKTraceGroup.h"
-
-#include "LTKWordRecoResult.h"
-
-#include "LTKWordRecognizer.h"
-
-#include "LTKLoggerUtil.h"
-
-#include "LTKException.h"
-
-/**********************************************************************************
-* AUTHOR : Thanigai
-* DATE : 3-AUG-2005
-* NAME : LTKRecognitionContext
-* DESCRIPTION : Default constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKRecognitionContext::LTKRecognitionContext()
-:m_confidThreshold(0),
-m_numResults(0),
-m_nextBestResultIndex(0),
-m_wordRecPtr(NULL)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::LTKRecognitionContext()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::LTKRecognitionContext()" << endl;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-FEB-2005
-* NAME : LTKRecognitionContext
-* DESCRIPTION : Initialization constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer *wordRecPtr )
-:m_wordRecPtr(wordRecPtr),
-m_confidThreshold(0),
-m_numResults(0),
-m_nextBestResultIndex(0)
-
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer*)" << endl;
-
- if(m_wordRecPtr == NULL)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENULL_POINTER <<":"<< getErrorMessage(ENULL_POINTER)
- <<" LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer*)" <<endl;
-
- throw LTKException(ENULL_POINTER);
- }
-
- m_recognitionFlags.clear();
- m_wordRecPtr = wordRecPtr;
-
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer*)" << endl;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Thanigai
-* DATE : 3-AUG-2005
-* NAME : setWordRecoEngine
-* DESCRIPTION : Accepts the handle to word recognition engine and store it locally
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::setWordRecoEngine(LTKWordRecognizer *wordRecPtr)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::setWordRecoEngine()" << endl;
-
- if(wordRecPtr == NULL)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENULL_POINTER <<":"<< getErrorMessage(ENULL_POINTER)
- <<" LTKRecognitionContext::setWordRecoEngine()" <<endl;
-
- LTKReturnError(ENULL_POINTER);
- }
- m_wordRecPtr = wordRecPtr;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::setWordRecoEngine()" << endl;
-
- return SUCCESS;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-FEB-2005
-* NAME : addTrace
-* DESCRIPTION : This function adds a trace to the recognition context for
-* recognition
-* ARGUMENTS : trace - the trace to be added
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::addTrace (const LTKTrace& trace)
-{
- int recMode; //strokes temporary string for getFlag
- string tempStr; // the recognition mode
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::addTrace()" << endl;
-
-
- m_fieldInk.push_back(trace); //pushing incoming trace to local buffer
-
- //if the recognition mode is set to streaming mode
- //the recognizer is called at this point
-
- tempStr = REC_MODE;
-
- int errorCode;
-
- if((errorCode = getFlag(tempStr,recMode))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKRecognitionContext::addTrace()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- if(recMode == REC_MODE_STREAMING)
- {
- m_wordRecPtr->processInk(*this);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::addTrace()" << endl;
-
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-FEB-2005
-* NAME : addTraceGroup
-* DESCRIPTION : Adds a vector of tracegroup for recognition in the recognition context
-* ARGUMENTS : fieldInk - the ink to be added.
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::addTraceGroups (const LTKTraceGroupVector& fieldInk)
-{
- int numTraceGroups = fieldInk.size(); //number of trace groups
- int numTraces =0; //number of traces in each trace group
- string tempStr; //strokes temporary string for getFlag
- int recMode =0; // the recognition mode
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::addTraceGroups()" << endl;
-
- for(int i =0; i<numTraceGroups; ++i)
- {
- //accessing each trace group
- const LTKTraceGroup& traceGp = fieldInk[i];
-
- //get all traces from tracegp
- //const LTKTraceVector& allTraces = traceGp.getAllTraces();
- const LTKTraceVector& allTraces = traceGp.getAllTraces();
-
- //push each trace to local buffer
- numTraces = allTraces.size();
-
- for(int j = 0; j<numTraces; ++j)
- {
- m_fieldInk.push_back(allTraces[j]);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_INFO) << "Pushed Trace Group:"<<i<<endl;
-
- }
-
- //if the recognition mode is set to streaming mode
- //the recognizer is called at this point
- tempStr = REC_MODE;
-
- int errorCode;
-
- if((errorCode = getFlag(tempStr,recMode))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKRecognitionContext::addTraceGroups()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- if(recMode == REC_MODE_STREAMING)
- {
- m_wordRecPtr->processInk(*this);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::addTraceGroups()" << endl;
-
-
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : beginRecoUnit
-* DESCRIPTION : This function marks the beginning of a recognition unit of Ink.
-* ARGUMENTS : none
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void LTKRecognitionContext::beginRecoUnit ( )
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::beginRecoUnit()" << endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::beginRecoUnit()" << endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : clearRecognitionResult
-* DESCRIPTION : clears all the recognition results
-* ARGUMENTS : none
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::clearRecognitionResult ( )
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::clearRecognitionResult()" << endl;
-
- //clearing the results
- m_results.clear();
-
- //reset the index of next best result
- m_nextBestResultIndex = 0;
-
- m_fieldInk.clear();
-
- int errorCode;
-
- if((errorCode=m_wordRecPtr->reset())!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKRecognitionContext::clearRecognitionResult()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::clearRecognitionResult()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : endRecoUnit
-* DESCRIPTION : This function marks the ending of a recognition unit of Ink.
-* ARGUMENTS : none
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-void LTKRecognitionContext::endRecoUnit ( )
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::endRecoUnit()" << endl;
-
- //pushing a "marker" into the stream
- m_fieldInk.push_back(LTKTrace());
-
- //calling the marker of the recognizer
- m_wordRecPtr->endRecoUnit();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::endRecoUnit()" << endl;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getAllInk
-* DESCRIPTION : Access function for the internal Ink data.
-* ARGUMENTS : none
-* RETURNS : reference to internal Ink data
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-const LTKTraceVector& LTKRecognitionContext::getAllInk () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getAllInk()" << endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getAllInk()" << endl;
-
- return m_fieldInk;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getConfidThreshold
-* DESCRIPTION : Access function for internal confidence threshold
-* ARGUMENTS : none
-* RETURNS : confidence threshold
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float LTKRecognitionContext::getConfidThreshold () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getConfidThreshold()" << endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getConfidThreshold()" << endl;
-
- return m_confidThreshold;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getDeviceContext
-* DESCRIPTION : Access function for device context
-* ARGUMENTS : none
-* RETURNS : reference to LTKCapture device
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-const LTKCaptureDevice& LTKRecognitionContext::getDeviceContext ( ) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getDeviceContext()" << endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getDeviceContext()" << endl;
-
- return m_deviceContext;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getFlag
-* DESCRIPTION : Returns the value of the flag
-* ARGUMENTS : key - index of map
-* RETURNS : value of queried flag (int)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKRecognitionContext::getFlag (const string& key,int& outValue) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getFlag()" << endl;
-
- if(key=="")
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKRecognitionContext::getFlag()" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
- vector<pair<string,int> >::const_iterator iter,iterEnd;
-
- iterEnd = m_recognitionFlags.end();
-
- //Iterating through the vector to find the key
- for(iter = m_recognitionFlags.begin(); iter != iterEnd; ++iter)
- {
- if( (*iter).first == key )
- {
- outValue = (*iter).second;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getFlag()" << endl;
-
- return SUCCESS;
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EKEY_NOT_FOUND <<":"<< getErrorMessage(EKEY_NOT_FOUND)
- <<" LTKRecognitionContext::getFlag()" <<endl;
-
- LTKReturnError(EKEY_NOT_FOUND);
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getLanguageModel
-* DESCRIPTION : returns the current language model indexed by the key
-* ARGUMENTS : key - index of map
-* RETURNS : value of the queried language model (string)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKRecognitionContext::getLanguageModel (const string& key,
- string& outValue) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getLanguageModel()" << endl;
-
- if(key=="")
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKRecognitionContext::getLanguageModel()" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
-
- stringStringMap::const_iterator iterMap;
-
- iterMap = this->m_languageModels.find(key);
-
- if(iterMap != m_languageModels.end() )
- {
- outValue = iterMap->second;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getLanguageModel()" << endl;
- return SUCCESS;
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EKEY_NOT_FOUND <<":"<< getErrorMessage(EKEY_NOT_FOUND)
- <<" LTKRecognitionContext::getLanguageModel()" <<endl;
-
- LTKReturnError(EKEY_NOT_FOUND);
-
-
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getNextBestResults
-* DESCRIPTION : returns the next N best results
-* ARGUMENTS : numResults - number of results required
-* : results - This will be populated with results
-* RETURNS : SUCCESS/FAILURE
-* NOTES : Maximum number of results added is limited by number of results
-* : available.
-* : vector is not cleared inside the function
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::getNextBestResults (int numResults,
- LTKWordRecoResultVector& outWordRecResults)
-{
- int lastIndex = 0;//Last index
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getNextBestResults()" << endl;
-
- if(numResults<=0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENON_POSITIVE_NUM <<":"<< getErrorMessage(ENON_POSITIVE_NUM)
- <<" LTKRecognitionContext::getNextBestResults()" <<endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
-
- vector<LTKWordRecoResult>::const_iterator resultBegin, resultEnd, resultIter;
-
- //Finding index of requested results
- resultBegin = m_results.begin() + m_nextBestResultIndex;
-
- //Finding index of requested results
- resultEnd = m_results.begin() + m_nextBestResultIndex + numResults;
-
- if(resultBegin > resultEnd
-)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting LTKRecognitionContext::getNextBestResults" <<endl;
-
- return SUCCESS;
- }
-
- //limiting the end to the limits of available results
- if(resultEnd > m_results.end() )
- resultEnd = m_results.end();
-
- //pushing back the results
- for(resultIter = resultBegin; resultIter< resultEnd; ++resultIter)
- {
- outWordRecResults.push_back(*resultIter);
- }
-
- //updating next best result index
- m_nextBestResultIndex += numResults;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getNextBestResults()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getNumResults
-* DESCRIPTION : parameter number of results
-* ARGUMENTS : none
-* RETURNS : number of results (int)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKRecognitionContext::getNumResults () const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getNumResults()" << endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getNumResults()" << endl;
-
- return m_numResults;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getScreenContext
-* DESCRIPTION : access function for the screen context
-* ARGUMENTS : none
-* RETURNS : reference to screencontext object
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-const LTKScreenContext& LTKRecognitionContext::getScreenContext ( ) const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getScreenContext()" << endl;
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getScreenContext()" << endl;
-
- return m_screenContext;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : getTopResult
-* DESCRIPTION : get the top result from the recognition context
-* ARGUMENTS : result - will be assigned to the top recognition result
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::getTopResult (LTKWordRecoResult& outTopResult)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::getTopResult()" << endl;
-
- if(m_results.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_WORDREC_RESULTS <<":"<< getErrorMessage(EEMPTY_WORDREC_RESULTS)
- <<" LTKRecognitionContext::getTopResult()" <<endl;
-
- LTKReturnError(EEMPTY_WORDREC_RESULTS);
- }
-
- m_nextBestResultIndex = 1;
-
- //assigning the value to output
- outTopResult = m_results[0];
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::getTopResult()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : setConfidThreshold
-* DESCRIPTION : set the confidence threshold
-* ARGUMENTS : thresh - the threshold value to be set
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::setConfidThreshold (float thresh)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::setConfidThreshold()" << endl;
-
- if(thresh < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"
- << getErrorMessage(ENEGATIVE_NUM)
- <<" LTKRecognitionContext::setConfidThreshold()" <<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
- }
-
- m_confidThreshold = thresh;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::setConfidThreshold()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : setDeviceContext
-* DESCRIPTION : set the device context
-* ARGUMENTS : dc - reference to device context object to be set
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void LTKRecognitionContext::setDeviceContext (const LTKCaptureDevice& dc)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::setDeviceContext()" << endl;
-
- m_deviceContext = dc;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::setDeviceContext()" << endl;
-
-
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : setFlag
-* DESCRIPTION : sets the flag
-* ARGUMENTS : key - index of the flag to be set
-* : value - value of the flag to be set
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKRecognitionContext::setFlag (const string& key, int value)
-{
- vector<pair<string,int> >::iterator iter,iterEnd;//iterators for iterating through all flags
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::setFlag()" << endl;
-
- if(key=="")
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKRecognitionContext::setFlag()" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
- iterEnd = m_recognitionFlags.end();
-
- //looping through the map to check whether the flag exists
- for(iter = m_recognitionFlags.begin(); iter != iterEnd; ++iter)
- {
- if((*iter).first == key)
- {
- (*iter).second = value;
- break;
- }
- }
-
- //if the flag is not there in the map add a new flag
- if((iter == iterEnd)||(m_recognitionFlags.empty()) )
- {
- m_recognitionFlags.push_back(pair<string,int>(key,value));
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::setFlag()" << endl;
-
- return SUCCESS;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : setLanguageModel
-* DESCRIPTION : sets the language model
-* ARGUMENTS : property - name of ppty to be set (DICTIONARY, GRAMMAR)
-* : value - value to be set
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::setLanguageModel (const string& property, const string& value)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::setLanguageModel()" << endl;
-
- if(property=="" || value=="")
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
- "Either property or value is empty"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKRecognitionContext::setLanguageModel()" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
- m_languageModels [property] = value;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::setLanguageModel()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : setNumResults
-* DESCRIPTION : sets parameter number of results to be buffered from recognizer
-* ARGUMENTS : numResults - the value to be set
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKRecognitionContext::setNumResults (int numResults)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::setNumResults()" << endl;
-
- if(numResults <= 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENON_POSITIVE_NUM <<":"
- << getErrorMessage(ENON_POSITIVE_NUM)
- <<" LTKRecognitionContext::setNumResults()" <<endl;
-
- LTKReturnError(ENON_POSITIVE_NUM);
- }
-
- m_numResults = numResults;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::setNumResults()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : setScreenContext
-* DESCRIPTION : sc - reference to the screencontext object to be set
-* ARGUMENTS : numResults - the value to be set
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void LTKRecognitionContext::setScreenContext (const LTKScreenContext& sc)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::setScreenContext()" << endl;
-
- m_screenContext = sc;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::setScreenContext()" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : addRecognitionResult
-* DESCRIPTION : used by the recognizer to set the results back in the recognition context
-* ARGUMENTS : result - the value to be added
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void LTKRecognitionContext::addRecognitionResult (const LTKWordRecoResult& result)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::addRecognitionResult()" << endl;
-
- //adding the result to the internal data structure
- m_results.push_back(result);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::addRecognitionResult()" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : recognize
-* DESCRIPTION : the recognize call from the application.
-* : calls the recognize emthod of the recognizer
-* ARGUMENTS : numResults - the value to be set
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKRecognitionContext::recognize ()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::recognize()" << endl;
-
- int errorCode;
-
- //calling recognize method of the recognizer
- if(m_wordRecPtr!=NULL)
- {
- if( (errorCode = m_wordRecPtr->recognize(*this)) != SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKRecognitionContext::recognize()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Recognizer is not initialized" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENULL_POINTER <<":"<< getErrorMessage(ENULL_POINTER)
- <<" LTKRecognitionContext::recognize()" <<endl;
-
-
- LTKReturnError(ENULL_POINTER);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::recognize()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 28-FEB-2005
-* NAME : reset
-* DESCRIPTION : Reset various parameters.
-* ARGUMENTS : resetParam - specifies data to be rest
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-/**
-* This function is used to reset the different components of recognition context
-* @param resetParam : parameter that identifies the component to be reset
-* @return SUCCESS/FAILURE
-*/
-int LTKRecognitionContext::reset (int resetParam)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKRecognitionContext::reset()" << endl;
-
- if(resetParam & LTK_RST_INK)
- {
- m_fieldInk.clear();
- }
-
- if(resetParam & LTK_RST_RECOGNIZER)
- {
- int errorCode=0;
-
- if((errorCode=m_wordRecPtr->reset(resetParam))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKRecognitionContext::reset()"<<endl;
-
- LTKReturnError(errorCode);
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKRecognitionContext::reset()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 22-FEB-2005
-* NAME : LTKRecognitionContext
-* DESCRIPTION : Destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKRecognitionContext::~LTKRecognitionContext()
-{
-
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp
deleted file mode 100644
index 57fc6317..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoConfig.cpp
+++ /dev/null
@@ -1,477 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate$
- * $Revision$
- * $Author$
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definition of LTKWordRecoConfig holds the config data for
- * the recognizer at the time of loading.
- *
- * CONTENTS:
- * getClassifierName
- * getDictionaryPath
- * getLipiRoot
- * getNumClasses
- * getProfile
- * getScript
- * getShapeSet
- * readConfigFile
- * setLipiRoot
- *
- * AUTHOR: Mudit Agrawal.
- *
- * DATE: Mar 2, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu 24-MAR-2005 Added getGrammarPath
- ************************************************************************/
-
-
-#include "LTKWordRecoConfig.h"
-
-#include "LTKMacros.h"
-
-#include "LTKErrors.h"
-
-#include "LTKErrorsList.h"
-
-#include "LTKException.h"
-
-#include "LTKLoggerUtil.h"
-
-#include "LTKConfigFileReader.h"
-
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 01-MAR-2005
-* NAME : LTKWordRecoConfig
-* DESCRIPTION : DEFAULT CONSTRUCTOR
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-LTKWordRecoConfig::LTKWordRecoConfig()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoConfig::LTKWordRecoConfig()" << endl;
- m_lipiRoot = "";
- m_problemName = "";
- m_profile = "";
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoConfig::LTKWordRecoConfig()" << endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : LTKWordRecoConfig
-* DESCRIPTION : Initialization Constructor
-* ARGUMENTS : lipiRoot
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-LTKWordRecoConfig::LTKWordRecoConfig(const string& lipiRoot)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoConfig::LTKWordRecoConfig(const string&)" << endl;
-
- if(lipiRoot=="")
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKWordRecoConfig::LTKWordRecoConfig(const string&)" <<endl;
-
- throw LTKException(EEMPTY_STRING);
- }
-
- m_lipiRoot = lipiRoot;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "m_lipiRoot = " << m_lipiRoot <<endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoConfig::LTKWordRecoConfig(const string&)" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : getClassifierName
-* DESCRIPTION : This function returns the classifier name
-* ARGUMENTS : none
-* RETURNS : returns the classifier name
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-string LTKWordRecoConfig::getClassifierName() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering: LTKWordRecoConfig::getClassifierName()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::getClassifierName()" <<endl;
-
- return m_classifierName;
-}
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : getDictionaryPath
-* DESCRIPTION : This function returns the Dictionary Path
-* ARGUMENTS : none
-* RETURNS : returns the Dictionary Path
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-string LTKWordRecoConfig::getDictionaryPath() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entered: LTKWordRecoConfig::getDictionaryPath()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::getDictionaryPath()" <<endl;
-
- return m_dictionaryPath;
-}
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : getDictionaryPath
-* DESCRIPTION : This function returns the Dictionary Path
-* ARGUMENTS : none
-* RETURNS : returns the Dictionary Path
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-string LTKWordRecoConfig::getGrammarPath() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entered: LTKWordRecoConfig::getGrammarPath()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::getGrammarPath()" <<endl;
-
- return m_grammarPath;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : getLipiRoot
-* DESCRIPTION : This function returns the lipi root
-* ARGUMENTS : none
-* RETURNS : returns the lipi root
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-string LTKWordRecoConfig::getLipiRoot() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering: LTKWordRecoConfig::getLipiRoot()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::getLipiRoot()" <<endl;
-
- return m_lipiRoot;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : getProfile
-* DESCRIPTION : This function returns the profile
-* ARGUMENTS : none
-* RETURNS : returns the profile
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-string LTKWordRecoConfig::getProfile() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering: LTKWordRecoConfig::getProfile()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::getProfile()" <<endl;
-
- return m_profile;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : getScript
-* DESCRIPTION : This function returns the script
-* ARGUMENTS : none
-* RETURNS : returns the script
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-string LTKWordRecoConfig::getScript() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering: LTKWordRecoConfig::getScript()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::getScript()" <<endl;
-
- return m_script;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 23-MAR-2005
-* NAME : getProblemName
-* DESCRIPTION : returns the problem name
-* ARGUMENTS : none
-* RETURNS : returns the problem name
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-string LTKWordRecoConfig::getProblemName() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering: LTKWordRecoConfig::getProblemName()" <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::getProblemName()" <<endl;
-
- return m_problemName;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : setLipiRoot
-* DESCRIPTION : sets the lipiRoot
-* ARGUMENTS : none
-* RETURNS : SUCCEESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKWordRecoConfig::setLipiRoot(const string& lipiRoot)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering: LTKWordRecoConfig::setLipiRoot()" <<endl;
-
- if(lipiRoot=="")
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKWordRecoConfig::LTKWordRecoConfig(const string&)" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
- this->m_lipiRoot = lipiRoot;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "m_lipiRoot = " << m_lipiRoot <<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::setLipiRoot()" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : readConfigFile
-* DESCRIPTION : reads the main config file and inturn other config files also (defined in main.cfg)
-* ARGUMENTS : none
-* RETURNS : SUCCESS on successful reads
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKWordRecoConfig::readConfigFile(const string& configFileName)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering: LTKWordRecoConfig::readConfigFile()" <<endl;
-
- LTKConfigFileReader* cfgFileMap;
-
- try
- {
- cfgFileMap= new LTKConfigFileReader(configFileName);
-
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKWordRecoConfig::readConfigFile()"<<endl;
-
- LTKReturnError(e.getErrorCode());
-
- }
-
- int errorCode = 0;
-
- if((errorCode=cfgFileMap->getConfigValue("script", m_script))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKWordRecoConfig::readConfigFile()"<<endl;
-
- LTKReturnError(errorCode);
-
- }
-
- if((errorCode=cfgFileMap->getConfigValue("problem", m_problemName))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKWordRecoConfig::readConfigFile()"<<endl;
-
- LTKReturnError(errorCode);
-
- }
-
- if(m_problemName=="")
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"problem string is empty"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKWordRecoConfig::readConfigFile()" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
- if((errorCode=cfgFileMap->getConfigValue("profile", m_profile))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKWordRecoConfig::readConfigFile()"<<endl;
-
- LTKReturnError(errorCode);
-
- }
-
-
- if(m_profile=="")
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"profile string is empty"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKWordRecoConfig::readConfigFile()" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
- if((errorCode=cfgFileMap->getConfigValue("dictmap", m_dictionaryPath))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKWordRecoConfig::readConfigFile()"<<endl;
-
- LTKReturnError(errorCode);
-
- }
-
- if((errorCode=cfgFileMap->getConfigValue("grammarmap", m_grammarPath))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKWordRecoConfig::readConfigFile()"<<endl;
-
- LTKReturnError(errorCode);
-
- }
-
- if(m_lipiRoot=="")
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Lipiroot is empty"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_STRING <<":"<< getErrorMessage(EEMPTY_STRING)
- <<" LTKWordRecoConfig::LTKWordRecoConfig(const string&)" <<endl;
-
- LTKReturnError(EEMPTY_STRING);
- }
-
- cfgFileMap = new LTKConfigFileReader(m_lipiRoot + SEPARATOR + m_problemName
- + SEPARATOR + WORDFILE);
-
-
- cfgFileMap = new LTKConfigFileReader(m_lipiRoot + SEPARATOR + m_problemName
- + SEPARATOR + m_profile + SEPARATOR
- + WORDPROFILEFILE);
-
- if((errorCode=cfgFileMap->getConfigValue("classifier",
- m_classifierName))!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKWordRecoConfig::readConfigFile()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- delete cfgFileMap;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting: LTKWordRecoConfig::readConfigFile()" <<endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Mudit Agrawal
-* DATE : 03-MAR-2005
-* NAME : LTKWordRecoConfig
-* DESCRIPTION : DEFAULT DESTRUCTOR
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-LTKWordRecoConfig::~LTKWordRecoConfig()
-{
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp
deleted file mode 100644
index f7c60716..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/LTKWordRecoResult.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate$
- * $Revision$
- * $Author$
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of the word recognition result
- * CONTENTS: setWordRecoResult
- * getResultWord
- * getResultConfidence
- *
- * AUTHOR: Deepu V.
- *
- * DATE: March 11, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu V. 23-Aug-05 Added update word recognition result method
- ************************************************************************/
-
-#include "LTKMacros.h"
-
-#include "LTKErrors.h"
-
-#include "LTKErrorsList.h"
-
-#include "LTKException.h"
-
-#include "LTKWordRecoResult.h"
-
-#include "LTKLoggerUtil.h"
-
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : LTKWordRecoResult
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKWordRecoResult::LTKWordRecoResult()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoResult::LTKWordRecoResult()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoResult::LTKWordRecoResult()" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : LTKWordRecoResult
-* DESCRIPTION : Constructor that takes two arguements
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKWordRecoResult::LTKWordRecoResult(const vector< unsigned short >& word, float confidence = 0)
-:m_word(word)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoResult::LTKWordRecoResult(const vector< unsigned short >&, float)" << endl;
-
- if(confidence < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<" LTKWordRecoResult::LTKWordRecoResult"
- <<"(vector< unsigned short >&, float)" <<endl;
-
- throw LTKException(ENEGATIVE_NUM);
- }
-
- m_confidence = confidence;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoResult::LTKWordRecoResult(const vector< unsigned short >&, float)" << endl;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : setWordRecoResult
-* DESCRIPTION : assign values to the word recognition result
-* ARGUMENTS : word - unicode result string
-* confidence - confidence of the current word (default 0)
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKWordRecoResult::setWordRecoResult(const vector< unsigned short >& word, float confidence = 0)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoResult::setWordRecoResult()" << endl;
-
- if(confidence < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<" LTKWordRecoResult::setWordRecoResult()"<<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
-
- }
-
- if(word.size() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_VECTOR <<":"<< getErrorMessage(EEMPTY_VECTOR)
- <<" LTKWordRecoResult::setWordRecoResult()"<<endl;
-
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- //assigning the values
- m_word = word;
-
- m_confidence = confidence;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoResult::setWordRecoResult()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : getResultWord
-* DESCRIPTION : returns the result word
-* ARGUMENTS :
-* RETURNS : Returns unicode result string
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-const vector<unsigned short>& LTKWordRecoResult::getResultWord() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoResult::getResultWord()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoResult::getResultWord()" << endl;
-
- return m_word;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : getResultConfidence
-* DESCRIPTION : returns the confidence of result
-* ARGUMENTS :
-* RETURNS : Returns float confidence value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float LTKWordRecoResult::getResultConfidence() const
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoResult::getResultConfidence()" << endl;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoResult::getResultConfidence()" << endl;
-
- return m_confidence;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : setResultConfidence
-* DESCRIPTION : sets the confidence of result
-* ARGUMENTS :
-* RETURNS : Returns SUCCESS if completed successfully
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKWordRecoResult::setResultConfidence(float confidence)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoResult::setResultConfidence()" << endl;
-
- if(confidence < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<" LTKWordRecoResult::setResultConfidence()"<<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
-
- }
-
- m_confidence = confidence;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoResult::setResultConfidence()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 19-MAR-2005
-* NAME : updateWordRecoResult
-* DESCRIPTION : This method adds to the existing word recognition result
-* : with a new symbol
-* ARGUMENTS : newSymbol - This will be appended to the existing word
-* : confidence - confidence of the new symbol, will be added
-* : to existing confidence
-* RETURNS : Returns SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKWordRecoResult::updateWordRecoResult( unsigned short newSymbol, float confidence)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKWordRecoResult::updateWordRecoResult()" << endl;
-
- if(confidence < 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<" LTKWordRecoResult::updateWordRecoResult()"<<endl;
-
- LTKReturnError(ENEGATIVE_NUM);
-
- }
-
- m_word.push_back(newSymbol);
- m_confidence += confidence;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKWordRecoResult::updateWordRecoResult()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 11-MAR-2005
-* NAME : ~LTKWordRecoResult
-* DESCRIPTION : Destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKWordRecoResult::~LTKWordRecoResult()
-{
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro
deleted file mode 100644
index 5a65fde5..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/common/common.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-BASE_TARGET_NAME = wordreccommon
-include(../../../lipilib.pri)
-
-INCLUDEPATH += \
- ../../../util/lib \
-
-SOURCES += \
- LTKRecognitionContext.cpp \
- LTKWordRecoConfig.cpp \
- LTKWordRecoResult.cpp
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro
deleted file mode 100644
index cf49e45d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/reco/wordrec/wordrec.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- common \
- boxfld
-
-boxfld.depends = common
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/src.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/src.pro
deleted file mode 100644
index a3f90198..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/src.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- common \
- util \
- reco \
- lipiengine
-
-util.depends = common
-reco.depends = util
-lipiengine.depends = common util reco
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/CMakeLists.txt
deleted file mode 100644
index 668f09f1..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from util.pro.
-
-add_subdirectory(lib)
-add_subdirectory(logger)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/.prev_CMakeLists.txt
deleted file mode 100644
index 51ddf0c6..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-# Generated from lib.pro.
-
-#####################################################################
-## ltkutil Generic Library:
-#####################################################################
-
-qt_add_cmake_library(ltkutil
- STATIC
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/lib"
- SOURCES
- LTKCheckSumGenerate.cpp LTKCheckSumGenerate.h
- LTKConfigFileReader.cpp LTKConfigFileReader.h
- LTKDynamicTimeWarping.h
- LTKErrors.cpp LTKErrors.h
- LTKHierarchicalClustering.h
- LTKImageWriter.cpp LTKImageWriter.h
- LTKInkFileReader.cpp LTKInkFileReader.h
- LTKInkFileWriter.cpp LTKInkFileWriter.h
- LTKInkUtils.cpp LTKInkUtils.h
- LTKLinuxUtil.h
- LTKLoggerUtil.cpp LTKLoggerUtil.h
- LTKOSUtilFactory.cpp
- LTKStrEncoding.cpp LTKStrEncoding.h
- LTKStringUtil.cpp LTKStringUtil.h
- LTKVersionCompatibilityCheck.cpp LTKVersionCompatibilityCheck.h
- LTKWinCEUtil.h
- LTKWindowsUtil.h
- INCLUDE_DIRECTORIES
- ../../include
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(ltkutil)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(ltkutil CONDITION WIN32
- SOURCES
- LTKWindowsUtil.cpp
- DEFINES
- -UNICODE
-)
-
-qt_extend_target(ltkutil CONDITION UNIX
- SOURCES
- LTKLinuxUtil.cpp
-)
-
-qt_extend_target(ltkutil CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/CMakeLists.txt
deleted file mode 100644
index 323c9095..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/CMakeLists.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-# Generated from lib.pro.
-
-#####################################################################
-## ltkutil Generic Library:
-#####################################################################
-
-qt_add_cmake_library(ltkutil
- STATIC
- EXCEPTIONS
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/lib"
- SOURCES
- LTKCheckSumGenerate.cpp LTKCheckSumGenerate.h
- LTKConfigFileReader.cpp LTKConfigFileReader.h
- LTKDynamicTimeWarping.h
- LTKErrors.cpp LTKErrors.h
- LTKHierarchicalClustering.h
- LTKImageWriter.cpp LTKImageWriter.h
- LTKInkFileReader.cpp LTKInkFileReader.h
- LTKInkFileWriter.cpp LTKInkFileWriter.h
- LTKInkUtils.cpp LTKInkUtils.h
- LTKLinuxUtil.h
- LTKLoggerUtil.cpp LTKLoggerUtil.h
- LTKOSUtilFactory.cpp
- LTKStrEncoding.cpp LTKStrEncoding.h
- LTKStringUtil.cpp LTKStringUtil.h
- LTKVersionCompatibilityCheck.cpp LTKVersionCompatibilityCheck.h
- LTKWinCEUtil.h
- LTKWindowsUtil.h
- INCLUDE_DIRECTORIES
- ../../include
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(ltkutil)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(ltkutil CONDITION WIN32
- SOURCES
- LTKWindowsUtil.cpp
- DEFINES
- # -UNICODE # special case remove
-)
-
-qt_extend_target(ltkutil CONDITION UNIX
- SOURCES
- LTKLinuxUtil.cpp
-)
-
-qt_extend_target(ltkutil CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp
deleted file mode 100644
index a9041ba6..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions of Checksum generate module
- *
- * CONTENTS:
- * LTKCheckSumGenerate
- * initCRC32Table
- * reflect
- * getCRC
- * addHeaderInfo
- * readMDTHeader
- *
- * AUTHOR: Vijayakumara M
- *
- * DATE: Aug 02, 2005
- * CHANGE HISTORY:
- * Author Date Description
- ************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 16:57:52 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 834 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-#include "LTKCheckSumGenerate.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-#include "LTKConfigFileReader.h"
-#include "LTKException.h"
-
-#include "LTKOSUtil.h"
-
-#include "LTKOSUtilFactory.h"
-
-/*****************************************************************************
-* AUTHOR : Vijayakumara M
-* DATE : 26 July 2005
-* NAME : LTKCheckSumGenerate
-* DESCRIPTION : Constractor.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*****************************************************************************/
-LTKCheckSumGenerate::LTKCheckSumGenerate():
-m_OSUtilPtr(LTKOSUtilFactory::getInstance())
-{
- initCRC32Table();
-}
-
-/*****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 26 June 2008
-* NAME : ~LTKCheckSumGenerate
-* DESCRIPTION : Desctructor.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*****************************************************************************/
-LTKCheckSumGenerate::~LTKCheckSumGenerate()
-{
- delete m_OSUtilPtr;
-}
-
-/****************************************************************************
-* AUTHOR : Vijayakumara M
-* DATE : 26 July 2005
-* NAME : initCRC32Table
-* DESCRIPTION : Call this function only once to initialize the CRC table.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-****************************************************************************/
-void LTKCheckSumGenerate::initCRC32Table()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKCheckSumGenerate::initCRC32Table()" << endl;
-
- unsigned int ulPolynomial = 0x04c11db7;
-
- // 256 values representing ASCII character codes.
- for(int i = 0; i <= 0xFF; i++)
- {
- m_CRC32Table[i]=reflect(i, 8) << 24;
- for (int j = 0; j < 8; j++)
- m_CRC32Table[i] = (m_CRC32Table[i] << 1) ^ (m_CRC32Table[i] & (1 << 31) ? ulPolynomial : 0);
- m_CRC32Table[i] = reflect(m_CRC32Table[i], 32);
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKCheckSumGenerate::initCRC32Table()" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Vijayakumara M
-* DATE : 26 July 2005
-* NAME : reflect
-* DESCRIPTION : reflection is a requirement for the official CRC-32 standard.
-* we can create CRCs without it, but they won't conform to the standard.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-unsigned int LTKCheckSumGenerate::reflect(unsigned int ref, char ch)
-{// Used only by initCRC32Table()
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKCheckSumGenerate::reflect()" << endl;
-
- unsigned int value(0);
-
- // Swap bit 0 for bit 7
- // bit 1 for bit 6, etc.
- for(int i = 1; i < (ch + 1); i++)
- {
- if(ref & 1)
- value |= 1 << (ch - i);
- ref >>= 1;
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKCheckSumGenerate::reflect()" << endl;
- return value;
-}
-
-/**********************************************************************************
-* AUTHOR : Vijayakumara M
-* DATE : 26 July 2005
-* NAME : getCRC
-* DESCRIPTION : Function to generate checkSum.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-* Balaji MNA 11th Nov, 2008 Changed char* parameter to string&
-*************************************************************************************/
-int LTKCheckSumGenerate::getCRC(string& text)
-{
- // Pass a text string to this function and it will return the CRC.
-
- // Once the lookup table has been filled in by the two functions above,
- // this function creates all CRCs using only the lookup table.
-
- // Be sure to use unsigned variables,
- // because negative values introduce high bits
- // where zero bits are required.
-
- // Start out with all bits set high.
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKCheckSumGenerate::getCRC()" << endl;
- unsigned int ulCRC(0xffffffff);
-
- // Get the length.
- int len = text.size();
-
- // Save the text in the buffer.
- unsigned char* buffer = (unsigned char*)text.c_str();
-
- // Perform the algorithm on each character
- // in the string, using the lookup table values.
- while(len--)
- {
- ulCRC = (ulCRC >> 8) ^ m_CRC32Table[(ulCRC & 0xFF) ^ *buffer++];
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKCheckSumGenerate::getCRC()" << endl;
-
- // Exclusive OR the result with the beginning value.
- return ulCRC ^ 0xffffffff;
-}
-
-/**********************************************************************************
-* AUTHOR : Srinivasa Vithal
-* DATE : 21 November 2007
-* NAME : addHeaderInfo
-* DESCRIPTION : This function adds the Header information to the Model Data file.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*************************************************************************************/
-int LTKCheckSumGenerate::addHeaderInfo(const string& modelDataHeaderInfoFilePath,
- const string& mdtFilePath,
- const stringStringMap& headerInfo)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKCheckSumGenerate::addHeaderInfo()" << endl;
-
- int nCRC; // Holds checks sum in decimal format
-
- long testEndian = 1;
-
- char *modelFileData = NULL; // Model File header Data.
-
- //unsigned int hdLen[CKSUM_HDR_STR_LEN], offsetLen[CKSUM_HDR_STR_LEN];
- char chSum[CKSUM_HDR_STR_LEN];
-
- long modelFileInfoSize ;
-
- string comment, heder; //Header comment,and the header data
-
- stringVector strTokens;
-
- ostringstream strHeaderContents1;
- ostringstream strHeaderContents2;
-
- string::size_type indx=0;
-
- // Add the mandatory fields to the header Info
- stringStringMap tempHeaderInfo = updateHeaderWithMandatoryFields(headerInfo);
-
- ostringstream headInfo, newHeadInfo;
-
-
- ifstream readFile(mdtFilePath.c_str(), ios::in | ios::binary);
-
- if(!readFile )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error : "<< EMODEL_DATA_FILE_OPEN
- <<": "<< "Error opening mdt file "<< mdtFilePath <<
- " LTKCheckSumGenerate::addHeaderInfo()"<<endl;
-
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
- // get fle size
- readFile.seekg(0, ios::beg);
- readFile.seekg(0, ios::end);
- modelFileInfoSize = readFile.tellg();
- readFile.seekg(0, ios::beg);
-
- try
- {
- if(!modelDataHeaderInfoFilePath.empty())
- {
- LTKConfigFileReader inputHeaderFileReader(modelDataHeaderInfoFilePath);
- const stringStringMap& tempCfgFileMap = inputHeaderFileReader.getCfgFileMap();
-
- stringStringMap::const_iterator tempCfgFileIter = tempCfgFileMap.begin();
- stringStringMap::const_iterator tempCfgFileIterEnd = tempCfgFileMap.end();
-
- for(; tempCfgFileIter != tempCfgFileIterEnd ; ++tempCfgFileIter)
- {
- if(tempHeaderInfo.find(tempCfgFileIter->first) == tempHeaderInfo.end())
- {
-
- //inserting user-defined key-value pair
- tempHeaderInfo[tempCfgFileIter->first] = tempCfgFileIter->second;
- }
- }
- }
-
- //Read Model Data File.
- modelFileData = new char[modelFileInfoSize+1];
-
- memset(modelFileData, '\0', modelFileInfoSize+1);
-
- readFile.read(modelFileData, modelFileInfoSize+1);
-
- readFile.close();
-
- string szBuf(modelFileData);
-
- //Caluculate Checksum for the Modiel File Data.
- nCRC = getCRC(szBuf);
-
- //Convert the check sum into Hexadecimal Value.
- sprintf(chSum, "%x", nCRC);
-
- tempHeaderInfo[CKS] = chSum;
-
-
-
-
-
- ofstream writeFile(mdtFilePath.c_str(),ios::out|ios::binary);
-
- stringStringMap::const_iterator tempHeadInfoIter = tempHeaderInfo.begin();
- stringStringMap::const_iterator tempHeadInfoIterEnd = tempHeaderInfo.end();
- for(; tempHeadInfoIter != tempHeadInfoIterEnd ; ++tempHeadInfoIter)
- {
- if((tempHeadInfoIter->first!=CKS) && (tempHeadInfoIter->first!=HEADERLEN)
- && (tempHeadInfoIter->first!=DATAOFFSET))
- {
- strHeaderContents2 <<"<"<<tempHeadInfoIter->first
- <<"="<<tempHeadInfoIter->second<<">";
- }
-
- }
-
- strHeaderContents1<<"<"<<CKS<<"="<<chSum<<">"<<"<"<<HEADERLEN<<"=";
-
-
-
- string initialStrHeader = strHeaderContents1.str() + strHeaderContents2.str();
-
- char strHeaderLength[CKSUM_HDR_STR_LEN], strOffsetLength[CKSUM_HDR_STR_LEN];
-
- //Get the Length of the header.( 15 is for length of ><DATAOFFSET=> ).
- sprintf(strHeaderLength, "%d", initialStrHeader.length()+14);
-
- sprintf(strOffsetLength, "%d", initialStrHeader.length()+15);
-
-
- //Add the length of the pre Header length and 1 for the last ">" char.
- sprintf(strHeaderLength, "%d", initialStrHeader.length()+strlen(strHeaderLength)+strlen(strOffsetLength)+14);
-
- sprintf(strOffsetLength, "%d", initialStrHeader.length()+strlen(strHeaderLength)+strlen(strOffsetLength)+15);
-
- strHeaderContents1<<strHeaderLength<<">";
-
- strHeaderContents1<<"<"<<DATAOFFSET<<"="<<strOffsetLength<<">";
-
- writeFile<<strHeaderContents1.str();
- writeFile<<strHeaderContents2.str();
-
- writeFile.write(modelFileData, modelFileInfoSize);
-
- writeFile.close();
-
- if( modelFileData != NULL)
- {
- delete [] modelFileData;
- modelFileData = NULL;
- }
-
-
- }
- catch (LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<"Error : "<<EFILE_OPEN_ERROR<<":"<< e.getExceptionMessage()<<
- "LTKCheckSumGenerate::addHeaderInfo()"<<endl;
- LTKReturnError(EFILE_OPEN_ERROR);
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKCheckSumGenerate::addHeaderInfo()" << endl;
-
- return SUCCESS;
-}
-
-stringStringMap LTKCheckSumGenerate::updateHeaderWithMandatoryFields(const stringStringMap& headerInfo)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKCheckSumGenerate::updateHeaderWithMandatoryFields()" << endl;
-
- long testEndian = 1;
- string comment="";
- int commentLen=0;
-
- stringStringMap tempHeaderInfo = headerInfo;
-
- if(tempHeaderInfo.find(COMMENT)!=tempHeaderInfo.end())
- {
-
- commentLen=tempHeaderInfo[COMMENT].length();
- }
-
-
- // Pushing keys to the tempHeaderInfo
- ostringstream tempString;
- string platformInfoString = "";
-
- string timeString ;
- m_OSUtilPtr->getSystemTimeString(timeString);
- tempString << timeString;
-
- tempHeaderInfo["CKS"] = "";
- tempHeaderInfo["HEADERLEN"] = "";
- tempHeaderInfo["DATAOFFSET"] = "";
- tempHeaderInfo["CREATETIME"] = tempString.str();
- tempHeaderInfo["MODTIME"] = tempString.str();
-
- // get Platform Name
- m_OSUtilPtr->getPlatformName(platformInfoString);
- tempHeaderInfo["PLATFORM"] = platformInfoString;
-
- //get processor architechure
- platformInfoString = "";
- m_OSUtilPtr->getProcessorArchitechure(platformInfoString);
- tempHeaderInfo["PROCESSOR_ARCHITEC"] = platformInfoString;
-
- // get OS info
- platformInfoString = "";
- m_OSUtilPtr->getOSInfo(platformInfoString);
- tempHeaderInfo["OSVERSION"] = platformInfoString;
- tempHeaderInfo["HEADERVER"] = HEADERVERSION;
-
- tempString.str("");
- tempString << commentLen;
- tempHeaderInfo["COMMENTLEN"] = tempString.str();
-
- tempString.str("");
- tempString << sizeof(int);
- tempHeaderInfo["SIZEOFINT"] = tempString.str();
-
- tempString.str("");
- tempString << sizeof(unsigned int);
- tempHeaderInfo["SIZEOFUINT"] = tempString.str();
-
- tempString.str("");
- tempString << sizeof(short int);
- tempHeaderInfo["SIZEOFSHORTINT"] = tempString.str();
-
- tempString.str("");
- tempString << sizeof(float);
- tempHeaderInfo["SIZEOFFLOAT"] = tempString.str();
-
- tempString.str("");
- tempString << sizeof(char);
- tempHeaderInfo["SIZEOFCHAR"] = tempString.str();
-
- // checking for indian ness
- if(!(*((char *)(&testEndian))))
- {
- tempHeaderInfo["BYTEORDER"] = "BE";
- }
- else
- {
- tempHeaderInfo["BYTEORDER"] = "LE";
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKCheckSumGenerate::updateHeaderWithMandatoryFields()" << endl;
-
- return tempHeaderInfo;
-}
-
-/****************************************************************************
-* AUTHOR : Vijayakumara M
-* DATE : 26 July 2005
-* NAME : readMDTHeader
-* DESCRIPTION : This function is used to check for checking the file integriry.
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description
-*****************************************************************************/
-int LTKCheckSumGenerate::readMDTHeader(const string &mdtFilePath,
- stringStringMap &headerSequence)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKCheckSumGenerate::readMDTHeader()" << endl;
-
- int headerLen, nCRC;
-
- long dSize, actDataSize;
-
- char chSum[CKSUM_HDR_STR_LEN], *sbuf,*headerData, headerInfo[51];
-
- stringVector strTokens;
-
- ifstream mdtFileHandle(mdtFilePath.c_str(), ios::in | ios::binary);
-
- if(!mdtFileHandle)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EMODEL_DATA_FILE_OPEN <<":"<< getErrorMessage(EMODEL_DATA_FILE_OPEN)
- <<"LTKCheckSumGenerate::readMDTHeader()" <<endl;
-
- LTKReturnError(EMODEL_DATA_FILE_OPEN);
- }
-
-
- mdtFileHandle.read(headerInfo, 50);
-
- char *ptr = strstr(headerInfo, HEADERLEN);
- if(ptr == NULL)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EMODEL_DATA_FILE_FORMAT <<":"<< getErrorMessage(EMODEL_DATA_FILE_FORMAT)
- <<"LTKCheckSumGenerate::readMDTHeader()" <<endl;
-
- LTKReturnError(EMODEL_DATA_FILE_FORMAT);
- }
-
- strtok(ptr, "=");
-
- char *headerLenPtr = strtok( NULL , ">" );
-
- if(headerLenPtr == NULL)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EMODEL_DATA_FILE_FORMAT <<":"<< getErrorMessage(EMODEL_DATA_FILE_FORMAT)
- <<"LTKCheckSumGenerate::readMDTHeader()"<<endl;
-
- LTKReturnError(EMODEL_DATA_FILE_FORMAT);
- }
-
- headerLen = atoi(headerLenPtr);
-
- mdtFileHandle.seekg(0, ios::beg);
-
- headerData = new char [headerLen+1];
-
- memset(headerData, '\0', headerLen+1);
-
- mdtFileHandle.read(headerData, headerLen);
-
- LTKStringUtil::tokenizeString(headerData, TOKENIZE_DELIMITER, strTokens);
-
- int strTokensSize = strTokens.size();
-
- for(int indx=0; indx+1 <strTokensSize ;indx=indx+2)
- {
- headerSequence[strTokens.at(indx)] = strTokens.at(indx+1);
- }
-
- // get the file size in bytes
- mdtFileHandle.seekg(0,ios::beg);
- mdtFileHandle.seekg(0, ios::end);
- dSize = mdtFileHandle.tellg();
-
- //Size fo the actual data excluding Header size.
- actDataSize=dSize-headerLen+1;
-
- string cks = headerSequence[CKS];
-
- //Allocate memory to read the actual data.
- sbuf = new char[actDataSize];
- memset(sbuf, '\0', actDataSize);
-
- //Read the file.
- mdtFileHandle.seekg(headerLen, ios::beg);
- mdtFileHandle.read(sbuf, actDataSize);
-
- //Close the file.
- mdtFileHandle.close();
-
- string szBuf(sbuf);
-
- //Caluculate Checksum for the Model File Data.
- nCRC = getCRC(szBuf);
- sprintf(chSum, "%x", nCRC);
-
- delete [] sbuf;
- delete [] headerData;
-
- if(strcmp(cks.c_str(), chSum) != 0)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_INPUT_FORMAT <<":"<< getErrorMessage(EINVALID_INPUT_FORMAT)
- <<"LTKCheckSumGenerate::readMDTHeade()r"<<endl;
- LTKReturnError(EINVALID_INPUT_FORMAT);
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKCheckSumGenerate::readMDTHeader()" << endl;
-
- return SUCCESS;
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h
deleted file mode 100644
index 511bfbaa..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKCheckSumGenerate.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the String Splitter Module
- *
- * CONTENTS:
- *
- * AUTHOR: Vijayakumara M.
- *
- * DATE: July 25, 2005
- * CHANGE HISTORY:
- * Author Date Description
- ************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-11-19 17:57:12 +0530 (Wed, 19 Nov 2008) $
- * $Revision: 704 $
- * $Author: mnab $
- *
- ************************************************************************/
-#ifndef __LTKCHECSUMGENERATE_H
-#define __LTKCHECSUMGENERATE_H
-
-#include <sstream>
-
-#include "LTKStringUtil.h"
-
-#include "LTKTypes.h"
-
-#include "LTKMacros.h"
-
-#include "LTKErrors.h"
-
-#include "LTKErrorsList.h"
-
-#ifdef _WIN32
-#include <windows.h>
-const int BUFSIZE = 256;
-#else
-#include <stdio.h>
-#include <sys/utsname.h>
-#endif
-
-class LTKOSUtil;
-
-class LTKCheckSumGenerate
-{
-private:
-
- unsigned int m_CRC32Table[256]; // Lookup table array.
-
- LTKOSUtil* m_OSUtilPtr;
-
-public:
-
- // @{
-
- /**
- * Default constractor, calls initCRC32Table function for intialization.
- */
-
- LTKCheckSumGenerate();
-
- /**
- * Destructor
- */
-
- ~LTKCheckSumGenerate();
-
-
- /**
- * This method generates the checksum.
- *
- * @param text, for which the checksum to be calculated.
- *
- * @return checksum for the text.
- */
- int getCRC(string& text);
-
- /**
- * This method reads the header information from the model data header information file and
- * adds it to the data file with additional header information.
- *
- * @param strModelDataHeaderInfoFile, Model data header information file name.
- * @param referenceModelFile, Model data file name.
- * @param verson information.
- * @algoName Name of the alogorithm.
- *
- * @return SUCCESS on successful addition of the header to the data file. of the respective
- * errorCode on the occurence of any errors.
- */
-
- int addHeaderInfo(const string& modelDataHeaderInfoFilePath,
- const string& mdtFilePath,
- const stringStringMap& headerInfo);
-
- /**
- * This method reads the header information from the header information file and
- * adds it to the data file with additional header information.
- *
- * @param headerInfo, Model data header information file name.
- * @param referenceModelFile, Model data file name.
- *
- * @return the new stringStringMap after updation
- */
- stringStringMap updateHeaderWithMandatoryFields(const stringStringMap& headerInfo);
-
-
- /**
- * This method is used to check the file integrity with the checksum.
- *
- * @param mdtFilePath, Model data file Name.
- * @param string - string map variable, which holds the header keys and the values respectively.
- *
- * @return SUCCESS,
- */
-
- int readMDTHeader(const string &mdtFilePath,
- stringStringMap &headerSequence);
-
-private:
-
- /**
- * This method intializes the crc32_table with 256 values representing ASCII character
- * codes.
- */
-
- void initCRC32Table();
-
- /**
- * This method is used only by initCRC32Table() function. reflection is a requirement
- * for the official CRC-32 standard.
- *
- * @param ref value.
- * @param character.
- *
- * @return long integer value which will be used by initCRC32Table functon.
- */
-
- unsigned int reflect(unsigned int ref, char ch);
-
-
- // @}
-};
-
-#endif //__LTKCHECSUMGENERATE_H
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp
deleted file mode 100644
index 30e06f42..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 14:54:14 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 833 $
- * $Author: dineshm $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of the Configuration File Reader Module
- *
- * CONTENTS:
- * getMap
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of LTKConfigFileReader
- ************************************************************************/
-
-#include "LTKConfigFileReader.h"
-
-#include "LTKStringUtil.h"
-
-#include "LTKException.h"
-
-#include "LTKErrorsList.h"
-
-#include "LTKMacros.h"
-
-#include "LTKErrors.h"
-
-#include "LTKLoggerUtil.h"
-
-/******************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKConfigFileReader
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of LTKConfigFileReader ctor
-* Nidhi Sharma 08-FEB-2007
-******************************************************************************/
-
-LTKConfigFileReader::LTKConfigFileReader(const string& configFilePath):
-m_configFilePath(configFilePath)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKConfigFileReader::LTKConfigFileReader()" << endl;
-
- // Read the config file into stringStringMap
- int errorCode = getMap();
-
- if (errorCode != SUCCESS )
- {
- // logger message
- LOG( LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKConfigFileReader::LTKConfigFileReader()"<<endl;
- throw LTKException(errorCode);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKConfigFileReader::LTKConfigFileReader()" << endl;
-}
-
-/***************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getMap
-* DESCRIPTION : reads string-value pair into an asoociative array
-* ARGUMENTS : cfgFile - the name of the configuration file from which the string-value pairs
-* are to be read from
-* RETURNS : an associative array indexable on the string to the value
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of getMap
-*Nidhi Sharma 08-FEB-2007 Made this function a private member function of the class
-*****************************************************************************/
-
-int LTKConfigFileReader::getMap()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKConfigFileReader::getMap()" << endl;
-
- string line = ""; // a line read from the config file
-
- vector<string> strTokens; // string list found in the line read
-
- // opening the config file
-
- ifstream cfgFileHandle(m_configFilePath.c_str());
-
- // checking if the file open was successful
-
- if(!cfgFileHandle)
- {
- // logger message
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Unable to Open Config file :"<< m_configFilePath<<endl;
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EFILE_OPEN_ERROR <<": "<<
- getErrorMessage(EFILE_OPEN_ERROR)
- <<"LTKConfigFileReader::getMap() => Config File Not Found" <<endl;
-
- LTKReturnError(EFILE_OPEN_ERROR);
- }
-
- // reading lines of the config file
- while(getline(cfgFileHandle, line, NEW_LINE_DELIMITER))
- {
- // trim the line
- LTKStringUtil::trimString(line);
-
- if(line.empty())
- {
- // skipping over empty line
- continue;
- }
- else if((line[0] == COMMENTCHAR))
- {
- // skipping over commented lines
- continue;
- }
- else
- {
- LTKStringUtil::tokenizeString(line, "=", strTokens);
-
- if(strTokens.size() == 2)
- {
- LTKStringUtil::trimString(strTokens[0]);
- LTKStringUtil::trimString(strTokens[1]);
-
- m_cfgFileMap[strTokens[0]] = strTokens[1];
- }
- else
- {
- // Logger message
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_CFG_FILE_ENTRY <<": "<<
- getErrorMessage(EINVALID_CFG_FILE_ENTRY)
- <<"LTKConfigFileReader::getMap()" <<endl;
-
- // closing the config file
- cfgFileHandle.close();
-
- LTKReturnError(EINVALID_CFG_FILE_ENTRY);
- }
- }
- // populating the name value pair associative array (map)
- }
-
- // closing the config file
- cfgFileHandle.close();
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKConfigFileReader::getMap()" << endl;
-
- return SUCCESS;
-}
-
-/****************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKConfigFileReader
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of ~LTKConfigFileReader
-*****************************************************************************/
-
-LTKConfigFileReader::~LTKConfigFileReader(){}
-
-/**************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 08-FEB-2007
-* NAME : getConfigValue
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of getConfigValue
-****************************************************************************/
-int LTKConfigFileReader::getConfigValue(const string& key, string& outValue)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKConfigFileReader::getConfigValue()" << endl;
-
- stringStringMap::const_iterator cfgItem = m_cfgFileMap.find(key);
- if (cfgItem != m_cfgFileMap.end() )
- {
- outValue = cfgItem->second.c_str();
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKConfigFileReader::getConfigValue()" << endl;
- return SUCCESS;
- }
- // logger mesage
- int errorCode = EKEY_NOT_FOUND;
- LTKReturnError(errorCode);
-}
-
-/****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 08-FEB-2007
-* NAME : isConfigMapEmpty
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of getConfigValue
-****************************************************************************/
-bool LTKConfigFileReader::isConfigMapEmpty()
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKConfigFileReader::isConfigMapEmpty()" << endl;
-
- bool returnBool = false;
-
- if ( m_cfgFileMap.empty() )
- {
- returnBool = true;
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKConfigFileReader::isConfigMapEmpty()" << endl;
-
- return returnBool;
-}
-
-/***************************************************************************
-* AUTHOR : Srinivasa Vithal
-* DATE : 21-NOV-2007
-* NAME : getCfgFileMap
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of getConfigValue
-****************************************************************************/
-const stringStringMap& LTKConfigFileReader::getCfgFileMap()
-{
- return m_cfgFileMap;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h
deleted file mode 100644
index 361d70f6..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKConfigFileReader.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the Configuration File Reader Module
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description
- ************************************************************************/
-
-#ifndef __LTKCONFIGFILEREADER_H
-#define __LTKCONFIGFILEREADER_H
-
-#include "LTKTypes.h"
-
-/**
-* @ingroup util
-*/
-
-/** @brief A utility class for reading the key value pairs defined in Lipi Config Files
-* @class LTKConfigFileReader
-*/
-class LTKConfigFileReader
-{
-
-private :
- /** @brief A string string map that holds the key-value pairs defined in the config file
- */
- stringStringMap m_cfgFileMap;
- string m_configFilePath;
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Parameterized Constructor
- *
- * <p>
- * The constructor takes in the path of the confg file to be read as paramater and
- * reads the key-value pairs defined in that class to the data member LTKConfigFileReader::m_cfgFileMap
- * </p>
- */
-
- LTKConfigFileReader(const string& configFilePath);
-
- /**
- * Destructor
- */
-
- ~LTKConfigFileReader();
-
- // @}
-
- /** @name public methods
- */
-
- // @{
-
- /** @brief Returns the value for the key defined in the config file
- * <p>
- * Returns the value for the key if the key is defined in the config file and empty string otherwise.
- * </p>
- * @param key Type : string (constant)
- * @returns Type : string
- */
- int getConfigValue(const string& key, string& outValue);
-
-
- /** @brief Returns true if no key-value pairs were defined in the config file
- *
- * @returns Type : bool, true : if config file has no valid key-value pairs and false otherwise.
- */
- bool isConfigMapEmpty();
- //bool isConfigFileEmpty();
- // @}
- /** @brief Returns the stringStringMap of m_cfgFileMap
- *
- */
- const stringStringMap& getCfgFileMap();
- // @}
-
-private:
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * Reads key-value pairs from a file into a map
- */
-
- int getMap();
-
- //@}
-};
-
-#endif
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h
deleted file mode 100644
index dced46bc..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKDynamicTimeWarping.h
+++ /dev/null
@@ -1,566 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-01-11 14:11:25 +0530 (Fri, 11 Jan 2008) $
- * $Revision: 359 $
- * $Author: sundarn $
- *
- ************************************************************************/
-#ifndef __DYNAMICTIMEWARPING_H
-#define __DYNAMICTIMEWARPING_H
-
-#include <iostream>
-#include <cstdlib>
-#include <string>
-#include <vector>
-#ifndef _WIN32
-//#include <values.h>
-#endif
-#include <limits>
-#include <algorithm>
-#include <cmath>
-#include <deque>
-
-
-using namespace std;
-
-template <typename TimeSeriesElementType, typename DistanceType>
-//TimeSeriesElementType - pointer of type feature (LTKShapeFeature * etc.)
-//DistanceType - type of distance (float, int etc.)
-
-
-
-/**
- * @class DTWShapeRecognizer
- */
-class DynamicTimeWarping
-{
- private:
-
- vector<vector <DistanceType> > m_cumulativeDistance; // Cumulative distance matrix
-
- vector<vector<int> > m_phi; // phi matrix required for path computation
-
- //function pointer type of the function that defines local distance function
- typedef void (*FN_PTR_DISTANCE)(const TimeSeriesElementType&, const TimeSeriesElementType&, DistanceType&) ;
-
-
- DistanceType m_maxVal;
- // Max val (like FLT_MAX etc),
- // this max value that can be returned
- // local distance
-
-
- /**
- * This function back tracks and calculates the DTW warping path from the DTW distance matrix
- * @param1 lastPointYIndex is the x index of the point from which back tracking has to start
- * @param1 lastPointXIndex is the y index of the point from which back tracking has to start
- */
- void populatePath(int lastPointYIndex, int lastPointXIndex, deque<vector<int> >& warpingPath)
- {
-
- int yIndex = lastPointYIndex;
- int xIndex = lastPointXIndex;
- vector<int > indices(2);
- int tb; // req for warping path
- int k,p; // loop variables
-
- //Path Computation
-
- indices[0] = yIndex;
- indices[1] = xIndex;
- warpingPath.push_front(indices);
-
- while((yIndex > 0) && (xIndex > 0))
- {
- tb = m_phi[yIndex][xIndex];
- if (tb == 2)
- {
- yIndex--;
- xIndex--;
- indices[0] = yIndex;
- indices[1] = xIndex;
- }
- else if(tb == 0)
- {
- yIndex--;
- indices[0] = yIndex;
- indices[1] = xIndex;
- }
- else if (tb == 1)
- {
- xIndex--;
- indices[0] = yIndex;
- indices[1] = xIndex;
- }
-
- warpingPath.push_front(indices);
-
- }
-
- if((yIndex > 0) && (xIndex == 0))
- {
- --yIndex;
- for(k = yIndex; k >= 0; --k)
- {
- indices[0] = (k);
- indices[1] = (0);
- warpingPath.push_front(indices);
- }
- }
- else if(( yIndex == 0) && (xIndex > 0))
- {
- --xIndex;
- for(p = xIndex; p >= 0; --p)
- {
- indices[0] = (0);
- indices[1] = (p);
- warpingPath.push_front(indices);
- }
- }
-
- }
-
- public:
-
-
-
- /** @name Constructors and Destructor */
- //@{
-
- /**
- * This Constructor takes the size of the input train character,
- * size of input test character, Max Value (ie FLT_MAX, INT_MAX etc)
- * Local distance function, reduce by half function, and banding value
- */
-
- DynamicTimeWarping()
- {
-
-
- }
-
-
- /**
- * Destructor
- */
-
- ~DynamicTimeWarping(){};
-
- /**
- * @name Methods
- */
-
- //@{
-
-
- /**
- * This function computes the DTW distance between the two vectors.
- * @param train This is an input parameter and corresponds to the first vector
- * @param test This is an input parameter and corresponds to the second vector
- * @param local This is the function pointer to the local distance function
- * @param distanceDTW This is the output parameter which gives the DTW distance between the two vectors.
- * @param warpingPath This is the output parameter which gives DTW warping path
- * @param banding This is the banding value for the DTW Matrix
- * @param bestSoFar This is an imput parameter as stoping criteria based on Best So Far
- * @param maxVal This is used to pass the maximum possible value for the DTW distance
- */
-/*
- int computeDTW(const vector <TimeSeriesElementType>& train,
- const vector <TimeSeriesElementType>& test,
- FN_PTR_DISTANCE localDistPtr,
- DistanceType& distanceDTW,
- deque<vector<int> >& warpingPath,
- int banding=0, DistanceType bestSoFar=numeric_limits<DistanceType>::infinity(),
- DistanceType maxVal=numeric_limits<DistanceType>::infinity())
- */
- int computeDTW(const vector <TimeSeriesElementType>& train,
- const vector <TimeSeriesElementType>& test,
- FN_PTR_DISTANCE localDistPtr,
- DistanceType& distanceDTW,
- deque<vector<int> >& warpingPath,
- float banding=0, DistanceType bestSoFar=numeric_limits<DistanceType>::infinity(),
- DistanceType maxVal=numeric_limits<DistanceType>::infinity())
-
- {
- m_maxVal = maxVal;
- if(localDistPtr == NULL)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENULL_POINTER <<":"<< getErrorMessage(ENULL_POINTER)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
-
- LTKReturnError(ENULL_POINTER);
- }
- int trainSize = train.size(); //Temporary variables to store the size of the train and test vectors.
- if(trainSize == 0)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_VECTOR <<":"<< getErrorMessage(EEMPTY_VECTOR)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
- LTKReturnError(EEMPTY_VECTOR);
- }
- int testSize = test.size(); //Temporary variables to store the size of the train and test vectors.
- if(testSize == 0)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_VECTOR <<":"<< getErrorMessage(EEMPTY_VECTOR)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- float testBanding = floor(testSize*(1-banding));
- float trainBanding = floor(trainSize*(1-banding));
- banding = (trainBanding < testBanding)?trainBanding:testBanding;
-
- int banded = 0;
-
- if(banding < 0 || banding >= trainSize || banding >= testSize)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
-
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- else
- {
- banded = banding; // is the variable used for fixing the band in the computation of the distance matrix.
- // this is the number of elements from the matrix
- // boundary for which computation will be skipped
- }
-
- int trunkI = banded; //Temporary variables used to keep track of the band in the distance matrix.
-
- int trunkJ = 0; //Temporary variables used to keep track of the band in the distance matrix.
-
- int i,j,l; //index variables
-
- if(m_cumulativeDistance.size() == 0)
- {
- vector <DistanceType> dVec(testSize,m_maxVal);
- vector <int> phiVec(testSize,0);
-
- for(i = 0; i < trainSize; ++i)
- {
- m_cumulativeDistance.push_back(dVec);
- m_phi.push_back(phiVec);
- }
- }
- else if(trainSize > m_cumulativeDistance.size() || testSize > m_cumulativeDistance[0].size())
- {
- m_cumulativeDistance.clear();
- m_phi.clear();
- vector <DistanceType> dVec(testSize,m_maxVal);
- vector <int> phiVec(testSize,0);
-
- for(i = 0; i < trainSize; ++i)
- {
- m_cumulativeDistance.push_back(dVec);
- m_phi.push_back(phiVec);
- }
-
- }
- else
- {
- for(i=0; i<m_cumulativeDistance.size(); i++)
- {
- for(j=0; j<m_cumulativeDistance[0].size();j++)
- {
- m_cumulativeDistance[i][j] = m_maxVal;
- m_phi[i][j] = 0;
- }
- }
- }
-
- DistanceType rowMin; //Temporary variable which contains the minimum value of the distance of a row.
-
- DistanceType tempDist[2]; //Temporary variable to store the distance
-
- DistanceType tempMinDist; //Temporary variable to store the minimum distance
-
- DistanceType tempVal;
-
- int tempIndex;
-
- typename vector <vector<DistanceType> > ::iterator cumDistIter1; //iterator for cumDist i
- typename vector<DistanceType> ::iterator cumDistIter2; //iterator for cumDist j
- typename vector<DistanceType> ::iterator cumDistIter3; //iterator for cumDist j
-
-
- (localDistPtr)(train[0],test[0],m_cumulativeDistance[0][0]);
-
- m_phi[0][0]=2;
-
- /**
- Computing the first row of the distance matrix.
- */
-
- cumDistIter2 = m_cumulativeDistance[0].begin();
- for(i = 1; i < testSize; ++i)
- {
- DistanceType tempVal;
-
- (localDistPtr)(train[0],test[i],tempVal);
-
- *(cumDistIter2 + i) = *(cumDistIter2 + i-1) + tempVal;
- m_phi[0][i]=1;
- }
- if(trunkI > 0)
- {
- --trunkI;
- }
- /**
- Computing the first column of the distance matrix.
- */
-
- for(j = 1; j < trainSize; ++j)
- {
-
-
- (localDistPtr)(train[j],test[0],tempVal);
-
- m_cumulativeDistance[j][0] = m_cumulativeDistance[j-1][0]+tempVal;
- m_phi[j][0]=0;
- }
-
-
- /**
- Computing the values of the rest of the cells in the distance matrix.
- */
- cumDistIter1 = m_cumulativeDistance.begin();
- for(i = 1; i < trainSize; ++i)
- {
- rowMin = m_maxVal;
- cumDistIter2 = (*(cumDistIter1+i-1)).begin();
- cumDistIter3 = (*(cumDistIter1+i)).begin();
-
- for(j = 1+trunkJ; j < testSize-trunkI; ++j)
- {
- tempDist[0] = *(cumDistIter2+j-1);
- tempIndex = 2;
-
- tempMinDist = tempDist[0];
- tempDist[0] = *(cumDistIter2+j);
- tempDist[1] = *(cumDistIter3+j-1);
-
- for(l = 0; l < 2; ++l)
- {
- if(tempMinDist>=tempDist[l])
- {
- tempMinDist=tempDist[l];
- tempIndex = l;
- }
- }
-
- m_phi[i][j] = tempIndex;
- localDistPtr(train[i],test[j],tempVal);
- tempMinDist= tempMinDist+tempVal;
- m_cumulativeDistance[i][j]=tempMinDist;
-
- if(rowMin > tempMinDist)
- rowMin = tempMinDist;
-
- }
- if(trunkI > 0)
- --trunkI;
- if(i > (trainSize-banded-1))
- ++trunkJ;
-
- if(rowMin > bestSoFar)
- {
- distanceDTW = m_maxVal;
- return SUCCESS;
- }
- }
-
- distanceDTW = tempMinDist;
-
- distanceDTW = distanceDTW/(trainSize + testSize);
-
- populatePath(trainSize-1,testSize-1,warpingPath);
-
- return SUCCESS;
-
- }
-
-
- /**
- * This function computes the DTW distance between the two vectors.
- * @param train This is an input parameter and corresponds to the first vector
- * @param test This is an input parameter and corresponds to the second vector
- * @param local This is the function pointer to the local distance function
- * @param distanceDTW This is the output parameter which gives the DTW distance between the two vectors.
- * @param banding This is the banding value for the DTW Matrix
- * @param bestSoFar This is an imput parameter as stoping criteria based on Best So Far
- * @param maxVal This is used to pass the maximum possible value for the DTW distance
- */
-/*
- int computeDTW(const vector <TimeSeriesElementType>& train,
- const vector <TimeSeriesElementType>& test,
- FN_PTR_DISTANCE localDistPtr, DistanceType& distanceDTW,
- int banding=0, DistanceType bestSoFar=(numeric_limits<DistanceType>::infinity()),
- DistanceType maxVal=(numeric_limits<DistanceType>::infinity()))
- */
- int computeDTW(const vector <TimeSeriesElementType>& train,
- const vector <TimeSeriesElementType>& test,
- FN_PTR_DISTANCE localDistPtr, DistanceType& distanceDTW,
- float banding=0, DistanceType bestSoFar=(numeric_limits<DistanceType>::infinity()),
- DistanceType maxVal=(numeric_limits<DistanceType>::infinity()))
- {
-
- m_maxVal = maxVal;
- if(localDistPtr == NULL)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENULL_POINTER <<":"<< getErrorMessage(ENULL_POINTER)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
-
- LTKReturnError(ENULL_POINTER);
- }
- int trainSize = train.size(); //Temporary variables to store the size of the train and test vectors.
- if(trainSize == 0)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_VECTOR <<":"<< getErrorMessage(EEMPTY_VECTOR)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
- LTKReturnError(EEMPTY_VECTOR);
- }
- int testSize = test.size(); //Temporary variables to store the size of the train and test vectors.
- if(testSize == 0)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EEMPTY_VECTOR <<":"<< getErrorMessage(EEMPTY_VECTOR)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
- LTKReturnError(EEMPTY_VECTOR);
- }
-
- float testBanding = floor(testSize*(1-banding));
- float trainBanding = floor(trainSize*(1-banding));
- banding = (trainBanding < testBanding)?trainBanding:testBanding;
-
-
- int banded = 0;
- if(banding < 0 || banding >= trainSize || banding >= testSize)
- {
- /*LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENEGATIVE_NUM <<":"<< getErrorMessage(ENEGATIVE_NUM)
- <<" DynamicTimeWarping::computeDTW()" <<endl;*/
- LTKReturnError(ECONFIG_FILE_RANGE);
- }
- else
- {
- banded = banding; // is the variable used for fixing the band in the computation of the distance matrix.
- // this is the number of elements from the matrix
- // boundary for which computation will be skipped
- }
-
- int trunkI = banded; //Temporary variables used to keep track of the band in the distance matrix.
-
- int trunkJ = 0; //Temporary variables used to keep track of the band in the distance matrix.
-
- int i,j,k; //index variables
- vector<DistanceType> currentRow(testSize,m_maxVal);
- vector<DistanceType> previousRow(testSize,m_maxVal);
-
- DistanceType rowMin; //Temporary variable which contains the minimum value of the distance of a row.
-
- DistanceType tempDist[3]; //Temporary variable to store the distance
-
- DistanceType tempMinDist; //Temporary variable to store the minimum distance
-
- DistanceType tempVal;
-
-
- (localDistPtr)(train[0],test[0],previousRow[0]);
-
- /**
- Computing the first row of the distance matrix.
- */
-
- for(i = 1; i < testSize; ++i)
- {
-
- (localDistPtr)(train[0],test[i],tempVal);
- previousRow[i] = previousRow[i-1] + tempVal;
- }
- if(trunkI > 0)
- {
- --trunkI;
- }
-
-
- for(i = 1; i < trainSize; ++i)
- {
- rowMin = m_maxVal;
-
-
- localDistPtr(train[i],test[trunkJ],tempVal);
- currentRow[trunkJ]=tempVal+previousRow[trunkJ];
-
- for(j = 1+trunkJ; j < testSize-trunkI; ++j)
- {
-
- tempDist[0] = currentRow[j-1];
- tempDist[1] = previousRow[j];
- tempDist[2] = previousRow[j-1];
-
- tempMinDist = tempDist[0];
-
- for(k = 0; k < 3; k++)
- {
- if(tempMinDist>=tempDist[k])
- {
- tempMinDist=tempDist[k];
- }
- }
-
- localDistPtr(train[i],test[j],tempVal);
- tempMinDist= tempMinDist+tempVal;
- currentRow[j]=tempMinDist;
- if(rowMin > tempMinDist)
- rowMin = tempMinDist;
-
- }
- if(rowMin > bestSoFar)
- {
- distanceDTW = m_maxVal;
- return SUCCESS;
- }
-
- if(i > (trainSize-banded-1))
- ++trunkJ;
- if(trunkI > 0)
- --trunkI;
- copy(currentRow.begin()+trunkJ, currentRow.end()-trunkI, previousRow.begin()+trunkJ);
- }
-
- distanceDTW = tempMinDist;
- distanceDTW = distanceDTW/(trainSize + testSize);
-
- return SUCCESS;
-
- }
-
-};
-
-#endif
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp
deleted file mode 100644
index 2cf87532..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-04-17 11:23:39 +0530 (Fri, 17 Apr 2009) $
- * $Revision: 765 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definition of getError function.
- *
- * CONTENTS:
- * getError
- *
- * AUTHOR: VijayaKumara M.
- *
- * DATE:
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#include "LTKErrors.h"
-#include "LTKMacros.h"
-#include "LTKErrorsList.h"
-#include "stdio.h"
-
-int errorCode;
-
-// Error list ( In the same oreder as in LTKErrorList.h file in "include" dir.
-static map<int,string> errors;
-
-static void initErrorCode()
-{
- errors.clear();
- errors[EINK_FILE_OPEN] = "Unable to open ink file"; /* 100 - EINK_FILE_OPEN */
- errors[ECONFIG_FILE_OPEN] = "Unable to open configuration file"; /* 101 - ECONFIG_FILE_OPEN */
- errors[EHEADER_INFO_FILE_OPEN] = "Unable to open model header information file"; /* 102 - EHEADER_INFO_FILE_OPEN_ERR */
- errors[EMODEL_DATA_FILE_OPEN] = "Unable to open model data file"; /* 103 - EMODEL_DATA_FILE_OPEN_ERR */
- errors[ETRAINLIST_FILE_OPEN] = "Unable to open train list file"; /* 104 - ETRAINLIST_FILE_OPEN_ERR */
- errors[EMODEL_DATA_FILE_FORMAT] = "Incompatible model data file. The header is not in the desired format."; /* 105 - EFILE_FORMAT_ERR */
- errors[EINVALID_INPUT_FORMAT] = "Model data file is corrupted"; /* 106 - EFILE_CORRUPT_ERR */
-
- errors[ELOAD_SHAPEREC_DLL] = "Error while loading shape recognition module"; /* 107 - ELOAD_SHAPEREC_DLL_ERR */
- errors[ELOAD_WORDREC_DLL] = "Error while loading word recognition module"; /* 108 - ELOAD_WORDREC_DLL_ERR */
- errors[ELOAD_PREPROC_DLL] = "Error while loading preprocessing module"; /* 109 - ELOAD_PREPROC_DLL_ERR */
- errors[EDLL_FUNC_ADDRESS] = "Exported function not found in module"; /* 110 - EDLL_FUNC_ADDRESS_ERR */
- errors[ECREATE_SHAPEREC] = "Error while creating shape recognizer instance"; /* 111 - ECREATE_SHAPEREC_ERR */
- errors[ECREATE_WORDREC] = "Error while creating word recognizer instance"; /* 112 - ECREATE_WORDREC_ERR */
- errors[ECREATE_PREPROC] = "Error while creating preprocessor instance"; /* 113 - ECREATE_PREPROC_ERR */
-
- errors[ELIPI_ROOT_PATH_NOT_SET] = "Environment variable LIPI_ROOT is not set"; /* 114 - ELIPI_ROOT_PATH_NOT_SET */
- errors[EINVALID_PROJECT_NAME] = "Invalid or no entry for project name"; /* 115 - EINVALID_PROJECT_NAME */
- errors[EINVALID_CONFIG_ENTRY] = "Invalid configuration entry in project.cfg file"; /* 116 - EINVALID_CONFIG_ENTRY */
- errors[ENO_SHAPE_RECOGNIZER] = "No shape recognizer specified in profile.cfg file"; /* 117 - ENO_SHAPE_RECOGNIZER */
- errors[ENO_WORD_RECOGNIZER] = "No word recognizer specified in profile.cfg file"; /* 118 - ENO_WORD_RECOGNIZER */
-
- errors[EINVALID_NUM_OF_TRACES] = "Invalid number of traces processed"; /* 119 - EINVALID_NUMBER_OF_TRACES */
- errors[EINVALID_NUM_OF_SHAPES] = "Invalid value for number of shapes"; /* 120 - EINVALID_VALUE_NUMOFSHAPES */
- errors[EINVALID_TRACE_DIMENTION] = "Invalid value for trace dimension"; /* 121 - EINVALID_TRACE_DIMENTION */
- errors[EINVALID_NUMEIGENVECTOR] = "Invalid value for eigen vector"; /* 122 - EINVALID_VALUE_NUMEIGENVECTOR */
- errors[EINVALID_FLOAT_SIZE] = "Invalid float size entry in model data File"; /* 123 - EINVALID_FLOAT_SIZE */
- errors[EINCOMPATIBLE_VERSION] = "Incompatible algorithm version"; /* 124 - EINCOMPATIBLE_VERSION_ERR */
- errors[EINVALID_PREPROC_SEQUENCE] = "Wrong preprocessor sequence entry in cfg file"; /* 125 - EPREPROC_SEQUENCE_ERR */
-
- errors[ENO_TOKEN_FOUND] = "Invalid or no value specified for project name for recognizer"; /* 126 - ENO_TOKEN_FOUND */
- errors[EINVALID_LOGICAL_NAME] = "Invalid or no value specified for logical name for recognizer"; /* 127 - EINVALID_LOGICAL_NAME */
-
- errors[EINVALID_SEGMENT] = "Invalid segment, boxfield recognizer requires character level segment info"; /* 128 - EINVALID_SEGMENT */
- errors[EINVALID_REC_MODE] = "Unsupported recognizer mode"; /* 129 - EINVALID_REC_MODE */
-
- errors[EUNSUPPORTED_STATISTICS] = "Unsupported or invalid statistics to be computed"; /* 130 - EUNSUPPORTED_STATISTICS */
-
-
- errors[EMAP_NOT_FOUND] = "No function implemented to convert to a unicode string"; /* 131 - EMAP_NOT_FOUND */
- errors[EINVALID_SHAPEID] = "Invalid value for shape id"; /* 132 - EINVALID_VALUE_SHAPEID */
-
- errors[ENOMAPFOUND_LIPIENGINECFG] = "Cannot map the logical name, no entries in lipiengine.cfg";/* 133 - ENOMAPFOUND_LIPIENGINECFG */
- errors[EINVALID_NUM_OF_POINTS] = "Number of points in the tracegroup is not normalized"; /* 134 - EINVALID_NUM_OF_POINTS */
- errors[EEMPTY_TRACE] = "Empty trace"; /* 135 - EEMPTY_TRACE*/
- errors[EEMPTY_TRACE_GROUP] = "Empty Trace Group" , /* 136 -EEMPTY_TRACE_GROUP*/
- errors[ECONFIG_FILE_RANGE] = "The config file variable is not within the correct range"; /* 137 - ECONFIG_FILE_RANGE */
-
-
- errors[EINITSHAPE_NONZERO] = "Recognizer requires the Intial shape id to be zero"; /* 138 - EINITSHAPE_NONZERO */
- errors[EINVALID_LINE_LISTFILE] = "Invalid line in the listfile (train or test )"; /* 139 - EINVALID_LINE_LISTFILE */
- errors[EINVALID_ORDER_LISTFILE] = "Invalid order of shape-ids in the list file ( train )"; /* 140 - EINVALID_ORDER_LISTFILE */
- errors[ENUM_NNS] = "Invalid number of nearest neighbours specified"; /*141 - ENUM_NNS/*/
- errors[EINKFILE_EMPTY] = "Ink file name is empty"; /* 142 - EINKFILE_EMPTY */
- errors[EINKFILE_CORRUPTED] = "Incorrect or corrupted unipen ink file."; /* 143 - EINKFILE_CORRUPTED */
- errors[EDLL_FUNC_ADDRESS_CREATE] = "Could not map the createPreprocessor function from DLL. "; /*144 EDLL_FUNC_ADDRESS_CREATE */
- errors[EDLL_FUNC_ADDRESS_DELETE] = "Could not map the deletePreprocessor function from DLL. "; /*145 EDLL_FUNC_ADDRESS_DELETE */
- errors[ENO_RESAMPLETRACEGROUP] = "No resampleTraceGroup in preProcSequence entry of cfg file. "; /*146 ENO_RESAMPLETRACEGROUP */
-
- errors[EINVALID_SAMPLING_RATE] = "Sampling rate cannot be negative. "; /*147 EINVALID_SAMPLING_RATE */
- errors[EINVALID_X_RESOLUTION] = "m_xDpi values cannot be negative. "; /*148 EINVALID_X_RESOLUTION */
- errors[EINVALID_Y_RESOLUTION] = "m_yDpi values cannot be negative. "; /*149 EINVALID_Y_RESOLUTION */
- errors[EINVALID_LATENCY] = "m_latency cannot be negative. "; /*150 EINVALID_LATENCY */
-
- errors[EPOINT_INDEX_OUT_OF_BOUND] = "Point index greater than number of points available. "; /*151 EPOINT_INDEX_OUT_OF_BOUND */
- errors[ECHANNEL_INDEX_OUT_OF_BOUND] = "Invalid Channel. "; /*152 ECHANNEL_INDEX_OUT_OF_BOUND */
- errors[ECHANNEL_SIZE_MISMATCH] = "New channel data not as long as the old one. "; /*153 ECHANNEL_SIZE_MISMATCH */
- errors[ENUM_CHANNELS_MISMATCH] = "Point to be added does not have the same number of channels as the trace. "; /*154 ENUM_CHANNELS_MISMATCH */
- errors[EDUPLICATE_CHANNEL] = "Channel with the new channel name already present. "; /*155 EDUPLICATE_CHANNEL */
- errors[ECHANNEL_NOT_FOUND] = "Channel not found. "; /*156 ECHANNEL_NOT_FOUND */
- errors[EZERO_CHANNELS] = "Number of channels cannot be zero. "; /*157 EZERO_CHANNELS */
- errors[EINVALID_INPUT_STREAM] = "Input stream does not match with number of channels in the trace. "; /*158 EINVALID_INPUT_STREAM */
- errors[ECOMPUTE_DISTANCE_ERROR] = "Error: Cannot find distance for test sample with more than 1 stroke. "; /*159 ECOMPUTE_DISTANCE_ERROR */
- errors[ECOMPARISON_ERROR] = "Error: Cannot compare with train sample having more than 1 stroke. "; /*160 ECOMPARISON_ERROR */
- errors[ETRAIN_TEST_VECTOR_SIZE_MISMATCH] = "Incompatible: train vector and test vector sizes do not match. "; /*161 ETRAIN_TEST_VECTOR_SIZE_MISMATCH */
- errors[EGRAMMER_FILE_NOT_EXIST] = "Grammar file does not exists. "; /*162 EGRAMMER_FILE_NOT_EXIST */
- errors[EVALUES_NOT_PROVIDED] = "Values for the terminal is not Provided. "; /*163 EVALUES_NOT_PROVIDED */
- errors[ECONFIG_FILE_FORMAT] = "No productions or terminals identified in the CFG. Please check the CFG format. "; /*164 ECONFIG_FILE_FORMAT */
- errors[ECYCLIC_DEPENDENCY] = "Cyclic dependency exists! Unable to find paths. "; /*165 ECYCLIC_DEPENDENCY */
- errors[EFILE_OPEN_ERROR] = "Could Not open file : "; /*166 EFILE_OPEN_ERROR*/
- errors[ELOAD_FEATEXT_DLL] = "Error while loading feature extractor module "; /*167 ELOAD_FEATEXT_DLL*/
- errors[EDLL_FUNC_ADDRESS_CREATE_FEATEXT] = "Could not map the createShapeFeatureExtractor function from DLL "; /*168 EDLL_FUNC_ADDRESS_CREATE_FEATEXT */
- errors[EDLL_FUNC_ADDRESS_DELETE_FEATEXT] = "Could not map the deleteShapeFeatureExtractor function from DLL "; /*169 EDLL_FUNC_ADDRESS_DELETE_FEATEXT */
- errors[EFTR_EXTR_NOT_EXIST] = "Feature extractor does not exist "; /*170 EFTR_EXTR_NOT_EXIST */
- errors[ENO_FTR_EXTR_IN_CFG] = "No Feature Extractor in Config file "; /*171 ENO_FTR_EXTR_IN_CFG*/
- errors[EFTR_RPRCLASS_NOIMPLEMENTATION] = "No implementation provided "; /*172 EFTR_RPRCLASS_NOIMPLEMENTATION */
- errors[EINVALID_ORDER_FEATUREFILE] = "Invalid order of shape-ids in the feature file "; /* 173 - EINVALID_ORDER_FEATUREFILE */
- errors[ENUMSHAPES_NOT_SET] = "NumShapes config variable is not set in the project.cfg file ";/* 174 - ENUMSHAPES_NOT_SET */
- errors[EUNEQUAL_LENGTH_VECTORS] = "Vectors are of different lengths "; /* 175 - EUNEQUAL_LENGTH_VECTORS */
- errors[EINVALID_LOG_LEVEL] = "Invalid log level "; /* 176 - EINVALID_LOG_LEVEL */
- errors[EPROJ_NOT_DYNAMIC] = "Not allowed to ADD/Delete class for a project with fixed number of shapes"; /*177 EPROJ_NOT_DYNAMIC*/
- errors[EMORPH_FVEC_SIZE_MISMATCH] = "Error: Cannot perform MORPH on features vectors of different sizes"; /*178 EMORPH_FVEC_SIZE_MISMATCH*/
- errors[ESHAPE_RECOCLASS_NOIMPLEMENTATION] = "No implementation provided"; /*179 ESHAPE_RECOCLASS_NOIMPLEMENTATION*/
- errors[ENULL_POINTER] = "Null Pointer Error"; /*180 ENULL_POINTER*/
- errors[EINVALID_X_SCALE_FACTOR] = "Invalid X scale factor. Scale factor must be greater than zero"; /*181 EINVALID_X_SCALE_FACTOR*/
- errors[EINVALID_Y_SCALE_FACTOR] = "Invalid Y scale factor. Scale factor must be greater than zero"; /*182 EINVALID_Y_SCALE_FACTOR*/
- errors[ECONFIG_MDT_MISMATCH] = "Parameter values in config file and MDT file do not match, check log file for more details"; /*183 ECONFIG_MDT_MISMATCH*/
- errors[ENEIGHBOR_INFO_VECTOR_EMPTY] = "Neighbor Info Vector is empty"; /*184 ENEIGHBOR_INFO_VECTOR_EMPTY*/
- errors[ERECO_RESULT_EMPTY] = "Recognize result is empty"; /*185 ERECO_RESULT_EMPTY*/
- errors[ESHAPE_SAMPLE_FEATURES_EMPTY] = "Features of input TraceGroup is empty"; /* 186 ESHAPE_SAMPLE_FEATURES_EMPTY*/
- errors[ENO_TOOLKIT_VERSION] = "Toolkit version missing in the control information"; /* 187 ENO_TOOLKIT_VERSION */
- errors[ETRACE_INDEX_OUT_OF_BOUND] = "Trace index greater than number of traces available. "; /*188 ETRACE_INDEX_OUT_OF_BOUND */
- errors[EINVALID_CFG_FILE_ENTRY] = "Invalid key=value pair in the config file"; /**189 EINVALID_CFG_FILE_ENTRY*/
- errors[EKEY_NOT_FOUND] = "Key could not be found in the config file"; /** 190 EKEY_NOT_FOUND */
- errors[EFEATURE_INDEX_OUT_OF_BOUND] = "feature index out of bounds"; /**191 EFEATURE_INDEX_OUT_OF_BOUND*/
- errors[EINVALID_FILE_HANDLE] = "Invalid file handle"; /**192 EINVALID_FILE_HANDLE*/
- errors[EFEATURE_FILE_OPEN] = "Feature file open error"; /**193 EFEATURE_FILE_OPEN*/
- errors[EFTR_DISTANCE_NOT_DEFINED] = "Distance between the features not defined"; /**194 EFTR_DISTANCE_NOT_DEFINED*/
- errors[EINVALID_CLUSTER_ID] = "Invalid Cluster ID"; /**195 EINVALID_CLUSTER_ID */
- errors[EPROTOTYPE_SET_EMPTY] = "Prototype set is empty"; /**196 EPROTOTYPE_SET_EMPTY */
- errors[ELOG_FILE_NOT_EXIST] = "Log file does not exist"; /**197 ELOG_FILE_NOT_EXIST */
- errors[EDATA_HYPERLINK_VEC_SIZE_MISMATCH] = "Size of the data objects vector and their corresponding hyperlinks vector do not match"; /**198 EDATA_HYPERLINK_VEC_SIZE_MISMATCH*/
- errors[EFILE_CREATION_FAILED] = "File creation failed. Invalid path or no permission."; /**199 EFILE_CREATION_FAILED*/
- errors[EINVALID_NUM_CLUSTERS] = "Invalid number of clusters specified. The number must be greater than or equal to 1 and less than number of data objects."; /**200 EINVALID_NUM_CLUSTERS*/
- errors[ENO_DATA_TO_CLUSTER] = "No elements in the input data vector for clustering."; /**201 ENO_DATA_TO_CLUSTER*/
- errors[EINSUFFICIENT_DATA_FOR_LMETHOD] = "Minimum 6 data objects are required to employ LMethod."; /**202 EINSUFFICIENT_DATA_FOR_LMETHOD*/
- errors[EMODULE_NOT_IN_MEMORY] = "Module index not found in module vector"; /**203 EMODULE_NOT_IN_MEMORY */
- errors[EINVALID_LOG_FILENAME] = "Specified Log filename is empty"; /**204 EINVALID_LOG_FILENAME */
- errors[ECREATE_LOGGER] = "Error creating logger"; /**205 ECREATE_LOGGER */
- errors[EINVALID_PROJECT_TYPE] = "Project type in CFG is missing or an invalid value"; /**206 EINVALID_PROJECT_TYPE*/
- errors[EEMPTY_STRING] = "Empty string"; /**207 EEMPTY_STRING*/
- errors[EEMPTY_VECTOR] = "Empty vector"; /**208 EEMPTY_VECTOR*/
- errors[ENON_POSITIVE_NUM] = "Negative or zero value"; /**209 ENON_POSITIVE_NUM*/
- errors[EEMPTY_WORDREC_RESULTS] = "The word recogniton result vector is empty"; /**210 EEMPTY_WORDREC_RESULTS*/
- errors[ENEGATIVE_NUM] = "Negative value";/**211 ENEGATIVE_NUM*/
- errors[EINVALID_CLASS_ID] = "Invalid Class ID"; /**212 EINVALID_CLASS_ID*/
- errors[EINVALID_CONFIDENCE_VALUE] = "Invalid Confidence Value"; /** 213 EINVALID_CONFIDENCE_VALUE*/
- errors[ENO_SHAPE_RECO_PROJECT] = "Shape Recognizer Project name missing in the word recognizer config file."; /**214 ENO_SHAPE_RECO_PROJECT*/
- errors[EINVALID_RECOGNITION_MODE] = "Unsupported recognition mode."; /**215 EINVALID_RECOGNITION_MODE*/
- errors[ELOGGER_LIBRARY_NOT_LOADED] = "Shared library for Logger not loaded";
- errors[ESINGLE_POINT_TRACE] = "Single point trace"; /**217 ESINGLE_POINT_TRACE*/
-
- errors[EADAPTSCHEME_NOT_SUPPORTED] = "AdaptScheme not supported:"; /**229 EADAPTSCHEME_NOT_SUPPORTED **/
-}
-/**********************************************************************************
-* AUTHOR : Vijayakumara M
-* DATE : 01-Sept-2005
-* NAME : getError
-* DESCRIPTION : returns the error descriptions from the errors Table.
-* ARGUMENTS : error code.
-* RETURNS : returns pointer to an error description
-* NOTES :
-* CHANGE HISTORY
-* Author Date Description of change
-*************************************************************************************/
-string getErrorMessage(int errorCode)
-{
- initErrorCode();
- string errorDiscrip = errors[errorCode];
- if(errorDiscrip.empty())
- {
- return "Error code is not set";
- }
-
- return errorDiscrip;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h
deleted file mode 100644
index eac0224b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKErrors.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 11:00:11 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 832 $
- * $Author: dineshm $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: getError function declaration.
- *
- * CONTENTS:
- *
- * AUTHOR: Vijayakumara M.
- *
- * DATE: Sept 01, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef _LTK_ERRORS_H__
-#define _LTK_ERRORS_H__
-
-#include "LTKInc.h"
-
-//extern int errorCode; // Error code, which will set for the error occurence.
-
-
-/**
- * This method returns error description corresponding to the error code.
- *
- * @param error code, the integer value for an error.
- *
- * @return the error description of the error code.
- */
-
-string getErrorMessage(int errorCode);
-
-#endif // #ifndef _LTKERRORS_H__
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h
deleted file mode 100644
index 921c6085..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKHierarchicalClustering.h
+++ /dev/null
@@ -1,1592 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definitions of Agglomerative Hierarchical Clustering module
- *
- * CONTENTS:
- * cluster
- * getProximityMatrix
- * setOutputConfig
- * setHyperlinkMap
- * getClusterResult
- * computeProximityMatrix
- * computeDistances
- * clusterToFindNumClusters
- * getInterObjectDistance
- * findGroup
- * findInterClusterDistance
- * writeClustersAsHTML
- * determineNumOfClusters
- * determineKnee
- * findRMSE
- * computeAvgSil
- *
- *
- * AUTHOR: Bharath A
- *
- * DATE: February 22, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef __LTKHIERARCHICALCLUSTERING_H
-#define __LTKHIERARCHICALCLUSTERING_H
-
-
-#ifndef _WIN32
-//#include <values.h>
-#endif
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-#include "LTKLoggerUtil.h"
-#include "LTKException.h"
-#include "LTKErrors.h"
-
-/*Enumerator for stopping criterion to be used*/
-enum ELTKHCStoppingCriterion
-{
- LMETHOD,
- AVG_SIL
-};
-
-/*Enumerator for methods in hierarchical clustering*/
- enum ELTKHCMethod
- {
- SINGLE_LINKAGE,
- COMPLETE_LINKAGE,
- AVERAGE_LINKAGE
- };
-
-#define OUTPUT_HTML_FILE_NAME "output.html"
-#define MIN_CUTOFF 20
-
-/**
- * @class LTKHierarchicalClustering
- * <p> This class does agglomerative hierarchical clustering. The data objects
- which could be LTKTrace or LTKTraceGroup, are supplied as a vector.
- Function that defines the distance between two data objects needs to be
- supplied as a function pointer.One of the 3 methods (Single,Average or
- Complete linkage) needs to be selected to define the way inter-cluster
- has to be determined. In case number of clusters is not supplied,
- it is determined using the L-method (default stopping criterion)<p> */
-
-template <class ClusterObjType,class DistanceClass>
-class LTKHierarchicalClustering
-{
-
- private:
-
- //reference to the vector containing the data objects to be clustered
- const vector<ClusterObjType>& m_data;
-
- //triangular matrix containing the pairwise distances between data
- //objects
- float2DVector m_proximityMatrix;
-
- //data structure that stores current (intermediate) state of the
- //clusters
- int2DVector m_intermediateCG;
-
- //vector mapping the data object id and path to the data (unipen) file
- stringVector m_hyperlinksVec;
-
- //contains the number of clusters required
- int m_numOfClusters;
-
- //output file handle to write the cluster results as html
- //with name of the file as OUTPUT_HTML_FILE_NAME
- ofstream m_output;
-
- //flag to indicate whether the output is required as html
- bool m_writeHTML;
-
- //flag to indicate whether to show all levels of the hierarchy in the
- //html file
- bool m_showAllLevels;
-
- //vector to hold merging distance for each number of clusters
- floatVector m_mergingDist;
-
- //flag for determining number of clusters
- bool m_determineClusters;
-
- //output result directory
- string m_outputDir;
-
- //extension of the image corresponding to each data object in
- //order to write in the html
- string m_imageFileExtn;
-
- //Method for defining inter-cluster distance
- ELTKHCMethod m_method;
-
- //number of clusters determined by Average Silhouette method
- int m_numBySil;
-
- //cached clustering result corresponding minimum average silhouette
- int2DVector m_cachedResult;
-
- //stopping criterion selected - LMethod or Average Silhouette
- ELTKHCStoppingCriterion m_stoppingCriterion;
-
- //pointer to the class that has the definition of distance function
- DistanceClass* m_distClassPtr;
-
- //function pointer type of the function that defines inter-object distance
- typedef int (DistanceClass::*FN_PTR_DISTANCE)(const ClusterObjType&,
- const ClusterObjType&,
- float&) ;
-
- //distance function pointer
- FN_PTR_DISTANCE m_distancePtr;
-
-
- public:
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : LTKHierarchicalClustering
-* DESCRIPTION : Constructor to initialise the required parameters
-* ARGUMENTS : clusterObjects - vector of data objects which could be LKTrace or
-* LTKTraceGroup for HWR
-* noOfClusters - Number of clusters required
-* clusteringMethod - One of the 3 methods:
-* SINGLE_LINKAGE,AVERAGE_LINKAGE
-* or COMPLETE_LINKAGE
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-LTKHierarchicalClustering(const vector<ClusterObjType>& clusterObjects,int noOfClusters,
- ELTKHCMethod clusteringMethod=AVERAGE_LINKAGE) :
- m_data(clusterObjects),m_method(clusteringMethod),
- m_numOfClusters(noOfClusters),m_writeHTML(false),
- m_showAllLevels(false),
- m_determineClusters(false)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::LTKHierarchicalClustering"
- <<"(vector<ClusterObjType>,int,ELTKHCMethod)"<<endl;
-
- if(m_numOfClusters < 1 || m_numOfClusters>=clusterObjects.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Number of clusters:"<<m_numOfClusters<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_NUM_CLUSTERS <<":"<< getErrorMessage(EINVALID_NUM_CLUSTERS)
- <<" LTKHierarchicalClustering::"
- <<"LTKHierarchicalClustering(vector<ClusterObjType>,int,ELTKHCMethod)"<<endl;
-
- throw LTKException(EINVALID_NUM_CLUSTERS);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::LTKHierarchicalClustering"
- <<"(vector<ClusterObjType>,int,ELTKHCMethod)"<<endl;
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : LTKHierarchicalClustering
-* DESCRIPTION : Constructor to initialise the required parameters.
-* Number of clusters is determined by L-method
-* ARGUMENTS : clusterObjects - vector of data objects which could be LKTrace or
-* LTKTraceGroup for HWR
-* clusteringMethod - One of the 3 methods:
-* SINGLE_LINKAGE,AVERAGE_LINKAGE
-* or COMPLETE_LINKAGE
-* stoppingCriterion - stopping criterion to determine the
-* right set of clusters: LMETHOD or AVG_SIL
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-LTKHierarchicalClustering(const vector<ClusterObjType>& clusterObjects,
- ELTKHCMethod clusteringMethod=AVERAGE_LINKAGE,
- ELTKHCStoppingCriterion stoppingCriterion=LMETHOD) :
- m_data(clusterObjects),
- m_method(clusteringMethod),
- m_stoppingCriterion(stoppingCriterion),
- m_writeHTML(false),
- m_showAllLevels(false),
- m_determineClusters(true)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::LTKHierarchicalClustering"
- <<"(vector<ClusterObjType>,ELTKHCMethod,ELTKHCStoppingCriterion)"<<endl;
-
- if(clusterObjects.size()==0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Number of elements in clusterObjects vector is zero"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< ENO_DATA_TO_CLUSTER <<":"<< getErrorMessage(ENO_DATA_TO_CLUSTER)
- <<" LTKHierarchicalClustering::LTKHierarchicalClustering"
- <<"(vector<ClusterObjType>,ELTKHCMethod,ELTKHCStoppingCriterion)"<<endl;
-
-
- throw LTKException(ENO_DATA_TO_CLUSTER);
- }
-
- if(clusterObjects.size() < 6 && stoppingCriterion == LMETHOD)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Number of elements in clusterObjects vector is:"
- <<clusterObjects.size()<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINSUFFICIENT_DATA_FOR_LMETHOD
- <<":"<< getErrorMessage(EINSUFFICIENT_DATA_FOR_LMETHOD)
- <<" LTKHierarchicalClustering::LTKHierarchicalClustering"
- <<"(vector<ClusterObjType>,ELTKHCMethod,ELTKHCStoppingCriterion)"<<endl;
-
- throw LTKException(EINSUFFICIENT_DATA_FOR_LMETHOD);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::LTKHierarchicalClustering"
- <<"(vector<ClusterObjType>,ELTKHCMethod,ELTKHCStoppingCriterion)"<<endl;
-
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : cluster
-* DESCRIPTION : Clusters the input data objects. The number of clusters is determined
-* based on the stopping criterion or as specified by the user.
-* ARGUMENTS : distanceClassPtr - pointer to the class that contains the distance
-* function defintion
-* distFuncPtr - distance function pointer
-* RETURNS : error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int cluster(DistanceClass* distanceClassPtr,FN_PTR_DISTANCE distFuncPtr)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::cluster()"<<endl;
-
-
- m_distancePtr=distFuncPtr;
-
- m_distClassPtr=distanceClassPtr;
-
-
- //To compute inter-object distances
- int errorCode = computeDistances();
-
- if (errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKHierarchicalClustering::cluster()"<<endl;
-
- LTKReturnError(errorCode)
- }
-
- //if the user has specified the number of clusters
- if(!m_determineClusters)
- {
- clusterToFindNumClusters();
- }
- else
- {
- m_numOfClusters=1;
-
- //clustering to determine the number of
- //clusters vs merging distance curve
- clusterToFindNumClusters();
-
- m_determineClusters=false;
-
- if(m_stoppingCriterion==LMETHOD)
- {
- //Number of clusters determined by L-method
- m_numOfClusters=determineNumOfClusters();
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Number of clusters determined using L-Method"
- <<m_numOfClusters<<endl;
-
- }
- else if(m_stoppingCriterion==AVG_SIL)
- {
-
- //Number of clusters determined by silhouette method
- m_numOfClusters=m_numBySil;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Number of clusters determined using Average Silhouette method"
- <<m_numOfClusters<<endl;
-
- }
-
- //clearing intermediate clusters formed during evaluation
- //of the stopping criterion
- m_intermediateCG.clear();
-
- //clustering to the number of clusters determined
- //by the stopping criterion
- clusterToFindNumClusters();
-
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::cluster()"<<endl;
- return SUCCESS;
-
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Dinesh M
-* DATE : 23-Jan-2006
-* NAME : getProximityMatrix
-* DESCRIPTION : returns the distance matrix
-* ARGUMENTS :
-* RETURNS : proximity matrix (float2DVector)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-const float2DVector& getProximityMatrix() const
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::getProximityMatrix()"<<endl;
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::getProximityMatrix()"<<endl;
-
- return m_proximityMatrix;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : setOutputConfig
-* DESCRIPTION : This function sets the configuration for the output of clustering.
-* ARGUMENTS : outputDirectory - path to the directory where output html
-* is to be generated
-* displayAllLevels - flag to indicate whether all levels in the
-* clustering need to written to the file
-* imageFileExtension - extension of the image file (ex)"png".
-* If not specified <img> tag in the output html is not created.
-* RETURNS : error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-//int setOutputConfig(const string& outputDirectory,
-// bool displayAllLevels=false,
-// string imageFileExtension="")
-int setOutputConfig(const string& outputDirectory,bool displayAllLevels=false,
- const string& imageFileExtension="")
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::setOutputConfig()"<<endl;
-
- m_writeHTML=true;
-
- m_showAllLevels=displayAllLevels;
-
- string tempOutputFilePath=outputDirectory+"/"+OUTPUT_HTML_FILE_NAME;
-
- m_output.open(tempOutputFilePath.c_str());
-
- if(m_output.fail())
- {
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Unable to create file:"
- <<tempOutputFilePath<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EFILE_CREATION_FAILED <<":"
- <<getErrorMessage(EFILE_CREATION_FAILED)
- <<" LTKHierarchicalClustering::setOutputConfig()" <<endl;
-
- LTKReturnError(EFILE_CREATION_FAILED)
- }
-
- m_outputDir=outputDirectory;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Clustering results output directory:"
- <<m_outputDir<<endl;
-
- m_output.close();
-
- //If it takes the default value, <img> tag in the output is not generated
- m_imageFileExtn=imageFileExtension;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Image file extension:"<<m_imageFileExtn<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::setOutputConfig()"<<endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : setHyperlinkMap
-* DESCRIPTION : To set hyperlinks for each data object which refers to actual data file.
-* Assumes one-to-one correspondence with the data vector
-* passed in the constructor.
-* ARGUMENTS : hyperlinksVector - Vector containing paths to physical
-* files of each data object.
-*
-* RETURNS : error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-//int setHyperlinkMap(const vector<string>& hyperlinksVector)
-int setHyperlinkMap(const vector<string>& hyperlinksVector)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::setHyperlinkMap()"<<endl;
-
- if(m_data.size()!=hyperlinksVector.size())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"cluster objects vector size:"<<m_data.size()
- <<" and hyperlinks vector size:"<<hyperlinksVector.size()<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EDATA_HYPERLINK_VEC_SIZE_MISMATCH
- <<":"<< getErrorMessage(EDATA_HYPERLINK_VEC_SIZE_MISMATCH)
- <<" LTKHierarchicalClustering::setHyperlinkMap()" <<endl;
-
- LTKReturnError(EDATA_HYPERLINK_VEC_SIZE_MISMATCH);
- }
-
- m_hyperlinksVec=hyperlinksVector; //Vector for hyperlinks is set
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::setHyperlinkMap()"<<endl;
-
- return SUCCESS;
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : getClusterResult
-* DESCRIPTION : Populates the argument (vector of vectors) with data objects indices.
-* Each row (inner vector) corresponds to a cluster.
-* ARGUMENTS : outClusterResult - reference to result vector of vectors.
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void getClusterResult(vector<vector<int> >& outClusterResult) const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::getClusterResult()"<<endl;
-
- for(int v=0;v<m_intermediateCG.size();v++)
- {
-
- outClusterResult.push_back(m_intermediateCG[v]);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::getClusterResult()"<<endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : computeProximityMatrix
-* DESCRIPTION : Populates the argument (vector of vectors) with data objects indices.
-* Each inner vector corresponds to a cluster.
-* ARGUMENTS : distanceClassPtr - pointer to the class that has the distance definition
-* distFuncPtr - function pointer to the distance function
-* RETURNS : error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-//void computeProximityMatrix(ComputeDistanceFunc computeDistFuncObj)
-int computeProximityMatrix(DistanceClass* distanceClassPtr,
- FN_PTR_DISTANCE distFuncPtr)
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::computeProximityMatrix()"<<endl;
-
- m_distancePtr=distFuncPtr;
- m_distClassPtr=distanceClassPtr;
-
- int errorCode;
-
- if((errorCode=computeDistances())!=SUCCESS)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKHierarchicalClustering::computeProximityMatrix()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::computeProximityMatrix()"<<endl;
-
- return SUCCESS;
-}
-
-
-
-private:
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : computeDistances
-* DESCRIPTION : Computes inter-object distances and puts them in the distance matrix
-* ARGUMENTS :
-* RETURNS : error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int computeDistances()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::computeDistances()"<<endl;
-
- for(int i=0;i<(m_data.size()-1);++i)
- {
- vector<float> eachRow((m_data.size()-i)-1);//added -1 at the end
-
- int c=0;
-
- for(int j=i+1;j<m_data.size();++j)
- {
- //external distance function called
- int errorCode = (m_distClassPtr->*m_distancePtr)(m_data[i],m_data[j], eachRow[c]);
-
- if (errorCode != SUCCESS )
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error while calling distance function"<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKHierarchicalClustering::computeDistances()"<<endl;
-
- LTKReturnError(errorCode);
- }
-
- ++c;
-
- }
-
- m_proximityMatrix.push_back(eachRow);
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::computeDistances()"<<endl;
-
- return SUCCESS;
-
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : clusterToFindNumClusters
-* DESCRIPTION : Clusters the data objects hierarchically (agglomerative)
-* till the desired number of
-* clusters and also evaluates the stopping criterion selected.
-* ARGUMENTS :
-* RETURNS : error code
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int clusterToFindNumClusters()
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::clusterToFindNumClusters()"<<endl;
-
- if(m_stoppingCriterion==LMETHOD)
- {
- //Number of clusters needs to be determined
- if(m_determineClusters)
- {
- //map for number of clusters vs. merging distance
- m_mergingDist.reserve(m_data.size());
- }
- }
- else if(m_stoppingCriterion==AVG_SIL)
- {
- if(m_writeHTML==false && m_cachedResult.size()>0)
- {
- m_intermediateCG=m_cachedResult;
-
- return SUCCESS;
- }
- }
-
- for(int i=0;i<m_data.size();i++)
- {
- vector<int> v;
- v.push_back(i);
-
- //To begin with, each data object is cluster by itself
- m_intermediateCG.push_back(v);
- }
-
- if(m_writeHTML) //If output is needed as html
- {
- string outputFilePath=m_outputDir+"/"+OUTPUT_HTML_FILE_NAME;
-
- m_output.open(outputFilePath.c_str()); //Cluster output file is created
-
- if(m_output.fail())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Unable to create file:"
- <<outputFilePath<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EFILE_CREATION_FAILED
- <<":"<< getErrorMessage(EFILE_CREATION_FAILED)
- <<" LTKHierarchicalClustering::clusterToFindNumClusters()" <<endl;
-
- LTKReturnError(EFILE_CREATION_FAILED);
- }
-
- /*Html tags are written*/
- m_output<<"<html>\n";
- m_output<<"<body>\n";
- m_output<<"<table border='1' bordercolor='black'>\n";
-
-
- m_output<<"<tr>\n";
-
-
- for(int v=0;v<m_intermediateCG.size();v++)
- {
-
- int clusterSize=m_intermediateCG[v].size();
-
- m_output<<"<td colspan=\""<<clusterSize<<"\">";
-
- for(int w=0;w<clusterSize;w++)
- {
- if(m_hyperlinksVec.size()>0)
- {
- m_output<<"<a href='"
- <<m_hyperlinksVec[m_intermediateCG[v][w]]
- <<"'>"<<m_intermediateCG[v][w]<<"</a>&nbsp;";
- }
- else
- {
- m_output<<m_intermediateCG[v][w]<<"&nbsp;";
- }
-
- //if there is an image file corresponding to each data object
- if(!m_imageFileExtn.empty())
- {
- m_output<<"<img src=\""
- <<m_intermediateCG[v][w]<<"."<<m_imageFileExtn
- <<"\" border=\"0\"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
- }
-
-
- }
- }
-
- m_output<<"<td><b>";
- m_output<<"Inter-cluster Dist";
- m_output<<"</b></td>";
-
- m_output<<"</tr>\n";
-
- }
-
- if(m_numOfClusters<m_data.size() || m_determineClusters==true)
- {
-
- int currNumOfClusters = m_data.size();
-
- //this local variable is used only for Average Silhouette method
- float minSil=FLT_MAX;
-
-
- for(int it=0;it<(m_data.size()-m_numOfClusters);++it)
- {
- vector<int> toCluster;
-
- //to find the clusters that need to be merged
- float interClusterDistance=findGroup(toCluster);
-
- currNumOfClusters=m_data.size()-it-1;
-
- if(m_stoppingCriterion==AVG_SIL)
- {
- float silDiff=computeAvgSil(toCluster[0],toCluster[1]);
-
- if(silDiff<minSil)
- {
- minSil=silDiff;
- if(currNumOfClusters > 2)
- {
- m_numBySil=currNumOfClusters+1;
- m_cachedResult=m_intermediateCG;
- }
-
- }
- }
- else if(m_stoppingCriterion==LMETHOD && m_determineClusters==true)
- {
- m_mergingDist[currNumOfClusters]=interClusterDistance;
- }
-
-
- //clusters are merged
- m_intermediateCG[toCluster[0]].insert(m_intermediateCG[toCluster[0]].end(),
- m_intermediateCG[toCluster[1]].begin(),
- m_intermediateCG[toCluster[1]].end());
-
- //old cluster deleted
- m_intermediateCG.erase(m_intermediateCG.begin()+ toCluster[1]);
-
-
-
- if(m_writeHTML)
- {
- if(!m_showAllLevels)
- {
- if(currNumOfClusters==m_numOfClusters)
- {
- writeClustersAsHTML(interClusterDistance);
- }
- }
- else
- {
- writeClustersAsHTML(interClusterDistance);
- }
-
- }
-
-
- }
-
-
- }
-
-
- //closing the html tags
- if(m_writeHTML)
- {
- m_output<<"</table>\n";
- m_output<<"</body>\n";
- m_output<<"</html>";
-
- m_output.close();
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::clusterToFindNumClusters()"<<endl;
-
- return SUCCESS;
-
-}
-
-
-
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : getInterObjectDistance
-* DESCRIPTION : Returns the distance between two data objects from the distance matrix
-* ARGUMENTS : firstObjIndex - index of the first data object
-* secondObjIndex - index of the second data object
-* RETURNS : distance (float)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float getInterObjectDistance(int firstObjIndex,int secondObjIndex) const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::getInterObjectDistance()"<<endl;
-
- int row = 0;
- int col = 0;
-
- if(firstObjIndex < secondObjIndex)
- {
- row=firstObjIndex;
- col=secondObjIndex;
- }
- else
- {
- row=secondObjIndex;
- col=firstObjIndex;
- } //lesser index is made as row and the other as column
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::getInterObjectDistance()"<<endl;
-
- return m_proximityMatrix[row][col-row-1];
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : findGroup
-* DESCRIPTION : Finds the indices in the m_intermediateCG (clusters) that
-* need to be merged
-* ARGUMENTS : pairToCombine - vector for storing the cluster indices
-* RETURNS : inter cluster distance (float)
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-//double findGroup(vector<int> pairToCombine)
-float findGroup(vector<int>& pairToCombine) const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::findGroup()"<<endl;
-
- float minDistance=FLT_MAX;
-
- pairToCombine.clear();
-
- pairToCombine.resize(2);
-
- for(int i=0;i<m_intermediateCG.size();i++)
- {
- for(int j=i+1;j<m_intermediateCG.size();j++)
- {
- float tempDist=findInterClusterDistance(m_intermediateCG[i],
- m_intermediateCG[j]);
-
- if(tempDist<minDistance)
- {
-
- minDistance=tempDist;
- pairToCombine[0]=i;
- pairToCombine[1]=j;
- }
- }
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::findGroup()"<<endl;
-
-
- return minDistance;
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : findInterClusterDistance
-* DESCRIPTION : Finds the inter-cluster distance.
-* The contents of each cluster are in the vectors.
-* ARGUMENTS : v1 cluster one
-* v2 cluster two
-* RETURNS : inter cluster distance
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-//double findInterClusterDistance(const vector<int>& v1,const vector<int>& v2)
-float findInterClusterDistance(const vector<int>& cluster1, const vector<int>& cluster2) const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::findInterClusterDistance()"<<endl;
-
- float groupDistance=0.0;
-
- /*For single-linkage algorithm*/
- if(m_method==SINGLE_LINKAGE)
- {
- groupDistance= FLT_MAX;
-
- for(int i=0;i<cluster1.size();i++)
- {
- for(int j=0;j<cluster2.size();j++)
- {
- float temp=getInterObjectDistance(cluster1[i],cluster2[j]);
-
- if(temp < groupDistance)
- {
- groupDistance=temp;
- }
- }
- }
- }
-
-
- /*For average-linkage algorithm*/
- if(m_method==AVERAGE_LINKAGE)
- {
- groupDistance=0.0;
-
- for(int i=0;i<cluster1.size();i++)
- {
- for(int j=0;j<cluster2.size();j++)
- {
-
- groupDistance+=getInterObjectDistance(cluster1[i],cluster2[j]);
- }
- }
-
- groupDistance/=((float)(cluster1.size()*cluster2.size()));
- }
-
-
- /*For complete-linkage algorithm*/
- if(m_method==COMPLETE_LINKAGE)
- {
- groupDistance=0.0;
-
- for(int i=0;i<cluster1.size();i++)
- {
- for(int j=0;j<cluster2.size();j++)
- {
- float temp=getInterObjectDistance(cluster1[i],cluster2[j]);
-
- if(temp > groupDistance)
- {
- groupDistance=temp;
- }
- }
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::findInterClusterDistance()"<<endl;
-
-
- return groupDistance;
-
-
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : writeClustersAsHTML
-* DESCRIPTION : Writes the cluster results as html with data objects' and clusters' ids.
-* If hyperlinks vector is set, provides links to actual files.
-* ARGUMENTS : interClustDist - merging distance of the new cluster formed
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-void writeClustersAsHTML(float interClustDist)
-{
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::writeClustersAsHTML()"<<endl;
-
- m_output<<"<tr>\n";
-
- for(int v=0;v<m_intermediateCG.size();v++)
- {
- int clusterSize=m_intermediateCG[v].size();
-
- m_output<<"<td colspan=\""<<clusterSize<<"\">";
-
- m_output<<"("<<v<<")<br>";
-
- for(int w=0;w<clusterSize;w++)
- {
- if(m_hyperlinksVec.size()>0)
- {
- m_output<<"<a href='"<<m_hyperlinksVec[m_intermediateCG[v][w]]
- <<"'>"<<m_intermediateCG[v][w]<<"</a>&nbsp;";
- }
- else
- {
- m_output<<m_intermediateCG[v][w]<<"&nbsp;";
- }
- if(!m_imageFileExtn.empty())
- {
- m_output<<"<img src=\""<<m_intermediateCG[v][w]<<"."
- <<m_imageFileExtn
- <<"\" border=\"0\"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
- }
-
- }
- }
-
- m_output<<"<td>";
-
- m_output<<"("<<m_intermediateCG.size()
- <<")&nbsp;&nbsp;&nbsp;<b>"<<interClustDist<<"</b>";
-
- m_output<<"</td>";
-
- m_output<<"</tr>\n";
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::writeClustersAsHTML()"<<endl;
-
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : determineNumOfClusters
-* DESCRIPTION : Determines the number of clusters to be formed using
-* iterative refinement of L-method.
-* REFERENCE:S. Salvador and P. Chan. Determining the number of clusters/
-* segments in hierarchical clustering/segmentation algorithms.
-* Proceedings of 16th IEEE International Conference
-* on Tools with Artificial Intelligence, 3:1852-1857, 2004.
-* ARGUMENTS :
-* RETURNS : number of clusters
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int determineNumOfClusters() const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::determineNumOfClusters()"<<endl;
-
- int cutOff=(int)m_mergingDist.capacity()-1;
-
- int lastKnee=0;
- int currentKnee=0;
-
- lastKnee=cutOff;
-
- currentKnee=lastKnee;
-
- bool trueCutOff=false;
-
- /*Iterative refinement of the L-method result*/
-
- while(true)
- {
-
- lastKnee=currentKnee;
-
- currentKnee=determineKnee(cutOff);
-
- if(trueCutOff)
- {
-
- if(currentKnee >= lastKnee)
- {
-
- break;
- }
- }
-
- int temp=currentKnee*2;
-
- if(temp>cutOff)
- {
- --cutOff;
-
- trueCutOff=false;
- }
- else
- {
- cutOff=temp;
-
- trueCutOff=true;
- }
-
-
- if(cutOff < MIN_CUTOFF)
- {
-
- break;
- }
-
-
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)
- <<"Number of clusters determined by iterative refinement:"
- <<currentKnee<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::determineNumOfClusters()"<<endl;
-
- return currentKnee;
-}
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : determineKnee
-* DESCRIPTION : Determines the knee of the given number of clusters vs. merging distance curve
-* ARGUMENTS : maxNumClusters - maximum number of clusters
-* RETURNS : knee point of the curve
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int determineKnee(int maxNumClusters) const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::determineKnee()"<<endl;
-
- int result=0;
-
- float minRMSE = FLT_MAX;
-
- //atleast two points are required to fit lines, hence c ranges
- //from 3 to maxNumClusters-2
- for(int c=3;c<maxNumClusters-2;c++)
- {
-
- float lRMSE=0,rRMSE=0;
-
- findRMSE(c,maxNumClusters,lRMSE,rRMSE);
-
- float cRMSE=(((float)(c-1)/(float)(maxNumClusters-1))*lRMSE)
- +(((float)(maxNumClusters-c)/(float)(maxNumClusters-1))*rRMSE);
-
- if(cRMSE<minRMSE)
- {
-
- minRMSE=cRMSE;
-
- result=c;
- }
- }
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::determineKnee()"<<endl;
-
- return result+1;
-}
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : determineKnee
-* DESCRIPTION : Determines left and right RMSE values of the given point
-* on the no. of clusters vs. merging distance curve.
-* It fits two regression lines on either side of the point to find RMSEs
-* ARGUMENTS : candidateKnee - candidata knee point
-* maxNumClusters - upper bound on number of clusters
-* lRMSE - output RMSE on the left of c
-* rRMSE - output RMSE on the right of c
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-void findRMSE(int candidateKnee,int maxNumClusters,float& outLRMSE,float& outRRMSE) const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::findRMSE()"<<endl;
-
- float avgXLeft = 0;
- float avgYLeft = 0;
- float avgXRight = 0;
- float avgYRight = 0;
-
- /*Regression line coefficients*/
- float beta0Left = 0;
- float beta1Left = 0;
- float beta0Right = 0;
- float beta1Right = 0;
-
- int i = 0;
- int j = 0;
-
- for(i=2;i<=candidateKnee;i++)
- {
- avgYLeft+=m_mergingDist[i];
-
- avgXLeft+=i;
- }
-
-
- avgYLeft /= (candidateKnee-1);
- avgXLeft /= (candidateKnee-1);
-
-
- for(j=candidateKnee+1;j<=maxNumClusters;j++)
- {
-
- avgYRight += m_mergingDist[j];
- avgXRight += j;
- }
-
- avgYRight /= (maxNumClusters-candidateKnee);
- avgXRight /= (maxNumClusters-candidateKnee);
-
- float numer=0;
- float denom=0;
-
- for(i=2;i<=candidateKnee;i++)
- {
-
- numer += ((i-avgXLeft)*(m_mergingDist[i]-avgYLeft));
- denom += ((i-avgXLeft)*(i-avgXLeft));
- }
-
- beta1Left = numer/denom;
- beta0Left = avgYLeft-(beta1Left*avgXLeft);
-
- numer=0;denom=0;
-
- for(j=candidateKnee+1;j<=maxNumClusters;j++)
- {
- numer += ((j-avgXRight)*(m_mergingDist[j]-avgYRight));
- denom += ((j-avgXRight)*(j-avgXRight));
- }
-
- if(denom > EPS)
- {
- beta1Right = numer / denom;
- }
- else
- {
- beta1Right = 0;
- }
-
- beta0Right = avgYRight-(beta1Right*avgXRight);
-
- float errorSOS=0;
-
- for(i=2;i<=candidateKnee;i++)
- {
-
- float yCap = (beta0Left+(beta1Left*i));
-
- errorSOS += ((m_mergingDist[i]-yCap)*(m_mergingDist[i]-yCap));
-
- }
-
- outLRMSE=sqrt(errorSOS/(candidateKnee-2));
-
- errorSOS=0;
-
- for(j=candidateKnee+1;j<=maxNumClusters;j++)
- {
-
- float yCap = beta0Right + (beta1Right*j);
-
- errorSOS += (m_mergingDist[j]-yCap)*(m_mergingDist[j]-yCap);
-
- }
-
- outRRMSE=sqrt(errorSOS/(maxNumClusters-candidateKnee-1));
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::findRMSE()"<<endl;
-
-}
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : computeAvgSil
-* DESCRIPTION : Funtion that determines the change in the ratio of
-* intra and inter cluster similarity before and after merging
-* ARGUMENTS : clust1Index - index of cluster one
-* clust2Index - index of cluster two
-* RETURNS : average silhouette computed
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-float computeAvgSil(int clust1Index,int clust2Index) const
-{
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Entering: "
- <<"LTKHierarchicalClustering::computeAvgSil()"<<endl;
-
- const vector<int>& clust1=m_intermediateCG[clust1Index];
-
- const vector<int>& clust2=m_intermediateCG[clust2Index];
-
- vector<int> combinedClust;
-
- combinedClust.insert(combinedClust.end(),clust1.begin(),clust1.end());
-
- combinedClust.insert(combinedClust.end(),clust2.begin(),clust2.end());
-
- float clust1TotalSils=0.0f,clust2TotalSils=0.0f,combinedClustTotalSils=0.0f;
-
- for(int i=0;i<clust1.size();i++)
- {
- int dataObj=clust1[i];
-
- float avgIntraDist=0.0;
-
- if(clust1.size()>1)
- {
- for(int j=0;j<clust1.size();j++)
- {
- if(clust1[j]!=dataObj)
- {
- avgIntraDist+=getInterObjectDistance(dataObj,clust1[j]);
-
- }
- }
-
- avgIntraDist/=((float)(clust1.size()-1));
- }
-
- float minInterDist= FLT_MAX;
-
- for(int r=0;r<m_intermediateCG.size();r++)
- {
- float avgInterDist=0.0;
-
- if(r!=clust1Index)
- {
- for(int c=0;c<m_intermediateCG[r].size();c++)
- {
- avgInterDist+=getInterObjectDistance(dataObj,m_intermediateCG[r][c]);
- }
-
- avgInterDist/=((float)m_intermediateCG[r].size());
-
- if(avgInterDist<minInterDist)
- {
- minInterDist=avgInterDist;
- }
- }
-
- }
-
- float dataObjSil=0.0;
-
- if(minInterDist > avgIntraDist && minInterDist > EPS)
- {
-
- dataObjSil=(minInterDist-avgIntraDist)/minInterDist;
-
- }
- else if(avgIntraDist > EPS)
- {
-
- dataObjSil=(minInterDist-avgIntraDist)/avgIntraDist;
-
- }
-
- clust1TotalSils+=dataObjSil;
- }
-
- for(int ii=0;ii<clust2.size();ii++)
- {
- int dataObj=clust2[ii];
-
- float avgIntraDist=0.0;
-
- if(clust2.size()>1)
- {
- for(int j=0;j<clust2.size();j++)
- {
- if(clust2[j]!=dataObj)
- {
-
- avgIntraDist+=getInterObjectDistance(dataObj,clust2[j]);
-
- }
- }
-
- avgIntraDist/=((float)(clust2.size()-1));
- }
-
- float minInterDist= FLT_MAX;
-
- for(int r=0;r<m_intermediateCG.size();r++)
- {
- float avgInterDist=0.0;
-
- if(r!=clust2Index)
- {
- for(int c=0;c<m_intermediateCG[r].size();c++)
- {
- avgInterDist+=getInterObjectDistance(dataObj,
- m_intermediateCG[r][c]);
- }
-
- avgInterDist/=((float)m_intermediateCG[r].size());
-
- if(avgInterDist < minInterDist)
- {
- minInterDist=avgInterDist;
- }
- }
-
- }
- float dataObjSil=0.0;
-
- if(minInterDist > avgIntraDist && minInterDist > EPS)
- {
- dataObjSil=(minInterDist-avgIntraDist)/minInterDist;
- }
- else if(avgIntraDist > EPS)
- {
- dataObjSil=(minInterDist-avgIntraDist)/avgIntraDist;
- }
-
- clust2TotalSils+=dataObjSil;
- }
-
-
- for(int iii=0;iii<combinedClust.size();iii++)
- {
- int dataObj=combinedClust[iii];
-
- float avgIntraDist=0.0;
-
- if(combinedClust.size()>1)
- {
- for(int j=0;j<combinedClust.size();j++)
- {
- if(combinedClust[j]!=dataObj)
- {
- avgIntraDist+=getInterObjectDistance(dataObj,combinedClust[j]);
-
- }
- }
- avgIntraDist/=((float)(combinedClust.size()-1));
- }
-
- float minInterDist=FLT_MAX;
-
- for(int r=0;r<m_intermediateCG.size();r++)
- {
-
- if(r!=clust1Index && r!=clust2Index)
- {
- float avgInterDist=0.0f;
-
- for(int c=0;c<m_intermediateCG[r].size();c++)
- {
- avgInterDist+=getInterObjectDistance(dataObj,m_intermediateCG[r][c]);
- }
-
- avgInterDist = (float)avgInterDist/ ((float)m_intermediateCG[r].size());
-
- if(avgInterDist<minInterDist)
- {
- minInterDist=avgInterDist;
-
- }
- }
-
- }
-
- float dataObjSil=0.0;
-
- if(minInterDist>avgIntraDist && minInterDist > EPS)
- {
-
- dataObjSil=(minInterDist-avgIntraDist)/minInterDist;
-
- }
- else if(avgIntraDist > EPS)
- {
-
- dataObjSil=(minInterDist-avgIntraDist)/avgIntraDist;
-
- }
-
- combinedClustTotalSils+=dataObjSil;
- }
-
-
- LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<"Exiting: "
- <<"LTKHierarchicalClustering::computeAvgSil()"<<endl;
-
-
- return (combinedClustTotalSils-clust1TotalSils-clust2TotalSils);
-
-}
-
-
-
-};
-#endif
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp
deleted file mode 100644
index 9067ca98..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.cpp
+++ /dev/null
@@ -1,1306 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2007-10-08 22:10:54 +0530 (Mon, 08 Oct 2007) $
- * $Revision: 252 $
- * $Author: bharatha $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definitions of Image Writer module
- *
- * CONTENTS:
- * drawLTKTraceGroupToImage
- * drawRawInkFileToImage
- * drawUnipenFileToImage
- * drawUnipenFileToImageWithBB
- * showStartingPoint
- * setColor
- * setAlternateColor
- * setOffstet
- * normalizeSize
- * getBoundingBox
- * findMinXOfTrace
- * findMaxXOfTrace
- * drawPoint
- * drawLine
- * drawRectangle
- * fillRectangle
- * createTraceOrderInTraceGroup
- *
- * AUTHOR: Bharath A
- *
- * DATE: February 22, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKImageWriter.h"
-#include "LTKChannel.h"
-#include "LTKTraceFormat.h"
-#include "LTKTrace.h"
-#include "LTKTraceGroup.h"
-#include "LTKInkFileReader.h"
-#include "LTKCaptureDevice.h"
-#include "LTKPreprocessorInterface.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-#include "LTKScreenContext.h"
-#include "LTKLoggerUtil.h"
-
-#include "LTKException.h"
-
-
-using namespace std;
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : LTKImageWriter
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKImageWriter::LTKImageWriter():
-m_width(0),
-m_height(0),
-m_pixels(NULL),
-m_showBB(false),
-m_showSP(false),
-m_red(255),
-m_green(0),
-m_blue(0),
-m_altRed(0),
-m_altGreen(0),
-m_altBlue(255),
-m_offset(0)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Entering: LTKImageWriter::LTKImageWriter()" <<endl;
-
- xChannelstr = "X";
- yChannelstr = "Y";
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Exiting: LTKImageWriter::LTKImageWriter()" <<endl;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : ~LTKImageWriter
-* DESCRIPTION : Destructor deletes the pixels array
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- LTKImageWriter::~LTKImageWriter()
- {
- if(m_pixels!=NULL){
- delete [] m_pixels;
- }
-
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawLTKTraceGroupToImage
-* DESCRIPTION : The function draws LTKTraceGroup to image file with specified width,height,color and offset.
- If offset not equal to zero, the image would be in the trace order.
-* ARGUMENTS :
-* traceGroup the trace group that is to be drawn
-* imgFileName name of the file that is to be created to draw the image
-* imgWidth width of the image
-* imgHeight height of the image
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawLTKTraceGroupToImage(const LTKTraceGroup& traceGroup,
- const string imgFileName,int imgWidth,int imgHeight)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawLTKTraceGroupToImage()" << endl;
-
- m_width=imgWidth+5;
- m_height=imgHeight+5;
- delete [] m_pixels;
- m_pixels=new unsigned char[3*m_width*m_height];
-
- for(int c=0;c<(3*m_width*m_height);c++)
- {
- m_pixels[c]=0xff;
- }
-
- LTKTraceGroup normTraceGroup;
-
- if(m_offset)
- {
- createTraceOrderInTraceGroup(traceGroup,normTraceGroup);
-
- }
- else
- {
- normTraceGroup=traceGroup;
- }
-
- normTraceGroup.getBoundingBox(m_xMin,m_yMin,m_xMax,m_yMax);
- float newXScaleFactor = (float) imgWidth/((float)(m_xMax-m_xMin)/normTraceGroup.getXScaleFactor());
-
- float newYScaleFactor = (float)imgHeight / (float) ((m_yMax-m_yMin)/normTraceGroup.getYScaleFactor());
-
- float origin = 0;
-
- normTraceGroup.affineTransform(newXScaleFactor,newYScaleFactor,origin,origin,XMIN_YMIN);
-
- int numOfTracesToDraw=normTraceGroup.getNumTraces();
-
- if(m_showBB)
- {
- numOfTracesToDraw = normTraceGroup.getNumTraces() - 1;
-
- LTKTrace trace ;
- normTraceGroup.getTraceAt(numOfTracesToDraw, trace);
-
- for(int j=1; j< trace.getNumberOfPoints(); j++)
- {
- floatVector fromPoint, toPoint;
-
- trace.getPointAt(j-1, fromPoint);
-
- trace.getPointAt(j, toPoint);
-
- drawLine((int)fromPoint[0]+2, (int)fromPoint[1]+2,
- (int)toPoint[0]+2, (int)toPoint[1]+2, 255, 255, 0);
- }
- }
-
-
- for(int i=0;i<numOfTracesToDraw;i++)
- {
- LTKTrace trace;
-
- normTraceGroup.getTraceAt(i, trace);
-
- for(int j=1 ; j < trace.getNumberOfPoints() ; j++)
- {
- floatVector fromPoint, toPoint;
-
- trace.getPointAt(j-1, fromPoint);
-
- trace.getPointAt(j, toPoint);
-
- if((i%2)==0)
- {
- if(j == 1)
- {
- if(m_showSP)
- {
- drawRectangle((int)fromPoint[0]+2-2,(int)fromPoint[1]+2+2,(int)fromPoint[0]+2+2,(int)fromPoint[1]+2-2,0,0,0);
-
- }
-
- }
- drawLine((int)fromPoint[0]+2,(int)fromPoint[1]+2,(int)toPoint[0]+2,(int)toPoint[1]+2,m_red,m_green,m_blue);
- }
- else
- {
- if(j==1)
- {
- if(m_showSP)
- {
- drawRectangle((int)fromPoint[0]+2-2,(int)fromPoint[1]+2+2,(int)fromPoint[0]+2+2,(int)fromPoint[1]+2-2,0,0,0);
-
- }
-
- }
- drawLine((int)fromPoint[0]+2,(int)fromPoint[1]+2,(int)toPoint[0]+2,(int)toPoint[1]+2,m_altRed,m_altGreen,m_altBlue);
-
- }
-
- }
-
- }
-
- drawBMPImage(imgFileName,m_pixels,m_width,m_height);
- delete [] m_pixels;
-
- m_pixels=NULL;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawLTKTraceGroupToImage()" << endl;
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawLTKTraceGroupToImage
-* DESCRIPTION : The function draws LTKTraceGroup to image file with specified color and offset. The width and height would be determined from the trace group. If offset not equal to zero, the image would be in the trace order.
-* ARGUMENTS :
-* traceGroup the trace group that is to be drawn
-* imgFileName name of the file that is to be created to draw the image
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawLTKTraceGroupToImage(const LTKTraceGroup& traceGroup,const string imgFileName)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawLTKTraceGroupToImage(const LTKTraceGroup&,const string)" << endl;
-
-
- traceGroup.getBoundingBox(m_xMin,m_yMin,m_xMax,m_yMax);
-
-
- drawLTKTraceGroupToImage(traceGroup,imgFileName,(int)(m_xMax-m_xMin),(int)(m_yMax-m_yMin));
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawLTKTraceGroupToImage(const LTKTraceGroup&,const string)" << endl;
- }
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawLTKTraceGroupToImage
-* DESCRIPTION : The function draws LTKTraceGroup to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
-* ARGUMENTS :
-* traceGroup the trace group that is to be drawn
-* imgFileName name of the file that is to be created to draw the image
-* size bound on larger dimension
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawLTKTraceGroupToImage(const LTKTraceGroup& traceGroup,
- const string imgFileName, int size)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawLTKTraceGroupToImage(const LTKTraceGroup&,const string,size)" << endl;
-
- LTKTraceGroup normTraceGroup = traceGroup;
-
- normTraceGroup.getBoundingBox(m_xMin,m_yMin,m_xMax,m_yMax);
-
- float xScale = ((float)fabs(m_xMax - m_xMin))/normTraceGroup.getXScaleFactor();
-
- float yScale = ((float)fabs(m_yMax - m_yMin))/normTraceGroup.getYScaleFactor();
-
-
- if(yScale > xScale)
- {
- xScale = yScale;
- }
- else
- {
- yScale = xScale;
- }
-
- float xScaleFactor = size / xScale ;
-
- float yScaleFactor = size / yScale;
-
- float origin = 0.0;
-
- normTraceGroup.affineTransform(xScaleFactor,yScaleFactor,origin,origin,XMIN_YMIN);
-
- drawLTKTraceGroupToImage(normTraceGroup,imgFileName);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawLTKTraceGroupToImage(const LTKTraceGroup&,const string,size)" << endl;
- }
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawLTKTraceGroupToImage
-* DESCRIPTION : The function draws LTKTraceGroup to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.The bounding box of the image is also drawn to show relative position.
-* ARGUMENTS :
-* traceGroup the trace group that is to be drawn
-* screenContext screenContext the reference to screen Context for determining the bounding box
-* imgFileName name of the file that is to be created to draw the image
-* size bound on larger dimension
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawLTKTraceGroupToImageWithBB(const LTKTraceGroup& traceGroup,const LTKScreenContext& screenContext,
- const string imgFileName,int size)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawLTKTraceGroupToImageWithBB()" << endl;
-
- LTKTraceGroup newTG;
- newTG=traceGroup;
- float x1=screenContext.getBboxLeft();
- float y1=screenContext.getBboxBottom();
- float x2=screenContext.getBboxRight();
- float y2=screenContext.getBboxTop();
-
- vector<LTKChannel> channels;
-
- LTKChannel xChannel("X", DT_FLOAT, true);
- LTKChannel yChannel("Y", DT_FLOAT, true);
-
- channels.push_back(xChannel);
- channels.push_back(yChannel);
-
- LTKTraceFormat traceFormat(channels);
-
- LTKTrace trace(traceFormat);
-
- vector<float> point1;
- point1.push_back(x1);
- point1.push_back(y1);
- trace.addPoint(point1);
-
- vector<float> point2;
- point2.push_back(x2);
- point2.push_back(y1);
- trace.addPoint(point2);
-
- vector<float> point3;
- point3.push_back(x2);
- point3.push_back(y2);
- trace.addPoint(point3);
-
- vector<float> point4;
- point4.push_back(x1);
- point4.push_back(y2);
- trace.addPoint(point4);
-
- vector<float> point5;
- point5.push_back(x1);
- point5.push_back(y1);
- trace.addPoint(point5);
-
- newTG.addTrace(trace);
-
- m_showBB=true;
-
- drawLTKTraceGroupToImage(newTG,imgFileName,size);
- m_showBB=false;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawLTKTraceGroupToImageWithBB()" << endl;
- }
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawRawInkFileToImage
-* DESCRIPTION : The function creates LTKTraceGroup from the specified data file and draws it to image file with specified width,height,color and offset. If offset not equal to zero, the image would be in the trace order.
-* ARGUMENTS :
-* fileName path to the datafile
-* imgFileName name of the file that is to be created to draw the image
-* imgWidth width of the image
-* imgHeight height of the image
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawRawInkFileToImage(const string fileName, const string imgFileName,
- int imgWidth,int imgHeight)
- {
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawRawInkFileToImage(const string, const string,int,int)" << endl;
-
- LTKTraceGroup traceGroup;
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
- string strFileName(fileName);
- try
- {
- LTKInkFileReader::readRawInkFile(strFileName,traceGroup,captureDevice,screenContext);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKImageWriter::drawRawInkFileToImage(const string, const string,int,int)" <<endl;
-
- errorCode = EINK_FILE_OPEN;
- }
-
- drawLTKTraceGroupToImage(traceGroup,imgFileName,imgWidth,imgHeight);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawRawInkFileToImage(const string, const string,int,int)" << endl;
- }
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawRawInkFileToImage
-* DESCRIPTION : The function creates LTKTraceGroup from the specified data file and draws it to image file with specified color and offset. The width and height would be determined from the trace group.
-* ARGUMENTS :
-* fileName path to the datafile
-* imgFileName name of the file that is to be created to draw the image
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawRawInkFileToImage(const string fileName, const string imgFileName)
- {
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawRawInkFileToImage(const string, const string)" << endl;
-
- LTKTraceGroup traceGroup;
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
- string strFileName(fileName);
-
- try
- {
- LTKInkFileReader::readRawInkFile(strFileName,traceGroup,captureDevice,screenContext);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKImageWriter::drawRawInkFileToImage(const string, const string)" <<endl;
-
- errorCode = EINK_FILE_OPEN;
- }
-
- drawLTKTraceGroupToImage(traceGroup,imgFileName);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawRawInkFileToImage(const string, const string)" << endl;
- }
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawRawInkFileToImage
-* DESCRIPTION : The function draws LTKTraceGroup to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
-* ARGUMENTS :
-* fileName path to the data file
-* imgFileName name of the file that is to be created to draw the image
-* size bound on larger dimension
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawRawInkFileToImage(const string fileName,const string imgFileName,int size)
- {
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawRawInkFileToImage(const string,const string,int)" << endl;
-
- LTKTraceGroup traceGroup;
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
- string strFileName(fileName);
- try
- {
- LTKInkFileReader::readRawInkFile(strFileName,traceGroup,captureDevice,screenContext);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKImageWriter::drawRawInkFileToImage(const string,const string,int)" <<endl;
-
- errorCode = EINK_FILE_OPEN;
- }
-
- drawLTKTraceGroupToImage(traceGroup,imgFileName,size);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawRawInkFileToImage(const string,const string,int)" << endl;
- }
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawUnipenFileToImage
-* DESCRIPTION : The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified width,height,color and offset. If offset not equal to zero, the image would be in the trace order.
-* ARGUMENTS :
-* unipenFileName path to the datafile
-* imgFileName name of the file that is to be created to draw the image
-* imgWidth width of the image
-* imgHeight height of the image
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawUnipenFileToImage(const string unipenFileName,const string imgFileName,int imgWidth,int imgHeight)
- {
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawUnipenFileToImage(const string,const string,int,int)" << endl;
-
- LTKTraceGroup traceGroup;
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
- string strFileName(unipenFileName);
- try
- {
- LTKInkFileReader::readUnipenInkFile(strFileName,traceGroup,captureDevice,screenContext);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKImageWriter::drawUnipenFileToImage(const string,const string,int,int)" <<endl;
-
- errorCode = EINK_FILE_OPEN;
- }
- drawLTKTraceGroupToImage(traceGroup,imgFileName,imgWidth,imgHeight);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawUnipenFileToImage(const string,const string,int,int)" << endl;
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawUnipenFileToImage
-* DESCRIPTION : The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The width and height would be determined from the trace group.
-* ARGUMENTS :
-* unipenFileName path to the datafile
-* imgFileName name of the file that is to be created to draw the image
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName)
- {
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawUnipenFileToImage(const string&,const string&)" << endl;
-
- LTKTraceGroup traceGroup;
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
- string strFileName(unipenFileName);
- try
- {
- LTKInkFileReader::readUnipenInkFile(strFileName,traceGroup,captureDevice,screenContext);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKImageWriter::drawUnipenFileToImage(const string&,const string&)" <<endl;
-
- errorCode = EINK_FILE_OPEN;
- }
-
- drawLTKTraceGroupToImage(traceGroup,imgFileName);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawUnipenFileToImage(const string&,const string&)" << endl;
- }
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawUnipenFileToImage
-* DESCRIPTION : The function creates LTKTraceGroup from the unipen data file specified and draws it to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
-* ARGUMENTS :
-* unipenFileName path to the unipen data file
-* imgFileName name of the file that is to be created to draw the image
-* size bound on larger dimension
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName,int size)
- {
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawUnipenFileToImage(const string&,const string&,int)" << endl;
-
-
- LTKTraceGroup traceGroup;
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
- string strFileName(unipenFileName);
- try
- {
- LTKInkFileReader::readUnipenInkFile(strFileName,traceGroup,captureDevice,screenContext);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKImageWriter::drawUnipenFileToImage(const string&,const string&,int)" <<endl;
-
-
- errorCode = EINK_FILE_OPEN;
- }
-
- drawLTKTraceGroupToImage(traceGroup,imgFileName,size);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawUnipenFileToImage(const string&,const string&,int)" << endl;
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawUnipenFileToImageWithBB
-* DESCRIPTION : The function creates LTKTraceGroup from the unipen data file specified and draws it to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.The bounding box of the image is also drawn to show relative position.
-* ARGUMENTS :
-* unipenFileName path to the unipen data file
-* imgFileName name of the file that is to be created to draw the image
-* size bound on larger dimension
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawUnipenFileToImageWithBB(const string& unipenFileName,const string& imgFileName,int size)
- {
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawUnipenFileToImageWithBB()" << endl;
-
- LTKTraceGroup traceGroup;
- string strFileName(unipenFileName);
- LTKCaptureDevice captureDevice;
- LTKScreenContext screenContext;
- try
- {
- LTKInkFileReader::readUnipenInkFile(strFileName,traceGroup,captureDevice,screenContext);
- }
- catch(LTKException e)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKImageWriter::drawUnipenFileToImageWithBB()" <<endl;
-
- errorCode = EINK_FILE_OPEN;
- }
- drawLTKTraceGroupToImageWithBB(traceGroup,screenContext,imgFileName,size);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawUnipenFileToImageWithBB()" << endl;
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : showStartingPoint
-* DESCRIPTION : The set function for showing the starting point of each stroke
-* ARGUMENTS :
-* toShow flag to show the starting point
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::showStartingPoint(bool toShow)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::showStartingPoint()" << endl;
-
- m_showSP=toShow;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::showStartingPoint()" << endl;
- }
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : findMinXOfTrace
-* DESCRIPTION : The function finds the minimum x value of the given trace.
-* ARGUMENTS :
-* trace input trace
-*
-* RETURNS : minimum value of x
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- int LTKImageWriter::findMinXOfTrace(const LTKTrace& trace,float& minX)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::findMinXOfTrace(const LTKTrace&,float&)" << endl;
-
- minX=numeric_limits<float>::infinity();
- for(int i=0;i<trace.getNumberOfPoints();i++){
- vector<float> point;
-
- trace.getPointAt(i, point);
- if(point[0]<minX){
- minX=point[0];
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::findMinXOfTrace(const LTKTrace&,float&)" << endl;
-
- return SUCCESS;
-
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : findMaxXOfTrace
-* DESCRIPTION : The function finds the maximum x value of the given trace.
-* ARGUMENTS :
-* trace input trace
-*
-* RETURNS : maximum value of x
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- int LTKImageWriter::findMaxXOfTrace(const LTKTrace& trace,float& maxX)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::findMaxXOfTrace(const LTKTrace&,float&)" << endl;
-
- maxX = -FLT_MAX;
-
- for(int i=0;i<trace.getNumberOfPoints();i++){
-
- vector<float> point;
-
- trace.getPointAt(i, point);
- if(point[0]>maxX){
-
- maxX=point[0];
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::findMaxXOfTrace(const LTKTrace&,float&)" << endl;
-
- return SUCCESS;
- }
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawPoint
-* DESCRIPTION : The function makes entries in the pixels array for the specified x,y and color.
-* ARGUMENTS :
-* x,y coordinates of the point to be drawn
-* red,green,blue RGB values of the color of the point
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawPoint(int x,int y,unsigned char red,unsigned char green,unsigned char blue){
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawPoint()" << endl;
-
-
- m_pixels[(3*((x)+y*m_width))]=red;
- m_pixels[(3*((x)+y*m_width))+1]=green;
- m_pixels[(3*((x)+y*m_width))+2]=blue;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawPoint()" << endl;
- }
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawLine
-* DESCRIPTION : The function draws line between the specified end points.
-* ARGUMENTS :
-* x1,y1,x2,y2 coordinates of the end points of the line to be drawn
-* red,green,blue RGB values of the color of the line
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawLine(int x1, int y1, int x2, int y2,unsigned char red,unsigned char green,unsigned char blue)
- {
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawLine()" << endl;
-
- int x, y;
- double k, s;
-
- if (y1==y2) {
- if (x1>x2)
- swap(x1,x2);
- for (x=x1; x<=x2; x++)
- drawPoint(x, y1,red,green,blue);
- } else {
- k = (double)(y2-y1)/(x2-x1);
- if (-1<=k && k<=1) {
- if (x1>x2) {
- swap(x1, x2);
- swap(y1, y2);
- }
- for (x=x1, s=y1; x<=x2; x++, s+=k)
- drawPoint(x, (int)(s+.5),red,green,blue);
- } else {
- if (y1>y2) {
- swap(x1, x2);
- swap(y1, y2);
- }
- k = 1/k;
- for (s=x1, y=y1; y<=y2; s+=k, y++)
- drawPoint((int)(s+.5), y,red,green,blue);
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting:LTKImageWriter::drawLine()" << endl;
- }
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawRectangle
-* DESCRIPTION : The function draws hollow rectange with specified color and diagonal end points.
-* ARGUMENTS :
-* x1,y1,x2,y2 coordinates of the end points of the diagonal of the rectangle
-* red,green,blue RGB values of the color of the lines
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::drawRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawRectangle()" << endl;
-
-
- int xmin,ymin,xmax,ymax;
-
- if(x1<x2){
-
- xmin=x1;xmax=x2;
- }
- else{
- xmin=x2;xmax=x1;
- }
-
- if(y1<y2){
-
- ymin=y1;ymax=y2;
- }
- else{
- ymin=y2;ymax=y1;
- }
-
- drawLine(xmin,ymin,xmin,ymax,red,green,blue);
- drawLine(xmin,ymin,xmax,ymin,red,green,blue);
- drawLine(xmin,ymax,xmax,ymax,red,green,blue);
- drawLine(xmax,ymin,xmax,ymax,red,green,blue);
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawRectangle()" << endl;
- }
-
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : drawRectangle
-* DESCRIPTION : The function draws a rectange with specified diagonal end points and fills it with the specified color.
-* ARGUMENTS :
-* x1,y1,x2,y2 coordinates of the end points of the diagonal of the rectangle
-* red,green,blue RGB values of the color of the lines
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- void LTKImageWriter::fillRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::fillRectangle()" << endl;
-
- int xmin,ymin,xmax,ymax;
-
- if(x1<x2){
-
- xmin=x1;xmax=x2;
- }
- else{
- xmin=x2;xmax=x1;
- }
-
- if(y1<y2){
-
- ymin=y1;ymax=y2;
- }
- else{
- ymin=y2;ymax=y1;
- }
-
-
- for(int i=xmin;i<=xmax;i++)
- {
- drawLine(i,ymin,i,ymax,red,green,blue);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::fillRectangle()" << endl;
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : createTraceOrderInTraceGroup
-* DESCRIPTION : The function offsets the input trace group by specified offset value and in the original trace order.
-* ARGUMENTS :
-* traceGroup input trace group
-* offsetTraceGroup trace group with offset
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::createTraceOrderInTraceGroup(const LTKTraceGroup& traceGroup,LTKTraceGroup& offsetTraceGroup)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::createTraceOrderInTraceGroup()" << endl;
-
-
- float maxOfX=0.0;
- LTKTrace tempTrace;
- traceGroup.getTraceAt(0, tempTrace);
-
- findMaxXOfTrace(tempTrace,maxOfX);
-
- maxOfX += m_offset;
-
-
- offsetTraceGroup.addTrace(tempTrace);
-
- for(int i = 1 ; i < traceGroup.getNumTraces(); i++)
- {
- LTKTrace trace;
- traceGroup.getTraceAt(i, trace);
-
- float minOfTrace =0;
-
- findMinXOfTrace(trace,minOfTrace);
-
- LTKTrace offsetTrace=trace;
- int pointToShift=0;
- vector<float> newXChannel;
- for(int j=0;j<trace.getNumberOfPoints();j++){
- vector<float> point;
-
- trace.getPointAt(j, point);
- point[0]+=fabs(maxOfX-minOfTrace);
- newXChannel.push_back(point[0]);
- }
-
- offsetTrace.reassignChannelValues(xChannelstr,newXChannel);
- offsetTraceGroup.addTrace(offsetTrace);
-
- findMaxXOfTrace(offsetTrace,maxOfX);
- maxOfX += m_offset;
-
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::createTraceOrderInTraceGroup()" << endl;
- }
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : setColor
-* DESCRIPTION : Setter method for color of the starting stroke and subsequent alternate strokes
-* ARGUMENTS :
-* red value of Red in RGB combination
-* green value of Green in RGB combination
-* blue value of Blue in RGB combination
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::setColor(unsigned char red,unsigned char green,unsigned char blue)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::setColor()" << endl;
-
- m_red=red;
- m_green=green;
- m_blue=blue;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::setColor()" << endl;
- }
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : setAlternateColor
-* DESCRIPTION : Setter method for color of alternate strokes
-* ARGUMENTS :
-* altRed value of Red in RGB combination
-* altGreen value of Green in RGB combination
-* altBlue value of Blue in RGB combination
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- void LTKImageWriter::setAlternateColor(unsigned char altRed,unsigned char altGreen,unsigned char altBlue)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::setAlternateColor()" << endl;
-
- m_altRed=altRed;
- m_altGreen=altGreen;
- m_altBlue=altBlue;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::setAlternateColor()" << endl;
- }
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 22-FEB-2005
-* NAME : setOffstet
-* DESCRIPTION : Setter method for offset value between strokes
-* ARGUMENTS :
-* offset value of offset
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
- void LTKImageWriter::setOffset(int offset)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::setOffset()" << endl;
-
- if(offset < 0)
- {
- m_offset=0;
- }
- else
- {
- m_offset=offset;
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::setOffset()" << endl;
- }
-
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A
-* DATE : 19-MAY-2005
-* NAME : drawBMPImage
-* DESCRIPTION : The function writes the given pixel array to the specified BMP file
-* ARGUMENTS :
-* fileName name of output bmp file name with extension as 'bmp'
-* pixelArray pixel array
-* width width of the image
-* height height of the image
-*
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
- void LTKImageWriter::drawBMPImage(string fileName,unsigned char* pixelArray,int width,int height)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKImageWriter::drawBMPImage()" << endl;
-
- short type;
- int size;
- short reserved1;
- short reserved2;
- int offset;
- int i,j;
- int biSize,biWidth,biHeight;
- short biPlanes, biBitCount;
- int biCompression,biSizeImage,biXPelsPerMeter,biYPelsPerMeter,biClrUsed,biClrImportant;
- FILE *bmp = fopen(fileName.c_str(),"wb");
-
- offset = 54;
- biSize = 40;
-
- biWidth=width;
- biHeight=height;
- biPlanes = 1;
- biBitCount = 24;
- biCompression = 0;
- biSizeImage =0;
- biXPelsPerMeter = 0;
- biYPelsPerMeter = 0;
- biClrUsed = 0;
- biClrImportant = 0;
- type = 19778;
-
- int padding = ( 4 - ( ( 3 * width ) % 4 ) ) % 4;
-
- size = 54 + ( ( 3 * width ) + padding ) * height;
- reserved1 = 0;
- reserved2 = 0;
- fwrite(&type,sizeof(short),1,bmp);
- fwrite(&size,sizeof(int),1,bmp);
- fwrite(&reserved1,sizeof(short),1,bmp);
- fwrite(&reserved1,sizeof(short),1,bmp);
- fwrite(&offset,sizeof(int),1,bmp);
- fwrite(&biSize,sizeof(int),1,bmp);
- fwrite(&biWidth,sizeof(int),1,bmp);
- fwrite(&biHeight,sizeof(int),1,bmp);
- fwrite(&biPlanes,sizeof(short),1,bmp);
- fwrite(&biBitCount,sizeof(short),1,bmp);
- fwrite(&biCompression,sizeof(int),1,bmp);
- fwrite(&biSizeImage,sizeof(int),1,bmp);
- fwrite(&biXPelsPerMeter,sizeof(int),1,bmp);
- fwrite(&biYPelsPerMeter,sizeof(int),1,bmp);
- fwrite(&biClrUsed,sizeof(int),1,bmp);
- fwrite(&biClrImportant,sizeof(int),1,bmp);
-
- unsigned char zeroValue=0x00;
- //if(height%4 ==0) ++height;
- for ( i = height-1; i >=0 ; --i )
- {
- for ( j = 0; j < width ; ++j )
- {
-
- fwrite(&m_pixels[(3*((i*m_width)+j))+2],sizeof(char),1,bmp);
- fwrite(&m_pixels[(3*((i*m_width)+j))+1],sizeof(char),1,bmp);
- fwrite(&m_pixels[(3*((i*m_width)+j))],sizeof(char),1,bmp);
-
- }
-
-
- for ( int k = 0; k < padding; k++ )
- {
-
- fwrite(&zeroValue,sizeof(char),1,bmp);
- }
- }
-
- fclose(bmp);
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKImageWriter::drawBMPImage()" << endl;
- }
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h
deleted file mode 100644
index c1e387e6..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKImageWriter.h
+++ /dev/null
@@ -1,431 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2007-10-08 22:10:54 +0530 (Mon, 08 Oct 2007) $
- * $Revision: 252 $
- * $Author: bharatha $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Declarations of Image Writer module
- *
- * CONTENTS:
- *
- * AUTHOR: Bharath A
- *
- * DATE: February 22, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef __LTKImageWriter_H
-#define __LTKImageWriter_H
-
-#include <limits>
-#include <math.h>
-#include "LTKInc.h"
-#include "LTKMacros.h"
-#include "LTKTypes.h"
-#include "LTKLoggerUtil.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <dlfcn.h>
-#endif
-
-#define SUPPORTED_MIN_VERSION "4.0.0"
-
-//class LTKPreprocessorInterface;
-class LTKTraceGroup;
-class LTKScreenContext;
-class LTKTrace;
-
-//typedef LTKPreprocessorInterface* (*FN_PTR_CREATELTKLIPIPREPROCESSOR)(LTKControlInfo);
-
-/**
-* @class LTKImageWriter
-* <p>This class converts LTKTraceGroup or LTKTrace to images. Inputs could be objects of LTKTraceGroup,LTKTrace or path to the file containing the LTKTraceGroup.</p>
-* <p>The output images could also display the trace order if the offset is not equal to zero.</p>
-*/
-
-class LTKImageWriter{
-
-private:
-
-
- unsigned char *m_pixels; //pointer to the array of pixels
-
- int m_width; //width of the image
-
- int m_height; //height of the image
-
- float m_xMin,m_yMin,m_xMax,m_yMax; //Min and Max of tracegroups
-
- bool m_showBB; //flag to show bounding box
-
- bool m_showSP; //flag to show starting point of each stroke
-
- unsigned char m_red; //Red value of starting color
- unsigned char m_green; //Green value of starting color
- unsigned char m_blue; //Blue value of starting color
-
- unsigned char m_altRed; //Red value of alternate color
- unsigned char m_altGreen; //Green value of alternate color
- unsigned char m_altBlue; //Blue value of alternate color
-
- int m_offset; //offset value between strokes
-
- string xChannelstr, yChannelstr;
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKImageWriter();
-
- /**
- * Destructor
- */
- ~LTKImageWriter();
-
- /**
- * @name Image writing functions
- */
- // @{
-
- /**
- * The function draws LTKTraceGroup to image file with specified width,height,color and offset. If offset not equal to zero, the image would be in the trace order.
- *
- * @param traceGroup the trace group that is to be drawn
- * @param imgFileName name of the file that is to be created to draw the image
- * @param imgWidth width of the image
- * @param imgHeight height of the image
- *
- * @return void
- */
- void drawLTKTraceGroupToImage(const LTKTraceGroup& traceGroup,
- const string imgFileName,int imgWidth,int imgHeight);
-
-
-
- /**
- * The function draws LTKTraceGroup to image file with specified color and offset. The width and height would be determined from the trace group. If offset not equal to zero, the image would be in the trace order.
- *
- * @param traceGroup the trace group that is to be drawn
- * @param imgFileName name of the file that is to be created to draw the image
- *
- * @return void
- */
- void drawLTKTraceGroupToImage(const LTKTraceGroup& traceGroup, const string imgFileName);
-
-
-
- /**
- * The function draws LTKTraceGroup to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
- *
- * @param traceGroup the trace group that is to be drawn
- * @param imgFileName name of the file that is to be created to draw the image
- * @param size bound on larger dimension
- *
- * @return void
- */
- void drawLTKTraceGroupToImage(const LTKTraceGroup& traceGroup,const string imgFileName,int size);
-
-
-
- /**
- * The function draws LTKTraceGroup to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
- * The bounding box of the image is also drawn to show relative position.
- *
- * @param traceGroup the trace group that is to be drawn
- * @param screenContext the reference to screen Context for determining the bounding box.
- * @param imgFileName name of the file that is to be created to draw the image
- * @param size bound on larger dimension
- * @return void
- */
- void drawLTKTraceGroupToImageWithBB(const LTKTraceGroup& traceGroup,const LTKScreenContext& screenContext,
- const string imgFileName,int size);
-
-
-
- /**
- * The function creates LTKTraceGroup from the specified data file and draws it to image file with specified width,height,color and offset. If offset not equal to zero, the image would be in the trace order.
- *
- * @param fileName path to the data file
- * @param imgFileName name of the file that is to be created to draw the image
- * @param imgWidth width of the image
- * @param imgHeight height of the image
- *
- * @return void
- */
- void drawRawInkFileToImage(const string fileName,const string imgFileName,
- int imgWidth,int imgHeight);
-
-
-
- /**
- * The function creates LTKTraceGroup from the specified data file and draws it to image file with specified color and offset. The width and height would be determined from the trace group.
- *
- * @param fileName path to the data file
- * @param imgFileName name of the file that is to be created to draw the image
- *
- * @return void
- */
- void drawRawInkFileToImage(const string fileName,const string imgFileName);
-
-
-
- /**
- * The function creates LTKTraceGroup from the specified data file and draws it to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
- *
- * @param fileName path to the data file
- * @param imgFileName name of the file that is to be created to draw the image
- * @param size bound on larger dimension
- *
- * @return void
- */
- void drawRawInkFileToImage(const string fileName,const string imgFileName,int size);
-
-
-
- /**
- * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The width and height would be determined from the trace group.
- *
- * @param unipenFileName path to the unipen data file
- * @param imgFileName name of the file that is to be created to draw the image
- * @param imgWidth width of the image
- * @param imgHeight height of the image
- *
- * @return void
-
- */
-
- void drawUnipenFileToImage(const string unipenFileName,const string imgFileName,int imgWidth,int imgHeight);
-
-
-
- /**
- * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The width and height would be determined from the trace group.
- *
- * @param unipenFileName path to the unipen data file
- * @param imgFileName name of the file that is to be created to draw the image
- *
- * @return void
- */
- void drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName);
-
-
-
- /**
- * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
- *
- * @param unipenFileName path to the unipen data file
- * @param imgFileName name of the file that is to be created to draw the image
- * @param size bound on larger dimension
- *
- * @return void
- */
- void drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName,int size);
-
-
-
- /**
- * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
- * The bounding box of the image is also drawn to show relative position.
- *
- * @param unipenFileName path to the unipen data file
- * @param imgFileName name of the file that is to be created to draw the image
- * @param size bound on larger dimension
- *
- * @return void
- */
-
-
- void drawUnipenFileToImageWithBB(const string& unipenFileName,const string& imgFileName,int size);
-
-
- /**
- * Setter method for showing the starting point of each stroke
- *
- * @param toShow flag to show the starting point
- *
- * @return
- */
-
- void showStartingPoint(bool toShow);
-
- /**
- * Setter method for color of the starting stroke and subsequent alternate strokes
- *
- * @param red value of Red in RGB combination
- * @param green value of Green in RGB combination
- * @param blue value of Blue in RGB combination
- *
- * @return void
- */
-
- void setColor(unsigned char red,unsigned char green,unsigned char blue);
-
- /**
- * Setter method for color of alternate strokes
- *
- * @param altRed value of Red in RGB combination
- * @param altGreen value of Green in RGB combination
- * @param altBlue value of Blue in RGB combination
- *
- * @return void
- */
-
- void setAlternateColor(unsigned char altRed,unsigned char altGreen,unsigned char altBlue);
-
-
- /**
- * Setter method for offset value between strokes
- *
- * @param offset value of offset
- *
- * @return void
- */
-
- void setOffset(int offset);
-
-
-private:
-
- /**
- * @name Preprocessing, trace group ordering, and point,line and rectangle drawing functions.
- */
-
-
-
- /**
- * The function finds the minimum x value of the given trace.
- *
- * @param trace input trace
- *
- * @return minimum value of x
- */
-
- int findMinXOfTrace(const LTKTrace& trace,float& minX);
-
-
-
- /**
- * The function finds the maximum x value of the given trace.
- *
- * @param trace input trace
- *
- * @return maximum value of x
- */
-
- int findMaxXOfTrace(const LTKTrace& trace,float& maxX);
-
-
-
- /**
- * The function makes entries in the pixels array for the specified x,y and color.
- *
- * @param x,y coordinates of the point to be drawn
- * @param red,green,blue RGB values of the color of the point
- *
- * @return
- */
-
- void drawPoint(int x,int y,unsigned char red,unsigned char green,unsigned char blue);
-
-
-
- /**
- * The function draws line between the specified end points.
- *
- * @param x1,y1,x2,y2 coordinates of the end points of the line to be drawn
- * @param red,green,blue RGB values of the color of the line
- *
- * @return
- */
-
- void drawLine(int x1, int y1, int x2, int y2,unsigned char red,unsigned char green,unsigned char blue);
-
-
-
- /**
- * The function draws hollow rectange with specified color and diagonal end points.
- *
- * @param x1,y1,x2,y2 coordinates of the end points of the diagonal of the rectangle
- * @param red,green,blue RGB values of the color of the lines
- *
- * @return
- */
-
- void drawRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue);
-
-
-
- /**
- * The function draws a rectange with specified diagonal end points and fills it with the specified color.
- *
- * @param x1,y1,x2,y2 coordinates of the end points of the diagonal of the rectangle
- * @param red,green,blue RGB values of the color of the lines
- *
- * @return
- */
-
- void fillRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue);
-
-
-
- /**
- * The function offsets the input trace group by specified offset value and in the original trace order.
- *
- * @param traceGroup input trace group
- * @param offsetTraceGroup trace group with offset
- *
- * @return
- */
-
- void createTraceOrderInTraceGroup(const LTKTraceGroup& traceGroup,LTKTraceGroup& offsetTraceGroup);
-
- /**
- * The function writes the given pixel array to the specified BMP file
- *
- * @param fileName name of output bmp file name with extension as 'bmp'
- * @param pixelArray pixel array
- * @param width width of the image
- * @param height height of the image
- *
- * @return
- */
-
- void drawBMPImage(string fileName,unsigned char* pixelArray,int width,int height);
-
-
-};
-#endif
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp
deleted file mode 100644
index da5e89b7..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.cpp
+++ /dev/null
@@ -1,676 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-04-05 13:49:39 +0530 (Tue, 05 Apr 2011) $
- * $Revision: 844 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of the Ink File Reader Module
- *
- * CONTENTS:
- * readInkFile
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu V. 14 Sept 2005 Added unipen file reading function
- * that reads annotation.
-************************************************************************/
-#include "LTKChannel.h"
-
-#include "LTKTraceFormat.h"
-
-#include "LTKTrace.h"
-
-#include "LTKTraceGroup.h"
-
-#include "LTKCaptureDevice.h"
-
-#include "LTKScreenContext.h"
-
-#include "LTKStringUtil.h"
-
-#include "LTKInc.h"
-
-#include "LTKException.h"
-
-#include "LTKMacros.h"
-
-#include "LTKErrors.h"
-
-#include "LTKErrorsList.h"
-
-#include "LTKLoggerUtil.h"
-#include "LTKInkFileReader.h"
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKInkFileReader
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKInkFileReader::LTKInkFileReader(){}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : readRawInkFile
-* DESCRIPTION : reads contents of a file containing raw ink stored in a specified format into
-* a trace group object. Also the device information stored in the ink file is read
-* into a capture device object.
-* ARGUMENTS : inkFile - name of the file containing the ink
-* traceGroup - trace group into which the ink has to be read into
-* captureDevice - capture device object into which device info is to be read into
-* screenContext - writing area information
-* RETURNS : SUCCESS on successfully reading the ink file into
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKInkFileReader::readRawInkFile(const string& inkFile, LTKTraceGroup& traceGroup, LTKCaptureDevice& captureDevice, LTKScreenContext& screenContext)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkFileReader::readRawInkFile()" << endl;
-
- string dataLine;
-
- vector<string> dataVector;
-
- vector<float> point; // a point of a trace
-
- int pointIndex;
-
- if(inkFile.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINKFILE_EMPTY <<":"<< getErrorMessage(EINKFILE_EMPTY)
- <<"LTKInkFileReader::readRawInkFile()" <<endl;
-
- LTKReturnError(EINKFILE_EMPTY);
- }
-
- // opening the ink file
-
- ifstream infile(inkFile.c_str());
-
- // checking if the file open was successful
-
- if(!infile)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKInkFileReader::readRawInkFile()"<<endl;
-
- LTKReturnError(EINK_FILE_OPEN);
- }
-
- vector<LTKChannel> channels; // channels of a trace
-
- LTKChannel xChannel("X", DT_FLOAT, true); // x-coordinate channel of the trace
-
- LTKChannel yChannel("Y", DT_FLOAT, true); // y-coordinate channel of the trace
-
- LTKChannel tChannel("T", DT_FLOAT, true); // time channel of the trace
-
- // initializing the channels of the trace
-
- channels.push_back(xChannel);
-
- channels.push_back(yChannel);
-
- channels.push_back(tChannel);
-
- // composing the trace format object
-
- LTKTraceFormat traceFormat(channels);
-
- // reading the ink file
-
- while(infile)
- {
- LTKTrace trace(traceFormat);
-
- while(infile)
- {
- getline(infile, dataLine);
-
- LTKStringUtil::tokenizeString(dataLine, " \t", dataVector);
-
- if(fabs( LTKStringUtil::convertStringToFloat(dataVector[0]) + 1 ) < EPS)
- {
- traceGroup.addTrace(trace);
-
- break;
- }
- else if(fabs( LTKStringUtil::convertStringToFloat(dataVector[0]) + 2 ) < EPS)
- {
- return SUCCESS;
- }
- else if(fabs( LTKStringUtil::convertStringToFloat(dataVector[0]) + 6 ) < EPS)
- {
- captureDevice.setXDPI(LTKStringUtil::convertStringToFloat(dataVector[1]));
-
- captureDevice.setYDPI(LTKStringUtil::convertStringToFloat(dataVector[2]));
- }
- else if(LTKStringUtil::convertStringToFloat(dataVector[0]) < 0)
- {
- // unknown tag. skipping line
-
- continue;
- }
- else
- {
-
- for(pointIndex = 0; pointIndex < dataVector.size(); ++pointIndex)
- {
- point.push_back(LTKStringUtil::convertStringToFloat(dataVector[pointIndex]));
- }
-
- if(dataVector.size() == 2)
- {
- point.push_back(0.0);
- }
-
- trace.addPoint(point);
-
- point.clear();
- }
- }
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkFileReader::readRawInkFile()" << endl;
-
- return FAILURE;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : readUnipenInkFile
-* DESCRIPTION : reads contents of a file containing unipen ink stored in a specified format into
-* a trace group object. Also the device information stored in the ink file is read
-* into a capture device object.
-* ARGUMENTS : inkFile - name of the file containing the ink
-* traceGroup - trace group into which the ink has to be read into
-* captureDevice - capture device object into which device info is to be read into
-* screenContext - writing area information
-* RETURNS : SUCCESS on successfully reading the ink file into
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKInkFileReader::readUnipenInkFile(const string& inkFile, LTKTraceGroup& traceGroup, LTKCaptureDevice& captureDevice, LTKScreenContext& screenContext)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkFileReader::readUnipenInkFile()" << endl;
-
- map<string,string> traceIndicesCommentsMap;
-
- string hierarchyLevel;
- string quality("ALL");
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkFileReader::readUnipenInkFile()" << endl;
-
- return (readUnipenInkFileWithAnnotation(inkFile,hierarchyLevel,quality,traceGroup,traceIndicesCommentsMap,captureDevice,screenContext));
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 14-SEP-2004
-* NAME : readUnipenInkFileWithAnnotation
-* DESCRIPTION : reads contents of a unipen file containing ink stored in a specified format into
-* a trace group object. Also the device information stored in the ink file is read
-* into a capture device object.The screen information is captured in screen context object.
-* ARGUMENTS : inkFile - name of the file containing the ink
-* hierarchyLevel - level at which the ink is required, ex. WORD or CHARACTER that follows .SEGMENT
-* quality - quality of the ink that is required. Can be GOOD,BAD,OK or ALL. Example, if ink of quality
-* GOOD and BAD are required, then quality="GOOD,BAD" (NOTE:comma(,) is the delimiter) else if all ink
-* are required, quality="ALL"
-* traceGroup - trace group into which the ink has to be read into
-* traceIndicesCommentsMap - Map containing list of strokes separated by commas as key and the comments
-* to that trace group unit as value (ex. key-"2,4,5" value-"delayed stroke"
-* captureDevice - capture device object into which device info is to be read into
-* screenContext - writing area information
-* RETURNS : SUCCESS on successfully reading the ink file into
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-
-
-int LTKInkFileReader::readUnipenInkFileWithAnnotation(const string& inkFile,const string& hierarchyLevel,const string& quality, LTKTraceGroup& traceGroup,map<string,string>& traceIndicesCommentsMap,LTKCaptureDevice& captureDevice, LTKScreenContext& screenContext)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkFileReader::readUnipenInkFileWithAnnotation()" << endl;
-
- vector<float> point; // a point of a trace
-
- float xDpi; // device resolution in the x direction
-
- float yDpi; // device resolution in the y direction
-
- float bboxLeft; // leftmost x-coord of the writing area
-
- float bboxBottom; // bottommost y-coord of the writing area
-
- float bboxRight; // rightmost x-coord of the writing area
-
- float bboxTop; // topmost y-coord of the writing area
-
- float floatChannelValue; // channel value of type float
-
- long longChannelValue; // channel value of type long
-
- string channelNames; // string containing all the channel names
-
- vector<string> channelNamesVector; // vector of channel names
-
- int channelIndex; // index to loop over all channels in the channel list
-
- vector<string> qualityLevels; // list of quality levels required
-
- vector<string> coordVals; // list of coordinate values present
-
- string remainingLine; //remaining of the line that does not contain the required hierarchy level
-
- bool verFlag = false, hlevelFlag = false, coordFlag = false;// bool level that denote whether version Info, Hierarchy level and coordinate info are set
-
- bool pendownFlag = false;
-
- LTKStringUtil::tokenizeString(quality,",", qualityLevels);
-
- // opening the ink file
-
- if(inkFile.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINKFILE_EMPTY <<":"<< getErrorMessage(EINKFILE_EMPTY)
- <<"LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EINKFILE_EMPTY);
- }
-
- ifstream infile(inkFile.c_str()); //
-
- // checking if the file open was successful
-
- if(!infile)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINK_FILE_OPEN <<":"<< getErrorMessage(EINK_FILE_OPEN)
- <<"LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EINK_FILE_OPEN);
- }
-
- LTKTrace *trace = NULL; // initializing trace to NULL
-
- vector<LTKChannel> channels; // channels of a trace
-
- LTKTraceFormat traceFormat; // format of the trace
-
- // reading the ink file
-
- string keyWord; // a key word of the unipen format
-
- while(infile)
- {
- keyWord = "";
- infile >> keyWord;
-
- if(keyWord == ".COORD")
- {
- coordFlag = true;
-
- getline(infile, channelNames);
-
- LTKStringUtil::tokenizeString(channelNames, " \t", channelNamesVector);
-
- for(channelIndex = 0; channelIndex < channelNamesVector.size(); ++channelIndex)
- {
- if(channelNamesVector[channelIndex] == "T")
- {
- LTKChannel channel(channelNamesVector[channelIndex], DT_LONG, true);
- channels.push_back(channel);
- }
- else
- {
- LTKChannel channel(channelNamesVector[channelIndex], DT_FLOAT, true);
- channels.push_back(channel);
- }
- }
-
- traceFormat.setChannelFormat(channels);
-
- }
- else if(keyWord == ".X_POINTS_PER_INCH")
- {
- infile >> xDpi;
- captureDevice.setXDPI(xDpi);
-
- }
- else if(keyWord == ".Y_POINTS_PER_INCH")
- {
- infile >> yDpi;
- captureDevice.setYDPI(yDpi);
- }
- else if(keyWord == ".H_LINE")
- {
- infile >> bboxBottom >> bboxTop;
- screenContext.setBboxBottom(bboxBottom);
- screenContext.setBboxTop(bboxTop);
- }
- else if(keyWord == ".V_LINE")
- {
- infile >> bboxLeft >> bboxRight;
-
- screenContext.setBboxLeft(bboxLeft);
-
- screenContext.setBboxRight(bboxRight);
- }
- else if(keyWord==".SEGMENT")
- {
- string strHierarchyLevel; //stores the hierarchy level (ex. CHARACTER or WORD)
- string strStrokeIndices; //comma separated stroke indices
- string strQuality; //annotated quality of the trace/trace group
- string strComments; //comments about the ink
-
- infile >> strHierarchyLevel;
-
- if(strHierarchyLevel==hierarchyLevel) //if the encountered hierarchy level is the required
- {
-
- string checkString;
- getline(infile,checkString,'\n');
-
- if(checkString.empty())
- {
-
- LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
- "Annotation not found at the specified hierarchy level:" <<
- hierarchyLevel << " in "+inkFile << endl;
- //return FAILURE;
- continue;
-
- }
-
- vector<string> tokens;
-
- LTKStringUtil::tokenizeString(checkString," ", tokens);
-
- if(tokens.size()>=3)
- {
-
- strStrokeIndices=tokens[0];
- strQuality=tokens[1];
- for(int i=2;i<tokens.size();++i)
- {
- strComments=strComments+tokens[i]+" ";
- }
-
- strComments=strComments.substr(0,strComments.length()-1); //removing the last space added
- }
- else
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- "Invalid annotation format at the specified hierarchy level:" <<
- hierarchyLevel << " in " << inkFile << endl;
- //return FAILURE;
- continue;
- }
-
-
- strComments=strComments.substr(1,strComments.length()-2); //to remove the leading space and double quoutes
-
- bool isRequiredQuality=false;
- if(quality=="ALL") //if no condition on quality
- {
- isRequiredQuality=true;
- }
- else
- {
- for(vector<string>::iterator iter=qualityLevels.begin();iter!=qualityLevels.end();++iter)
- {
-
- if((*iter)==strQuality)
- {
- isRequiredQuality=true;
- break;
- }
-
- }
-
- }
-
- if(isRequiredQuality)
- {
- //if the trace/trace group is of required quality stores the stroke
- //indices and comments in the output map
- traceIndicesCommentsMap.insert(make_pair(strStrokeIndices,strComments));
-
- }
- }
- else //if not the required hierarchy level, just get the remaining line
- {
- if(keyWord == ".VERSION")
- verFlag = true;
- else if ((keyWord == ".HIERARCHY"))
- hlevelFlag = true;
-
- getline(infile,remainingLine);
-
- }
-
- }
- else if(keyWord == ".PEN_DOWN")
- {
- if (pendownFlag)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINKFILE_CORRUPTED <<":"<< getErrorMessage(EINKFILE_CORRUPTED)
- <<"LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EINKFILE_CORRUPTED);
- }
-
- pendownFlag = true;
-
- LTKTrace trace(traceFormat);
-
-
- while(infile)
- {
- infile >> keyWord;
-
- if(keyWord == ".PEN_UP")
- {
- if (!pendownFlag)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINKFILE_CORRUPTED <<":"<< getErrorMessage(EINKFILE_CORRUPTED)
- <<"LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EINKFILE_CORRUPTED);
- }
-
- pendownFlag = false;
-
- if(trace.getNumberOfPoints() == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKInkFileReader::readUnipenInkFileWithAnnotation()"<<endl;
-
- LTKReturnError(EEMPTY_TRACE);
- }
-
- traceGroup.addTrace(trace);
-
- break;
- }
- else
- {
- // BUGFIX : if no attributes in input ink file, throw error and stop
- if(channelNamesVector.empty())
- {
- //if(!verFlag)
- //{
- //}
- // cout<<" keyword = "<<keyWord<<endl;
-
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINKFILE_CORRUPTED <<":"<< getErrorMessage(EINKFILE_CORRUPTED)
- <<"LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EINKFILE_CORRUPTED);
- }
-
- if(channelNamesVector[0] == "T")
- {
- longChannelValue = atol(keyWord.c_str());
-
- point.push_back(longChannelValue);
- }
- else
- {
- floatChannelValue = LTKStringUtil::convertStringToFloat(keyWord);
-
- point.push_back(floatChannelValue);
- }
-
- getline(infile,remainingLine);
-
- coordVals.clear();
-
- LTKStringUtil::tokenizeString(remainingLine,string(" "), coordVals);
-
- if (coordVals.size() != (channelNamesVector.size() -1))
- {
- int index;
- for (index = 0 ; index < channelNamesVector.size(); ++index)
- {
- cout << "coord name at index "<<channelNamesVector.at(index) <<endl;
- }
- cout<<"first coord val "<<keyWord;
- for (index = 0 ; index < coordVals.size(); ++index)
- {
- cout << "coord val at index "<<coordVals.at(index) <<endl;
- }
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINKFILE_CORRUPTED <<":"<< getErrorMessage(EINKFILE_CORRUPTED)
- <<"LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EINKFILE_CORRUPTED);
- }
-
- for(channelIndex = 1; channelIndex < channelNamesVector.size(); ++channelIndex)
- {
- if(channelNamesVector[channelIndex] == "T")
- {
- longChannelValue = atol((coordVals.at(channelIndex -1 )).c_str());
-
- point.push_back(longChannelValue);
- }
- else
- {
- floatChannelValue = LTKStringUtil::convertStringToFloat(coordVals.at(channelIndex -1 ));
-
- point.push_back(floatChannelValue);
- }
-
- }
-
- trace.addPoint(point);
-
- point.clear();
-
- }
- }
- }
- else if(keyWord == ".PEN_UP")
- {
- if (!pendownFlag)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINKFILE_CORRUPTED <<":"<< getErrorMessage(EINKFILE_CORRUPTED)
- <<"LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EINKFILE_CORRUPTED);
- }
- }
- else
- {
- if(keyWord == ".VERSION")
- verFlag = true;
- else if ((keyWord == ".HIERARCHY"))
- hlevelFlag = true;
-
- getline(infile, keyWord);
- }
- }
-
- int numberOfTraces = traceGroup.getNumTraces();
-
- if(numberOfTraces == 0)
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : LTKInkFileReader::readUnipenInkFileWithAnnotation()" <<endl;
-
- LTKReturnError(EEMPTY_TRACE_GROUP);
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkFileReader::readUnipenInkFileWithAnnotation()" << endl;
-
- return SUCCESS;
-}
-
-
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKInkFileReader
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKInkFileReader::~LTKInkFileReader(){}
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h
deleted file mode 100644
index 16704688..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileReader.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the Ink File Reader Module
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- * Deepu V. 14 Sept 2005 Added unipen file reading function
- * that reads annotation.
- ************************************************************************/
-
-#ifndef __LTKINKFILEREADER_H
-#define __LTKINKFILEREADER_H
-
-#include "LTKTypes.h"
-
-
-class LTKTraceGroup;
-class LTKCaptureDevice;
-class LTKScreenContext;
-
-/**
-* @ingroup util
-*/
-
-/** @brief Exposes the APIs for reading ink files
-@class LTKInkFileReader
-*/
-class LTKInkFileReader
-{
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKInkFileReader();
-
- /**
- * Destructor
- */
-
- ~LTKInkFileReader();
-
- // @}
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * This is a static method which reads a raw ink file and loads it into a trace group object
- * Also reads the device information from the unipen ink file into a capture device object
- * @param inkFile Name of the ink file to be read
- * @param traceGroup trace group into which the ink file has to be read into
- * @param captureDevice object into which the device specific information is to be read into
- * @return SUCCESS on successful read operation
- */
-
- static int readRawInkFile(const string& inkFile, LTKTraceGroup& traceGroup, LTKCaptureDevice& captureDevice, LTKScreenContext& screenContext);
-
- /**
- * This is a static method which reads a unipen ink file and loads it into a trace group object
- * Also reads the device information from the unipen ink file into a capture device object
- * @param inkFile Name of the ink file to be read
- * @param traceGroup trace group into which the ink file has to be read into
- * @param captureDevice object into which the device specific information is to be read into
- * @return SUCCESS on successful read operation
- */
-
- static int readUnipenInkFile(const string& inkFile, LTKTraceGroup& traceGroup, LTKCaptureDevice& captureDevice, LTKScreenContext& screenContext);
-
- /**
- * This is a static method which reads the contents of a unipen file containing ink stored in a specified format into
- * a trace group object. Also the device information stored in the ink file is read
- * into a capture device object.The writing area information is captured in screen context object.
- * @param inkFile name of the file containing the ink
- * @param hierarchyLevel level at which the ink is required, ex. WORD or CHARACTER that follows .SEGMENT
- * @param quality quality of the ink that is required. Can be GOOD,BAD,OK or ALL. Example, if ink of quality
- * GOOD and BAD are required, then quality="GOOD,BAD" (NOTE:comma(,) is the delimiter) else if all ink
- * are required, quality="ALL"
- * @param traceGroup trace group into which the ink has to be read into
- * @param traceIndicesCommentsMap Map containing list of strokes separated by commas as key and the comments
- * to that trace group unit as value (ex. key-"2,4,5" value-"delayed stroke"
- * @param captureDevice capture device object into which device info is to be read into
- * @param screenContext writing area information
- * @return SUCCESS on successful read operation
- */
-
- static int readUnipenInkFileWithAnnotation(const string& inkFile,const string& hierarchyLevel,const string& quality, LTKTraceGroup& traceGroup,map<string,string>& traceIndicesCommentsMap,LTKCaptureDevice& captureDevice, LTKScreenContext& screenContext);
-
-
- // @}
-};
-
-#endif //#ifndef __LTKINKFILEREADER_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp
deleted file mode 100644
index ae7fdd3f..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
- * $Revision: 827 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of the Ink File Writer Module
- *
- * CONTENTS:
- *
- * AUTHOR: Bharath A.
- *
- * DATE: March 22, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#include "LTKInkFileWriter.h"
-#include "LTKMacros.h"
-#include "LTKTrace.h"
-#include "LTKTraceGroup.h"
-#include "LTKLoggerUtil.h"
-
-using namespace std;
-
-
-/**********************************************************************************
-* AUTHOR : Bharath A.
-* DATE : 22-MAR-2005
-* NAME : LTKInkFileWriter
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKInkFileWriter::LTKInkFileWriter()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A.
-* DATE : 22-MAR-2005
-* NAME : ~LTKInkFileWriter
-* DESCRIPTION : Destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKInkFileWriter::~LTKInkFileWriter()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A.
-* DATE : 22-MAR-2005
-* NAME : writeRawInkFile
-* DESCRIPTION : This is a static method which writes the trace group supplied to the file name specified with X and Y DPI info.
-* ARGUMENTS traceGroup trace group to be written onto the file
-* fileName name of the file
-* xDPI x-coordinate dots per inch
-* yDPI y-coordinate dots per inch
-* :
-* RETURNS : SUCCESS on successful write operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKInkFileWriter::writeRawInkFile(const LTKTraceGroup& traceGroup,const string& fileName,int xDPI,int yDPI)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkFileWriter::writeRawInkFile()" << endl;
-
- if(traceGroup.getNumTraces()>=1)
- {
- LTKTrace tempTrace;
- traceGroup.getTraceAt(0, tempTrace);
-
- int numOfChannels = tempTrace.getTraceFormat().getNumChannels();
-
- std::ofstream output(fileName.c_str());
- output<<"-6 "<<xDPI<<" "<<yDPI<<endl;
- for(int i=0;i<traceGroup.getNumTraces();i++)
- {
- LTKTrace trace;
-
- traceGroup.getTraceAt(i, trace);
-
- for(int j=0;j<trace.getNumberOfPoints();j++)
- {
- floatVector pointVec;
- trace.getPointAt(j, pointVec);
-
- for(int k=0;k<pointVec.size();k++){
- if(k==pointVec.size()-1){
- output<<pointVec[k]<<endl;
- }
- else{
- output<<pointVec[k]<<" ";
- }
- }
- }
-
- for(int d=0;d<numOfChannels;d++){
- if(d==numOfChannels-1){
- output<<"-1"<<endl;
- }
- else{
- output<<"-1 ";
- }
- }
-
- }
-
- for(int e=0;e<numOfChannels;e++){
- if(e==numOfChannels-1){
- output<<"-2"<<endl;
- }
- else{
- output<<"-2 ";
- }
- }
- output.close();
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkFileWriter::writeRawInkFile()" << endl;
-
- return SUCCESS;
- }
- else
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkFileWriter::writeRawInkFile()" << endl;
- return FAILURE;
- }
-}
-
-/**********************************************************************************
-* AUTHOR : Bharath A.
-* DATE : 22-MAR-2005
-* NAME : writeUnipenInkFile
-* DESCRIPTION : This is a static method which writes the trace group supplied to the file name specified with X and Y DPI info, in unipen format
-* ARGUMENTS traceGroup trace group to be written onto the file
-* fileName name of the file
-* xDPI x-coordinate dots per inch
-* yDPI y-coordinate dots per inch
-* :
-* RETURNS : SUCCESS on successful write operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKInkFileWriter::writeUnipenInkFile(const LTKTraceGroup& traceGroup,const string& fileName,int xDPI,int yDPI)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkFileWriter::writeUnipenInkFile()" << endl;
-
- if(traceGroup.getNumTraces()>=1)
- {
- LTKTrace tempTrace;
- traceGroup.getTraceAt(0, tempTrace);
-
- vector<string> channelNames = tempTrace.getTraceFormat().getAllChannelNames();
- std::ofstream output(fileName.c_str());
- output<<".VERSION 1.0"<<endl;
- output<<".COORD";
- for(int c=0;c<channelNames.size();c++)
- {
- output<<" "<<channelNames[c];
-
- }
- output<<endl;
- output<<".X_POINTS_PER_INCH "<<xDPI<<endl;
- output<<".Y_POINTS_PER_INCH "<<yDPI<<endl;
- for(int i=0;i<traceGroup.getNumTraces();i++)
- {
- output<<".PEN_DOWN"<<endl;
-
- LTKTrace trace;
- traceGroup.getTraceAt(i, trace);
-
- for(int j=0;j<trace.getNumberOfPoints();j++){
-
- floatVector pointVec;
- trace.getPointAt(j, pointVec);
-
- for(int k=0;k<pointVec.size();k++){
- if(k==pointVec.size()-1){
- output<<pointVec[k]<<endl;
- }
- else{
- output<<pointVec[k]<<" ";
- }
- }
- }
- output<<".PEN_UP"<<endl;
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkFileWriter::writeUnipenInkFile()" << endl;
- return SUCCESS;
- }
- else
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkFileWriter::writeUnipenInkFile()" << endl;
- return FAILURE;
- }
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h
deleted file mode 100644
index ee41ac4c..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkFileWriter.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the Ink File Writer Module
- *
- * CONTENTS:
- *
- * AUTHOR: Bharath A.
- *
- * DATE: March 22, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#ifndef __LTKINKFILEWRITER_H
-#define __LTKINKFILEWRITER_H
-
-#include "LTKInc.h"
-
-class LTKTraceGroup;
-
-/**
-* @ingroup util
-*/
-
-/** @brief Utility class for writing ink files
-* @class LTKInkFileWriter
-*/
-class LTKInkFileWriter
-{
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKInkFileWriter();
-
- /**
- * Destructor
- */
-
- ~LTKInkFileWriter();
-
- // @}
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * This is a static method which writes the trace group supplied to the file name specified with X and Y DPI info
- * @param traceGroup trace group to be written onto the file
- * @param fileName name of the file
- * @param xDPI x-coordinate dots per inch
- * @param yDPI y-coordinate dots per inch
- * @return SUCCESS on successful write operation
- */
-
- static int writeRawInkFile(const LTKTraceGroup& traceGroup,const string& fileName,int xDPI,int yDPI);
-
- /**
- * This is a static method which writes the trace group supplied to the file name specified with X and Y DPI info, in unipen format
- * @param traceGroup trace group to be written onto the file
- * @param fileName name of the file
- * @param xDPI x-coordinate dots per inch
- * @param yDPI y-coordinate dots per inch
- * @return SUCCESS on successful write operation
- */
-
- static int writeUnipenInkFile(const LTKTraceGroup& traceGroup,const string& fileName,int xDPI,int yDPI);
-
- // @}
-};
-
-
-#endif
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp
deleted file mode 100644
index 53a34c13..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 11:00:11 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 832 $
- * $Author: dineshm $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of LTKInkUtils that computes the statistics
- * of a trace group
- *
- * CONTENTS:
- * computeTraceGroupStatistics
- * computeChannelMaximum
- * computeChannelMinimum
- * computeChannelMaxMin
- *
- * AUTHOR: Deepu V.
- *
- * DATE: March 9, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKInkUtils.h"
-#include "LTKMacros.h"
-#include "LTKErrors.h"
-#include "LTKLoggerUtil.h"
-#include "LTKErrorsList.h"
-#include "LTKTrace.h"
-#include "LTKTraceGroup.h"
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 09-MAR-2005
-* NAME : LTKInkUtils
-* DESCRIPTION : Initialization constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKInkUtils::LTKInkUtils()
-{
-
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 09-MAR-2005
-* NAME : computeChannelStatistics
-* DESCRIPTION : This is a generic function that computes the statistics of channels of
-* an LTKTraceGroup object passed to it.
-* ARGUMENTS : traceGroup - The TraceGroup whose statistics need to be computed channelNames - Names of channels in the traceGroup for which
-* channelNames - channels for which statistics have to be comptued
-* properties - The names of the statistics to be computed
-* channelStatistics - output vector containing results
-* channelStatistics[i][j] the statistics properties[j] for channelname
-* channelNames[i]
-*
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKInkUtils::computeChannelStatistics(const LTKTraceGroup& traceGroup,
- const vector<string>& channelNames, const vector<ELTKTraceGroupStatistics>& properties,
- vector<vector<float> >& channelStatistics)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkUtils::computeChannelStatistics()" << endl;
-
- vector<float> tempVec; //temporary vector
-
- int numChannels = channelNames.size(); //num of channels for which statistics need to be computed
-
- int numFeatures = properties.size(); //number of properties to be calculated
-
- int numTraces = traceGroup.getNumTraces(); //number of traces in each tracegroup
-
- int numPoints; //number of points in a stroke
-
-
- int totalNumPoints=0; //each channel is of equal length
-
- float currVal; //value of current point in the channel
-
- int traceIndex, channelIndex, pointIndex, featureIndex;
-
- // Clear the output vector
- channelStatistics.clear();
-
- //Make an initial vector
- tempVec.clear();
- for (featureIndex= 0 ; featureIndex <numFeatures; ++featureIndex)
- {
- switch(properties[featureIndex])
- {
- //initializing max
- case TG_MAX:tempVec.push_back(-FLT_MAX);
- break;
- //initializing min
- case TG_MIN:tempVec.push_back(FLT_MAX);
- break;
- //initializing avg
- case TG_AVG:tempVec.push_back(0);
- break;
-
- default: LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKInkUtils::computeChannelStatistics()"<<endl;
-
- LTKReturnError(EUNSUPPORTED_STATISTICS);
- }
- }
-
- //Initialization Every channel has the same value
- for(channelIndex =0; channelIndex<numChannels; ++channelIndex)
- {
- channelStatistics.push_back(tempVec);
-
- //initialize total number of points for each channel to zero
- }
-
-
- //Iterating through all the strokes
- for (traceIndex = 0; traceIndex <numTraces; ++traceIndex)
- {
- LTKTrace trace;
- traceGroup.getTraceAt(traceIndex, trace);
-
- //Iterating through all the channels in a stroke
- for (channelIndex =0; channelIndex<numChannels; ++channelIndex)
- {
- //get the current channel values
- floatVector currChannel;
- trace.getChannelValues(channelNames[channelIndex], currChannel);
-
- //get the current output vector to be updated
- floatVector& currStats = channelStatistics.at(channelIndex);
-
- //number of points in this channel
- numPoints = currChannel.size();
-
- if(channelIndex==0)
- {
- totalNumPoints += numPoints;
- }
-
- //iterate through all points in the channel
- for(pointIndex = 0; pointIndex <numPoints; ++pointIndex)
- {
- currVal = currChannel[pointIndex];
-
- //updating all features as we iterate through each point;
- for (featureIndex =0; featureIndex<numFeatures; featureIndex++)
- {
- switch(properties[featureIndex])
- {
-
- //updating the maximum
- case TG_MAX:
- if(currVal > currStats[featureIndex])
- currStats[featureIndex] = currVal;
- break;
-
- //updating the minimum
- case TG_MIN:
- if(currVal < currStats[featureIndex])
- currStats[featureIndex] = currVal;
- break;
-
- //accumulating the sum
- case TG_AVG:
- currStats[featureIndex] += currVal;
- break;
-
- default: LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error: LTKInkUtils::computeChannelStatistics()"<<endl;
-
- LTKReturnError(EUNSUPPORTED_STATISTICS);
-
- }
-
- }
-
- }
-
- }
-
- }
-
- //Finalization Step
- for (channelIndex= 0 ; channelIndex<numChannels; ++channelIndex)
- {
-
- floatVector& currStats = channelStatistics.at(channelIndex);
-
- //total number of points in this channel
- numPoints = totalNumPoints;
-
- for(featureIndex = 0; featureIndex<numFeatures; ++featureIndex)
- {
- switch(properties[featureIndex])
- {
- //finding the average
- case TG_AVG:
- currStats[featureIndex] /= numPoints;
- break;
- }
- }
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkUtils::computeChannelStatistics()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 09-MAR-2005
-* NAME : computeChannelMaximum
-* DESCRIPTION : Function that computes the minimums of channels of an
-* LTKTraceGroup object passed to it.
-* ARGUMENTS : traceGroup - The TraceGroup whose minimums need to be computed
-* channelNames - channels for which minimum vals have to be comptued
-* minValues - output vector containing results
-* minValues[i] the minimum for channelname[i]
-*
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKInkUtils::computeChannelMaximum(const LTKTraceGroup& traceGroup, const vector<string>& channelNames,
- vector<float>& maxValues)
-{
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkUtils::computeChannelMaximum()" << endl;
-
- vector<vector<float> >results; //results from computeChannelStatistics;
-
- vector<ELTKTraceGroupStatistics> properties (1,TG_MAX); //Initializing the properties to MIN
-
-
- maxValues.clear(); //clear the minValues
-
- //call generic function
- if(errorCode = computeChannelStatistics(traceGroup,channelNames,properties,results))
- {
- return errorCode;
- }
-
- //populate the results
- for (int resultIndex=0; resultIndex<results.size(); ++resultIndex)
- {
- maxValues.push_back( (results.at(resultIndex)).at(0) );
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkUtils::computeChannelMaximum()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 09-MAR-2005
-* NAME : computeChannelMinimum
-* DESCRIPTION : Function that computes the minimums of channels of an
-* LTKTraceGroup object passed to it.
-* ARGUMENTS : traceGroup - The TraceGroup whose minimums need to be computed
-* channelNames - channels for which minimum vals have to be comptued
-* minValues - output vector containing results
-* minValues[i] the minimum for channelname[i]
-*
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKInkUtils::computeChannelMinimum(const LTKTraceGroup& traceGroup,const vector<string>& channelNames,
- vector<float>& minValues)
-{
-
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkUtils::computeChannelMinimum()" << endl;
-
-
- vector<vector<float> >results; //results from computeChannelStatistics;
-
- vector<ELTKTraceGroupStatistics> properties (1,TG_MIN); //Initializing the properties to MIN
-
-
- minValues.clear(); //clear the minValues
-
- //call generic function
- if(errorCode = computeChannelStatistics(traceGroup,channelNames,properties,results))
- {
- return errorCode;
- }
-
- //populate the results
- for (int resultIndex =0; resultIndex<results.size(); ++resultIndex)
- {
- minValues.push_back( (results.at(resultIndex)).at(0) );
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkUtils::computeChannelMinimum()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 09-MAR-2005
-* NAME : computeChannelMaxMin
-* DESCRIPTION : Function that computes the minimum and maximum of channels of an
-* LTKTraceGroup object passed to it.
-* ARGUMENTS : traceGroup - The TraceGroup whose parameters need to be computed
-* channelNames - channels for which parameters have to be comptued
-* minValues - output vector containing min values
-* maxValues - output vector containing max values
-*
-* RETURNS : SUCCESS/FAILURE
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKInkUtils::computeChannelMaxMin(const LTKTraceGroup& traceGroup, const vector<string>& channelNames,
- vector<float>& maxValues, vector<float>& minValues)
-{
- int errorCode;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKInkUtils::computeChannelMaxMin()" << endl;
-
- vector<vector<float> >results; //results from computeChannelStatistics;
-
- vector<ELTKTraceGroupStatistics> properties (2); //Initializing the properties to MIN
-
- //pushing the operations to be performed
- properties[0] = TG_MIN;
- properties[1] = TG_MAX;
-
- minValues.clear(); //clear the minValues
- maxValues.clear(); //clear the maxvalues
-
- //call generic function
- if(errorCode = computeChannelStatistics(traceGroup,channelNames,properties,results))
- {
- return errorCode;
- }
-
- //populate the results
- for (int resultIndex =0; resultIndex<results.size(); ++resultIndex)
- {
- minValues.push_back( (results.at(resultIndex)).at(0) );
- maxValues.push_back( (results.at(resultIndex)).at(1) );
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKInkUtils::computeChannelMaxMin()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 09-MAR-2005
-* NAME : ~LTKInkUtils
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKInkUtils::~LTKInkUtils()
-{
-
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h
deleted file mode 100644
index a6ca369e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKInkUtils.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the Ink utilities module
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: March 07 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKINKUTILS_H
-#define __LTKINKUTILS_H
-
-#include <cfloat>
-
-#include "LTKInc.h"
-
-#include "LTKTypes.h"
-
-class LTKTraceGroup;
-
-/**
-* @ingroup util
-*/
-
-/** @brief This class contains the methods for computing statistics of a channel
-* @class LTKInkUtils
-*/
-
-class LTKInkUtils
-{
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
- LTKInkUtils();
-
- /**
- * Destructor
- */
- virtual ~LTKInkUtils();
-
- // @}
-
- /**
- * @name Functions that computes the statistics
- */
- // @{
-
- /**
- * Generic function that computes the statistics of channels of an LTKTraceGroup object
- *
- * @param traceGroup The TraceGroup whose statistics need to be computed
- * @param channelNames Names of channels in the traceGroup for which statistics have to be comptued
- * @param properties The names of the statistics to be computed
- * @param channelStatistics output vector containing results
- */
- static int computeChannelStatistics(const LTKTraceGroup& traceGroup,const vector<string>& channelNames,
- const vector<ELTKTraceGroupStatistics>& properties, vector<vector<float> >& channelStatistics);
-
-
- /**
- * This function computes the minimum of channels of an LTKTraceGroup object
- *
- * @param traceGroup The TraceGroup whose maximum need to be computed
- * @param channelNames Names of channels in the traceGroup for which maximum need to be computed
- * @param maxValues output vector containing maxValues for each channel
- */
- static int computeChannelMaximum(const LTKTraceGroup& traceGroup, const vector<string>& channelNames,
- vector<float>& maxValues);
-
- /**
- * This function computes the minimum of channels of an LTKTraceGroup object
- *
- * @param traceGroup The TraceGroup whose minimum need to be computed
- * @param channelNames Names of channels in the traceGroup for which minimum need to be computed
- * @param minValues output vector containing minValues for each channel
- */
- static int computeChannelMinimum(const LTKTraceGroup& traceGroup, const vector<string>& channelNames,
- vector<float>& minValues);
-
- /**
- * This function computes the minimum and maximum of channels of an LTKTraceGroup object
- *
- * @param traceGroup The TraceGroup whose parameters need to be computed
- * @param channelNames Names of channels for which parameters need to be computed
- * @param minValues output vector containing minValues for each channel
- * @param maxValues output vector containing maxValues for each channel
- */
- static int computeChannelMaxMin(const LTKTraceGroup& traceGroup, const vector<string>& channelNames,
- vector<float>& maxValues, vector<float>& minValues);
-
-
- // @}
-
-};
-
-#endif //#ifndef __LTKINKUTILS_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp
deleted file mode 100644
index f7f85702..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-******************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2009-02-25 13:55:23 +0530 (Wed, 25 Feb 2009) $
- * $Revision: 741 $
- * $Author: mnab $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-#include "LTKLinuxUtil.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-
-
-#include <dlfcn.h>
-#include <stdio.h>
-#include <sys/utsname.h>
-
-
-/************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : LTKWindowsUtil
- * DESCRIPTION : Default constructor
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *****************************************************************************/
-LTKLinuxUtil::LTKLinuxUtil()
-{
-
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : ~LTKWindowsUtil
- * DESCRIPTION : Desstructor
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-LTKLinuxUtil::~LTKLinuxUtil()
-{
-
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : loadSharedLib
- * DESCRIPTION : Loads dynamic library
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::loadSharedLib(const string & lipiLibPath,
- const string & sharedLibName,
- void * * libHandle)
-{
-
-
- string sharedLibraryPath = "";
-
- // construct the path for the recogniser DLL
- sharedLibraryPath = lipiLibPath + "/" + "lib" + sharedLibName + ".so";
-
- // Load the DLL
- *libHandle = dlopen(sharedLibraryPath.c_str(), RTLD_LAZY);
-
- if(*libHandle == NULL)
- {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : loadSharedLib
- * DESCRIPTION : Loads dynamic library
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::unloadSharedLib(void * libHandle)
-{
- if (libHandle != NULL)
- {
- int returnVal = dlclose(libHandle);
-
- if (returnVal != 0 )
- {
- return FAILURE;
- }
- }
- else
- {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : getFunctionAddress
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::getFunctionAddress(void * libHandle,
- const string& functionName,
- void** functionHandle)
-{
- // validate parameters
- if (libHandle == NULL )
- {
- return FAILURE;
- }
-
- if (functionName.empty())
- {
- return FAILURE;
- }
-
- *functionHandle = dlsym(libHandle, functionName.c_str());
-
- if ( *functionHandle == NULL )
- {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getPlatformName
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::getPlatformName(string& outStr)
-{
- outStr = "Linux";
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getProcessorArchitechure
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::getProcessorArchitechure(string& outStr)
-{
-
- struct utsname name;
-
- uname(&name);
-
- outStr = name.machine;
-
- return SUCCESS;
-
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getOSInfo
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::getOSInfo(string& outStr)
-{
-
- struct utsname name;
- uname(&name);
- string sysName(name.sysname);
- string sysRelease(name.release);
-
- outStr = sysName + " " + sysRelease;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : recordStartTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::recordStartTime()
-{
- time(&m_startTime);
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : recordEndTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::recordEndTime()
-{
- time(&m_endTime);
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : diffTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::diffTime(string& outStr)
-{
- char temp[10];
- sprintf(temp, "%.1f", difftime(m_endTime, m_startTime));
- string tempStr(temp) ;
- outStr = tempStr;
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getSystemTimeString
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKLinuxUtil::getSystemTimeString(string& outStr)
-{
- time_t rawtime;
-
- time(&rawtime);
-
- string timeStr = ctime(&rawtime);
-
- outStr = timeStr.substr(0, 24);
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 17-07-2008
- * NAME : getLibraryHandle
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-
-void* LTKLinuxUtil::getLibraryHandle(const string& libName)
-{
- string lipiRoot= getEnvVariable(LIPIROOT_ENV_STRING) ;
- string libNameLinux = lipiRoot + "/" + "lib" + "/" + "lib" + libName + ".so";
-
- void* libHandle = NULL;
- libHandle = dlopen(libNameLinux.c_str(), RTLD_LAZY);
-
- if(libHandle == NULL)
- cout << "Error opening " << libNameLinux.c_str() << " : " << dlerror() << endl;
-
- return libHandle;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 17-07-2008
- * NAME : getEnvVariable
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-
-string LTKLinuxUtil::getEnvVariable(const string& envVariableName)
-{
- return getenv(envVariableName.c_str());
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h
deleted file mode 100644
index d8eef6f2..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLinuxUtil.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-******************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-12 11:34:07 +0530 (Tue, 12 Aug 2008) $
- * $Revision: 604 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR:
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKLINUXUTIL_H
-#define __LTKLINUXUTIL_H
-
-#include "LTKOSUtil.h"
-
-class LTKLinuxUtil: public LTKOSUtil
-{
-private:
- time_t m_startTime;
-
- time_t m_endTime;
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKLinuxUtil();
-
- /**
- * Destructor
- */
-
- ~LTKLinuxUtil();
-
- // @}
- int loadSharedLib(const string& lipiLibPath,
- const string& sharedLibName,
- void** libHandle);
-
- int unloadSharedLib(void* libHandle);
-
- int getFunctionAddress(void * libHandle,
- const string& functionName,
- void** functionHandle);
-
- int getPlatformName(string& outStr);
-
- int getProcessorArchitechure(string& outStr);
-
- int getOSInfo(string& outStr);
-
- int recordStartTime();
-
- int recordEndTime();
-
- int diffTime(string& outStr);
-
- int getSystemTimeString(string& outStr);
-
- void* getLibraryHandle(const string& libName);
-
- string getEnvVariable(const string& envVariableName);
-
-};
-
-#endif
-
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp
deleted file mode 100644
index 1971a69d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-04 11:43:39 +0530 (Fri, 04 Jul 2008) $
- * $Revision: 544 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Implementation of the String Splitter Module
- *
- * CONTENTS:
- * tokenizeString
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKLoggerUtil.h"
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKLogger.h"
-#include "LTKMacros.h"
-#include "LTKErrors.h"
-#include "LTKErrorsList.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include <memory>
-
-void* LTKLoggerUtil::m_libHandleLogger = NULL;
-FN_PTR_LOGMESSAGE LTKLoggerUtil::module_logMessage = NULL;
-FN_PTR_STARTLOG LTKLoggerUtil::module_startLogger = NULL;
-FN_PTR_GETINSTANCE LTKLoggerUtil::module_getInstanceLogger = NULL;
-FN_PTR_DESTROYINSTANCE LTKLoggerUtil::module_destroyLogger = NULL;
-#ifdef _WIN32
-ofstream LTKLoggerUtil::m_emptyStream;
-#else
-ofstream LTKLoggerUtil::m_emptyStream("/dev/null");
-#endif
-
-/****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 09-Jul-2007
-* NAME : LTKLoggerUtil
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-****************************************************************************/
-
-LTKLoggerUtil::LTKLoggerUtil(){}
-
-
-
-/****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 09-Jul-2007
-* NAME : createLogger
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-****************************************************************************/
-
-int LTKLoggerUtil::createLogger(const string& lipiLibPath)
-{
- void* functionHandle = NULL;
- auto_ptr<LTKOSUtil> a_ptrOSUtil(LTKOSUtilFactory::getInstance());
-
- int iErrorCode = a_ptrOSUtil->loadSharedLib(lipiLibPath,
- LOGGER_MODULE_STR,
- &m_libHandleLogger);
-
-
- if(iErrorCode != SUCCESS)
- {
- return iErrorCode;
- }
-
- // Create logger instance
- if (module_getInstanceLogger == NULL)
- {
- iErrorCode = a_ptrOSUtil->getFunctionAddress(m_libHandleLogger,
- "getLoggerInstance",
- &functionHandle);
- if(iErrorCode != SUCCESS)
- {
- return iErrorCode;
- }
-
- module_getInstanceLogger = (FN_PTR_GETINSTANCE)functionHandle;
-
- functionHandle = NULL;
- }
-
- module_getInstanceLogger();
-
- // map destoylogger function
- if (module_destroyLogger == NULL)
- {
- iErrorCode = a_ptrOSUtil->getFunctionAddress(m_libHandleLogger,
- "destroyLogger",
- &functionHandle);
- if(iErrorCode != SUCCESS)
- {
- return iErrorCode;
- }
-
- module_destroyLogger = (FN_PTR_DESTROYINSTANCE)functionHandle;
-
- functionHandle = NULL;
- }
-
- return iErrorCode;
-
-}
-
-/*****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE :
-* NAME : destroyLogger
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-int LTKLoggerUtil::destroyLogger()
-{
- auto_ptr<LTKOSUtil> a_ptrOSUtil(LTKOSUtilFactory::getInstance());
-
- if (module_destroyLogger != NULL )
- {
- module_destroyLogger();
- }
-
- int returnVal = a_ptrOSUtil->unloadSharedLib(m_libHandleLogger);
-
- return returnVal;
-}
-
-
-/*****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE :
-* NAME : getAddressLoggerFunctions
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-int LTKLoggerUtil::configureLogger(const string& logFile, LTKLogger::EDebugLevel logLevel)
-{
- void* functionHandle = NULL;
- int returnVal = SUCCESS;
-
- FN_PTR_SETLOGFILENAME module_setLogFileName = NULL;
- FN_PTR_SETLOGLEVEL module_setLogLevel = NULL;
-
- if (m_libHandleLogger == NULL )
- {
- LTKReturnError(ELOGGER_LIBRARY_NOT_LOADED);
- }
-
- auto_ptr<LTKOSUtil> a_ptrOSUtil(LTKOSUtilFactory::getInstance());
-
- if ( logFile.length() != 0 )
- {
- returnVal = a_ptrOSUtil->getFunctionAddress(m_libHandleLogger,
- "setLoggerFileName",
- &functionHandle);
-
- if(returnVal != SUCCESS)
- {
- return returnVal;
- }
-
- module_setLogFileName = (FN_PTR_SETLOGFILENAME)functionHandle;
-
- functionHandle = NULL;
-
- module_setLogFileName(logFile);
-
- }
- else
- {
- LTKReturnError(EINVALID_LOG_FILENAME);
- }
-
- returnVal = a_ptrOSUtil->getFunctionAddress(m_libHandleLogger,
- "setLoggerLevel",
- &functionHandle);
-
- if(returnVal != SUCCESS)
- {
- LTKReturnError(returnVal);
- }
-
- module_setLogLevel = (FN_PTR_SETLOGLEVEL)functionHandle;
-
- functionHandle = NULL;
-
- module_setLogLevel(logLevel);
-
- return SUCCESS;
-
-}
-
-
-/*****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE :
-* NAME : getAddressLoggerFunctions
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-int LTKLoggerUtil::getAddressLoggerFunctions()
-{
- void* functionHandle = NULL;
- int returnVal = SUCCESS;
-
- auto_ptr<LTKOSUtil> a_ptrOSUtil;
-
- //start log
-
- if (module_startLogger == NULL )
- {
- if(!a_ptrOSUtil.get())
- a_ptrOSUtil.reset(LTKOSUtilFactory::getInstance());
- returnVal = a_ptrOSUtil->getFunctionAddress(m_libHandleLogger,
- "startLogger",
- &functionHandle);
-
- if(returnVal != SUCCESS)
- {
- LTKReturnError(returnVal);
- }
-
- module_startLogger = (FN_PTR_STARTLOG)functionHandle;
-
- functionHandle = NULL;
- }
-
- module_startLogger();
-
- // map Log message
- if (module_logMessage == NULL)
- {
- if(!a_ptrOSUtil.get())
- a_ptrOSUtil.reset(LTKOSUtilFactory::getInstance());
- returnVal = a_ptrOSUtil->getFunctionAddress(m_libHandleLogger,
- "logMessage",
- &functionHandle);
-
- if(returnVal != SUCCESS)
- {
- LTKReturnError(returnVal);
- }
-
- module_logMessage = (FN_PTR_LOGMESSAGE)functionHandle;
-
- functionHandle = NULL;
-
- }
-
-
- return SUCCESS;
-
-}
-
-/*****************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 15-Jul-2008
-* NAME : nidhi
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-
-
-ostream& LTKLoggerUtil::logMessage(LTKLogger::EDebugLevel logLevel, string inStr, int lineNumber)
-{
- if (m_libHandleLogger == NULL)
- {
- auto_ptr<LTKOSUtil> a_ptrOSUtil(LTKOSUtilFactory::getInstance());
- m_libHandleLogger = a_ptrOSUtil->getLibraryHandle(LOGGER_MODULE_STR);
-
- if (m_libHandleLogger == NULL)
- {
- return m_emptyStream;
- }
- }
-
-
- // get function addresses
- if ( module_startLogger == NULL ||
- module_logMessage == NULL )
- {
- int returnVal = getAddressLoggerFunctions();
-
- if(returnVal != SUCCESS)
- {
- return m_emptyStream;
- }
- }
-
- return module_logMessage(logLevel, inStr, lineNumber);
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h
deleted file mode 100644
index 2f09831b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKLoggerUtil.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate:$
- * $Revision: $
- * $Author: $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the String Splitter Module
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKLOGGERUTIL_H
-#define __LTKLOGGERUTIL_H
-
-#include "LTKInc.h"
-#include "LTKLogger.h"
-class LTKOSUtil;
-
-typedef LTKLoggerInterface* (*FN_PTR_GETINSTANCE)();
-typedef void (*FN_PTR_DESTROYINSTANCE)();
-typedef void (*FN_PTR_STARTLOG)();
-typedef void (*FN_PTR_SETLOGFILENAME)(const string&);
-typedef void (*FN_PTR_SETLOGLEVEL)(LTKLogger::EDebugLevel);
-typedef ostream& (*FN_PTR_LOGMESSAGE)(int, const string& , int );
-
-// Set to 1 to disable the logging functionality
-#define DISABLE_LOG 1
-
-#define LOG(EDebugLevel) if(!DISABLE_LOG) LTKLoggerUtil::logMessage(EDebugLevel, __FILE__, __LINE__)
-
-/**
-* @ingroup util
-*/
-
-/** @brief Utility class to tokenize a string on any given delimiter
-@class LTKStringUtil
-*/
-
-class LTKLoggerUtil
-{
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKLoggerUtil();
-
-
- // @}
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * This is a static method which splits a string at the specified delimiters
- * @param str String to be split
- * @param tokens The split sub-strings
- * @param delimiters The symbols at which the string is to be split at
- * @return SUCCESS on successful split operation
- */
-
- static int createLogger(const string& lipiLibPath);
-
- static int destroyLogger();
-
- static int configureLogger(const string& logFile, LTKLogger::EDebugLevel logLevel);
-
- static int getAddressLoggerFunctions();
-
- static ostream& logMessage(LTKLogger::EDebugLevel logLevel, string, int);
-
- static ofstream m_emptyStream;
-
-
- // @}
-
- private:
- static void* m_libHandleLogger;
-
- static FN_PTR_LOGMESSAGE module_logMessage;
-
- static FN_PTR_STARTLOG module_startLogger;
-
- static FN_PTR_GETINSTANCE module_getInstanceLogger;
-
- static FN_PTR_DESTROYINSTANCE module_destroyLogger;
-
-
-
-
-};
-
-#endif //#ifndef __LTKSTRINGTOKENIZER_H
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp
deleted file mode 100644
index 87e14a64..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKOSUtilFactory.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-12 13:24:43 +0530 (Tue, 12 Aug 2008) $
- * $Revision: 610 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKMacros.h"
-
-#ifdef WINCE
- #include "LTKWinCEUtil.h"
-#elif defined WIN32
- #include "LTKWindowsUtil.h"
-#else
- #include "LTKLinuxUtil.h"
-#endif
-
-
-/*************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 29-May-2008
-* NAME : getInstance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-**************************************************************************/
-LTKOSUtil* LTKOSUtilFactory::getInstance()
-{
- #ifdef WINCE
- return new LTKWinCEUtil();
- #elif defined WIN32
- return new LTKWindowsUtil();
- #else
- return new LTKLinuxUtil();
- #endif
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp
deleted file mode 100644
index 3d27249e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-02-08 11:00:11 +0530 (Tue, 08 Feb 2011) $
- * $Revision: 832 $
- * $Author: dineshm $
- *
- ************************************************************************/
-
-#include "LTKStrEncoding.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-
-/************************************************************************
- * FILE DESCR: Implementation of LTKInkUtils that computes the statistics
- * of a trace group
- *
- * CONTENTS:
- * shapeStrToUnicode
- * tamilShapeStrToUnicode
- *
- * AUTHOR: Deepu V.
- *
- * DATE: September 8, 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 08-SEP-2005
-* NAME : LTKStrEncoding
-* DESCRIPTION : Initialization constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKStrEncoding::LTKStrEncoding()
-{
-
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 08-SEP-2005
-* NAME : shapeStrToUnicode
-* DESCRIPTION : Do the mapping from shaperecognition ID to Unicode string
-* ARGUMENTS : shapeRecProjectName - Shape Recognition Project name
-* : shapeIDs - The shape recognizer output IDs
-* : unicodeString - output unicode string
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-int LTKStrEncoding::shapeStrToUnicode(const string shapeRecProjectName, const vector<unsigned short>&shapeIDs, vector<unsigned short>& unicodeString)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKStrEncoding::shapeStrToUnicode()" << endl;
-
-
- /*if(shapeRecProjectName.empty())
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EMAP_NOT_FOUND <<":"<< getErrorMessage(EMAP_NOT_FOUND)
- <<"LTKStrEncoding::shapeStrToUnicode()" <<endl;
-
- LTKReturnError(EMAP_NOT_FOUND);
- }*/
-
- if(shapeRecProjectName == "tamil_iso_char")
- {
- return (tamilShapeStrToUnicode(shapeIDs,unicodeString));
- }
- else
- {
- return (numShapeStrToUnicode(shapeIDs,unicodeString));
- }
-
- //uncomment following if you need to implement mappings for
- //additional shape rec projects
- //else if (shapeRecProjectName == <YOUR PROJECT NAME>)
- //{
- // //Implement the logic here
- //}
-
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKStrEncoding::shapeStrToUnicode()" << endl;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 08-SEP-2005
-* NAME : numShapeStrToUnicode
-* DESCRIPTION : Do the mapping from shaperecognition ID
-* : to Unicode string for numerals project
-* ARGUMENTS : shapeIDs - The shape recognizer output IDs
-* : unicodeString - output unicode string
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKStrEncoding::numShapeStrToUnicode(const vector<unsigned short>& shapeIDs, vector<unsigned short>& unicodeString)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKStrEncoding::numShapeStrToUnicode()" << endl;
-
- vector<unsigned short>::const_iterator shapeIDsIter, shapeIDsEnd;
-
- //iterating through the shape IDs
- shapeIDsEnd = shapeIDs.end();
- for(shapeIDsIter = shapeIDs.begin();shapeIDsIter != shapeIDsEnd;++shapeIDsIter)
- {
- if(*shapeIDsIter == SHRT_MAX )
- unicodeString.push_back(L' ');
- else
- unicodeString.push_back((L'0')+ (*shapeIDsIter) );
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKStrEncoding::numShapeStrToUnicode()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 08-SEP-2005
-* NAME : tamilShapeStrToUnicode
-* DESCRIPTION : Do the mapping from shaperecognition ID
-* : to Unicode string for tamil_iso_char project
-* ARGUMENTS : shapeIDs - The shape recognizer output IDs
-* : unicodeString - output unicode string
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKStrEncoding::tamilShapeStrToUnicode(const vector<unsigned short>& shapeIDs, vector<unsigned short>& unicodeString)
-{
- int errorCode;
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKStrEncoding::tamilShapeStrToUnicode()" << endl;
-
- vector<unsigned short>::const_iterator shapeIDsIter, shapeIDsEnd;
- int charIndex; //index variable for unicode string
- unsigned short currentChar; //unicode representation of the character
- bool matraFlag; //indicates whether a matra is following the current character
-
- //iterating through the shape IDs
- shapeIDsEnd = shapeIDs.end();
- for(shapeIDsIter = shapeIDs.begin();shapeIDsIter != shapeIDsEnd;++shapeIDsIter)
- {
- if(*shapeIDsIter == SHRT_MAX )
- unicodeString.push_back(L' ');
- else if(*shapeIDsIter < 35)
- {
- if((errorCode = tamilCharToUnicode(*shapeIDsIter,unicodeString)) != SUCCESS)
- {
- return errorCode;
- }
- }
- else if (*shapeIDsIter < 58 )
- {
- if((errorCode = tamilCharToUnicode((*shapeIDsIter-23),unicodeString)) != SUCCESS)
- {
- return errorCode;
- }
- unicodeString.push_back(0x0bbf); //i mAtra
- }
- else if (*shapeIDsIter < 81 )
- {
- if((errorCode = tamilCharToUnicode((*shapeIDsIter-46),unicodeString)) != SUCCESS)
- {
- return errorCode;
- }
- unicodeString.push_back(0x0bc0); //ii mAtra
- }
- else if (*shapeIDsIter < 99 )
- {
- if((errorCode = tamilCharToUnicode((*shapeIDsIter-69),unicodeString)) != SUCCESS)
- {
- return errorCode;
- }
- unicodeString.push_back(0x0bc1); //u mAtra
- }
- else if (*shapeIDsIter < 117 )
- {
- if((errorCode = tamilCharToUnicode((*shapeIDsIter-87),unicodeString)) != SUCCESS)
- unicodeString.push_back(0x0bc2); //uu mAtra
- }
- else if (*shapeIDsIter < 118 )
- {
- unicodeString.push_back(0x0bbe); //aa mAtra
- }
- else if (*shapeIDsIter < 119 )
- {
- unicodeString.push_back(0x0bc6); //e mAtra
- }
- else if (*shapeIDsIter < 120 )
- {
- unicodeString.push_back(0x0bc7); //E mAtra
- }
- else if (*shapeIDsIter < 121 )
- {
- unicodeString.push_back(0x0bc8); //ai mAtra
- }
- else if(*shapeIDsIter < 122 )
- {
- //letter shri
- unicodeString.push_back(0x0bb8);//ss
- unicodeString.push_back(0x0bcd);//halant
- unicodeString.push_back(0x0bb0);//r
- unicodeString.push_back(0x0bc0);//ii
- }
- else if(*shapeIDsIter < 127 )
- {
- if((errorCode = tamilCharToUnicode((*shapeIDsIter-92),unicodeString)) != SUCCESS)
- {
- return errorCode;
- }
- unicodeString.push_back(0x0bc1); //u mAtra
- }
- else if(*shapeIDsIter < 132 )
- {
- if((errorCode = tamilCharToUnicode((*shapeIDsIter-97),unicodeString)) != SUCCESS)
- {
- return errorCode;
- }
- unicodeString.push_back(0x0bc2); //u mAtra
- }
- else if(*shapeIDsIter < 155 )
- {
- if((errorCode = tamilCharToUnicode((*shapeIDsIter-120),unicodeString)) != SUCCESS)
- {
- return errorCode;
- }
- unicodeString.push_back(0x0bcd); //halant
- }
- else if (*shapeIDsIter < 156 )
- {
- unicodeString.push_back(0x0b94);
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_SHAPEID <<":"<< getErrorMessage(EINVALID_SHAPEID)
- <<"LTKStrEncoding::tamilShapeStrToUnicode()" <<endl;
-
- LTKReturnError(EINVALID_SHAPEID);
- }
- }
-
- //Applying rules for e, E , ai, o, O, and au matras
- charIndex = 0;
- while( charIndex < unicodeString.size() )
- {
- currentChar = unicodeString[charIndex];
- switch(currentChar)
- {
- case 0x0bc6://e
- case 0x0bc7://E
- case 0x0bc8://ai
- if( (charIndex +1) < unicodeString.size() )
- {
- unicodeString[charIndex] = unicodeString[charIndex+1];
- unicodeString[charIndex+1] = currentChar;
- charIndex += 2;
- }
- else
- {
- ++charIndex;
- }
- break;
- case 0x0bbe: //check for `o' or `O'
- if(charIndex>0)//within string bounds
- {
- if(unicodeString[charIndex-1] == 0x0bc6 )
- {
- unicodeString[charIndex-1] = 0x0bca;
- unicodeString.erase(unicodeString.begin()+charIndex);
- }
- else if(unicodeString[charIndex-1] == 0x0bc7 )
- {
- unicodeString[charIndex-1] = 0x0bcb;
- unicodeString.erase(unicodeString.begin()+charIndex);
- }
- else
- {
- ++charIndex;
- }
- }
- else
- {
- ++charIndex;
- }
- break;
- case 0x0bb3: //check for au
- matraFlag = (charIndex+1<unicodeString.size() && (unicodeString[charIndex+1] > 0x0bbd && unicodeString[charIndex+1] < 0x0bc3 ) );
-
- //if la is not follwed by a matra and is preceded by an e matra it is an au matra
- if((charIndex >0)&&(unicodeString[charIndex-1] == 0x0bc6) && (!matraFlag))
- {
- unicodeString[charIndex-1] = 0x0bcc;
- unicodeString.erase(unicodeString.begin()+charIndex);
- }
- else
- {
- ++charIndex;
- }
- break;
- default:
- ++charIndex;
-
- }
-
- }
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKStrEncoding::tamilShapeStrToUnicode()" << endl;
-
- return SUCCESS;
-}
-
-int LTKStrEncoding::tamilCharToUnicode(const unsigned short& shapeID, vector<unsigned short>& unicodeString)
-{
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKStrEncoding::tamilCharToUnicode()" << endl;
-
-
- if(shapeID < 35)
- {
- if(shapeID == 34)
- {
- unicodeString.push_back(0x0b95);
- unicodeString.push_back(0x0bcd);
- unicodeString.push_back(0x0bb7);
- }
- else
- {
- unicodeString.push_back(tamilIsoCharMap[shapeID]);
- }
- }
- else
- {
- LOG(LTKLogger::LTK_LOGLEVEL_ERR)
- <<"Error : "<< EINVALID_SHAPEID <<":"<< getErrorMessage(EINVALID_SHAPEID)
- <<"LTKStrEncoding::tamilCharToUnicode()" <<endl;
-
- LTKReturnError(EINVALID_SHAPEID);
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKStrEncoding::tamilCharToUnicode()" << endl;
-
- return SUCCESS;
-}
-
-
-/**********************************************************************************
-* AUTHOR : Deepu V.
-* DATE : 08-SEP-2005
-* NAME : ~LTKStrEncoding
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKStrEncoding::~LTKStrEncoding()
-{
-
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h
deleted file mode 100644
index a61517fb..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStrEncoding.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the Shape ID to Unicode mapping functions
- *
- * CONTENTS:
- *
- * AUTHOR: Deepu V.
- *
- * DATE: September 08 2005
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKSTRENCODING_H
-#define __LTKSTRENCODING_H
-
-#include <string>
-
-#include "LTKInc.h"
-#include "LTKTypes.h"
-#include "LTKErrorsList.h"
-#include "LTKErrors.h"
-
-//mapping for Tamil basic characters
-static unsigned short tamilIsoCharMap[] = {
-//class ID Unicode value
-/*000*/ 0x0b85, //a
-/*001*/ 0x0b86, //aa
-/*002*/ 0x0b87, //i
-/*003*/ 0x0b88, //ii
-/*004*/ 0x0b89, //u
-/*005*/ 0x0b8a, //uu
-/*006*/ 0x0b8e, //e
-/*007*/ 0x0b8f, //E
-/*008*/ 0x0b90, //ai
-/*009*/ 0x0b92, //o
-/*010*/ 0x0b93, //O
-/*011*/ 0x0b83, //aytham
-/*012*/ 0x0b95, //ka
-/*013*/ 0x0b99, //nga
-/*014*/ 0x0b9a, //cha
-/*015*/ 0x0b9e, //nja
-/*016*/ 0x0b9f, //Ta
-/*017*/ 0x0ba3, //Na
-/*018*/ 0x0ba4, //ta
-/*019*/ 0x0ba8, //na
-/*020*/ 0x0baa, //pa
-/*021*/ 0x0bae, //ma
-/*022*/ 0x0baf, //ya
-/*023*/ 0x0bb0, //ra
-/*024*/ 0x0bb2, //la
-/*025*/ 0x0bb5, //va
-/*026*/ 0x0bb4, //zha
-/*027*/ 0x0bb3, //La
-/*028*/ 0x0bb1, //Ra
-/*029*/ 0x0ba9, //n2a
-/*030*/ 0x0bb8, //sa
-/*031*/ 0x0bb7, //sha
-/*032*/ 0x0b9c, //ja
-/*033*/ 0x0bb9 //ha
- };
-
-/**
-* @class LTKStrEncoding
-* <p> This class contains the methods
-* for mapping shape ID to Unicode </p>
-*/
-
-class LTKStrEncoding
-{
-
-public:
- /**
- * @name Constructors and Destructor
- */
- // @{
-
- /**
- * Default Constructor
- */
- LTKStrEncoding();
-
- /**
- * Destructor
- */
- virtual ~LTKStrEncoding();
-
- // @}
-
- /**
- * This function maps the vector of shape recognizer strings to the
- *
- * @param shapeRecProjectName The shape recognition project name
- * @param shapeIDs the vector of shape ids from the shape recognizer
- * @param unicodeString the unicode string output
- */
- static int shapeStrToUnicode(const string shapeRecProjectName, const vector<unsigned short>& shapeIDs, vector<unsigned short>& unicodeString);
-
-private:
-
- static int numShapeStrToUnicode(const vector<unsigned short>& shapeIDs, vector<unsigned short>& unicodeString);
- static int tamilShapeStrToUnicode(const vector<unsigned short>& shapeIDs, vector<unsigned short>& unicodeString);
- static int tamilCharToUnicode(const unsigned short& shapeID, vector<unsigned short>& unicodeString);
-
-
-};
-#endif //#ifndef __LTKSTRENCODING_H \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp
deleted file mode 100644
index 7f56a66d..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2011-01-11 13:48:17 +0530 (Tue, 11 Jan 2011) $
- * $Revision: 827 $
- * $Author: mnab $
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Implementation of the String Splitter Module
- *
- * CONTENTS:
- * tokenizeString
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKStringUtil.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-#include <sstream>
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKStringUtil
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKStringUtil::LTKStringUtil(){}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : tokenizeString
-* DESCRIPTION : splits the given string at the specified delimiters
-* ARGUMENTS : str - string to be split
-* outTokens - the vector containing the split parts of the string
-* delimiters - the symbols at which the string is to be split
-* RETURNS : SUCCESS on successfully splitting of the string
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Saravanan. R 29-3-07 dynamic allocation for strString
-*************************************************************************************/
-
-int LTKStringUtil::tokenizeString(const string& inputString,
- const string& delimiters,
- vector<string>& outTokens)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKStringUtil::tokenizeString()" << endl;
-
- // clearing the token list
- int inputStrLength = inputString.length();
- int delimLength = delimiters.length();
-
-
- char *strToken;
- char *strString = new char[inputStrLength + 1];
-
- outTokens.clear();
-
- strcpy(strString, inputString.c_str());
-
- strToken = strtok(strString, delimiters.c_str());
-
- while( strToken != NULL )
- {
- outTokens.push_back(strToken);
-
- // Get next token:
- strToken = strtok(NULL, delimiters.c_str());
- }
- delete[] strString;
-
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKStringUtil::tokenizeString()" << endl;
-
- return SUCCESS;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKStringUtil
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKStringUtil::~LTKStringUtil(){}
-
-
-/*****************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : ~LTKStringUtil
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-void LTKStringUtil::trimString(string& str)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKStringUtil::trimString()" << endl;
-
- string::size_type pos = str.find_last_not_of(' ');
-
- if(pos != string::npos)
- {
- // we found a non space char
- str.erase(pos + 1);
- pos = str.find_first_not_of(' ');
-
- if(pos != string::npos)
- {
- str.erase(0, pos);
- }
- }
- else
- {
- // string has nothing else but spaces
- str.erase(str.begin(), str.end());
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKStringUtil::trimString()" << endl;
-}
-
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 29-Jan-2008
-* NAME : convertIntegerToString
-* DESCRIPTION : Converts an integer variable to string
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-void LTKStringUtil::convertIntegerToString(int intVariable, string& outStr)
-{
- ostringstream tempString;
-
- tempString << intVariable;
-
- outStr = tempString.str();
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 29-Jan-2008
-* NAME : convertIntegerToString
-* DESCRIPTION : Converts an integer variable to string
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-void LTKStringUtil::convertFloatToString(float floatVariable, string& outStr)
-{
- ostringstream tempString;
-
- tempString << floatVariable;
-
- outStr = tempString.str();
-}
-
-/***************************************************************************
-* AUTHOR :
-* DATE : 18-Mar-2015
-* NAME : convertStringToFloat
-* DESCRIPTION : Converts string to float
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-float LTKStringUtil::convertStringToFloat(const string& str)
-{
- float rval;
- stringstream ss(str);
- ss.imbue(locale("C"));
- ss >> rval;
- return rval;
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 29-Jan-2008
-* NAME : isNumeric
-* DESCRIPTION : Retruns true if the input string is numeric
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-bool LTKStringUtil::isFloat(const string& inputStr)
-{
- string remainingStr = "";
-
- // check if prefixed with a sign
- if (inputStr.find_first_of('-') == 0 || inputStr.find_first_of('+') == 0)
- {
- remainingStr = inputStr.substr(1);
- }
- else
- {
- remainingStr = inputStr;
- }
-
- // check if two decimals are there like 9.8.8
- string::size_type pos = remainingStr.find_first_of('.');
-
- if (pos != string::npos)
- {
- string tempString = remainingStr.substr(pos+1);
-
- string::size_type pos2 = tempString.find_first_of('.');
-
- if (pos2 != string::npos)
- {
- return false;
- }
- }
-
-
- const char* ptr = remainingStr.c_str();
-
- for ( ; *ptr; ptr++)
- {
- if (*ptr < '0' || *ptr > '9' )
- {
- if ( *ptr != '.' )
- {
- return false;
- }
- }
- }
-
- return true;
-}
-
-/***************************************************************************
-* AUTHOR : Srinivasa Vithal
-* DATE : 18-Feb-2008
-* NAME : isFloat
-* DESCRIPTION : Retruns true if the input string is integer
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-bool LTKStringUtil::isInteger(const string& inputStr)
-{
- string remainingStr = "";
-
- // check if prefixed with a sign
- if (inputStr.find_first_of('-') == 0 || inputStr.find_first_of('+') == 0)
- {
- remainingStr = inputStr.substr(1);
- }
- else
- {
- remainingStr = inputStr;
- }
-
- // check if a decimal is present
- string::size_type pos = remainingStr.find_first_of('.');
-
- if (pos != string::npos)
- {
- return false;
- }
-
- const char* ptr = remainingStr.c_str();
-
- for ( ; *ptr; ptr++)
- {
- if (*ptr < '0' || *ptr > '9' )
- {
- return false;
- }
- }
-
- return true;
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h
deleted file mode 100644
index 4a2c9442..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKStringUtil.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-10 15:23:21 +0530 (Thu, 10 Jul 2008) $
- * $Revision: 556 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Definitions for the String Splitter Module
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKSTRINGTOKENIZER_H
-#define __LTKSTRINGTOKENIZER_H
-
-#include "LTKInc.h"
-
-/**
-* @ingroup util
-*/
-
-/** @brief Utility class to tokenize a string on any given delimiter
-@class LTKStringUtil
-*/
-
-class LTKStringUtil
-{
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKStringUtil();
-
- /**
- * Destructor
- */
-
- ~LTKStringUtil();
-
- // @}
-
- /**
- * @name Methods
- */
-
- // @{
-
- /**
- * This is a static method which splits a string at the specified delimiters
- * @param str String to be split
- * @param tokens The split sub-strings
- * @param delimiters The symbols at which the string is to be split at
- * @return SUCCESS on successful split operation
- */
-
- static int tokenizeString(const string& str, const string& delimiters, vector<string>& outTokens);
-
- static void convertIntegerToString(int intVariable, string& outStr);
-
- static void convertFloatToString(float floatVariable, string& outStr);
-
- static float convertStringToFloat(const string& str);
-
- static void trimString(string& str);
-
- static bool isFloat(const string& inputStr);
-
- static bool isInteger(const string& inputStr);
-
- // @}
-
-};
-
-#endif //#ifndef __LTKSTRINGTOKENIZER_H
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp
deleted file mode 100644
index 1b48e8d4..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:33:34 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 564 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Defines the function to check the version compatibility
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: May 25, 2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKVersionCompatibilityCheck.h"
-#include "LTKStringUtil.h"
-#include "LTKTypes.h"
-#include "LTKLoggerUtil.h"
-
-/**********************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 25-May-2007
-* NAME : LTKVersionCompatibilityCheck
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKVersionCompatibilityCheck::LTKVersionCompatibilityCheck():m_delimiter(".")
-{
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 25-May-2007
-* NAME : ~LTKVersionCompatibilityCheck
-* DESCRIPTION : Default Destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-LTKVersionCompatibilityCheck::~LTKVersionCompatibilityCheck()
-{
-}
-
-/**********************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 25-May-2007
-* NAME : checkCompatibility
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-bool LTKVersionCompatibilityCheck::checkCompatibility(const string& supportedMinVersion,
- const string& currentVersion,
- const string& versionRead)
- {
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKVersionCompatibilityCheck::checkCompatibility()" << endl;
-
- bool returnStatus = false;
-
-
- if (versionRead == currentVersion )
- {
- return true;
- }
-
- if (isFirstVersionHigher(versionRead, supportedMinVersion) == true &&
- isFirstVersionHigher(currentVersion, versionRead) == true)
- {
- returnStatus = true;
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKVersionCompatibilityCheck::checkCompatibility()" << endl;
-
- return returnStatus;
-}
-
-bool LTKVersionCompatibilityCheck::isFirstVersionHigher(const string& firstVersion,
- const string& secondVersion)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKVersionCompatibilityCheck::isFirstVersionHigher()" << endl;
-
- if ( firstVersion == secondVersion )
- {
- return true;
- }
-
- bool returnVal = false;
- bool equalityObtained = false;
-
- stringVector firstVerTok;
- stringVector secondVerTok;
-
- LTKStringUtil::tokenizeString(firstVersion, m_delimiter, firstVerTok);
- LTKStringUtil::tokenizeString(secondVersion, m_delimiter, secondVerTok);
-
- int versionTokSize = firstVerTok.size();
-
- if ( versionTokSize != secondVerTok.size())
- {
- return false;
- }
-
- // compare first tokens
- int cmpResults = compareTokens(atoi((firstVerTok[0]).c_str()), atoi((secondVerTok[0]).c_str()));
-
- switch (cmpResults)
- {
- case GREATER :
- returnVal = true;
- break;
-
- case LESSER :
- returnVal = false;
- break;
-
- case EQUAL :
- equalityObtained = true;
- break;
- }
-
- if (equalityObtained == false)
- {
- return returnVal;
- }
- else
- {
- equalityObtained = false;
- returnVal = false;
-
- // Compare the second tokens
- int cmpResults2 = compareTokens(atoi((firstVerTok[1]).c_str()), atoi((secondVerTok[1]).c_str()));
-
- switch (cmpResults2)
- {
- case GREATER :
- returnVal = true;
- break;
-
- case LESSER :
- returnVal = false;
- break;
-
- case EQUAL :
- equalityObtained = true;
- break;
- }
- }
-
- if (equalityObtained == false)
- {
- return returnVal;
- }
- else
- {
- equalityObtained = false;
- returnVal = false;
-
- // Compare the second tokens
- int cmpResults3 = compareTokens(atoi((firstVerTok[2]).c_str()), atoi((secondVerTok[2]).c_str()));
-
- switch (cmpResults3)
- {
- case GREATER :
- returnVal = true;
- break;
-
- case LESSER :
- returnVal = false;
- break;
-
- case EQUAL :
- returnVal = true;
- break;
- }
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKVersionCompatibilityCheck::isFirstVersionHigher()" << endl;
- return returnVal;
-
-}
-
-ELTKVersionComparison LTKVersionCompatibilityCheck::compareTokens(int firstTokenIntegerValue,
- int secondTokenIntegerValue)
-{
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Entering: LTKVersionCompatibilityCheck::compareTokens()" << endl;
-
- ELTKVersionComparison returnVal;
-
- //int firstTokenIntegerValue =atoi((firstToken).c_str());
- //int secondTokenIntegerValue =atoi((secondToken).c_str());
-
- if (firstTokenIntegerValue > secondTokenIntegerValue )
- {
- returnVal = GREATER;
- }
- else if (firstTokenIntegerValue < secondTokenIntegerValue )
- {
- returnVal = LESSER;
- }
- else
- {
- returnVal = EQUAL;
- }
- LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
- " Exiting: LTKVersionCompatibilityCheck::compareTokens()" << endl;
-
- return returnVal;
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h
deleted file mode 100644
index 476aae72..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKVersionCompatibilityCheck.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-01 09:48:58 +0530 (Fri, 01 Aug 2008) $
- * $Revision: 583 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Defines the function to check the version compatibility
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: May 25, 2007
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef LTKVERSIONCOMPATIBILITYCHECK_H
-#define LTKVERSIONCOMPATIBILITYCHECK_H
-
-#include "LTKInc.h"
-
-/**
-* @ingroup util
-*/
-
-enum ELTKVersionComparison
-{
- GREATER,
- LESSER,
- EQUAL
-};
-
-class LTKVersionCompatibilityCheck
-{
-private:
- string m_delimiter;
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
- LTKVersionCompatibilityCheck();
-
-
- /**
- * Destructor
- */
-
- ~LTKVersionCompatibilityCheck();
-
- // @}
-
- /**
- * @name Methods
- */
-
- // @{
-
- bool checkCompatibility(const string& supportedMinVersion,const string& currentVersion, const string& versionRead);
-
- bool isFirstVersionHigher(const string& firstVersion, const string& secondVersion);
-
-private:
-
-
- ELTKVersionComparison compareTokens(int firstTokenIntegerValue,
- int secondTokenIntegerValue);
-
- // @}
-};
-
-#endif
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp
deleted file mode 100644
index 1462fedf..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.cpp
+++ /dev/null
@@ -1,469 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-******************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKWinCEUtil.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-#include "LTKStringUtil.h"
-
-/************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : LTKWinCEUtil
- * DESCRIPTION : Default constructor
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *****************************************************************************/
-LTKWinCEUtil::LTKWinCEUtil()
-{
-
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : ~LTKWinCEUtil
- * DESCRIPTION : Desstructor
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-LTKWinCEUtil::~LTKWinCEUtil()
-{
-
-}
-
-/***************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
-* NAME : LoadLibraryUnicode
-* DESCRIPTION : Loads the library which takes as character string input
-* ARGUMENTS :
-* RETURNS : Handle to the library loaded.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-HANDLE LTKWinCEUtil::LoadLibraryUnicode(const char* pszDllName)
-{
- if (pszDllName == NULL)
- return NULL ;
-
- HANDLE hDll = NULL ;
- TCHAR *pszwDll = convertCharToTChar(pszDllName);
- if (pszwDll)
- {
- hDll = ::LoadLibrary(pszwDll) ;
- delete(pszwDll) ;
- }
- return hDll ;
-}
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : loadSharedLib
- * DESCRIPTION : Loads dynamic library
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::loadSharedLib(const string & lipiRoot,
- const string & sharedLibName,
- void * * libHandle)
-{
- string sharedLibraryPath = "";
-
- // construct the path for the recogniser DLL
- sharedLibraryPath = lipiRoot + "\\" + "lib" + "\\" + sharedLibName + ".dll";
-
- // Load the DLL
- *libHandle = (void*)LoadLibraryUnicode(sharedLibraryPath.c_str());
-
- if(*libHandle == NULL)
- {
- cout << GetLastError() << endl;
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : loadSharedLib
- * DESCRIPTION : Loads dynamic library
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::unloadSharedLib(void * libHandle)
-{
-
- if (libHandle != NULL)
- {
- int returnVal = FreeLibrary((HINSTANCE)(libHandle));
-
- // For FreeLibrary, If the function fails, the return value is zero
- if (returnVal == 0 )
- {
- return FAILURE;
- }
- }
- else
- {
-
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : getFunctionAddress
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::getFunctionAddress(void * libHandle,
- const string& functionName,
- void** functionHandle)
-{
-
- // validate parameters
- if (libHandle == NULL )
- {
- return FAILURE;
- }
-
- if (functionName.empty())
- {
- return FAILURE;
- }
- TCHAR *pszwName = convertCharToTChar(functionName.c_str());
- *functionHandle = GetProcAddress((HMODULE)libHandle, pszwName);
- delete pszwName;
-
- if ( *functionHandle == NULL )
- {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : getPlatformName
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::getPlatformName(string& outStr)
-{
- outStr = "Windows";
- return SUCCESS;
-
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : getProcessorArchitechure
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::getProcessorArchitechure(string& outStr)
-{
- SYSTEM_INFO architechure;
-
- GetSystemInfo(&architechure);
-
- int arc = architechure.wProcessorArchitecture;
-
- switch (arc)
- {
- case 0 : outStr = "INTEL";
- break;
-
- case 1 : outStr = "MIPS";
- break;
-
- case 2 : outStr = "ALPHA";
- break;
-
- case 3 : outStr = "PPC";
- break;
-
- case 4 : outStr = "SHX";
- break;
-
- case 5 : outStr = "ARM";
- break;
-
- case 6 : outStr = "IA64";
- break;
-
- case 7 : outStr = "ALPHA64";
- break;
-
- default : outStr = "UNKNOWN";
- break;
- }
-
- return SUCCESS;
-
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : getOSInfo
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::getOSInfo(string& outStr)
-{
- outStr = "";
- outStr += "Microsoft WinCE" ;
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : recordStartTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::recordStartTime()
-{
- GetLocalTime(&m_startTime);
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : recordEndTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::recordEndTime()
-{
- GetLocalTime(&m_endTime);
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : diffTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::diffTime(string& outStr)
-{
- //Convert the SYSTEMTIME to FILETIME
- FILETIME ftimeStart, ftimeEnd ;
- SystemTimeToFileTime(&m_startTime, &ftimeStart) ;
- SystemTimeToFileTime(&m_endTime, &ftimeEnd) ;
-
- //Convert the FILETIME to ULARGE_INTEGER
- ULARGE_INTEGER uIntStart, uIntEnd ;
- uIntStart.HighPart = ftimeStart.dwHighDateTime ;
- uIntStart.LowPart = ftimeStart.dwLowDateTime;
-
- uIntEnd.HighPart = ftimeEnd.dwHighDateTime;
- uIntEnd.LowPart = ftimeEnd.dwLowDateTime;
-
- ULONGLONG ulDiff = uIntEnd.QuadPart - uIntStart.QuadPart ;
-
- char temp[10];
- sprintf(temp, "%.1f", ulDiff/10000000);
-
- string tempStr(temp) ;
- outStr = tempStr;
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : getSystemTimeString
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWinCEUtil::getSystemTimeString(string& outStr)
-{
- SYSTEMTIME st;
- GetLocalTime(&st);
- char szTime[100] ;
- sprintf(szTime, "%02u:%02u:%02u", st.wHour, st.wMinute, st.wSecond);
- outStr = szTime ;
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Sarbeswar Meher
- * DATE : 11-08-2008
- * NAME : getLibraryHandle
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-
-void* LTKWinCEUtil::getLibraryHandle(const string& libName)
-{
- string libNameWindows = libName + ".dll";
-
- void* libHandle = NULL;
-
- TCHAR *pszwLib = convertCharToTChar(libNameWindows.c_str()) ;
- libHandle = GetModuleHandle(pszwLib);
- delete pszwLib ;
-
- return libHandle;
-}
-/***************************************************************************
-* AUTHOR : Sarbeswar Meher
-* DATE : 14-Apr-2008
-* NAME : ConvertCharToTChar
-* DESCRIPTION : Converts char to TCHAR
-* ARGUMENTS :
-* RETURNS : TCHAR*
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-TCHAR* LTKWinCEUtil::convertCharToTChar(const char* pszData)
-{
- if (pszData == NULL)
- return NULL ;
-
- int nLen = strlen(pszData)+1 ;
- TCHAR *pszwData = new TCHAR[nLen] ;
- if (pszwData)
- {
- //Converts the char to TCHAR value
- MultiByteToWideChar(CP_ACP, 0, pszData, nLen, pszwData, nLen) ;
- return pszwData ;
- }
- return NULL ;
-}
-
-/***************************************************************************
-* AUTHOR : Sarbeswar Meher
-* DATE : 14-Apr-2008
-* NAME : getEnvVariable
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*******************************************************************************/
-string LTKWinCEUtil::getEnvVariable(const string& envVariableName)
-{
- return NULL;
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h
deleted file mode 100644
index 649a2700..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWinCEUtil.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-07-18 15:00:39 +0530 (Fri, 18 Jul 2008) $
- * $Revision: 561 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR:
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKWINCEUTIL_H
-#define __LTKWINCEUTIL_H
-
-#define BUFSIZE 256
-
-#include "LTKOSUtil.h"
-#include <windows.h>
-
-class LTKWinCEUtil: public LTKOSUtil
-{
-private:
- SYSTEMTIME m_startTime;
- SYSTEMTIME m_endTime;
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKWinCEUtil();
-
- /**
- * Destructor
- */
-
- ~LTKWinCEUtil();
-
- // @}
- int loadSharedLib(const string& lipiLibPath,
- const string& sharedLibName,
- void** libHandle);
-
- int unloadSharedLib(void* libHandle);
-
- int getFunctionAddress(void * libHandle,
- const string& functionName,
- void** functionHandle);
-
- int getPlatformName(string& outStr);
-
- int getProcessorArchitechure(string& outStr);
-
- int getOSInfo(string& outStr);
-
- int recordStartTime();
-
- int recordEndTime();
-
- int diffTime(string& outStr);
-
- int getSystemTimeString(string& outStr);
-
- void* getLibraryHandle(const string& libName);
-
- HANDLE LoadLibraryUnicode(const char* pszDllName) ;
-
- TCHAR* convertCharToTChar(const char* pszData) ;
-
- string getEnvVariable(const string& envVariableName);
-
-};
-
-
-#endif /*__LTKWINCEUTIL_H*/
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp
deleted file mode 100644
index 825ee84c..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.cpp
+++ /dev/null
@@ -1,582 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-******************************************************************************/
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-12 11:34:07 +0530 (Tue, 12 Aug 2008) $
- * $Revision: 604 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKWindowsUtil.h"
-#include "LTKMacros.h"
-#include "LTKLoggerUtil.h"
-
-#include <windows.h>
-
-/************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : LTKWindowsUtil
- * DESCRIPTION : Default constructor
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- *****************************************************************************/
-LTKWindowsUtil::LTKWindowsUtil()
-{
-
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : ~LTKWindowsUtil
- * DESCRIPTION : Desstructor
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-LTKWindowsUtil::~LTKWindowsUtil()
-{
-
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : loadSharedLib
- * DESCRIPTION : Loads dynamic library
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::loadSharedLib(const string & lipiLibPath,
- const string & sharedLibName,
- void * * libHandle)
-{
- string sharedLibraryPath = "";
-
- // construct the path for the recogniser DLL
- sharedLibraryPath = lipiLibPath + "\\" + sharedLibName +
-#ifndef NDEBUG
- "d"
-#endif
- ".dll";
- // Load the DLL
- *libHandle = (void*)LoadLibrary(sharedLibraryPath.c_str());
-
- if(*libHandle == NULL)
- {
- cout << GetLastError() << endl;
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : loadSharedLib
- * DESCRIPTION : Loads dynamic library
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::unloadSharedLib(void * libHandle)
-{
-
- if (libHandle != NULL)
- {
- int returnVal = FreeLibrary((HINSTANCE)(libHandle));
-
- // For FreeLibrary, If the function fails, the return value is zero
- if (returnVal == 0 )
- {
- return FAILURE;
- }
- }
- else
- {
-
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 29-05-2008
- * NAME : getFunctionAddress
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::getFunctionAddress(void * libHandle,
- const string& functionName,
- void** functionHandle)
-{
-
- // validate parameters
- if (libHandle == NULL )
- {
- return FAILURE;
- }
-
- if (functionName.empty())
- {
- return FAILURE;
- }
-
- *functionHandle = GetProcAddress((HMODULE)libHandle, functionName.c_str());
-
- if ( *functionHandle == NULL )
- {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getPlatformName
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::getPlatformName(string& outStr)
-{
- outStr = "Windows";
- return SUCCESS;
-
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getProcessorArchitechure
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::getProcessorArchitechure(string& outStr)
-{
- SYSTEM_INFO architechure;
-
- GetSystemInfo(&architechure);
-
- int arc = architechure.wProcessorArchitecture;
-
- switch (arc)
- {
- case 0 : outStr = "INTEL";
- break;
-
- case 1 : outStr = "MIPS";
- break;
-
- case 2 : outStr = "ALPHA";
- break;
-
- case 3 : outStr = "PPC";
- break;
-
- case 4 : outStr = "SHX";
- break;
-
- case 5 : outStr = "ARM";
- break;
-
- case 6 : outStr = "IA64";
- break;
-
- case 7 : outStr = "ALPHA64";
- break;
-
- default : outStr = "UNKNOWN";
- break;
- }
-
- return SUCCESS;
-
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getOSInfo
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::getOSInfo(string& outStr)
-{
- outStr = "";
-
- OSVERSIONINFOEX osvi;
- BOOL bOsVersionInfoEx;
-
- ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
- if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
- {
- osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- if (! GetVersionEx ((OSVERSIONINFO *) &osvi))
- return SUCCESS;
- }
-
- switch (osvi.dwPlatformId)
- {
- // Test for the Windows NT product family.
- case VER_PLATFORM_WIN32_NT:
-
- // Test for the specific product family.
- if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
- {
- outStr = "Microsoft Windows Server&nbsp;2003 family, ";
- }
-
- if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
- {
- outStr = "Microsoft Windows XP ";
- }
-
- if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
- {
- outStr = "Microsoft Windows 2000 ";
- }
-
- if ( osvi.dwMajorVersion <= 4 )
- {
- outStr = "Microsoft Windows NT ";
- }
-
- // Test for specific product on Windows NT 4.0 SP6 and later.
- if( bOsVersionInfoEx )
- {
- // Test for the workstation type.
- if( osvi.dwMajorVersion == 4 )
- {
- outStr += "Workstation 4.0 ";
- }
- }
- else // Test for specific product on Windows NT 4.0 SP5 and earlier
- {
- HKEY hKey;
-
- char szProductType[BUFSIZE];
- DWORD dwBufLen=BUFSIZE;
- LONG lRet;
-
- lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
- 0, KEY_QUERY_VALUE, &hKey );
- if( lRet != ERROR_SUCCESS )
- return SUCCESS;
-
- lRet = RegQueryValueEx( hKey, "ProductType", NULL, NULL,
- (LPBYTE) szProductType, &dwBufLen);
- if( (lRet != ERROR_SUCCESS) )
- return SUCCESS;
-
- RegCloseKey( hKey );
-
- if ( lstrcmpi( "WINNT", szProductType) == 0 )
- {
- outStr += "Workstation ";
- }
-
- if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
- {
- outStr += "Server ";
- }
-
- if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
- {
- outStr += "Advanced Server ";
- }
-
- printf( "%d.%d ", osvi.dwMajorVersion, osvi.dwMinorVersion );
- }
-
- // Display service pack (if any) and build number.
-
- if( osvi.dwMajorVersion == 4 &&
- lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 )
- {
- HKEY hKey;
- LONG lRet;
-
- // Test for SP6 versus SP6a.
- lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
- "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009",
- 0, KEY_QUERY_VALUE, &hKey );
-
- if( lRet == ERROR_SUCCESS )
- {
- char tempStr[50];
- sprintf(tempStr,"%d", osvi.dwBuildNumber & 0xFFFF);
- string str1 = string(tempStr);
- string temp = "Service Pack 6a (Build " + str1 + ")";
-
- outStr += temp;
- }
- else // Windows NT 4.0 prior to SP6a
- {
- char tempStr[100];
-
- sprintf (tempStr, "%s (Build %d)",
- osvi.szCSDVersion,
- osvi.dwBuildNumber & 0xFFFF);
- string str1 = string(tempStr);
-
- outStr += str1;
- }
-
- RegCloseKey( hKey );
- }
- else // Windows NT 3.51 and earlier or Windows 2000 and later
- {
- char tempStr[100];
-
- sprintf (tempStr, "%s (Build %d)",
- osvi.szCSDVersion,
- osvi.dwBuildNumber & 0xFFFF);
-
- string str1 = string(tempStr);
-
- outStr += str1;
-
- }
-
-
- break;
-
- // Test for the Windows 95 product family.
- case VER_PLATFORM_WIN32_WINDOWS:
-
- if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
- {
- outStr += "Microsoft Windows 95 ";
-
- if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
- {
- outStr += "OSR2 ";
- }
- }
-
- if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
- {
- outStr += "Microsoft Windows 98 ";
-
- if ( osvi.szCSDVersion[1] == 'A' )
- {
- outStr += "SE " ;
- }
- }
-
- if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
- {
- outStr += "Microsoft Windows Millennium Edition";
- }
- break;
-
- case VER_PLATFORM_WIN32s:
- outStr += "Microsoft Win32s";
-
- break;
- }
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : recordStartTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::recordStartTime()
-{
- time(&m_startTime);
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : recordEndTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::recordEndTime()
-{
- time(&m_endTime);
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : diffTime
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::diffTime(string& outStr)
-{
- char temp[10];
- sprintf(temp, "%.1f", difftime(m_endTime, m_startTime));
- string tempStr(temp) ;
- outStr = tempStr;
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 26-06-2008
- * NAME : getSystemTimeString
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-int LTKWindowsUtil::getSystemTimeString(string& outStr)
-{
- time_t rawtime;
-
- time(&rawtime);
-
- string timeStr = ctime(&rawtime);
-
- outStr = timeStr.substr(0, 24);
-
- return SUCCESS;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 17-07-2008
- * NAME : getLibraryHandle
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-
-void* LTKWindowsUtil::getLibraryHandle(const string& libName)
-{
- string libNameWindows = libName +
-#ifndef NDEBUG
- "d"
-#endif
- ".dll";
-
- void* libHandle = NULL;
-
- libHandle = GetModuleHandle(libNameWindows.c_str());
-
- return libHandle;
-}
-
-/**************************************************************************
- * AUTHOR : Nidhi Sharma
- * DATE : 17-07-2008
- * NAME : getEnvVariable
- * DESCRIPTION :
- * ARGUMENTS :
- *
- * RETURNS :
- * NOTES :
- * CHANGE HISTROY
- * Author Date Description
- ***************************************************************************/
-
-string LTKWindowsUtil::getEnvVariable(const string& envVariableName)
-{
- return getenv(envVariableName.c_str());
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h
deleted file mode 100644
index d62350d9..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/LTKWindowsUtil.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all copies or
-* substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-08-12 11:34:07 +0530 (Tue, 12 Aug 2008) $
- * $Revision: 604 $
- * $Author: sharmnid $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR:
- *
- * CONTENTS:
- *
- * AUTHOR:
- *
- * DATE: May 29, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#ifndef __LTKWINDOWSUTIL_H
-#define __LTKWINDOWSUTIL_H
-
-#define BUFSIZE 256
-
-#include "LTKOSUtil.h"
-
-class LTKWindowsUtil: public LTKOSUtil
-{
-private:
- time_t m_startTime;
-
- time_t m_endTime;
-
-public:
-
- /**
- * @name Constructors and Destructor
- */
-
- // @{
-
- /**
- * Default Constructor
- */
-
- LTKWindowsUtil();
-
- /**
- * Destructor
- */
-
- ~LTKWindowsUtil();
-
- // @}
- int loadSharedLib(const string& lipiLibPath,
- const string& sharedLibName,
- void** libHandle);
-
- int unloadSharedLib(void* libHandle);
-
- int getFunctionAddress(void * libHandle,
- const string& functionName,
- void** functionHandle);
-
- int getPlatformName(string& outStr);
-
- int getProcessorArchitechure(string& outStr);
-
- int getOSInfo(string& outStr);
-
- int recordStartTime();
-
- int recordEndTime();
-
- int diffTime(string& outStr);
-
- int getSystemTimeString(string& outStr);
-
- void* getLibraryHandle(const string& libName);
-
- string getEnvVariable(const string& envVariableName);
-
-};
-
-
-#endif
-
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/lib.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/lib.pro
deleted file mode 100644
index f5ed0149..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/lib/lib.pro
+++ /dev/null
@@ -1,39 +0,0 @@
-BASE_TARGET_NAME = ltkutil
-include(../../lipilib.pri)
-
-win32: DEFINES -= UNICODE
-
-HEADERS += \
- LTKCheckSumGenerate.h \
- LTKConfigFileReader.h \
- LTKDynamicTimeWarping.h \
- LTKErrors.h \
- LTKHierarchicalClustering.h \
- LTKImageWriter.h \
- LTKInkFileReader.h \
- LTKInkFileWriter.h \
- LTKInkUtils.h \
- LTKLinuxUtil.h \
- LTKLoggerUtil.h \
- LTKStrEncoding.h \
- LTKStringUtil.h \
- LTKVersionCompatibilityCheck.h \
- LTKWinCEUtil.h \
- LTKWindowsUtil.h
-
-SOURCES += \
- LTKCheckSumGenerate.cpp \
- LTKConfigFileReader.cpp \
- LTKInkFileReader.cpp \
- LTKInkFileWriter.cpp \
- LTKLoggerUtil.cpp \
- LTKInkUtils.cpp \
- LTKStrEncoding.cpp \
- LTKErrors.cpp \
- LTKStringUtil.cpp \
- LTKVersionCompatibilityCheck.cpp \
- LTKOSUtilFactory.cpp \
- LTKImageWriter.cpp
-
-win32: SOURCES += LTKWindowsUtil.cpp
-else: SOURCES += LTKLinuxUtil.cpp
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/.prev_CMakeLists.txt
deleted file mode 100644
index 809dce7b..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from logger.pro.
-
-#####################################################################
-## logger Generic Library:
-#####################################################################
-
-qt_add_cmake_library(logger
- MODULE
- INSTALL_DIRECTORY "$$[QT_INSTALL_PLUGINS]/lipi_toolkit"
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- LTKLogger.cpp
- logger.cpp logger.h
- INCLUDE_DIRECTORIES
- ../../include
- ../lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(logger)
-
-#### Keys ignored in scope 1:.:.:logger.pro:<TRUE>:
-# LIPILIBS = "ltkutil"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(logger CONDITION WIN32
- DEFINES
- LOGGER_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(logger CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
-)
-
-qt_autogen_tools_initial_setup(logger)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/CMakeLists.txt b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/CMakeLists.txt
deleted file mode 100644
index dc494bd8..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from logger.pro.
-
-#####################################################################
-## logger Generic Library:
-#####################################################################
-
-qt_add_cmake_library(logger
- MODULE
- INSTALL_DIRECTORY "${INSTALL_PLUGINSDIR}/lipi_toolkit" # special case
- OUTPUT_DIRECTORY "${QT_BUILD_DIR}/plugins/lipi_toolkit"
- SOURCES
- LTKLogger.cpp
- logger.cpp logger.h
- INCLUDE_DIRECTORIES
- ../../include
- ../lib
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-qt_disable_warnings(logger)
-
-#### Keys ignored in scope 1:.:.:logger.pro:<TRUE>:
-# LIPILIBS = "ltkutil"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(logger CONDITION WIN32
- DEFINES
- LOGGER_EXPORTS
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(logger CONDITION NOT LIPILIBS_ISEMPTY
- PUBLIC_LIBRARIES
- # Remove: L/lib
- lkutil # special case
-)
-
-qt_autogen_tools_initial_setup(logger)
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp
deleted file mode 100644
index 75ad218e..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/LTKLogger.cpp
+++ /dev/null
@@ -1,399 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate: 2008-01-10 14:36:54 +0530 (Thu, 10 Jan 2008) $
- * $Revision: 353 $
- * $Author: charakan $
- *
- ************************************************************************/
-/************************************************************************
- * FILE DESCR: Implementation of the Debug Logging Module
- *
- * CONTENTS:
- *
- * AUTHOR: Balaji R.
- *
- * DATE: December 23, 2004
- * CHANGE HISTORY:
- * Author Date Description of change
- ************************************************************************/
-
-#include "LTKLogger.h"
-#include "LTKMacros.h"
-#include "LTKErrorsList.h"
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-
-LTKLoggerInterface* LTKLogger::loggerInstance = NULL;
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKLogger
-* DESCRIPTION : Default Constructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKLogger::LTKLogger():
-m_debugLevel(LTKLogger::LTK_LOGLEVEL_ERR),
-m_logFileName(DEFAULT_LOG_FILE),
-m_logStatus(INACTIVE),
-m_isTimeStamped(true)
-{
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : LTKLogger
-* DESCRIPTION : destructor
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKLogger::~LTKLogger()
-{
- stopLog();
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : operator()
-* DESCRIPTION : overloaded function call operator
-* ARGUMENTS : msgDebugLevel - log level of the messages to be logged
-* RETURNS : reference to an output stream object
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-ostream& LTKLogger::operator()(const EDebugLevel& msgDebugLevel,
- const string& fileName,
- int lineNumber)
-{
- if ( m_debugLevel <= msgDebugLevel )
- {
- writeAuxInfo(fileName, lineNumber);
-
- switch ( msgDebugLevel )
- {
-
- case LTKLogger::LTK_LOGLEVEL_ALL:
- m_logFile << "[All] ";
- break;
-
- case LTKLogger::LTK_LOGLEVEL_VERBOSE:
- m_logFile << "[Verbose] ";
- break;
- case LTKLogger::LTK_LOGLEVEL_DEBUG:
- m_logFile << "[Debug] ";
- break;
-
- case LTKLogger::LTK_LOGLEVEL_INFO:
- m_logFile << "[Info] ";
- break;
-
- case LTKLogger::LTK_LOGLEVEL_ERR:
- m_logFile << "[Error] ";
- break;
- }
-
- m_logFile.flush();
-
- return m_logFile;
- }
-
- // if m_debugLevel is higher than the message importance,
- // then don't attempt to process it's input
- return m_ofstream;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : writeAuxInfo
-* DESCRIPTION : writes the data, time, file, line no. information into the log file
-* ARGUMENTS : fileName - name of file containing the log message
-* lineNumber - line number of the log message
-* RETURNS : SUCCESS on successful writing of the auxiliary information
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-int LTKLogger::writeAuxInfo(const string& fileName, int lineNumber)
-{
-
- #ifdef LOGGEROFF
- return FAILURE;
- #endif
-
- if(m_isTimeStamped)
- {
- LTKOSUtil *pOSUtil = LTKOSUtilFactory::getInstance() ;
-
- string formattedTimeStr ;
- pOSUtil->getSystemTimeString(formattedTimeStr) ;
- m_logFile << formattedTimeStr << ' ';
- delete pOSUtil ;
-
- /*
- time_t rawtime;
-
- time(&rawtime);
-
- string timeStr = ctime(&rawtime);
-
- string formattedTimeStr = timeStr.substr(0, 24);
-
- m_logFile << formattedTimeStr << ' ';
- */
- }
-
- m_logFile << fileName.substr(fileName.find_last_of(SEPARATOR) + 1, fileName.size());
-
- if(lineNumber != 0)
- {
- m_logFile << '(' << lineNumber << "): ";
- }
-
- return SUCCESS;
-}
-
-
-/***************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setLogLevel
-* DESCRIPTION : sets the level of the messages to be logged
-* ARGUMENTS : debugLevel - level of the messages to be logged
-* RETURNS : SUCCESS on successful set operation
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-****************************************************************************/
-
-int LTKLogger::setLogLevel(const EDebugLevel& debugLevel)
-{
- #ifdef LOGGEROFF
- return FAILURE;
- #endif
-
- m_debugLevel = debugLevel;
-
- return SUCCESS;
-}
-
-/****************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : setLogFileName
-* DESCRIPTION : sets the name of the file to be used for logging
-* ARGUMENTS : logFileName - name of the file to be used for logging
-* RETURNS : Nothing
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Balaji MNA 07-Apr-2009 To fix bug: LIPTKT-600
-*****************************************************************************/
-
-void LTKLogger::setLogFileName(const string& logFileName)
-{
-
- #ifdef LOGGEROFF
- return;
- #endif
-
- m_logStatus = INACTIVE;
- m_logFileName = logFileName;
-}
-
-/**********************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getLogLevel
-* DESCRIPTION : returns the log of messages to be logged
-* ARGUMENTS :
-* RETURNS : log of messages to be logged
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*************************************************************************************/
-
-LTKLogger::EDebugLevel LTKLogger::getLogLevel()
-{
- #ifdef LOGGEROFF
- return string("Logger is off");
- #endif
- return m_debugLevel;
-}
-
-/*****************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : getLogFileName
-* DESCRIPTION : returns the name of the log file
-* ARGUMENTS :
-* RETURNS : name of the log file
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-******************************************************************************/
-
-const string& LTKLogger::getLogFileName()
-{
- return m_logFileName;
-}
-
-/****************************************************************************
-* AUTHOR : Balaji R.
-* DATE : 23-DEC-2004
-* NAME : startLog
-* DESCRIPTION : starts the logging operation
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful start of logging
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-****************************************************************************/
-
-int LTKLogger::startLog(bool isTimeStamped)
-{
-
- if (m_debugLevel == LTK_LOGLEVEL_OFF )
- return FAILURE;
-
- if(m_logStatus == INACTIVE)
- {
- m_isTimeStamped = isTimeStamped;
-
- if(m_logFileName != "")
- {
- m_logFile.close();
-
- m_logFile.clear();
-
- m_logFile.open(m_logFileName.c_str(), ios::app);
- }
-
- if(m_logFileName == "" || !m_logFile)
- {
- // log the non-existance of m_logFileName file path is unable to open m_logFileName
-
- return (ELOG_FILE_NOT_EXIST);
-
- m_logFile.close();
-
- m_logFile.clear();
-
- m_logFile.open(m_logFileName.c_str(), ios::app);
- }
-
- m_logStatus = ACTIVE;
- }
-
- return SUCCESS;
-}
-
-/****************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 12-SEPT-2005
-* NAME : getInstance
-* DESCRIPTION : This file will return the address of the Logger instance.
-* ARGUMENTS :
-* RETURNS : Address of the Logger instance.
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-* Thanigai 28-NOV-05 returning the address of global Logger object
-* is giving runtime error, because the vfptr is not
-* getting initialized(vtable). So implementing the
-* workaround by allocating a new Logger object runtime.
-*****************************************************************************/
-
-LTKLoggerInterface* LTKLogger::getInstance()
-{
- if(loggerInstance == NULL)
- {
- loggerInstance = new LTKLogger();
- }
-
- return loggerInstance;
-
-}
-
-/****************************************************************************
-* AUTHOR : Nidhi sharma
-* DATE : 12-SEPT-2005
-* NAME : destroyLoggerInstance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-void LTKLogger::destroyLoggerInstance()
-{
- if (loggerInstance != NULL)
- {
- delete loggerInstance;
- loggerInstance = NULL;
- }
-}
-
-/****************************************************************************
-* AUTHOR : Thanigai
-* DATE : 12-SEPT-2005
-* NAME : stopLog
-* DESCRIPTION : stops the logging operation
-* ARGUMENTS :
-* RETURNS : SUCCESS on successful stop of logging
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-*****************************************************************************/
-
-int LTKLogger::stopLog()
-{
- if (m_debugLevel == LTK_LOGLEVEL_OFF )
- return FAILURE;
-
- if(m_logFileName != "")
- {
- m_logFile.close();
- m_logStatus = INACTIVE;
- return 0;
- }
- return FAILURE;
-}
-
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.cpp b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.cpp
deleted file mode 100644
index 2fa735bb..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE
-********************************************************************************/
-
-/******************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate$
- * $Revision$
- * $Author$
- *
- ************************************************************************/
-/***************************************************************************
- * FILE DESCR: DLL Implementation file for logger module
- *
- * CONTENTS:
- * DllMain
- *
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: April 01, 2008
- *
- * CHANGE HISTORY:
- *
- * Author Date Description of change
- ************************************************************************/
-#include "logger.h"
-#include "LTKLoggerUtil.h"
-#include "LTKLoggerInterface.h"
-#include "LTKLogger.h"
-#include "LTKMacros.h"
-#include "LTKErrorsList.h"
-
-
-
-LTKLoggerInterface* ptrLog = LTKLogger::getInstance();
-
-/************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 01-APR-2008
-* NAME : DllMain
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-************************************************************************/
-#ifdef _WIN32
-BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- break;
- case DLL_THREAD_ATTACH:
- break;
-
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
-#endif // #ifdef _WIN32
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 01-APR-2008
-* NAME : getLoggerInstance
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-LTKLoggerInterface* getLoggerInstance()
-{
- return ptrLog;
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 01-APR-2008
-* NAME : destroyLogger
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-void destroyLogger()
-{
- ptrLog = NULL;
- LTKLogger::destroyLoggerInstance();
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 01-APR-2008
-* NAME : setLogFileName
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-void setLoggerFileName(const string& logFileName)
-{
- if (!ptrLog) return;
- ptrLog->setLogFileName(logFileName);
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 01-APR-2008
-* NAME : setLogLevel
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-int setLoggerLevel(LTKLogger::EDebugLevel logLevel)
-{
- if (!ptrLog) return FAILURE;
- return ptrLog->setLogLevel(logLevel);
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 01-APR-2008
-* NAME : getLogFileName
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-const string& getLoggerFileName()
-{
- static string emptyStr;
- if (!ptrLog) return emptyStr;
- return ptrLog->getLogFileName();
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 03-APR-2008
-* NAME : getLogLevel
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-LTKLogger::EDebugLevel getLoggerLevel()
-{
- if (!ptrLog) return LTKLogger::LTK_LOGLEVEL_OFF;
- return ptrLog->getLogLevel();
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 02-APR-2008
-* NAME : startLog
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-void startLogger()
-{
- if (!ptrLog) return;
- ptrLog->startLog();
-}
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 02-APR-2008
-* NAME : startLog
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-void stopLogger()
-{
- if (!ptrLog) return;
- ptrLog->stopLog();
-}
-
-
-/***************************************************************************
-* AUTHOR : Nidhi Sharma
-* DATE : 08-APR-2008
-* NAME : logMessage
-* DESCRIPTION :
-* ARGUMENTS :
-* RETURNS :
-* NOTES :
-* CHANGE HISTROY
-* Author Date Description of change
-***************************************************************************/
-ostream& logMessage(LTKLogger::EDebugLevel logLevel, const string& fileName,
- int lineNumber)
-{
- if (!ptrLog) return LTKLoggerUtil::m_emptyStream;
- return (*ptrLog)(logLevel, fileName, lineNumber);
-} \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.def b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.def
deleted file mode 100644
index 5a47ec22..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.def
+++ /dev/null
@@ -1,10 +0,0 @@
-EXPORTS
- getLoggerInstance @1
- setLoggerFileName @2
- setLoggerLevel @3
- getLoggerFileName @4
- getLoggerLevel @5
- startLogger @6
- stopLogger @7
- logMessage @9
- destroyLogger @10 \ No newline at end of file
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.h b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.h
deleted file mode 100644
index dfcbde30..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************************
-* Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to use,
-* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-* Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*****************************************************************************************/
-
-/************************************************************************
- * SVN MACROS
- *
- * $LastChangedDate$
- * $Revision$
- * $Author$
- *
- ************************************************************************/
-
-/************************************************************************
- * FILE DESCR: Definitions for Logger dll exporting functions.
- *
- * CONTENTS:
- *
- * AUTHOR: Nidhi Sharma
- *
- * DATE: 01-April-2008
- *
- * CHANGE HISTORY:
- *
- * Author Date Description
- ************************************************************************/
-#ifndef __LOGGERDLL_H__
-#define __LOGGERDLL_H__
-
-#ifndef _WIN32
-#include <dlfcn.h>
-#else
-#include <windows.h>
-#endif
-
-
-#ifdef _WIN32
-#ifdef LOGGER_EXPORTS
-#define LOGGER_API __declspec(dllexport)
-#else
-#define LOGGER_API __declspec(dllimport)
-#endif //#ifdef LOGGER_EXPORTS
-#else
-#define LOGGER_API
-#endif //#ifdef _WIN32
-
-class LTKLoggerInterface;
-#include "LTKLogger.h"
-#include "LTKTypes.h"
-
-
-extern "C" LOGGER_API LTKLoggerInterface* getLoggerInstance();
-
-extern "C" LOGGER_API void destroyLogger();
-
-extern "C" LOGGER_API void setLoggerFileName(const string& logFileName);
-
-extern "C" LOGGER_API int setLoggerLevel(LTKLogger::EDebugLevel logLevel);
-
-extern "C" LOGGER_API const string& getLoggerFileName();
-
-extern "C" LOGGER_API LTKLogger::EDebugLevel getLoggerLevel();
-
-extern "C" LOGGER_API void startLogger();
-
-extern "C" LOGGER_API void stopLogger();
-
-extern "C" LOGGER_API ostream& logMessage(LTKLogger::EDebugLevel,
- const string& fileName,
- int lineNumber);
-
-
-
-
-#endif //#ifndef __LOGGERDLL_H__
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.pro
deleted file mode 100644
index 5f1cc5ac..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/logger/logger.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-LIPILIBS = ltkutil
-include(../../lipiplugin.pri)
-CONFIG -= exceptions
-
-HEADERS += \
- logger.h \
-
-SOURCES += \
- logger.cpp \
- LTKLogger.cpp \
-
-INCLUDEPATH += \
- ../lib \
-
-win32 {
- DEFINES += LOGGER_EXPORTS
- LIBS += Advapi32.lib
- #DEF_FILE = logger.def
-}
diff --git a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/util.pro b/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/util.pro
deleted file mode 100644
index 79cfc027..00000000
--- a/src/plugins/lipi-toolkit/3rdparty/lipi-toolkit/src/util/util.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- lib \
- logger
-
-logger.depends = lib
diff --git a/src/plugins/lipi-toolkit/CMakeLists.txt b/src/plugins/lipi-toolkit/CMakeLists.txt
deleted file mode 100644
index e6332d18..00000000
--- a/src/plugins/lipi-toolkit/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from lipi-toolkit.pro.
-
-add_subdirectory(3rdparty/lipi-toolkit)
-add_subdirectory(plugin)
diff --git a/src/plugins/lipi-toolkit/lipi-toolkit.pro b/src/plugins/lipi-toolkit/lipi-toolkit.pro
deleted file mode 100644
index ce996b66..00000000
--- a/src/plugins/lipi-toolkit/lipi-toolkit.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- 3rdparty/lipi-toolkit \
- plugin
-
-plugin.depends += 3rdparty/lipi-toolkit
diff --git a/src/plugins/lipi-toolkit/plugin/.prev_CMakeLists.txt b/src/plugins/lipi-toolkit/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index b1821896..00000000
--- a/src/plugins/lipi-toolkit/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardLipiPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardLipiPlugin
- OUTPUT_NAME qtvirtualkeyboard_lipi
- TYPE virtualkeyboard
- EXCEPTIONS
- SOURCES
- lipiinputmethod.cpp lipiinputmethod_p.h
- lipiplugin.cpp lipiplugin.h
- lipisharedrecognizer.cpp lipisharedrecognizer_p.h
- lipiworker.cpp lipiworker_p.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- INCLUDE_DIRECTORIES
- ../3rdparty/lipi-toolkit/src/include
- ../3rdparty/lipi-toolkit/src/util/lib
- PUBLIC_LIBRARIES
- # Remove: L${CMAKE_CURRENT_BINARY_DIR}/../../../../lib
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboardPrivate
- ltkcommon
- ltkutil
- shaperecommon
-)
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# INSTALLS = "ltk_projects"
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fallback/handwriting.qml"
-# OTHER_FILES = "lipi.json" "$$LAYOUT_FILES"
-# ltk_projects.files = "$$PWD/../3rdparty/lipi-toolkit/projects"
-# ltk_projects.path = "$$VIRTUALKEYBOARD_INSTALL_DATA/lipi_toolkit"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QtVirtualKeyboardLipiPlugin CONDITION WIN32
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(QtVirtualKeyboardLipiPlugin CONDITION UNIX
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
-)
-
-#### Keys ignored in scope 4:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "ltk_projects"
-
-qt_extend_target(QtVirtualKeyboardLipiPlugin CONDITION QT_FEATURE_hunspell
- PUBLIC_LIBRARIES
- Qt::HunspellInputMethodPrivate
-)
-
-#### Keys ignored in scope 6:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_GB:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback"
-
-#### Keys ignored in scope 7:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_US:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback"
-
-#### Keys ignored in scope 8:.:.:plugin.pro:qtConfig(vkb-lang-id.ID):
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback"
-
-#### Keys ignored in scope 9:.:.:plugin.pro:QT_FEATURE_vkb_lang_ms_MY:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback"
-
-#### Keys ignored in scope 10:.:.:plugin.pro:QT_FEATURE_vkb_lang_nl_NL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback"
-
-if(NOT LAYOUT_FILES_ISEMPTY)
- # Resources:
- set(qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/fallback/handwriting.qml"
- )
-
- qt_add_resource(QtVirtualKeyboardLipiPlugin "qmake_virtualkeyboard_ltk_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_ltk_layouts_resource_files}
- )
-endif()
diff --git a/src/plugins/lipi-toolkit/plugin/CMakeLists.txt b/src/plugins/lipi-toolkit/plugin/CMakeLists.txt
deleted file mode 100644
index 3b905b0f..00000000
--- a/src/plugins/lipi-toolkit/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,133 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardLipiPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardLipiPlugin
- OUTPUT_NAME qtvirtualkeyboard_lipi
- TYPE virtualkeyboard
- EXCEPTIONS
- SOURCES
- lipiinputmethod.cpp lipiinputmethod_p.h
- lipiplugin.cpp lipiplugin.h
- lipisharedrecognizer.cpp lipisharedrecognizer_p.h
- lipiworker.cpp lipiworker_p.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- INCLUDE_DIRECTORIES
- ../3rdparty/lipi-toolkit/src/include
- ../3rdparty/lipi-toolkit/src/util/lib
- PUBLIC_LIBRARIES
- # Remove: L${CMAKE_CURRENT_BINARY_DIR}/../../../../lib
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboardPrivate
- ltkcommon
- ltkutil
- shaperecommon
-)
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# INSTALLS = "ltk_projects"
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fallback/handwriting.qml"
-# OTHER_FILES = "lipi.json" "$$LAYOUT_FILES"
-# ltk_projects.files = "$$PWD/../3rdparty/lipi-toolkit/projects"
-# ltk_projects.path = "$$VIRTUALKEYBOARD_INSTALL_DATA/lipi_toolkit"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QtVirtualKeyboardLipiPlugin CONDITION WIN32
- PUBLIC_LIBRARIES
- Advapi32.lib
-)
-
-qt_extend_target(QtVirtualKeyboardLipiPlugin CONDITION UNIX
- PUBLIC_LIBRARIES
- ${CMAKE_DL_LIBS}
-)
-
-#### Keys ignored in scope 4:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "ltk_projects"
-
-qt_extend_target(QtVirtualKeyboardLipiPlugin CONDITION QT_FEATURE_hunspell
- PUBLIC_LIBRARIES
- Qt::HunspellInputMethodPrivate
-)
-
-#### Keys ignored in scope 6:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_GB:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback"
-
-#### Keys ignored in scope 7:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_US:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback"
-
-#### Keys ignored in scope 8:.:.:plugin.pro:qtConfig(vkb-lang-id.ID):
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback"
-
-#### Keys ignored in scope 9:.:.:plugin.pro:QT_FEATURE_vkb_lang_ms_MY:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback"
-
-#### Keys ignored in scope 10:.:.:plugin.pro:QT_FEATURE_vkb_lang_nl_NL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback"
-
-# special case begin
-# this secition needs to be commented out
-#if(NOT LAYOUT_FILES_ISEMPTY)
- # Resources:
- # set(qmake_virtualkeyboard_ltk_layouts_resource_files
- # ....
-#endif()
-
-set(qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/fallback/handwriting.qml"
-)
-
-if (QT_FEATURE_vkb_lang_en_GB)
- list(APPEND qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/en_GB/handwriting.fallback"
- )
-endif()
-
-if (QT_FEATURE_vkb_lang_en_US)
- list(APPEND qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/en_US/handwriting.fallback"
- )
-endif()
-
-if (QT_FEATURE_vkb_lang_id_ID)
- list(APPEND qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/id_ID/handwriting.fallback"
- )
-endif()
-
-if (QT_FEATURE_vkb_lang_ms_MY)
- list(APPEND qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/ms_MY/handwriting.fallback"
- )
-endif()
-
-if (QT_FEATURE_vkb_lang_nl_NL)
- list(APPEND qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/nl_NL/handwriting.fallback"
- )
-endif()
-
-set(qmake_virtualkeyboard_ltk_layouts_resource_files
- "virtualkeyboard/content/layouts/fallback/handwriting.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardLipiPlugin "qmake_virtualkeyboard_ltk_layouts"
- PREFIX
- "${VKB_LAYOUTS_PREFIX}"
- BASE
- "${VKB_LAYOUTS_BASE}"
- FILES
- ${qmake_virtualkeyboard_ltk_layouts_resource_files}
-)
-
-# special case end
diff --git a/src/plugins/lipi-toolkit/plugin/lipi.json b/src/plugins/lipi-toolkit/plugin/lipi.json
deleted file mode 100644
index 8e22b4e9..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipi.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "handwriting",
- "Provider": "Qt Lipi-Toolkit Extension",
- "InputMethod": "HandwritingInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/lipi-toolkit/plugin/lipiinputmethod.cpp b/src/plugins/lipi-toolkit/plugin/lipiinputmethod.cpp
deleted file mode 100644
index 67e87521..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipiinputmethod.cpp
+++ /dev/null
@@ -1,641 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "lipiinputmethod_p.h"
-#include "lipisharedrecognizer_p.h"
-#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
-#include <QtVirtualKeyboard/private/shifthandler_p.h>
-#include <QLoggingCategory>
-#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
-#include <QtVirtualKeyboard/private/handwritinggesturerecognizer_p.h>
-
-#if QT_CONFIG(hunspell)
-#include <QtHunspellInputMethod/private/hunspellinputmethod_p_p.h>
-#endif
-
-#include "LTKCaptureDevice.h"
-#include "LTKScreenContext.h"
-#include "LTKTraceGroup.h"
-#include "LTKChannel.h"
-#include "LTKTraceFormat.h"
-#include "LTKTrace.h"
-#include "LTKShapeRecoResult.h"
-
-#include <QCryptographicHash>
-
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
-#include <QtVirtualKeyboard/private/unipentrace_p.h>
-#include <QStandardPaths>
-#endif
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-#if QT_CONFIG(hunspell)
-#define LipiInputMethodPrivateBase HunspellInputMethodPrivate
-#else
-#define LipiInputMethodPrivateBase DummyPrivate
-class DummyPrivate {};
-#endif
-
-Q_LOGGING_CATEGORY(lcLipi, "qt.virtualkeyboard.lipi")
-
-class LipiInputMethodPrivate : public LipiInputMethodPrivateBase
-{
- Q_DECLARE_PUBLIC(LipiInputMethod)
-public:
- LipiInputMethodPrivate(LipiInputMethod *q_ptr) :
-#if QT_CONFIG(hunspell)
- LipiInputMethodPrivateBase(static_cast<HunspellInputMethod *>(q_ptr)),
-#else
- LipiInputMethodPrivateBase(),
-#endif
- q_ptr(q_ptr),
- recognizeTimer(0),
- textCase(QVirtualKeyboardInputEngine::TextCase::Lower)
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- , unipenTrace(0)
-#endif
- {
- }
-
- ~LipiInputMethodPrivate()
- {
- cancelRecognition();
- }
-
- QByteArray getContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo,
- const QVariantMap &traceScreenInfo) const
- {
- QCryptographicHash hash(QCryptographicHash::Md5);
-
- hash.addData((const char *)&patternRecognitionMode, sizeof(patternRecognitionMode));
-
- QByteArray mapData;
- QDataStream ds(&mapData, QIODevice::WriteOnly);
- ds << traceCaptureDeviceInfo;
- ds << traceScreenInfo;
- hash.addData(mapData);
-
- return hash.result();
- }
-
- void setContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo,
- const QVariantMap &traceScreenInfo)
- {
- QByteArray context = getContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
- if (context == currentContext)
- return;
-
- qCDebug(lcLipi) << "LipiInputMethodPrivate::setContext():" << QLatin1String(context.toHex());
-
- clearTraces();
-
- deviceInfo.reset(new LTKCaptureDevice());
- deviceInfo->setSamplingRate(traceCaptureDeviceInfo.value(QLatin1String("sampleRate"), 60).toInt());
- deviceInfo->setXDPI(traceCaptureDeviceInfo.value(QLatin1String("dpi"), 96).toInt());
- deviceInfo->setYDPI(deviceInfo->getXDPI());
- deviceInfo->setLatency(traceCaptureDeviceInfo.value(QLatin1String("latency"), 0.0).toFloat());
- deviceInfo->setUniformSampling(traceCaptureDeviceInfo.value(QLatin1String("uniform"), false).toBool());
-
- screenContext.reset(new LTKScreenContext());
- QRectF boundingBox(traceScreenInfo.value(QLatin1String("boundingBox")).toRectF());
- if (!boundingBox.isEmpty()) {
- screenContext->setBboxLeft(boundingBox.left());
- screenContext->setBboxTop(boundingBox.top());
- screenContext->setBboxRight(boundingBox.right());
- screenContext->setBboxBottom(boundingBox.bottom());
- }
-
- QVariantList horizontalRulers(traceScreenInfo.value(QLatin1String("horizontalRulers"), QVariantList()).toList());
- if (!horizontalRulers.isEmpty()) {
- for (QVariantList::ConstIterator i = horizontalRulers.constBegin();
- i != horizontalRulers.constEnd(); i++) {
- screenContext->addHLine(i->toFloat());
- }
- }
-
- QVariantList verticalRulers(traceScreenInfo.value(QLatin1String("verticalRulers"), QVariantList()).toList());
- if (!horizontalRulers.isEmpty()) {
- for (QVariantList::ConstIterator i = verticalRulers.constBegin();
- i != verticalRulers.constEnd(); i++) {
- screenContext->addVLine(i->toFloat());
- }
- }
-
- gestureRecognizer.setDpi(deviceInfo->getXDPI());
-
- currentContext = context;
- }
-
- QVirtualKeyboardTrace *traceBegin(
- int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
- {
- Q_UNUSED(traceId);
-
- stopRecognizeTimer();
-
- setContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
-
- if (recognitionTask) {
- recognizer.cancelRecognitionTask(recognitionTask);
- recognitionTask.reset();
- delayedResult.clear();
- }
-
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- if (!unipenTrace) {
- Q_Q(LipiInputMethod);
- unipenTrace = new UnipenTrace(traceCaptureDeviceInfo, traceScreenInfo, q);
- }
-#endif
-
- QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace();
- trace->setChannels(QStringList(QLatin1String("t")));
- traceList.append(trace);
-
- return trace;
- }
-
- void traceEnd(QVirtualKeyboardTrace *trace)
- {
- if (trace->isCanceled()) {
- qCDebug(lcLipi) << "LipiInputMethodPrivate::traceEnd(): discarded" << trace;
- traceList.removeOne(trace);
- delete trace;
- } else {
- addPointsToTraceGroup(trace);
- }
- handleGesture();
- if (!traceList.isEmpty() && countActiveTraces() == 0)
- restartRecognition();
- }
-
- int countActiveTraces() const
- {
- int count = 0;
- for (QVirtualKeyboardTrace *trace : qAsConst(traceList)) {
- if (!trace->isFinal())
- count++;
- }
- return count;
- }
-
- void handleGesture()
- {
- if (countActiveTraces() > 0)
- return;
-
- QVariantMap gesture = gestureRecognizer.recognize(traceList);
- if (gesture.isEmpty())
- return;
-
- qCDebug(lcLipi) << "LipiInputMethodPrivate::handleGesture():" << gesture;
-
- if (gesture[QLatin1String("type")].toString() == QLatin1String("swipe")) {
-
- static const int SWIPE_MIN_LENGTH = 25; // mm
- static const int SWIPE_ANGLE_THRESHOLD = 15; // degrees +-
-
- qreal swipeLength = gesture[QLatin1String("length_mm")].toReal();
- if (swipeLength >= SWIPE_MIN_LENGTH) {
-
- Q_Q(LipiInputMethod);
- QVirtualKeyboardInputContext *ic = q->inputContext();
- if (!ic)
- return;
-
- qreal swipeAngle = gesture[QLatin1String("angle_degrees")].toReal();
- int swipeTouchCount = gesture[QLatin1String("touch_count")].toInt();
-
- // Swipe left
- if (swipeAngle <= 180 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 180 - SWIPE_ANGLE_THRESHOLD) {
- if (swipeTouchCount == 1) {
- // Single swipe: backspace
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- dumpTraces();
- saveTraces(Qt::Key_Backspace, 100);
-#endif
- cancelRecognition();
- ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
- } else if (swipeTouchCount == 2) {
- // Double swipe: reset word, or backspace
- cancelRecognition();
- if (!ic->preeditText().isEmpty()) {
- q->reset();
- ic->setPreeditText(QString());
- } else {
- ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
- }
- }
- return;
- }
-
- // Swipe right
- if (swipeAngle <= SWIPE_ANGLE_THRESHOLD || swipeAngle >= 360 - SWIPE_ANGLE_THRESHOLD) {
- if (swipeTouchCount == 1) {
- // Single swipe: space
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- dumpTraces();
- saveTraces(Qt::Key_Space, 100);
-#endif
- cancelRecognition();
- ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
- } else if (swipeTouchCount == 2) {
- // Double swipe: commit word, or insert space
- cancelRecognition();
-#if QT_CONFIG(hunspell)
- int activeWordIndex = wordCandidates.index();
- if (activeWordIndex != -1) {
- q->selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
- return;
- }
-#endif
- ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
- }
- return;
- }
-
- // Swipe up
- if (swipeAngle <= 270 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 270 - SWIPE_ANGLE_THRESHOLD) {
- if (swipeTouchCount == 1) {
- // Single swipe: toggle input mode
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- dumpTraces();
- saveTraces(Qt::Key_Mode_switch, 100);
-#endif
- cancelRecognition();
- if (!(ic->inputMethodHints() & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly))) {
- QVirtualKeyboardInputEngine::InputMode inputMode = ic->inputEngine()->inputMode();
- inputMode = inputMode == QVirtualKeyboardInputEngine::InputMode::Latin ?
- QVirtualKeyboardInputEngine::InputMode::Numeric : QVirtualKeyboardInputEngine::InputMode::Latin;
- ic->inputEngine()->setInputMode(inputMode);
- }
- } else if (swipeTouchCount == 2) {
- // Double swipe: toggle text case
- cancelRecognition();
- ic->priv()->shiftHandler()->toggleShift();
- }
- return;
- }
- }
- }
- }
-
- void clearTraces()
- {
- qDeleteAll(traceList);
- traceList.clear();
- traceGroup.emptyAllTraces();
- }
-
- void addPointsToTraceGroup(QVirtualKeyboardTrace *trace)
- {
- vector<LTKChannel> channels;
- channels.push_back(LTKChannel("X", DT_INT, true));
- channels.push_back(LTKChannel("Y", DT_INT, true));
- bool hasTime = trace->channels().contains(QLatin1String("t"));
- if (hasTime)
- channels.push_back(LTKChannel("T", DT_FLOAT, true));
- LTKTraceFormat traceFormat(channels);
- LTKTrace ltktrace(traceFormat);
-
- const QVariantList points = trace->points();
- const QVariantList timeData = hasTime ? trace->channelData(QLatin1String("t")) : QVariantList();
- QVariantList::ConstIterator t = timeData.constBegin();
- for (const QVariant &p : points) {
- const QPointF pt(p.toPointF());
- vector<float> point;
- point.push_back(pt.x());
- point.push_back(pt.y());
- if (hasTime) {
- point.push_back(t->toFloat());
- t++;
- }
- ltktrace.addPoint(point);
- }
- traceGroup.addTrace(ltktrace);
- }
-
- void finishRecognition()
- {
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- dumpTraces();
-#endif
- stopRecognizeTimer();
- clearTraces();
- if (recognitionTask && !delayedResult.isEmpty() && recognitionTask->resultId() == delayedResult[QLatin1String("resultId")].toInt())
- processResult(delayedResult);
- delayedResult.clear();
- recognitionTask.reset();
- }
-
- void restartRecognition()
- {
- recognitionTask = recognizer.newRecognition(*deviceInfo, *screenContext, subsetOfClasses, 0.0f, 4);
- if (recognitionTask) {
- Q_Q(LipiInputMethod);
-
- recognitionTask->traceGroup = traceGroup;
-
- QSharedPointer<LipiRecognitionResultsTask> resultsTask = recognizer.startRecognition(recognitionTask);
- q->connect(resultsTask.data(), SIGNAL(resultsAvailable(const QVariantList &)), SLOT(resultsAvailable(const QVariantList &)));
-
- resetRecognizeTimer();
- } else {
- stopRecognizeTimer();
- }
- }
-
- bool cancelRecognition()
- {
- stopRecognizeTimer();
- clearTraces();
- delayedResult.clear();
- bool result = !recognitionTask.isNull();
- recognitionTask.reset();
- return recognizer.cancelRecognition() || result;
- }
-
- void resetRecognizeTimer()
- {
- Q_Q(LipiInputMethod);
- stopRecognizeTimer();
- recognizeTimer = q->startTimer(300);
- }
-
- void stopRecognizeTimer()
- {
- if (recognizeTimer) {
- Q_Q(LipiInputMethod);
- q->killTimer(recognizeTimer);
- recognizeTimer = 0;
- }
- }
-
- void resultsAvailable(const QVariantList &resultList)
- {
- if (!resultList.isEmpty()) {
- const QVariantMap result = resultList.at(0).toMap();
- if (recognitionTask && recognitionTask->resultId() == result[QLatin1String("resultId")].toInt())
- delayedResult = result;
- else
- processResult(result);
- }
- }
-
- void processResult(const QVariantMap &result)
- {
- const QChar ch = result[QLatin1String("unicode")].toChar();
- const QChar chUpper = ch.toUpper();
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- // In recording mode, the text case must match with the current text case
- if (unipenTrace) {
- if (!ch.isLetter() || (ch.isUpper() == (textCase == QVirtualKeyboardInputEngine::TextCase::Upper)))
- saveTraces(ch.unicode(), qRound(result[QLatin1String("confidence")].toDouble() * 100));
- delete unipenTrace;
- unipenTrace = 0;
- }
-#endif
- Q_Q(LipiInputMethod);
- q->inputContext()->inputEngine()->virtualKeyClick((Qt::Key)chUpper.unicode(),
- textCase == QVirtualKeyboardInputEngine::TextCase::Lower ? QString(ch.toLower()) : QString(chUpper),
- Qt::NoModifier);
- }
-
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- void dumpTraces()
- {
- if (unipenTrace)
- unipenTrace->record(traceList);
- }
-
- void saveTraces(uint unicode, uint confidence)
- {
- if (!unipenTrace)
- return;
-
- QStringList homeLocations = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
- if (!homeLocations.isEmpty()) {
- QString filePath = QStringLiteral("%1/%2").arg(homeLocations.at(0)).arg(QLatin1String("VIRTUAL_KEYBOARD_TRACES"));
- unipenTrace->setDirectory(filePath);
- unipenTrace->save(unicode, confidence);
- }
- }
-#endif
-
- LipiInputMethod *q_ptr;
- LipiSharedRecognizer recognizer;
- QByteArray currentContext;
- QScopedPointer<LTKCaptureDevice> deviceInfo;
- QScopedPointer<LTKScreenContext> screenContext;
- QSharedPointer<LipiRecognitionTask> recognitionTask;
- LTKTraceGroup traceGroup;
- QList<QVirtualKeyboardTrace *> traceList;
- int recognizeTimer;
- QVirtualKeyboardInputEngine::TextCase textCase;
- vector<int> subsetOfClasses;
- QVariantMap delayedResult;
- HandwritingGestureRecognizer gestureRecognizer;
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- UnipenTrace *unipenTrace;
-#endif
-};
-
-/*!
- \class QtVirtualKeyboard::LipiInputMethod
- \internal
-*/
-
-LipiInputMethod::LipiInputMethod(QObject *parent) :
-#ifdef QT_HUNSPELLINPUTMETHOD_LIB
- LipiInputMethodBase(new LipiInputMethodPrivate(this), parent)
-#else
- LipiInputMethodBase(parent),
- d_ptr(new LipiInputMethodPrivate(this))
-#endif
-{
-}
-
-LipiInputMethod::~LipiInputMethod()
-{
-}
-
-QList<QVirtualKeyboardInputEngine::InputMode> LipiInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale);
- QList<QVirtualKeyboardInputEngine::InputMode> availableInputModes;
- const Qt::InputMethodHints inputMethodHints(inputContext()->inputMethodHints());
-
- if (inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly) || inputMethodHints.testFlag(Qt::ImhDigitsOnly)) {
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Dialable);
- } else if (inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly)) {
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
- } else {
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Latin);
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
- }
-
- return availableInputModes;
-}
-
-bool LipiInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
-{
- Q_D(LipiInputMethod);
-#if QT_CONFIG(hunspell)
- HunspellInputMethod::setInputMode(locale, inputMode);
-#else
- Q_UNUSED(locale);
-#endif
- bool result = d->recognizer.setModel(QStringLiteral("SHAPEREC_ALPHANUM"));
- if (!result)
- return false;
- d->subsetOfClasses.clear();
- switch (inputMode) {
- case QVirtualKeyboardInputEngine::InputMode::Latin:
- d->recognizer.subsetOfClasses(QStringLiteral("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz?,.@"), d->subsetOfClasses);
- break;
- case QVirtualKeyboardInputEngine::InputMode::Numeric:
- case QVirtualKeyboardInputEngine::InputMode::Dialable:
- d->recognizer.subsetOfClasses(QStringLiteral("1234567890,.+"), d->subsetOfClasses);
- break;
- default:
- break;
- }
- return true;
-}
-
-bool LipiInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
-{
- Q_D(LipiInputMethod);
- d->textCase = textCase;
-#if QT_CONFIG(hunspell)
- HunspellInputMethod::setTextCase(textCase);
-#endif
- return true;
-}
-
-bool LipiInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
-#if QT_CONFIG(hunspell)
- Q_D(LipiInputMethod);
- switch (key) {
- case Qt::Key_Enter:
- case Qt::Key_Return:
- d->cancelRecognition();
- break;
- case Qt::Key_Backspace:
- if (d->cancelRecognition())
- return true;
- break;
- default:
- break;
- }
- return HunspellInputMethod::keyEvent(key, text, modifiers);
-#else
- Q_UNUSED(key);
- Q_UNUSED(text);
- Q_UNUSED(modifiers);
- return false;
-#endif
-}
-
-void LipiInputMethod::reset()
-{
- LipiInputMethodBase::reset();
- Q_D(LipiInputMethod);
- d->cancelRecognition();
-}
-
-void LipiInputMethod::update()
-{
- LipiInputMethodBase::update();
-}
-
-void LipiInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
-{
- LipiInputMethodBase::selectionListItemSelected(type, index);
- Q_D(LipiInputMethod);
- d->cancelRecognition();
-}
-
-QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> LipiInputMethod::patternRecognitionModes() const
-{
- return QList<QVirtualKeyboardInputEngine::PatternRecognitionMode>()
- << QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting;
-}
-
-QVirtualKeyboardTrace *LipiInputMethod::traceBegin(
- int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
-{
- Q_D(LipiInputMethod);
- return d->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
-}
-
-bool LipiInputMethod::traceEnd(QVirtualKeyboardTrace *trace)
-{
- Q_D(LipiInputMethod);
- d->traceEnd(trace);
- return true;
-}
-
-void LipiInputMethod::timerEvent(QTimerEvent *timerEvent)
-{
- Q_D(LipiInputMethod);
- if (timerEvent->timerId() == d->recognizeTimer) {
- d->finishRecognition();
- }
-}
-
-void LipiInputMethod::resultsAvailable(const QVariantList &resultList)
-{
-#ifdef SENSITIVE_DEBUG
- if (lcLipi().isDebugEnabled()) {
- qCDebug(lcLipi) << "LipiInputMethod::resultsAvailable():";
- for (int i = 0; i < resultList.size(); i++) {
- QVariantMap result = resultList.at(i).toMap();
- const QChar unicode = result[QLatin1String("unicode")].toChar();
- const double confidence = result[QLatin1String("confidence")].toDouble();
- qCDebug(lcLipi) << QStringLiteral("%1: %2 (%3)").arg(i + 1)
- .arg(unicode).arg(confidence).toUtf8().constData();
- }
- }
-#endif
- Q_D(LipiInputMethod);
- d->resultsAvailable(resultList);
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/lipi-toolkit/plugin/lipiinputmethod_p.h b/src/plugins/lipi-toolkit/plugin/lipiinputmethod_p.h
deleted file mode 100644
index e235c32d..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipiinputmethod_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIPIINPUTMETHOD_P_H
-#define LIPIINPUTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/private/qvirtualkeyboard_global_p.h>
-#if QT_CONFIG(hunspell)
-#include <QtHunspellInputMethod/private/hunspellinputmethod_p.h>
-#define LipiInputMethodBase HunspellInputMethod
-#else
-#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-#define LipiInputMethodBase QVirtualKeyboardAbstractInputMethod
-#endif
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class LipiInputMethodPrivate;
-
-class LipiInputMethod : public LipiInputMethodBase
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(LipiInputMethod)
-public:
- explicit LipiInputMethod(QObject *parent = nullptr);
- ~LipiInputMethod();
-
- QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode);
- bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- void reset();
- void update();
-
- void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index);
-
- QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patternRecognitionModes() const;
- QVirtualKeyboardTrace *traceBegin(
- int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
- bool traceEnd(QVirtualKeyboardTrace *trace);
-
-protected:
- void timerEvent(QTimerEvent *timerEvent);
-
-protected slots:
- void resultsAvailable(const QVariantList &resultList);
-
-#ifndef QT_HUNSPELLINPUTMETHOD_LIB
-private:
- QScopedPointer<LipiInputMethodPrivate> d_ptr;
-#endif
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/lipi-toolkit/plugin/lipiplugin.cpp b/src/plugins/lipi-toolkit/plugin/lipiplugin.cpp
deleted file mode 100644
index 8878f45a..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipiplugin.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "lipiplugin.h"
-#include "lipiinputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardLipiPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<LipiInputMethod>(uri, 2, 0, "HandwritingInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/lipi-toolkit/plugin/lipiplugin.h b/src/plugins/lipi-toolkit/plugin/lipiplugin.h
deleted file mode 100644
index 79e5b20d..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipiplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIPIPLUGIN_H
-#define LIPIPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardLipiPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "lipi.json")
-public:
- void registerTypes(const char *uri) const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer.cpp b/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer.cpp
deleted file mode 100644
index 2650c47e..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "lipisharedrecognizer_p.h"
-#include <QLoggingCategory>
-#include "lipiworker_p.h"
-
-#include "LTKMacros.h"
-#include "LTKInc.h"
-#include "LTKTypes.h"
-#include "LTKOSUtil.h"
-#include "LTKOSUtilFactory.h"
-#include "LTKErrorsList.h"
-#include "LTKErrors.h"
-#include "LTKLogger.h"
-#include "LTKConfigFileReader.h"
-#include "LTKException.h"
-#include "LTKLipiEngineInterface.h"
-
-#include <QDir>
-#include <QtCore/QLibraryInfo>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_DECLARE_LOGGING_CATEGORY(lcLipi)
-
-int LipiSharedRecognizer::s_lipiEngineRefCount = 0;
-QString LipiSharedRecognizer::s_lipiRoot;
-QString LipiSharedRecognizer::s_lipiLib;
-void *LipiSharedRecognizer::s_lipiEngineHandle = nullptr;
-LipiSharedRecognizer::FN_PTR_CREATELTKLIPIENGINE LipiSharedRecognizer::s_createLTKLipiEngine = nullptr;
-LipiSharedRecognizer::FN_PTR_DELETELTKLIPIENGINE LipiSharedRecognizer::s_deleteLTKLipiEngine = nullptr;
-LTKLipiEngineInterface *LipiSharedRecognizer::s_lipiEngine = nullptr;
-LTKShapeRecognizer *LipiSharedRecognizer::s_shapeRecognizer = nullptr;
-LipiWorker *LipiSharedRecognizer::s_lipiWorker = nullptr;
-QMap<int, QChar> LipiSharedRecognizer::s_unicodeMap;
-QString LipiSharedRecognizer::s_activeModel;
-stringStringMap LipiSharedRecognizer::s_lipiEngineConfigEntries;
-int LipiSharedRecognizer::s_recognitionCount = 0;
-
-/*!
- \class QtVirtualKeyboard::LipiSharedRecognizer
- \internal
-*/
-
-LipiSharedRecognizer::LipiSharedRecognizer()
-{
- loadLipiInterface();
-}
-
-LipiSharedRecognizer::~LipiSharedRecognizer()
-{
- unloadLipiInterface();
-}
-
-QString LipiSharedRecognizer::model() const
-{
- return s_activeModel;
-}
-
-bool LipiSharedRecognizer::setModel(const QString &modelName)
-{
- qCDebug(lcLipi) << "LipiSharedRecognizer::setModel():" << modelName;
-
- if (!s_lipiEngine) {
- qCWarning(lcLipi) << "Engine not initialized";
- return false;
- }
-
- if (modelName.isEmpty())
- return false;
-
- if (modelName == s_activeModel)
- return true;
-
- unloadModelData();
-
- return loadModelData(modelName) == SUCCESS;
-}
-
-void LipiSharedRecognizer::subsetOfClasses(const QString &charset, vector<int> &outSubsetOfClasses) const
-{
- outSubsetOfClasses.clear();
- outSubsetOfClasses.reserve(charset.length());
- QString notFound;
- for (int i = 0; i < charset.length(); i++) {
- int classId = s_unicodeMap.key(charset.at(i), -1);
- if (classId != -1)
- outSubsetOfClasses.push_back(classId);
- else if (lcLipi().isDebugEnabled())
- notFound.append(charset.at(i));
- }
- if (!notFound.isEmpty())
- qCDebug(lcLipi) << "LipiSharedRecognizer::subsetOfClasses(): unrecognized characters" << notFound;
-}
-
-QSharedPointer<LipiRecognitionTask> LipiSharedRecognizer::newRecognition(const LTKCaptureDevice& deviceInfo,
- const LTKScreenContext& screenContext,
- const vector<int>& inSubsetOfClasses,
- float confThreshold,
- int numChoices)
-{
- if (!s_lipiEngine || !s_shapeRecognizer || !s_lipiWorker)
- return QSharedPointer<LipiRecognitionTask>();
-
- QSharedPointer<LipiRecognitionTask> task(new LipiRecognitionTask(deviceInfo,
- screenContext,
- inSubsetOfClasses,
- confThreshold,
- numChoices,
- s_recognitionCount));
-
- ++s_recognitionCount;
-
- return task;
-}
-
-QSharedPointer<LipiRecognitionResultsTask> LipiSharedRecognizer::startRecognition(QSharedPointer<LipiRecognitionTask> &recognitionTask)
-{
- if (!s_lipiEngine || !s_shapeRecognizer || !s_lipiWorker)
- return QSharedPointer<LipiRecognitionResultsTask>();
-
- QSharedPointer<LipiRecognitionResultsTask> resultsTask(new LipiRecognitionResultsTask(recognitionTask->resultVector,
- s_unicodeMap,
- recognitionTask->resultId()));
-
- s_lipiWorker->addTask(recognitionTask);
- s_lipiWorker->addTask(resultsTask);
-
- return resultsTask;
-}
-
-bool LipiSharedRecognizer::cancelRecognition()
-{
- if (!s_lipiEngine || !s_shapeRecognizer || !s_lipiWorker)
- return false;
-
- return s_lipiWorker->removeAllTasks() > 0;
-}
-
-bool LipiSharedRecognizer::cancelRecognitionTask(QSharedPointer<LipiRecognitionTask> &recognitionTask)
-{
- if (!s_lipiEngine || !s_shapeRecognizer || !s_lipiWorker || !recognitionTask)
- return false;
-
- return recognitionTask->cancelRecognition() || s_lipiWorker->removeTask(recognitionTask) > 0;
-}
-
-int LipiSharedRecognizer::loadLipiInterface()
-{
- qCDebug(lcLipi) << "LipiSharedRecognizer::loadLipiInterface():" << s_lipiEngineRefCount;
-
- if (++s_lipiEngineRefCount == 1) {
- if (s_lipiRoot.isEmpty()) {
- /* LIPI_ROOT defines the root directory for lipi-toolkit project.
- LIPI_LIB is an extension implemented for QtVirtualKeyboard and
- allows using different location for lipi-toolkit plugins.
-
- LIPI_LIB defaults to LIPI_ROOT + "/lib".
- */
- bool lipiRootVarIsEmpty = qEnvironmentVariableIsEmpty("LIPI_ROOT");
- s_lipiRoot = lipiRootVarIsEmpty ?
- QDir(QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/lipi_toolkit")).absolutePath() :
- qEnvironmentVariable("LIPI_ROOT");
-
- bool lipiLibVarIsEmpty = qEnvironmentVariableIsEmpty("LIPI_LIB");
- if (!lipiLibVarIsEmpty)
- s_lipiLib = qEnvironmentVariable("LIPI_LIB");
- else if (!lipiRootVarIsEmpty)
- s_lipiLib = s_lipiRoot + QLatin1String("/lib");
- else
- s_lipiLib = QDir(QLibraryInfo::location(QLibraryInfo::PluginsPath) + QLatin1String("/lipi_toolkit")).absolutePath();
- }
-
- QScopedPointer<LTKOSUtil> osUtil(LTKOSUtilFactory::getInstance());
- const string lipiRootPath(QDir::toNativeSeparators(s_lipiRoot).toStdString());
- const string lipiLibPath(QDir::toNativeSeparators(s_lipiLib).toStdString());
-
- int result = osUtil->loadSharedLib(lipiLibPath, LIPIENGINE_MODULE_STR, &s_lipiEngineHandle);
- if (result != SUCCESS) {
- qCWarning(lcLipi) << QStringLiteral("Error %1: Could not open shared library for module '%2'").arg(result).arg(QLatin1String(LIPIENGINE_MODULE_STR));
- return result;
- }
-
- result = loadLipiEngineConfig();
- if (result != SUCCESS)
- return result;
-
- result = osUtil->getFunctionAddress(s_lipiEngineHandle, "createLTKLipiEngine", (void **)&s_createLTKLipiEngine);
- if (result != SUCCESS) {
- qCWarning(lcLipi) << QStringLiteral("Error %1: %2").arg(result).arg(QLatin1String(getErrorMessage(result).c_str()));
- return result;
- }
-
- result = osUtil->getFunctionAddress(s_lipiEngineHandle, "deleteLTKLipiEngine", (void **)&s_deleteLTKLipiEngine);
- if (result != SUCCESS) {
- qCWarning(lcLipi) << QStringLiteral("Error %1: %2").arg(result).arg(QLatin1String(getErrorMessage(result).c_str()));
- return result;
- }
-
- s_lipiEngine = s_createLTKLipiEngine();
- s_lipiEngine->setLipiRootPath(lipiRootPath);
- s_lipiEngine->setLipiLibPath(lipiLibPath);
-#if 0
- s_lipiEngine->setLipiLogFileName(QDir::toNativeSeparators(QString("%1/lipi.log").arg(s_lipiRoot)).toStdString());
- s_lipiEngine->setLipiLogLevel("DEBUG");
-#endif
-
- result = s_lipiEngine->initializeLipiEngine();
- if (result != SUCCESS) {
- qCWarning(lcLipi) << QStringLiteral("Error %1: %2").arg(result).arg(QLatin1String(getErrorMessage(result).c_str()));
- return result;
- }
- }
-
- return SUCCESS;
-}
-
-void LipiSharedRecognizer::unloadLipiInterface()
-{
- qCDebug(lcLipi) << "LipiSharedRecognizer::unloadLipiInterface():" << s_lipiEngineRefCount;
-
- Q_ASSERT(s_lipiEngineRefCount > 0);
- if (--s_lipiEngineRefCount == 0) {
- unloadModelData();
- if (s_lipiEngine) {
- s_deleteLTKLipiEngine();
- s_lipiEngine = nullptr;
- }
- s_createLTKLipiEngine = nullptr;
- s_deleteLTKLipiEngine = nullptr;
- QScopedPointer<LTKOSUtil> osUtil(LTKOSUtilFactory::getInstance());
- osUtil->unloadSharedLib(s_lipiEngineHandle);
- s_lipiEngineHandle = nullptr;
- }
-}
-
-int LipiSharedRecognizer::loadLipiEngineConfig()
-{
- s_lipiEngineConfigEntries.clear();
-
- const QString &lipiEngineConfigFile(QDir::toNativeSeparators(QStringLiteral("%1/projects/lipiengine.cfg").arg(s_lipiRoot)));
- if (!QFileInfo::exists(lipiEngineConfigFile)) {
- qCWarning(lcLipi) << "File not found" << lipiEngineConfigFile;
- return FAILURE;
- }
-
- try {
- LTKConfigFileReader configReader(lipiEngineConfigFile.toStdString());
- s_lipiEngineConfigEntries = configReader.getCfgFileMap();
- } catch (LTKException e) {
- return e.getErrorCode();
- }
-
- return SUCCESS;
-}
-
-int LipiSharedRecognizer::resolveLogicalNameToProjectProfile(const QString &logicalName, QString &outProjectName, QString &outProfileName)
-{
- outProjectName.clear();
- outProfileName.clear();
-
- stringStringMap::const_iterator configEntry = s_lipiEngineConfigEntries.find(logicalName.toStdString());
- if (configEntry == s_lipiEngineConfigEntries.end())
- return FAILURE;
-
- QStringList parts = QString::fromStdString(configEntry->second).split(QLatin1Char('('), Qt::SkipEmptyParts);
- if (parts.length() != 2)
- return FAILURE;
-
- parts[1].replace(QLatin1Char(')'), QString());
-
- outProjectName = parts[0].trimmed();
- outProfileName = parts[1].trimmed();
-
- return SUCCESS;
-}
-
-int LipiSharedRecognizer::loadModelData(const QString &logicalName)
-{
- qCDebug(lcLipi) << "LipiSharedRecognizer::loadModelData():" << logicalName;
-
- Q_ASSERT(s_shapeRecognizer == nullptr);
- Q_ASSERT(s_lipiWorker == nullptr);
-
- QTime perf;
- perf.start();
-
- s_activeModel = logicalName;
-
- QString project;
- QString profile;
- int result = resolveLogicalNameToProjectProfile(logicalName, project, profile);
- if (result == SUCCESS) {
- string strProject = project.toStdString();
- string strProfile = profile.toStdString();
- int result = s_lipiEngine->createShapeRecognizer(strProject, strProfile, &s_shapeRecognizer);
- if (result == SUCCESS) {
- result = loadMapping(QDir::toNativeSeparators(QStringLiteral("%1/projects/%2/config/unicodeMapfile_%2.ini").arg(s_lipiRoot).arg(project)));
- if (result == SUCCESS) {
- s_lipiWorker = new LipiWorker(s_shapeRecognizer);
- QSharedPointer<LipiLoadModelDataTask> loadModelDataTask(new LipiLoadModelDataTask());
- s_lipiWorker->addTask(loadModelDataTask);
- s_lipiWorker->start();
- }
- }
- }
-
- if (result == SUCCESS)
- qCDebug(lcLipi) << "LipiSharedRecognizer::loadModelData(): time:" << perf.elapsed() << "ms";
-
- if (result != SUCCESS) {
- qCWarning(lcLipi) << QStringLiteral("Error %1: %2").arg(result).arg(QLatin1String(getErrorMessage(result).c_str()));
- unloadModelData();
- }
-
- return result;
-}
-
-void LipiSharedRecognizer::unloadModelData()
-{
- if (!s_shapeRecognizer)
- return;
-
- qCDebug(lcLipi) << "LipiSharedRecognizer::unloadModelData():" << s_activeModel;
-
- QTime perf;
- perf.start();
-
- if (s_lipiWorker) {
- delete s_lipiWorker;
- s_lipiWorker = nullptr;
- }
-
- s_lipiEngine->deleteShapeRecognizer(s_shapeRecognizer);
- s_shapeRecognizer = nullptr;
- s_unicodeMap.clear();
- s_activeModel.clear();
-
- qCDebug(lcLipi) << "LipiSharedRecognizer::unloadModelData(): time:" << perf.elapsed() << "ms";
-}
-
-int LipiSharedRecognizer::loadMapping(const QString &mapFile)
-{
- if (!QFileInfo(mapFile).exists()) {
- qCWarning(lcLipi) << "File not found" << mapFile;
- return FAILURE;
- }
-
- try {
- LTKConfigFileReader configfilereader(mapFile.toStdString());
- const stringStringMap &cfgFileMap = configfilereader.getCfgFileMap();
-
- for (stringStringMap::const_iterator i = cfgFileMap.begin(); i != cfgFileMap.end(); i++) {
- if (i->first.empty())
- continue;
- if (!QChar::fromLatin1(i->first.at(0)).isDigit())
- continue;
-
- bool ok;
- int id = QString::fromLatin1(i->first.c_str()).toInt(&ok, 10);
- if (!ok)
- continue;
-
- QChar ch = QChar(QString::fromLatin1(i->second.c_str()).toInt(&ok, 16));
- if (!ok)
- continue;
-
- s_unicodeMap[id] = ch;
- }
- } catch (LTKException) {
- return FAILURE;
- }
-
- qCDebug(lcLipi) << s_unicodeMap;
-
- return SUCCESS;
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer_p.h b/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer_p.h
deleted file mode 100644
index 9d7cfbea..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipisharedrecognizer_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIPISHAREDRECOGNIZER_P_H
-#define LIPISHAREDRECOGNIZER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QString>
-#include <QMap>
-
-#include "lipiworker_p.h"
-
-class LTKLipiEngineInterface;
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class LipiSharedRecognizer
-{
- Q_DISABLE_COPY(LipiSharedRecognizer)
-public:
- LipiSharedRecognizer();
- ~LipiSharedRecognizer();
-
- QString model() const;
- bool setModel(const QString &modelName);
-
- void subsetOfClasses(const QString &charset, vector<int> &outSubsetOfClasses) const;
-
- QSharedPointer<LipiRecognitionTask> newRecognition(const LTKCaptureDevice& deviceInfo,
- const LTKScreenContext& screenContext,
- const vector<int>& inSubsetOfClasses,
- float confThreshold,
- int numChoices);
- QSharedPointer<LipiRecognitionResultsTask> startRecognition(QSharedPointer<LipiRecognitionTask> &recognitionTask);
- bool cancelRecognition();
- bool cancelRecognitionTask(QSharedPointer<LipiRecognitionTask> &recognitionTask);
-
-private:
- static int loadLipiInterface();
- static void unloadLipiInterface();
- static int loadLipiEngineConfig();
- static int resolveLogicalNameToProjectProfile(const QString &logicalName, QString &outProjectName, QString &outProfileName);
- static int loadModelData(const QString &logicalName);
- static void unloadModelData();
- static int loadMapping(const QString &mapFile);
-
- typedef LTKLipiEngineInterface* (*FN_PTR_CREATELTKLIPIENGINE)(void);
- typedef void (*FN_PTR_DELETELTKLIPIENGINE)(void);
-
- static int s_lipiEngineRefCount;
- static QString s_lipiRoot;
- static QString s_lipiLib;
- static void *s_lipiEngineHandle;
- static FN_PTR_CREATELTKLIPIENGINE s_createLTKLipiEngine;
- static FN_PTR_DELETELTKLIPIENGINE s_deleteLTKLipiEngine;
- static LTKLipiEngineInterface *s_lipiEngine;
- static LTKShapeRecognizer *s_shapeRecognizer;
- static LipiWorker *s_lipiWorker;
- static QMap<int, QChar> s_unicodeMap;
- static QString s_activeModel;
- static stringStringMap s_lipiEngineConfigEntries;
- static int s_recognitionCount;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // LIPISHAREDRECOGNIZER_P_H
diff --git a/src/plugins/lipi-toolkit/plugin/lipiworker.cpp b/src/plugins/lipi-toolkit/plugin/lipiworker.cpp
deleted file mode 100644
index ffe5c3b7..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipiworker.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "lipiworker_p.h"
-#include <QLoggingCategory>
-
-#include <QTime>
-
-#include "LTKShapeRecognizer.h"
-#include "LTKErrors.h"
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_DECLARE_LOGGING_CATEGORY(lcLipi)
-
-/*!
- \class QtVirtualKeyboard::LipiTask
- \internal
-*/
-
-/*!
- \class QtVirtualKeyboard::LipiLoadModelDataTask
- \internal
-*/
-
-void LipiLoadModelDataTask::run()
-{
- qCDebug(lcLipi) << "LipiLoadModelDataTask::run()";
- QTime perf;
- perf.start();
- int result = shapeRecognizer->loadModelData();
- qCDebug(lcLipi) << "LipiLoadModelDataTask::run(): time:" << perf.elapsed() << "ms";
- if (result != SUCCESS)
- qCWarning(lcLipi) << QStringLiteral("Error %1: %2").arg(result).arg(QLatin1String(getErrorMessage(result).c_str()));
-}
-
-/*!
- \class QtVirtualKeyboard::LipiRecognitionTask
- \internal
-*/
-
-LipiRecognitionTask::LipiRecognitionTask(const LTKCaptureDevice& deviceInfo,
- const LTKScreenContext& screenContext,
- const vector<int>& inSubsetOfClasses,
- float confThreshold,
- int numChoices,
- int resultId) :
- LipiTask(),
- deviceInfo(deviceInfo),
- screenContext(screenContext),
- inSubsetOfClasses(inSubsetOfClasses),
- confThreshold(confThreshold),
- numChoices(numChoices),
- resultVector(new vector<LTKShapeRecoResult>()),
- _resultId(resultId),
- stateRunning(false),
- stateCancelled(false)
-{
-}
-
-void LipiRecognitionTask::run()
-{
- qCDebug(lcLipi) << "LipiRecognitionTask::run()";
-
- if (!shapeRecognizer || !resultVector)
- return;
-
- {
- QMutexLocker stateGuard(&stateLock);
- stateRunning = true;
- }
-
- resultVector->clear();
- resultVector->reserve(numChoices);
-
- shapeRecognizer->setDeviceContext(deviceInfo);
-
- QTime perf;
- perf.start();
- shapeRecognizer->recognize(traceGroup, screenContext,
- inSubsetOfClasses, confThreshold,
- numChoices, *resultVector);
-
- int perfElapsed = perf.elapsed();
-
- {
- QMutexLocker stateGuard(&stateLock);
- stateRunning = false;
- if (stateCancelled)
- resultVector->clear();
- qCDebug(lcLipi) << "LipiRecognitionTask::run(): time:" << perfElapsed << "ms" << (stateCancelled ? "(cancelled)" : "");
- }
-}
-
-bool LipiRecognitionTask::cancelRecognition()
-{
- QMutexLocker stateGuard(&stateLock);
- stateCancelled = true;
- bool result = (stateRunning && shapeRecognizer);
- if (result)
- shapeRecognizer->requestCancelRecognition();
- return result;
-}
-
-int LipiRecognitionTask::resultId() const
-{
- return _resultId;
-}
-
-/*!
- \class QtVirtualKeyboard::LipiRecognitionResultsTask
- \internal
-*/
-
-LipiRecognitionResultsTask::LipiRecognitionResultsTask(QSharedPointer<vector<LTKShapeRecoResult> > resultVector,
- const QMap<int, QChar> &unicodeMap,
- int resultId) :
- LipiTask(),
- resultVector(resultVector),
- unicodeMap(unicodeMap),
- _resultId(resultId)
-{
-}
-
-void LipiRecognitionResultsTask::run()
-{
- if (!resultVector || unicodeMap.isEmpty())
- return;
-
- QVariantList resultList;
- for (vector<LTKShapeRecoResult>::const_iterator i = resultVector->begin();
- i != resultVector->end(); i++) {
- QVariantMap result;
- int shapeId = i->getShapeId();
- result[QLatin1String("resultId")] = _resultId;
- result[QLatin1String("shapeId")] = shapeId;
- result[QLatin1String("unicode")] = unicodeMap.value(shapeId);
- result[QLatin1String("confidence")] = i->getConfidence();
- resultList.append(result);
- }
-
- if (resultList.isEmpty())
- return;
-
- emit resultsAvailable(resultList);
-}
-
-/*!
- \class QtVirtualKeyboard::LipiWorker
- \internal
-*/
-
-LipiWorker::LipiWorker(LTKShapeRecognizer *shapeRecognizer, QObject *parent) :
- QThread(parent),
- taskSema(),
- taskLock(),
- shapeRecognizer(shapeRecognizer)
-{
- abort = false;
-}
-
-LipiWorker::~LipiWorker()
-{
- abort = true;
- taskSema.release();
- wait();
- if (shapeRecognizer)
- shapeRecognizer->unloadModelData();
-}
-
-void LipiWorker::addTask(QSharedPointer<LipiTask> task)
-{
- if (task) {
- QMutexLocker guard(&taskLock);
- taskList.append(task);
- taskSema.release();
- }
-}
-
-int LipiWorker::removeTask(QSharedPointer<LipiTask> task)
-{
- int count = 0;
- if (task) {
- QMutexLocker guard(&taskLock);
- count = taskList.removeAll(task);
- taskSema.acquire(qMin(count, taskSema.available()));
- }
- return count;
-}
-
-int LipiWorker::removeAllTasks()
-{
- QMutexLocker guard(&taskLock);
- int count = taskList.count();
- taskList.clear();
- if (taskSema.available())
- taskSema.acquire(taskSema.available());
- return count;
-}
-
-void LipiWorker::run()
-{
- while (!abort) {
- taskSema.acquire();
- if (abort)
- break;
- QSharedPointer<LipiTask> currentTask;
- {
- QMutexLocker guard(&taskLock);
- if (!taskList.isEmpty()) {
- currentTask = taskList.front();
- taskList.pop_front();
- }
- }
- if (currentTask) {
- currentTask->shapeRecognizer = shapeRecognizer;
- currentTask->run();
- }
- }
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/lipi-toolkit/plugin/lipiworker_p.h b/src/plugins/lipi-toolkit/plugin/lipiworker_p.h
deleted file mode 100644
index 098e198b..00000000
--- a/src/plugins/lipi-toolkit/plugin/lipiworker_p.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIPIWORKER_P_H
-#define LIPIWORKER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QThread>
-#include <QSemaphore>
-#include <QMutex>
-#include <QStringList>
-#include <QSharedPointer>
-#include <QMap>
-
-#include "LTKTypes.h"
-#include "LTKCaptureDevice.h"
-#include "LTKScreenContext.h"
-#include "LTKTraceGroup.h"
-#include "LTKChannel.h"
-#include "LTKTraceFormat.h"
-#include "LTKTrace.h"
-#include "LTKShapeRecognizer.h"
-#include "LTKShapeRecoResult.h"
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class LipiTask : public QObject
-{
- Q_OBJECT
-public:
- explicit LipiTask(QObject *parent = nullptr) :
- QObject(parent),
- shapeRecognizer(nullptr)
- {}
-
- virtual void run() = 0;
-
- LTKShapeRecognizer *shapeRecognizer;
-};
-
-class LipiLoadModelDataTask : public LipiTask
-{
- Q_OBJECT
-public:
- void run();
-};
-
-class LipiRecognitionTask : public LipiTask
-{
- Q_OBJECT
-public:
- explicit LipiRecognitionTask(const LTKCaptureDevice& deviceInfo,
- const LTKScreenContext& screenContext,
- const vector<int>& inSubsetOfClasses,
- float confThreshold,
- int numChoices,
- int resultId);
-
- void run();
- bool cancelRecognition();
- int resultId() const;
-
- LTKTraceGroup traceGroup;
-
-private:
- friend class LipiSharedRecognizer;
- const QMap<int, QChar> unicodeMap;
- const LTKCaptureDevice deviceInfo;
- const LTKScreenContext screenContext;
- const vector<int> inSubsetOfClasses;
- const float confThreshold;
- const int numChoices;
- QSharedPointer<vector<LTKShapeRecoResult> > resultVector;
- const int _resultId;
- QMutex stateLock;
- bool stateRunning;
- bool stateCancelled;
-};
-
-class LipiRecognitionResultsTask : public LipiTask
-{
- Q_OBJECT
-public:
- explicit LipiRecognitionResultsTask(QSharedPointer<vector<LTKShapeRecoResult> > resultVector,
- const QMap<int, QChar> &unicodeMap,
- int resultId);
-
- void run();
-
-signals:
- void resultsAvailable(const QVariantList &resultList);
-
-private:
- QSharedPointer<vector<LTKShapeRecoResult> > resultVector;
- const QMap<int, QChar> &unicodeMap;
- const int _resultId;
-};
-
-class LipiWorker : public QThread
-{
- Q_OBJECT
-public:
- explicit LipiWorker(LTKShapeRecognizer *shapeRecognizer, QObject *parent = nullptr);
- ~LipiWorker();
-
- void addTask(QSharedPointer<LipiTask> task);
- int removeTask(QSharedPointer<LipiTask> task);
- int removeAllTasks();
-
-protected:
- void run();
-
-private:
- QList<QSharedPointer<LipiTask> > taskList;
- QSemaphore taskSema;
- QMutex taskLock;
- LTKShapeRecognizer *shapeRecognizer;
- QBasicAtomicInt abort;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // LIPIWORKER_P_H
diff --git a/src/plugins/lipi-toolkit/plugin/plugin.pro b/src/plugins/lipi-toolkit/plugin/plugin.pro
deleted file mode 100644
index 562443a8..00000000
--- a/src/plugins/lipi-toolkit/plugin/plugin.pro
+++ /dev/null
@@ -1,68 +0,0 @@
-TARGET = qtvirtualkeyboard_lipi
-CONFIG += exceptions
-QT += qml virtualkeyboard-private
-
-include(../../../shared.pri)
-
-HEADERS += \
- lipiinputmethod_p.h \
- lipiplugin.h \
- lipisharedrecognizer_p.h \
- lipiworker_p.h
-SOURCES += \
- lipiinputmethod.cpp \
- lipiplugin.cpp \
- lipisharedrecognizer.cpp \
- lipiworker.cpp
-OTHER_FILES += \
- lipi.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-INCLUDEPATH += \
- ../3rdparty/lipi-toolkit/src/include \
- ../3rdparty/lipi-toolkit/src/util/lib
-LIBS += -L$$OUT_PWD/../../../../lib \
- -lshaperecommon$$qtPlatformTargetSuffix() \
- -lltkcommon$$qtPlatformTargetSuffix() \
- -lltkutil$$qtPlatformTargetSuffix()
-win32: LIBS += Advapi32.lib
-else: QMAKE_USE += libdl
-ltk_projects.files = $$PWD/../3rdparty/lipi-toolkit/projects
-ltk_projects.path = $$VIRTUALKEYBOARD_INSTALL_DATA/lipi_toolkit
-INSTALLS += ltk_projects
-!prefix_build: COPIES += ltk_projects
-
-qtConfig(hunspell) {
- QT += hunspellinputmethod-private
-}
-
-LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fallback/handwriting.qml
-qtConfig(vkb-lang-en_GB): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback
-qtConfig(vkb-lang-en_US): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback
-qtConfig(vkb-lang-id.ID): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback
-qtConfig(vkb-lang-ms_MY): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback
-qtConfig(vkb-lang-nl_NL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-!isEmpty(LAYOUT_FILES) {
- virtualkeyboard_ltk_layouts.files = $$LAYOUT_FILES
- virtualkeyboard_ltk_layouts.base = $$LAYOUTS_BASE
- virtualkeyboard_ltk_layouts.prefix = $$LAYOUTS_PREFIX
- RESOURCES += virtualkeyboard_ltk_layouts
-}
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Lipi-Toolkit (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardLipiPlugin
-load(qt_plugin)
diff --git a/src/plugins/myscript/3rdparty/myscript/myscript.pri b/src/plugins/myscript/3rdparty/myscript/myscript.pri
deleted file mode 100644
index d22129a9..00000000
--- a/src/plugins/myscript/3rdparty/myscript/myscript.pri
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Automatically detects the MyScript SDK directory and sets the following variables:
-#
-# MYSCRIPT_FOUND: 0/1 MyScript SDK found
-#
-
-MYSCRIPT_FOUND = 0
-isEmpty(MYSCRIPT_PATH): MYSCRIPT_PATH = $$PWD
-unix:linux:!android {
- equals(QT_ARCH, "arm64") {
- MYSCRIPT_ENGINE_PATH = "engine/bin/lin-arm64"
- MYSCRIPT_VOIM_PATH = "voim/bin/lin-arm64"
- } else:equals(QT_ARCH, "arm") {
- MYSCRIPT_ENGINE_PATH = "engine/bin/lin-armv7"
- MYSCRIPT_VOIM_PATH = "voim/bin/lin-armv7"
- } else:equals(QT_ARCH, "x86_64") {
- MYSCRIPT_ENGINE_PATH = "engine/bin/lin-x64"
- MYSCRIPT_VOIM_PATH = "voim/bin/lin-x64"
- } else:equals(QT_ARCH, "x86")|equals(QT_ARCH, "i386") {
- MYSCRIPT_ENGINE_PATH = "engine/bin/lin-x86"
- MYSCRIPT_VOIM_PATH = "voim/bin/lin-x86"
- } else {
- MYSCRIPT_ENGINE_PATH = "engine/bin/lin-$$QT_ARCH"
- MYSCRIPT_VOIM_PATH = "voim/bin/lin-$$QT_ARCH"
- }
- MYSCRIPT_LIB_PREFIX = "lib"
- MYSCRIPT_LIB_SUFFIX = ".so"
- MYSCRIPT_VOIM_LIB_NAME = "libvoim.so"
- MYSCRIPT_VOIM_LIB_PATH = $$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_PATH/$$MYSCRIPT_VOIM_LIB_NAME
-} else:win32|win64 {
- equals(QT_ARCH, "x86_64") {
- MYSCRIPT_ENGINE_PATH = "engine/bin/win-x64"
- MYSCRIPT_VOIM_PATH = "voim/bin/win-x64"
- } else {
- MYSCRIPT_ENGINE_PATH = "engine/bin/win-x86"
- MYSCRIPT_VOIM_PATH = "voim/bin/win-x86"
- }
- MYSCRIPT_LIB_PREFIX = ""
- MYSCRIPT_LIB_SUFFIX = ".dll"
- MYSCRIPT_VOIM_LIB_NAME = "voim.lib"
- MYSCRIPT_VOIM_LIB_PATH = $$MYSCRIPT_PATH/voim/api/c/lib/$$MYSCRIPT_VOIM_LIB_NAME
- !exists($$MYSCRIPT_VOIM_LIB_PATH) {
- system(lib /def:$$MYSCRIPT_PATH/voim/api/c/lib/voim.def /OUT:$$MYSCRIPT_VOIM_LIB_PATH)
- }
-}
-MYSCRIPT_VOIM_LIB += \
- $$MYSCRIPT_VOIM_LIB_PATH
-MYSCRIPT_ENGINE_BINS += \
- $$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_PATH/$${MYSCRIPT_LIB_PREFIX}voim$${MYSCRIPT_LIB_SUFFIX} \
- $$MYSCRIPT_PATH/$$MYSCRIPT_ENGINE_PATH/$${MYSCRIPT_LIB_PREFIX}MyScriptInk$${MYSCRIPT_LIB_SUFFIX} \
- $$MYSCRIPT_PATH/$$MYSCRIPT_ENGINE_PATH/$${MYSCRIPT_LIB_PREFIX}MyScript2D$${MYSCRIPT_LIB_SUFFIX} \
- $$MYSCRIPT_PATH/$$MYSCRIPT_ENGINE_PATH/$${MYSCRIPT_LIB_PREFIX}MyScriptPrediction$${MYSCRIPT_LIB_SUFFIX} \
- $$MYSCRIPT_PATH/$$MYSCRIPT_ENGINE_PATH/$${MYSCRIPT_LIB_PREFIX}MyScriptText$${MYSCRIPT_LIB_SUFFIX} \
- $$MYSCRIPT_PATH/$$MYSCRIPT_ENGINE_PATH/$${MYSCRIPT_LIB_PREFIX}MyScriptEngine$${MYSCRIPT_LIB_SUFFIX}
-MYSCRIPT_VOIM_CONF = voim/conf
-MYSCRIPT_LANGUAGE_CONF = conf
-MYSCRIPT_RESOURCES = resources
-
-exists($$MYSCRIPT_VOIM_LIB_PATH): MYSCRIPT_FOUND = 1
diff --git a/src/plugins/myscript/CMakeLists.txt b/src/plugins/myscript/CMakeLists.txt
index bf32310f..7d5453f6 100644
--- a/src/plugins/myscript/CMakeLists.txt
+++ b/src/plugins/myscript/CMakeLists.txt
@@ -1,3 +1 @@
-# Generated from myscript.pro.
-
add_subdirectory(plugin)
diff --git a/src/plugins/myscript/myscript.pro b/src/plugins/myscript/myscript.pro
deleted file mode 100644
index b6e92972..00000000
--- a/src/plugins/myscript/myscript.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- plugin
diff --git a/src/plugins/myscript/plugin/.prev_CMakeLists.txt b/src/plugins/myscript/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index 72f3d2b3..00000000
--- a/src/plugins/myscript/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,196 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardMyScriptPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardMyScriptPlugin
- OUTPUT_NAME qtvirtualkeyboard_myscript
- TYPE virtualkeyboard
- SOURCES
- /voim/api/c/examples/common/PortabilityDefinitions.c
- /voim/api/c/examples/common/Properties.c
- myscriptinputmethod.cpp myscriptinputmethod_p.h
- myscriptinputmethod_p_p.h
- myscriptplugin.cpp myscriptplugin.h
- DEFINES
- MYSCRIPT_CERTIFICATE=\\\"/edk/c/examples/certificates/MyCertificate.c\\\"
- MYSCRIPT_ENGINE_NAME=\\\"MyScriptEngine\\\"
- MYSCRIPT_LANGUAGE_CONF_PATH=\\\"qtvirtualkeyboard/myscript/\\\"
- MYSCRIPT_VOIM_NAME=\\\"voim\\\"
- MYSCRIPT_VOIM_PROPERTY_PATH=\\\"qtvirtualkeyboard/myscript/\\\"
- INCLUDE_DIRECTORIES
- /voim/api/c/examples
- /voim/api/c/include
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
-)
-
-# Resources:
-set(qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/fallback/handwriting.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardMyScriptPlugin "qmake_virtualkeyboard_myscript_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_myscript_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# INSTALLS = "myscript_engine_bins" "myscript_voim_conf" "myscript_language_conf" "myscript_resources"
-# OTHER_FILES = "myscript.json" "$$LAYOUT_FILES"
-# myscript_engine_bins.files = "$$MYSCRIPT_ENGINE_BINS"
-# myscript_engine_bins.path = "$$[QT_INSTALL_BINS]"
-# myscript_language_conf.files = "$$MYSCRIPT_PATH/$$MYSCRIPT_LANGUAGE_CONF"
-# myscript_language_conf.path = "$$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA"
-# myscript_resources.files = "$$MYSCRIPT_PATH/$$MYSCRIPT_RESOURCES"
-# myscript_resources.path = "$$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA"
-# myscript_voim_conf.files = "$$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_CONF"
-# myscript_voim_conf.path = "$$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA/voim"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:plugin.pro:UNIX AND LINUX AND NOT ANDROID:
-# QMAKE_RPATHDIR = "$$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_PATH"
-
-#### Keys ignored in scope 4:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "myscript_engine_bins" "myscript_voim_conf" "myscript_language_conf" "myscript_resources"
-
-#### Keys ignored in scope 5:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_GB:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback"
-
-#### Keys ignored in scope 6:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_US:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback"
-
-#### Keys ignored in scope 7:.:.:plugin.pro:QT_FEATURE_vkb_lang_ar_AR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ar_AR/handwriting.qml"
-
-#### Keys ignored in scope 8:.:.:plugin.pro:QT_FEATURE_vkb_lang_bg_BG:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/bg_BG/handwriting.qml"
-
-#### Keys ignored in scope 9:.:.:plugin.pro:QT_FEATURE_vkb_lang_cs_CZ:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/cs_CZ/handwriting.qml"
-
-#### Keys ignored in scope 10:.:.:plugin.pro:QT_FEATURE_vkb_lang_da_DK:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/da_DK/handwriting.fallback"
-
-#### Keys ignored in scope 11:.:.:plugin.pro:QT_FEATURE_vkb_lang_de_DE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/de_DE/handwriting.fallback"
-
-#### Keys ignored in scope 12:.:.:plugin.pro:QT_FEATURE_vkb_lang_el_GR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/el_GR/handwriting.qml"
-
-#### Keys ignored in scope 13:.:.:plugin.pro:QT_FEATURE_vkb_lang_es_ES:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/es_ES/handwriting.qml"
-
-#### Keys ignored in scope 14:.:.:plugin.pro:QT_FEATURE_vkb_lang_es_MX:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/es_MX/handwriting.qml"
-
-#### Keys ignored in scope 15:.:.:plugin.pro:QT_FEATURE_vkb_lang_et_EE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/et_EE/handwriting.fallback"
-
-#### Keys ignored in scope 16:.:.:plugin.pro:QT_FEATURE_vkb_lang_fa_FA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fa_FA/handwriting.qml"
-
-#### Keys ignored in scope 17:.:.:plugin.pro:QT_FEATURE_vkb_lang_fi_FI:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fi_FI/handwriting.fallback"
-
-#### Keys ignored in scope 18:.:.:plugin.pro:QT_FEATURE_vkb_lang_fr_FR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fr_FR/handwriting.fallback"
-
-#### Keys ignored in scope 19:.:.:plugin.pro:QT_FEATURE_vkb_lang_fr_CA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fr_CA/handwriting.fallback"
-
-#### Keys ignored in scope 20:.:.:plugin.pro:QT_FEATURE_vkb_lang_he_IL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/he_IL/handwriting.qml"
-
-#### Keys ignored in scope 21:.:.:plugin.pro:QT_FEATURE_vkb_lang_hi_IN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hi_IN/handwriting.qml"
-
-#### Keys ignored in scope 22:.:.:plugin.pro:QT_FEATURE_vkb_lang_hr_HR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hr_HR/handwriting.qml"
-
-#### Keys ignored in scope 23:.:.:plugin.pro:QT_FEATURE_vkb_lang_hu_HU:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hu_HU/handwriting.qml"
-
-#### Keys ignored in scope 24:.:.:plugin.pro:QT_FEATURE_vkb_lang_id_ID:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback"
-
-#### Keys ignored in scope 25:.:.:plugin.pro:QT_FEATURE_vkb_lang_it_IT:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/it_IT/handwriting.fallback"
-
-#### Keys ignored in scope 26:.:.:plugin.pro:QT_FEATURE_vkb_lang_ja_JP:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ja_JP/handwriting.qml"
-
-#### Keys ignored in scope 27:.:.:plugin.pro:QT_FEATURE_vkb_lang_ko_KR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ko_KR/handwriting.qml"
-
-#### Keys ignored in scope 28:.:.:plugin.pro:QT_FEATURE_vkb_lang_ms_MY:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback"
-
-#### Keys ignored in scope 29:.:.:plugin.pro:QT_FEATURE_vkb_lang_nb_NO:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nb_NO/handwriting.fallback"
-
-#### Keys ignored in scope 30:.:.:plugin.pro:QT_FEATURE_vkb_lang_nl_NL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback"
-
-#### Keys ignored in scope 31:.:.:plugin.pro:QT_FEATURE_vkb_lang_pl_PL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pl_PL/handwriting.fallback"
-
-#### Keys ignored in scope 32:.:.:plugin.pro:QT_FEATURE_vkb_lang_pt_BR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pt_BR/handwriting.fallback"
-
-#### Keys ignored in scope 33:.:.:plugin.pro:QT_FEATURE_vkb_lang_pt_PT:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pt_PT/handwriting.fallback"
-
-#### Keys ignored in scope 34:.:.:plugin.pro:QT_FEATURE_vkb_lang_ro_RO:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ro_RO/handwriting.qml"
-
-#### Keys ignored in scope 35:.:.:plugin.pro:QT_FEATURE_vkb_lang_ru_RU:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ru_RU/handwriting.fallback"
-
-#### Keys ignored in scope 36:.:.:plugin.pro:QT_FEATURE_vkb_lang_sk_SK:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sk_SK/handwriting.fallback"
-
-#### Keys ignored in scope 37:.:.:plugin.pro:QT_FEATURE_vkb_lang_sl_SI:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sl_SI/handwriting.fallback"
-
-#### Keys ignored in scope 38:.:.:plugin.pro:QT_FEATURE_vkb_lang_sq_AL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sq_AL/handwriting.fallback"
-
-#### Keys ignored in scope 39:.:.:plugin.pro:QT_FEATURE_vkb_lang_sr_SP:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sr_SP/handwriting.qml"
-
-#### Keys ignored in scope 40:.:.:plugin.pro:QT_FEATURE_vkb_lang_sv_SE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sv_SE/handwriting.fallback"
-
-#### Keys ignored in scope 41:.:.:plugin.pro:QT_FEATURE_vkb_lang_th_TH:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/th_TH/handwriting.fallback"
-
-#### Keys ignored in scope 42:.:.:plugin.pro:QT_FEATURE_vkb_lang_tr_TR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/tr_TR/handwriting.fallback"
-
-#### Keys ignored in scope 43:.:.:plugin.pro:QT_FEATURE_vkb_lang_uk_UA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/uk_UA/handwriting.fallback"
-
-#### Keys ignored in scope 44:.:.:plugin.pro:QT_FEATURE_vkb_lang_vi_VN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/vi_VN/handwriting.fallback"
-
-#### Keys ignored in scope 45:.:.:plugin.pro:QT_FEATURE_vkb_lang_zh_CN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/zh_CN/handwriting.qml"
-
-#### Keys ignored in scope 46:.:.:plugin.pro:QT_FEATURE_vkb_lang_zh_TW:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/zh_TW/handwriting.qml"
-
-#### Keys ignored in scope 47:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard MyScript (Qt $$QT_VERSION)"
diff --git a/src/plugins/myscript/plugin/CMakeLists.txt b/src/plugins/myscript/plugin/CMakeLists.txt
index 2245fae6..226005ac 100644
--- a/src/plugins/myscript/plugin/CMakeLists.txt
+++ b/src/plugins/myscript/plugin/CMakeLists.txt
@@ -1,451 +1,343 @@
-# Generated from plugin.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QtVirtualKeyboardMyScriptPlugin Plugin:
#####################################################################
-qt_internal_add_plugin(QtVirtualKeyboardMyScriptPlugin
- OUTPUT_NAME qtvirtualkeyboard_myscript
- TYPE virtualkeyboard
+set(MYSCRIPT_INSTALL_DATA "${VKB_INSTALL_DATA}/myscript")
+
+if(WIN32)
+ set(MYSCRIPT_VOIM_NAME "voim.dll")
+ set(MYSCRIPT_ENGINE_NAME "MyScriptEngine.dll")
+ set(MYSCRIPT_INSTALL_BINDIR "${QT_BUILD_DIR}/${INSTALL_BINDIR}")
+else() # only for Linux here, (UNIX OR LINUX) AND NOT ANDROID AND NOT APPLE
+ set(MYSCRIPT_VOIM_NAME "libvoim.so")
+ set(MYSCRIPT_ENGINE_NAME "libMyScriptEngine.so")
+ set(MYSCRIPT_INSTALL_BINDIR "${QT_BUILD_DIR}/${INSTALL_LIBDIR}")
+endif()
+set(MYSCRIPT_VOIM_PROPERTY_NAME "voim/conf")
+set(MYSCRIPT_LANGUAGE_CONF_NAME "conf")
+set(MYSCRIPT_LANGUAGE_RESOURCES_NAME "resources")
+
+qt_internal_add_qml_module(qtvkbmyscriptplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.MyScript"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbmyscriptplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
SOURCES
- /voim/api/c/examples/common/PortabilityDefinitions.c
- /voim/api/c/examples/common/Properties.c
+ ${MyScript_ROOT_DIR}/voim/api/c/examples/common/Properties.c
myscriptinputmethod.cpp myscriptinputmethod_p.h
myscriptinputmethod_p_p.h
- myscriptplugin.cpp myscriptplugin.h
DEFINES
- MYSCRIPT_CERTIFICATE=\\\"/edk/c/examples/certificates/MyCertificate.c\\\"
- MYSCRIPT_ENGINE_NAME=\\\"MyScriptEngine\\\"
- MYSCRIPT_LANGUAGE_CONF_PATH=\\\"qtvirtualkeyboard/myscript/\\\"
- MYSCRIPT_VOIM_NAME=\\\"voim\\\"
- MYSCRIPT_VOIM_PROPERTY_PATH=\\\"qtvirtualkeyboard/myscript/\\\"
+ MYSCRIPT_CERTIFICATE="${MyScript_ROOT_DIR}/edk/c/examples/certificates/MyCertificate.c"
+ MYSCRIPT_VOIM_PROPERTY_PATH="${MYSCRIPT_INSTALL_DATA}/${MYSCRIPT_VOIM_PROPERTY_NAME}"
+ MYSCRIPT_LANGUAGE_CONF_PATH="${MYSCRIPT_INSTALL_DATA}/${MYSCRIPT_LANGUAGE_CONF_NAME}"
+ MYSCRIPT_VOIM_NAME="${MYSCRIPT_VOIM_NAME}"
+ MYSCRIPT_ENGINE_NAME="${MYSCRIPT_ENGINE_NAME}"
+ # POSIX source must be required to use "strdup" for "Properties.c"
+ _POSIX_C_SOURCE=200809L
INCLUDE_DIRECTORIES
- /voim/api/c/examples
- /voim/api/c/include
- PUBLIC_LIBRARIES
+ ${MyScript_ROOT_DIR}/voim/api/c/examples
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::Qml
Qt::VirtualKeyboard
+ MyScript::VOIM
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# MyScript Engine Binaries
+qt_copy_or_install(
+ FILES "${MyScript_BINARIES}"
+ DESTINATION "${MYSCRIPT_INSTALL_BINDIR}"
+)
+
+# MyScript VoIM Properties
+qt_copy_or_install(
+ DIRECTORY "${MyScript_ROOT_DIR}/${MYSCRIPT_VOIM_PROPERTY_NAME}"
+ DESTINATION "${MYSCRIPT_INSTALL_DATA}/voim"
+)
+
+# MyScript Language Conf
+qt_copy_or_install(
+ DIRECTORY "${MyScript_ROOT_DIR}/${MYSCRIPT_LANGUAGE_CONF_NAME}"
+ DESTINATION "${MYSCRIPT_INSTALL_DATA}"
+)
+
+# MyScript Language Resources
+qt_copy_or_install(
+ DIRECTORY "${MyScript_ROOT_DIR}/${MYSCRIPT_LANGUAGE_RESOURCES_NAME}"
+ DESTINATION "${MYSCRIPT_INSTALL_DATA}"
)
# Resources:
set(qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/fallback/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/fallback/handwriting.qml"
)
# special case begin
if (QT_FEATURE_vkb_lang_en_GB)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/en_GB/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/en_GB/handwriting.fallback"
)
endif()
if (QT_FEATURE_vkb_lang_en_US)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/en_US/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/en_US/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_ar_AR
+if (QT_FEATURE_vkb_lang_ar_AR)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/ar_AR/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/ar_AR/handwriting.qml"
)
endif()
if (QT_FEATURE_vkb_lang_bg_BG)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/bg_BG/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/bg_BG/handwriting.qml"
)
endif()
if (QT_FEATURE_vkb_lang_cs_CZ)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/cs_CZ/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/cs_CZ/handwriting.fallback"
)
endif()
if (QT_FEATURE_vkb_lang_da_DK)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/da_DK/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/da_DK/handwriting.fallback"
)
endif()
if (QT_FEATURE_vkb_lang_de_DE)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/de_DE/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/de_DE/handwriting.fallback"
)
endif()
if (QT_FEATURE_vkb_lang_el_GR)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/el_GR/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/el_GR/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_es_ES
+if (QT_FEATURE_vkb_lang_es_ES)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/es_ES/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/es_ES/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_es_MX
+if (QT_FEATURE_vkb_lang_es_MX)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/es_MX/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/es_MX/handwriting.qml"
)
endif()
if (QT_FEATURE_vkb_lang_et_EE)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/et_EE/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/et_EE/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_fa_FA
+if (QT_FEATURE_vkb_lang_fa_FA)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/fa_FA/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/fa_FA/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_fi_FI
+if (QT_FEATURE_vkb_lang_fi_FI)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/fi_FI/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/fi_FI/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_fr_FR
+if (QT_FEATURE_vkb_lang_fr_CA)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/fr_FR/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/fr_CA/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_fr_CA
+if (QT_FEATURE_vkb_lang_fr_FR)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/fr_CA/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/fr_FR/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_he_IL
+if (QT_FEATURE_vkb_lang_he_IL)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/he_IL/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/he_IL/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_hi_IN
+if (QT_FEATURE_vkb_lang_hi_IN)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/he_IN/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/hi_IN/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_hr_HR
+if (QT_FEATURE_vkb_lang_hr_HR)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/hr_HR/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/hr_HR/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_hu_HU
+if (QT_FEATURE_vkb_lang_hu_HU)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/hu_HU/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/hu_HU/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_id_ID
+if (QT_FEATURE_vkb_lang_id_ID)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/id_ID/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/id_ID/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_it_IT
+if (QT_FEATURE_vkb_lang_it_IT)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/it_IT/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/it_IT/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_ja_JP
+if (QT_FEATURE_vkb_lang_ja_JP)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/ja_JP/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/ja_JP/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_ko_KR
+if (QT_FEATURE_vkb_lang_ko_KR)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/ko_KR/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/ko_KR/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_ms_MY
+if (QT_FEATURE_vkb_lang_ms_MY)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/ms_MY/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/ms_MY/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_nb_NO
+if (QT_FEATURE_vkb_lang_nb_NO)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/nb_NO/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/nb_NO/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_nl_NL
+if (QT_FEATURE_vkb_lang_nl_NL)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/nl_NL/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/nl_NL/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_pl_PL
+if (QT_FEATURE_vkb_lang_pl_PL)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/pl_PL/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/pl_PL/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_pt_BR
+if (QT_FEATURE_vkb_lang_pt_BR)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/pt_BR/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/pt_BR/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_pt_PT
+if (QT_FEATURE_vkb_lang_pt_PT)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/pt_PT/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/pt_PT/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_ro_RO
+if (QT_FEATURE_vkb_lang_ro_RO)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/ro_RO/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/ro_RO/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_ru_RU
+if (QT_FEATURE_vkb_lang_ru_RU)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/ru_RU/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/ru_RU/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_sk_SK
+if (QT_FEATURE_vkb_lang_sk_SK)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/sk_SK/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/sk_SK/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_sl_SI
+if (QT_FEATURE_vkb_lang_sl_SI)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/sl_SI/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/sl_SI/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_sq_AL
+if (QT_FEATURE_vkb_lang_sq_AL)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/sq_AL/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/sq_AL/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_sr_SP
+if (QT_FEATURE_vkb_lang_sr_SP)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/sr_SP/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/sr_SP/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_sv_SE
+if (QT_FEATURE_vkb_lang_sv_SE)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/sv_SE/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/sv_SE/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_th_TH
+if (QT_FEATURE_vkb_lang_th_TH)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/th_TH/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/th_TH/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_tr_TR
+if (QT_FEATURE_vkb_lang_tr_TR)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/tr_TR/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/tr_TR/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_uk_UA
+if (QT_FEATURE_vkb_lang_uk_UA)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/uk_UA/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/uk_UA/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_vi_VN
+if (QT_FEATURE_vkb_lang_vi_VN)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/vi_VN/handwriting.fallback"
+ "${VKB_LAYOUTS_BASE}/vi_VN/handwriting.fallback"
)
endif()
-if (QT_FEATURE_vkb_lang_zh_CN
+if (QT_FEATURE_vkb_lang_zh_CN)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/zh_CN/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/zh_CN/handwriting.qml"
)
endif()
-if (QT_FEATURE_vkb_lang_zh_TW
+if (QT_FEATURE_vkb_lang_zh_TW)
list(APPEND qmake_virtualkeyboard_myscript_layouts_resource_files
- "virtualkeyboard/content/layouts/zh_TW/handwriting.qml"
+ "${VKB_LAYOUTS_BASE}/zh_TW/handwriting.qml"
)
endif()
-# special case end
-
-qt_add_resource(QtVirtualKeyboardMyScriptPlugin "qmake_virtualkeyboard_myscript_layouts"
+qt_internal_add_resource(qtvkbmyscriptplugin "qmake_virtualkeyboard_myscript_layouts"
PREFIX
- "${VKB_LAYOUTS_PREFIX}" # special case
+ "${VKB_LAYOUTS_PREFIX}"
BASE
- "${VKB_LAYOUTS_BASE}" # special case
+ "${VKB_LAYOUTS_BASE}"
FILES
${qmake_virtualkeyboard_myscript_layouts_resource_files}
)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# INSTALLS = "myscript_engine_bins" "myscript_voim_conf" "myscript_language_conf" "myscript_resources"
-# OTHER_FILES = "myscript.json" "$$LAYOUT_FILES"
-# myscript_engine_bins.files = "$$MYSCRIPT_ENGINE_BINS"
-# myscript_engine_bins.path = "$$[QT_INSTALL_BINS]"
-# myscript_language_conf.files = "$$MYSCRIPT_PATH/$$MYSCRIPT_LANGUAGE_CONF"
-# myscript_language_conf.path = "$$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA"
-# myscript_resources.files = "$$MYSCRIPT_PATH/$$MYSCRIPT_RESOURCES"
-# myscript_resources.path = "$$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA"
-# myscript_voim_conf.files = "$$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_CONF"
-# myscript_voim_conf.path = "$$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA/voim"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:plugin.pro:UNIX AND LINUX AND NOT ANDROID:
-# QMAKE_RPATHDIR = "$$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_PATH"
-
-#### Keys ignored in scope 4:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "myscript_engine_bins" "myscript_voim_conf" "myscript_language_conf" "myscript_resources"
-
-#### Keys ignored in scope 5:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_GB:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback"
-
-#### Keys ignored in scope 6:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_US:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback"
-
-#### Keys ignored in scope 7:.:.:plugin.pro:QT_FEATURE_vkb_lang_ar_AR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ar_AR/handwriting.qml"
-
-#### Keys ignored in scope 8:.:.:plugin.pro:QT_FEATURE_vkb_lang_bg_BG:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/bg_BG/handwriting.qml"
-
-#### Keys ignored in scope 9:.:.:plugin.pro:QT_FEATURE_vkb_lang_cs_CZ:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/cs_CZ/handwriting.qml"
-
-#### Keys ignored in scope 10:.:.:plugin.pro:QT_FEATURE_vkb_lang_da_DK:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/da_DK/handwriting.fallback"
-
-#### Keys ignored in scope 11:.:.:plugin.pro:QT_FEATURE_vkb_lang_de_DE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/de_DE/handwriting.fallback"
-
-#### Keys ignored in scope 12:.:.:plugin.pro:QT_FEATURE_vkb_lang_el_GR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/el_GR/handwriting.qml"
-
-#### Keys ignored in scope 13:.:.:plugin.pro:QT_FEATURE_vkb_lang_es_ES:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/es_ES/handwriting.qml"
-
-#### Keys ignored in scope 14:.:.:plugin.pro:QT_FEATURE_vkb_lang_es_MX:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/es_MX/handwriting.qml"
-
-#### Keys ignored in scope 15:.:.:plugin.pro:QT_FEATURE_vkb_lang_et_EE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/et_EE/handwriting.fallback"
-
-#### Keys ignored in scope 16:.:.:plugin.pro:QT_FEATURE_vkb_lang_fa_FA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fa_FA/handwriting.qml"
-
-#### Keys ignored in scope 17:.:.:plugin.pro:QT_FEATURE_vkb_lang_fi_FI:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fi_FI/handwriting.fallback"
-
-#### Keys ignored in scope 18:.:.:plugin.pro:QT_FEATURE_vkb_lang_fr_FR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fr_FR/handwriting.fallback"
-
-#### Keys ignored in scope 19:.:.:plugin.pro:QT_FEATURE_vkb_lang_fr_CA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fr_CA/handwriting.fallback"
-
-#### Keys ignored in scope 20:.:.:plugin.pro:QT_FEATURE_vkb_lang_he_IL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/he_IL/handwriting.qml"
-
-#### Keys ignored in scope 21:.:.:plugin.pro:QT_FEATURE_vkb_lang_hi_IN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hi_IN/handwriting.qml"
-
-#### Keys ignored in scope 22:.:.:plugin.pro:QT_FEATURE_vkb_lang_hr_HR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hr_HR/handwriting.qml"
-
-#### Keys ignored in scope 23:.:.:plugin.pro:QT_FEATURE_vkb_lang_hu_HU:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hu_HU/handwriting.qml"
-
-#### Keys ignored in scope 24:.:.:plugin.pro:QT_FEATURE_vkb_lang_id_ID:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback"
-
-#### Keys ignored in scope 25:.:.:plugin.pro:QT_FEATURE_vkb_lang_it_IT:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/it_IT/handwriting.fallback"
-
-#### Keys ignored in scope 26:.:.:plugin.pro:QT_FEATURE_vkb_lang_ja_JP:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ja_JP/handwriting.qml"
-
-#### Keys ignored in scope 27:.:.:plugin.pro:QT_FEATURE_vkb_lang_ko_KR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ko_KR/handwriting.qml"
-
-#### Keys ignored in scope 28:.:.:plugin.pro:QT_FEATURE_vkb_lang_ms_MY:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback"
-
-#### Keys ignored in scope 29:.:.:plugin.pro:QT_FEATURE_vkb_lang_nb_NO:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nb_NO/handwriting.fallback"
-
-#### Keys ignored in scope 30:.:.:plugin.pro:QT_FEATURE_vkb_lang_nl_NL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback"
-
-#### Keys ignored in scope 31:.:.:plugin.pro:QT_FEATURE_vkb_lang_pl_PL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pl_PL/handwriting.fallback"
-
-#### Keys ignored in scope 32:.:.:plugin.pro:QT_FEATURE_vkb_lang_pt_BR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pt_BR/handwriting.fallback"
-
-#### Keys ignored in scope 33:.:.:plugin.pro:QT_FEATURE_vkb_lang_pt_PT:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pt_PT/handwriting.fallback"
-
-#### Keys ignored in scope 34:.:.:plugin.pro:QT_FEATURE_vkb_lang_ro_RO:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ro_RO/handwriting.qml"
-
-#### Keys ignored in scope 35:.:.:plugin.pro:QT_FEATURE_vkb_lang_ru_RU:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ru_RU/handwriting.fallback"
-
-#### Keys ignored in scope 36:.:.:plugin.pro:QT_FEATURE_vkb_lang_sk_SK:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sk_SK/handwriting.fallback"
-
-#### Keys ignored in scope 37:.:.:plugin.pro:QT_FEATURE_vkb_lang_sl_SI:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sl_SI/handwriting.fallback"
-
-#### Keys ignored in scope 38:.:.:plugin.pro:QT_FEATURE_vkb_lang_sq_AL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sq_AL/handwriting.fallback"
-
-#### Keys ignored in scope 39:.:.:plugin.pro:QT_FEATURE_vkb_lang_sr_SP:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sr_SP/handwriting.qml"
-
-#### Keys ignored in scope 40:.:.:plugin.pro:QT_FEATURE_vkb_lang_sv_SE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sv_SE/handwriting.fallback"
-
-#### Keys ignored in scope 41:.:.:plugin.pro:QT_FEATURE_vkb_lang_th_TH:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/th_TH/handwriting.fallback"
-
-#### Keys ignored in scope 42:.:.:plugin.pro:QT_FEATURE_vkb_lang_tr_TR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/tr_TR/handwriting.fallback"
-
-#### Keys ignored in scope 43:.:.:plugin.pro:QT_FEATURE_vkb_lang_uk_UA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/uk_UA/handwriting.fallback"
-
-#### Keys ignored in scope 44:.:.:plugin.pro:QT_FEATURE_vkb_lang_vi_VN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/vi_VN/handwriting.fallback"
-
-#### Keys ignored in scope 45:.:.:plugin.pro:QT_FEATURE_vkb_lang_zh_CN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/zh_CN/handwriting.qml"
-
-#### Keys ignored in scope 46:.:.:plugin.pro:QT_FEATURE_vkb_lang_zh_TW:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/zh_TW/handwriting.qml"
-
-#### Keys ignored in scope 47:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard MyScript (Qt $$QT_VERSION)"
diff --git a/src/plugins/myscript/plugin/myscript.json b/src/plugins/myscript/plugin/myscript.json
deleted file mode 100644
index 8f573972..00000000
--- a/src/plugins/myscript/plugin/myscript.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "handwriting",
- "Provider": "Qt MyScript Extension",
- "InputMethod": "HandwritingInputMethod",
- "Version": 300
-}
diff --git a/src/plugins/myscript/plugin/myscriptinputmethod.cpp b/src/plugins/myscript/plugin/myscriptinputmethod.cpp
index dc15cdb8..e1cf48f2 100644
--- a/src/plugins/myscript/plugin/myscriptinputmethod.cpp
+++ b/src/plugins/myscript/plugin/myscriptinputmethod.cpp
@@ -1,33 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) MyScript. Contact: https://www.myscript.com/about/contact-us/sales-inquiry/
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). Contact: https://www.qt.io/licensing/
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) MyScript. Contact: https://www.myscript.com/about/contact-us/sales-inquiry/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). Contact: https://www.qt.io/licensing/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "myscriptinputmethod_p.h"
#include "myscriptinputmethod_p_p.h"
@@ -40,7 +14,6 @@
#include MYSCRIPT_CERTIFICATE
#include <common/Properties.h>
-#include <common/PortabilityDefinitions.h>
#include <voim.h>
#include <thread>
@@ -52,6 +25,7 @@
#endif
#include <QCryptographicHash>
+#include <QFile>
#include <QThread>
#include <QtCore/qmath.h>
@@ -180,7 +154,8 @@ public:
traceList[i]->setOpacity(qMax(0.0, 1 - 0.25 * (traceList.size() - i)));
}
- QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace();
+ Q_Q(MyScriptInputMethod);
+ QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace(q);
traceList.append(trace);
return trace;
@@ -204,7 +179,7 @@ public:
int countActiveTraces() const
{
int count = 0;
- for (QVirtualKeyboardTrace *trace : qAsConst(traceList)) {
+ for (QVirtualKeyboardTrace *trace : std::as_const(traceList)) {
if (!trace->isFinal())
count++;
}
@@ -268,7 +243,7 @@ public:
m_itemIndex = -1;
- for (int i = 0; i < m_items.count(); i++) {
+ for (int i = 0; i < m_items.size(); i++) {
CandidateItem *candidateItem = m_items.at(i).second;
delete candidateItem;
}
@@ -312,6 +287,16 @@ public:
}
}
+ QString getLibraryPath(QString libName)
+ {
+ QString libPath = QLibraryInfo::path(QLibraryInfo::LibrariesPath) + "/" + libName;
+ if (QFile::exists(libPath)) {
+ return libPath;
+ } else {
+ return QLibraryInfo::path(QLibraryInfo::BinariesPath) + "/" + libName;
+ }
+ }
+
void initHwrEngine(void)
{
if (!createEngine())
@@ -353,14 +338,14 @@ public:
const voCertificate *certificate = &myCertificate;
voimProperty *properties = nullptr;
- QString imLibrary = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/" + MYSCRIPT_VOIM_NAME;
+ QString imLibrary = getLibraryPath(MYSCRIPT_VOIM_NAME);
properties = Properties_put(properties, "com.myscript.im.library", imLibrary.toStdString().c_str());
if (!properties) {
qCCritical(qlcVKMyScript) << "failed to define property " << "com.myscript.im.library" << " with value " << imLibrary;
return false;
}
- QString engineLibrary = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/" + MYSCRIPT_ENGINE_NAME;
+ QString engineLibrary = getLibraryPath(MYSCRIPT_ENGINE_NAME);
properties = Properties_put(properties, "com.myscript.engine.library", engineLibrary.toStdString().c_str());
if (!properties) {
qCCritical(qlcVKMyScript) << "failed to define property " << "com.myscript.engine.library" << " with value " << engineLibrary;
@@ -368,7 +353,7 @@ public:
}
QString propertyFile = QLatin1String("/Engine.properties");
- propertyFile = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
+ propertyFile = MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
if (!checkFile(propertyFile)) {
qCCritical(qlcVKMyScript) << "failed to open Engine Property file " << propertyFile;
@@ -390,7 +375,7 @@ public:
voimProperty *properties = nullptr;
- QString languageConf = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + MYSCRIPT_LANGUAGE_CONF_PATH;
+ QString languageConf = MYSCRIPT_LANGUAGE_CONF_PATH;
properties = Properties_put(properties, "com.myscript.im.languageSearchPath", languageConf.toStdString().c_str());
if (!properties) {
qCCritical(qlcVKMyScript) << "failed to define property " << "com.myscript.im.languageSearchPath" << " with value " << languageConf;
@@ -404,7 +389,7 @@ public:
}
QString propertyFile = QLatin1String("/LanguageManager.properties");
- propertyFile = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
+ propertyFile = MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
if (!checkFile(propertyFile)) {
qCCritical(qlcVKMyScript) << "failed to open LanguageManager Property file " << propertyFile;
@@ -431,7 +416,7 @@ public:
qCDebug(qlcVKMyScript) << Q_FUNC_INFO;
QString propertyFile = QLatin1String("/Recognizer.properties");
- propertyFile = QLibraryInfo::location(QLibraryInfo::DataPath) + "/" + MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
+ propertyFile = MYSCRIPT_VOIM_PROPERTY_PATH + propertyFile;
if (!checkFile(propertyFile)) {
qCCritical(qlcVKMyScript) << "failed to open Recognizer Property file " << propertyFile;
@@ -1050,7 +1035,7 @@ int MyScriptInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListMod
if (type != QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
return 0;
- return d->wordCandidates.count();
+ return d->wordCandidates.size();
}
QVariant MyScriptInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
diff --git a/src/plugins/myscript/plugin/myscriptinputmethod_p.h b/src/plugins/myscript/plugin/myscriptinputmethod_p.h
index 2f022fd2..83b66565 100644
--- a/src/plugins/myscript/plugin/myscriptinputmethod_p.h
+++ b/src/plugins/myscript/plugin/myscriptinputmethod_p.h
@@ -1,33 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) MyScript. Contact: https://www.myscript.com/about/contact-us/sales-inquiry/
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). Contact: https://www.qt.io/licensing/
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) MyScript. Contact: https://www.myscript.com/about/contact-us/sales-inquiry/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). Contact: https://www.qt.io/licensing/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MYSCRIPTINPUTMETHOD_P_H
#define MYSCRIPTINPUTMETHOD_P_H
@@ -55,6 +29,9 @@ class MyScriptInputMethod : public QVirtualKeyboardAbstractInputMethod
Q_OBJECT
Q_DECLARE_PRIVATE(MyScriptInputMethod)
Q_PROPERTY(bool superimposed READ superimposed CONSTANT)
+ QML_NAMED_ELEMENT(HandwritingInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
public:
explicit MyScriptInputMethod(QObject *parent = nullptr);
~MyScriptInputMethod();
diff --git a/src/plugins/myscript/plugin/myscriptinputmethod_p_p.h b/src/plugins/myscript/plugin/myscriptinputmethod_p_p.h
index 5ee303fd..55fc174f 100644
--- a/src/plugins/myscript/plugin/myscriptinputmethod_p_p.h
+++ b/src/plugins/myscript/plugin/myscriptinputmethod_p_p.h
@@ -1,33 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) MyScript. Contact: https://www.myscript.com/about/contact-us/sales-inquiry/
-** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). Contact: https://www.qt.io/licensing/
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) MyScript. Contact: https://www.myscript.com/about/contact-us/sales-inquiry/
+// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). Contact: https://www.qt.io/licensing/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MYSCRIPTINPUTMETHOD_P_P_H
#define MYSCRIPTINPUTMETHOD_P_P_H
diff --git a/src/plugins/myscript/plugin/myscriptplugin.cpp b/src/plugins/myscript/plugin/myscriptplugin.cpp
deleted file mode 100644
index 779a52d2..00000000
--- a/src/plugins/myscript/plugin/myscriptplugin.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "myscriptplugin.h"
-#include "myscriptinputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardMyScriptPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<MyScriptInputMethod>(uri, 2, 0, "HandwritingInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/myscript/plugin/myscriptplugin.h b/src/plugins/myscript/plugin/myscriptplugin.h
deleted file mode 100644
index 7b7873ca..00000000
--- a/src/plugins/myscript/plugin/myscriptplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MYSCRIPTPLUGIN_H
-#define MYSCRIPTPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardMyScriptPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "myscript.json")
-public:
- void registerTypes(const char *uri) const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/myscript/plugin/plugin.pro b/src/plugins/myscript/plugin/plugin.pro
deleted file mode 100644
index 81f62de8..00000000
--- a/src/plugins/myscript/plugin/plugin.pro
+++ /dev/null
@@ -1,111 +0,0 @@
-TARGET = qtvirtualkeyboard_myscript
-QT += qml virtualkeyboard
-
-!qtConfig(vkb-myscript) {
- error("MyScript SDK could not be found. For more information, see" \
- "the documentation in Building Qt Virtual Keyboard")
-}
-
-include(../../../shared.pri)
-
-HEADERS += \
- myscriptplugin.h \
- myscriptinputmethod_p.h \
- myscriptinputmethod_p_p.h
-SOURCES += \
- myscriptplugin.cpp \
- myscriptinputmethod.cpp \
- $$MYSCRIPT_PATH/voim/api/c/examples/common/Properties.c \
- $$MYSCRIPT_PATH/voim/api/c/examples/common/PortabilityDefinitions.c
-OTHER_FILES += \
- myscript.json
-INCLUDEPATH += \
- $$MYSCRIPT_PATH/voim/api/c/include \
- $$MYSCRIPT_PATH/voim/api/c/examples
-MYSCRIPT_DATA = qtvirtualkeyboard/myscript
-DEFINES += MYSCRIPT_CERTIFICATE=\\\"$$MYSCRIPT_PATH/edk/c/examples/certificates/MyCertificate.c\\\"
-DEFINES += MYSCRIPT_VOIM_PROPERTY_PATH=\\\"$$MYSCRIPT_DATA/$$MYSCRIPT_VOIM_CONF\\\"
-DEFINES += MYSCRIPT_LANGUAGE_CONF_PATH=\\\"$$MYSCRIPT_DATA/$$MYSCRIPT_LANGUAGE_CONF\\\"
-DEFINES += MYSCRIPT_VOIM_NAME=\\\"$${MYSCRIPT_LIB_PREFIX}voim$${MYSCRIPT_LIB_SUFFIX}\\\"
-DEFINES += MYSCRIPT_ENGINE_NAME=\\\"$${MYSCRIPT_LIB_PREFIX}MyScriptEngine$${MYSCRIPT_LIB_SUFFIX}\\\"
-LIBS += $$MYSCRIPT_VOIM_LIB
-unix:linux:!android: QMAKE_RPATHDIR += $$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_PATH
-myscript_engine_bins.files = $$MYSCRIPT_ENGINE_BINS
-myscript_engine_bins.path = $$[QT_INSTALL_BINS]
-myscript_voim_conf.files = $$MYSCRIPT_PATH/$$MYSCRIPT_VOIM_CONF
-myscript_voim_conf.path = $$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA/voim
-myscript_language_conf.files = $$MYSCRIPT_PATH/$$MYSCRIPT_LANGUAGE_CONF
-myscript_language_conf.path = $$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA
-myscript_resources.files = $$MYSCRIPT_PATH/$$MYSCRIPT_RESOURCES
-myscript_resources.path = $$[QT_INSTALL_DATA]/$$MYSCRIPT_DATA
-INSTALLS += \
- myscript_engine_bins \
- myscript_voim_conf \
- myscript_language_conf \
- myscript_resources
-!prefix_build: COPIES += \
- myscript_engine_bins \
- myscript_voim_conf \
- myscript_language_conf \
- myscript_resources
-
-LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fallback/handwriting.qml
-qtConfig(vkb-lang-en_GB): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback
-qtConfig(vkb-lang-en_US): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback
-qtConfig(vkb-lang-ar_AR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ar_AR/handwriting.qml
-qtConfig(vkb-lang-bg_BG): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/bg_BG/handwriting.qml
-qtConfig(vkb-lang-cs_CZ): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/cs_CZ/handwriting.qml
-qtConfig(vkb-lang-da_DK): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/da_DK/handwriting.fallback
-qtConfig(vkb-lang-de_DE): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/de_DE/handwriting.fallback
-qtConfig(vkb-lang-el_GR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/el_GR/handwriting.qml
-qtConfig(vkb-lang-es_ES): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_ES/handwriting.qml
-qtConfig(vkb-lang-es_MX): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_MX/handwriting.qml
-qtConfig(vkb-lang-et_EE): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/et_EE/handwriting.fallback
-qtConfig(vkb-lang-fa_FA): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fa_FA/handwriting.qml
-qtConfig(vkb-lang-fi_FI): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fi_FI/handwriting.fallback
-qtConfig(vkb-lang-fr_FR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_FR/handwriting.fallback
-qtConfig(vkb-lang-fr_CA): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_CA/handwriting.fallback
-qtConfig(vkb-lang-he_IL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/he_IL/handwriting.qml
-qtConfig(vkb-lang-hi_IN): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hi_IN/handwriting.qml
-qtConfig(vkb-lang-hr_HR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hr_HR/handwriting.qml
-qtConfig(vkb-lang-hu_HU): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hu_HU/handwriting.qml
-qtConfig(vkb-lang-id_ID): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback
-qtConfig(vkb-lang-it_IT): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/it_IT/handwriting.fallback
-qtConfig(vkb-lang-ja_JP): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ja_JP/handwriting.qml
-qtConfig(vkb-lang-ko_KR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ko_KR/handwriting.qml
-qtConfig(vkb-lang-ms_MY): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback
-qtConfig(vkb-lang-nb_NO): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nb_NO/handwriting.fallback
-qtConfig(vkb-lang-nl_NL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback
-qtConfig(vkb-lang-pl_PL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pl_PL/handwriting.fallback
-qtConfig(vkb-lang-pt_BR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_BR/handwriting.fallback
-qtConfig(vkb-lang-pt_PT): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_PT/handwriting.fallback
-qtConfig(vkb-lang-ro_RO): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ro_RO/handwriting.qml
-qtConfig(vkb-lang-ru_RU): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ru_RU/handwriting.fallback
-qtConfig(vkb-lang-sk_SK): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sk_SK/handwriting.fallback
-qtConfig(vkb-lang-sl_SI): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sl_SI/handwriting.fallback
-qtConfig(vkb-lang-sq_AL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sq_AL/handwriting.fallback
-qtConfig(vkb-lang-sr_SP): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sr_SP/handwriting.qml
-qtConfig(vkb-lang-sv_SE): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sv_SE/handwriting.fallback
-qtConfig(vkb-lang-th_TH): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/th_TH/handwriting.fallback
-qtConfig(vkb-lang-tr_TR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/tr_TR/handwriting.fallback
-qtConfig(vkb-lang-uk_UA): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/uk_UA/handwriting.fallback
-qtConfig(vkb-lang-vi_VN): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/vi_VN/handwriting.fallback
-qtConfig(vkb-lang-zh_CN): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/zh_CN/handwriting.qml
-qtConfig(vkb-lang-zh_TW): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/zh_TW/handwriting.qml
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-virtualkeyboard_myscript_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_myscript_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_myscript_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_myscript_layouts
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard MyScript (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardMyScriptPlugin
-load(qt_plugin)
diff --git a/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt b/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt
index 3cab39b9..d235785f 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt
+++ b/src/plugins/openwnn/3rdparty/openwnn/CMakeLists.txt
@@ -4,7 +4,8 @@
## BundledOpenwnn Generic Library:
#####################################################################
-qt_add_3rdparty_library(BundledOpenwnn
+qt_internal_add_3rdparty_library(BundledOpenwnn
+ QMAKE_LIB_NAME openwnn
STATIC
SOURCES
wnnDictionary/engine/ndapi.c
diff --git a/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro b/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro
deleted file mode 100644
index 150ed169..00000000
--- a/src/plugins/openwnn/3rdparty/openwnn/openwnn.pro
+++ /dev/null
@@ -1,63 +0,0 @@
-TARGET = qtopenwnn
-
-VERSION = 1.3.6
-CONFIG += static
-CONFIG += warn_off
-
-MODULE_INCLUDEPATH = $$PWD/wnnEngine/include
-MODULE_DEFINES = HAVE_OPENWNN
-INCLUDEPATH += wnnDictionary/include
-
-SOURCES += \
- wnnDictionary/engine/ndapi.c \
- wnnDictionary/engine/ndbdic.c \
- wnnDictionary/engine/ndcommon.c \
- wnnDictionary/engine/ndfdic.c \
- wnnDictionary/engine/ndldic.c \
- wnnDictionary/engine/ndrdic.c \
- wnnDictionary/engine/neapi.c \
- wnnDictionary/engine/necode.c \
- wnnDictionary/engine/nj_str.c \
- wnnEngine/WnnJpnDic.c \
- wnnEngine/openwnndictionary.cpp \
- wnnEngine/openwnnenginejajp.cpp \
- wnnEngine/openwnnclauseconverterjajp.cpp \
- wnnEngine/kanaconverter.cpp \
- wnnEngine/composingtext.cpp \
- wnnEngine/letterconverter.cpp \
- wnnEngine/romkan.cpp \
- wnnEngine/romkanfullkatakana.cpp \
- wnnEngine/romkanhalfkatakana.cpp \
- wnnEngine/wnnlookuptable.cpp
-
-HEADERS += \
- wnnDictionary/include/nj_dic.h \
- wnnDictionary/include/nj_err.h \
- wnnDictionary/include/nj_ext.h \
- wnnDictionary/include/nj_lib.h \
- wnnDictionary/include/njd.h \
- wnnDictionary/include/njx_lib.h \
- wnnEngine/predef_table.h \
- wnnEngine/include/openwnndictionary.h \
- wnnEngine/include/openwnnenginejajp.h \
- wnnEngine/include/openwnnclauseconverterjajp.h \
- wnnEngine/include/wnnword.h \
- wnnEngine/include/kanaconverter.h \
- wnnEngine/include/composingtext.h \
- wnnEngine/include/strsegment.h \
- wnnEngine/include/letterconverter.h \
- wnnEngine/include/romkan.h \
- wnnEngine/include/romkanfullkatakana.h \
- wnnEngine/include/romkanhalfkatakana.h \
- wnnEngine/include/wnnlookuptable.h
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-load(qt_helper_lib)
-
-CONFIG += qt
-QT = core-private
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
index 2b200b9e..f29efe94 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/kanaconverter.cpp
@@ -50,7 +50,7 @@ public:
static bool createCandidateString(const QString &input, const WnnLookupTable &map, QString &outBuf)
{
outBuf.clear();
- for (int index = 0, length = input.length(); index < length; index++) {
+ for (int index = 0, length = input.size(); index < length; index++) {
QString out = map.value(input.mid(index, 1));
if (out.isEmpty())
return false;
@@ -167,7 +167,7 @@ QList<WnnWord> KanaConverter::createPseudoCandidateList(const QString &inputHira
Q_D(KanaConverter);
QList<WnnWord> list;
- if (inputHiragana.length() == 0) {
+ if (inputHiragana.size() == 0) {
return list;
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
index e948456f..21db663a 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnclauseconverterjajp.cpp
@@ -22,7 +22,9 @@
#include "openwnnclauseconverterjajp.h"
#include "openwnndictionary.h"
#include "wnnword.h"
+
#include <QtCore/private/qobject_p.h>
+#include <QtCore/qpointer.h>
class OpenWnnClauseConverterJAJPPrivate : public QObjectPrivate
{
@@ -49,7 +51,7 @@ public:
/* get clauses with ancillary word */
int max = CLAUSE_COST * 2;
- for (int split = 1; split < input.length(); split++) {
+ for (int split = 1; split < input.size(); split++) {
/* get ancillary patterns */
QString str = input.mid(split);
QList<WnnWord> fzks = getAncillaryPattern(str);
@@ -147,7 +149,7 @@ public:
QList<WnnWord> getAncillaryPattern(const QString &input)
{
- if (input.length() == 0) {
+ if (input.size() == 0) {
return QList<WnnWord>();
}
@@ -161,7 +163,7 @@ public:
dict->clearApproxPattern();
dict->setDictionary(6, 400, 500);
- for (int start = input.length() - 1; start >= 0; start--) {
+ for (int start = input.size() - 1; start >= 0; start--) {
QString key = input.mid(start);
if (mFzkPatterns.contains(key)) {
@@ -178,7 +180,7 @@ public:
}
/* concatenate sequence of ancillary words */
- for (int end = input.length() - 1; end > start; end--) {
+ for (int end = input.size() - 1; end > start; end--) {
QString followKey = input.mid(end);
if (!mFzkPatterns.contains(followKey))
continue;
@@ -204,7 +206,7 @@ public:
QList<WnnWord> getIndependentWords(const QString &input, bool all)
{
- if (input.length() == 0)
+ if (input.size() == 0)
return QList<WnnWord>();
QMap<QString, QList<WnnWord> > &wordBag = all ? mAllIndepWordBag : mIndepWordBag;
@@ -261,12 +263,12 @@ public:
void addAutoGeneratedCandidates(const QString &input, QList<WnnWord> &wordList, bool all)
{
Q_UNUSED(all);
- wordList.append(WnnWord(input, input, mPosDefault, (CLAUSE_COST - 1) * input.length()));
+ wordList.append(WnnWord(input, input, mPosDefault, (CLAUSE_COST - 1) * input.size()));
}
WnnClause defaultClause(const QString &input)
{
- return WnnClause(input, input, mPosDefault, (CLAUSE_COST - 1) * input.length());
+ return WnnClause(input, input, mPosDefault, (CLAUSE_COST - 1) * input.size());
}
/** Score(frequency value) of word in the learning dictionary */
@@ -351,7 +353,7 @@ QList<WnnClause> OpenWnnClauseConverterJAJP::convert(const QString &input)
return convertResult;
/* do nothing if the length of input exceeds the limit */
- if (input.length() > OpenWnnClauseConverterJAJPPrivate::MAX_INPUT_LENGTH)
+ if (input.size() > OpenWnnClauseConverterJAJPPrivate::MAX_INPUT_LENGTH)
return convertResult;
/* try single clause conversion */
@@ -367,18 +369,18 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
/* clear the cache which is not matched */
QList<QSharedPointer<WnnSentence> > sentence;
- for (int i = 0; i < input.length(); i++) {
+ for (int i = 0; i < input.size(); i++) {
sentence.append(QSharedPointer<WnnSentence>());
}
/* consecutive clause conversion */
- for (int start = 0; start < input.length(); start++) {
+ for (int start = 0; start < input.size(); start++) {
if (start != 0 && sentence[start - 1] == NULL) {
continue;
}
/* limit the length of a clause */
- int end = input.length();
+ int end = input.size();
if (end > start + 20) {
end = start + 20;
}
@@ -403,7 +405,7 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
QString key = input.mid(start, end - start);
clauses.clear();
- if (end == input.length()) {
+ if (end == input.size()) {
/* get the clause which can be the end of the sentence */
d->singleClauseConvert(clauses, key, d->mPosEndOfClause1, false);
} else {
@@ -424,8 +426,8 @@ QSharedPointer<WnnSentence> OpenWnnClauseConverterJAJP::consecutiveClauseConvert
}
/* return the result of the consecutive clause conversion */
- if (sentence[input.length() - 1] != NULL) {
- return sentence[input.length() - 1];
+ if (sentence[input.size() - 1] != NULL) {
+ return sentence[input.size() - 1];
}
return QSharedPointer<WnnSentence>();
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
index abcf060c..871a58f4 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnndictionary.cpp
@@ -340,7 +340,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SEARCH_WORD, NJ_ERR_INVALID_PARAM);
}
- if (keyString.length() > NJ_MAX_LEN) {
+ if (keyString.size() > NJ_MAX_LEN) {
/* If too long key string was specified, return "No result is found" */
work.flag &= ~NJ_JNI_FLAG_ENABLE_CURSOR;
work.flag &= ~NJ_JNI_FLAG_ENABLE_RESULT;
@@ -468,8 +468,8 @@ public:
int setApproxPattern(const QString &src, const QString &dst)
{
- if (src.isEmpty() || src.length() > 1 ||
- dst.isEmpty() || dst.length() > 3) {
+ if (src.isEmpty() || src.size() > 1 ||
+ dst.isEmpty() || dst.size() > 3) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_APPROX_PATTERN, NJ_ERR_INVALID_PARAM);
}
@@ -543,7 +543,7 @@ public:
QStringList getApproxPattern(const QString &src)
{
- if (src.isEmpty() || src.length() > 1)
+ if (src.isEmpty() || src.size() > 1)
return QStringList();
NJ_CHAR from[NJ_MAX_CHARSET_FROM_LEN + NJ_TERM_LEN];
@@ -614,7 +614,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SET_STROKE, NJ_ERR_INVALID_PARAM);
}
- if (stroke.length() > NJ_MAX_LEN) {
+ if (stroke.size() > NJ_MAX_LEN) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_STROKE, NJ_ERR_YOMI_TOO_LONG);
}
@@ -632,7 +632,7 @@ public:
return NJ_SET_ERR_VAL(NJ_FUNC_SET_CANDIDATE, NJ_ERR_INVALID_PARAM);
}
- if (candidate.length() > NJ_MAX_RESULT_LEN) {
+ if (candidate.size() > NJ_MAX_RESULT_LEN) {
/* If a invalid parameter was specified, return an error code */
return NJ_SET_ERR_VAL(NJ_FUNC_SET_CANDIDATE, NJ_ERR_CANDIDATE_TOO_LONG);
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
index f66d4942..1a13f72d 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/openwnnenginejajp.cpp
@@ -143,7 +143,7 @@ public:
bool addCandidate(QSharedPointer<WnnWord> word)
{
if (word.isNull() || word->candidate.isEmpty() || mCandTable.contains(word->candidate)
- || word->candidate.length() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
+ || word->candidate.size() > OpenWnnEngineJAJP::MAX_OUTPUT_LENGTH) {
return false;
}
/*
@@ -170,14 +170,14 @@ public:
int setSearchKey(const ComposingText &text, int maxLen)
{
QString input = text.toString(ComposingText::LAYER1);
- if (0 <= maxLen && maxLen <= input.length()) {
+ if (0 <= maxLen && maxLen <= input.size()) {
input = input.mid(0, maxLen);
mExactMatchMode = true;
} else {
mExactMatchMode = false;
}
- if (input.length() == 0) {
+ if (input.size() == 0) {
mInputHiragana.clear();
mInputRomaji.clear();
return 0;
@@ -186,7 +186,7 @@ public:
mInputHiragana = input;
mInputRomaji = text.toString(ComposingText::LAYER0);
- return input.length();
+ return input.size();
}
void clearPreviousWord()
@@ -292,7 +292,7 @@ int OpenWnnEngineJAJP::convert(ComposingText &text)
}
QSharedPointer<WnnSentence> sentence;
- if (input.length() != 0) {
+ if (input.size() != 0) {
sentence = d->mClauseConverter.consecutiveClauseConvert(input);
}
if (!head.isNull()) {
@@ -307,7 +307,7 @@ int OpenWnnEngineJAJP::convert(ComposingText &text)
for (QList<WnnClause>::ConstIterator it = sentence->elements.constBegin();
it != sentence->elements.constEnd(); it++) {
const WnnClause &clause = *it;
- int len = clause.stroke.length();
+ int len = clause.stroke.size();
ss.append(StrSegment(clause, pos, pos + len - 1));
pos += len;
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
index 3a555e2b..f3be31d6 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/romkan.cpp
@@ -126,20 +126,20 @@ bool Romkan::convertImpl(ComposingText &text, const WnnLookupTable &table) const
for (int i = start; i < RomkanPrivate::MAX_LENGTH; i++) {
key.append(str[i].string);
}
- bool upper = key.at(key.length() - 1).isUpper();
+ bool upper = key.at(key.size() - 1).isUpper();
QString match = table[key.toLower()];
if (!match.isEmpty()) {
if (upper) {
match = match.toUpper();
}
QList<StrSegment> out;
- if (match.length() == 1) {
+ if (match.size() == 1) {
out.append(StrSegment(match, str[start].from, str[RomkanPrivate::MAX_LENGTH - 1].to));
text.replaceStrSegment(ComposingText::LAYER1, out, RomkanPrivate::MAX_LENGTH - start);
} else {
- out.append(StrSegment(match.left(match.length() - 1),
+ out.append(StrSegment(match.left(match.size() - 1),
str[start].from, str[RomkanPrivate::MAX_LENGTH - 1].to - 1));
- out.append(StrSegment(match.mid(match.length() - 1),
+ out.append(StrSegment(match.mid(match.size() - 1),
str[RomkanPrivate::MAX_LENGTH - 1].to, str[RomkanPrivate::MAX_LENGTH - 1].to));
text.replaceStrSegment(ComposingText::LAYER1, out, RomkanPrivate::MAX_LENGTH - start);
}
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
index a9dc5dda..cd094295 100644
--- a/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnEngine/wnnlookuptable.cpp
@@ -54,7 +54,7 @@ void WnnLookupTable::create(const QMap<QString, QString> &map, const QString &ta
std::sort(keys.begin(), keys.end(), [] (const QString &lhs, const QString &rhs) {
return strcmp(lhs.toUtf8().constData(), rhs.toUtf8().constData()) < 0;
});
- file.write(QString("static const int %1Length = %2;\n").arg(tablePrefix).arg(keys.count()).toUtf8().constData());
+ file.write(QString("static const int %1Length = %2;\n").arg(tablePrefix).arg(keys.size()).toUtf8().constData());
file.write(QString("static const char *%1Key[%1Length];\n").arg(tablePrefix).toUtf8().constData());
file.write(QString("static const char *%1Value[%1Length];\n").arg(tablePrefix).toUtf8().constData());
file.write(QString("const char *%1Key[] = {\n").arg(tablePrefix).toUtf8().constData());
diff --git a/src/plugins/openwnn/CMakeLists.txt b/src/plugins/openwnn/CMakeLists.txt
index f3f86808..eb65f4fb 100644
--- a/src/plugins/openwnn/CMakeLists.txt
+++ b/src/plugins/openwnn/CMakeLists.txt
@@ -1,4 +1,50 @@
-# Generated from openwnn.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(3rdparty/openwnn)
-add_subdirectory(plugin)
+
+#####################################################################
+## QtVirtualKeyboardOpenWnnPlugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(qtvkbopenwnnplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.OpenWNN"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbopenwnnplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ openwnninputmethod.cpp openwnninputmethod_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboard
+ Qt::BundledOpenwnn
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# Resources:
+set(qmake_virtualkeyboard_openwnn_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/ja_JP/dialpad.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/main.qml"
+ "${VKB_LAYOUTS_BASE}/ja_JP/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/ja_JP/symbols.qml"
+)
+
+qt_internal_add_resource(qtvkbopenwnnplugin "qmake_virtualkeyboard_openwnn_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${VKB_LAYOUTS_BASE}"
+ FILES
+ ${qmake_virtualkeyboard_openwnn_layouts_resource_files}
+)
diff --git a/src/plugins/openwnn/openwnn.pro b/src/plugins/openwnn/openwnn.pro
deleted file mode 100644
index bb639c86..00000000
--- a/src/plugins/openwnn/openwnn.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = subdirs
-
-include(../../../shared.pri)
-
-SUBDIRS += \
- 3rdparty/openwnn \
- plugin
-
-plugin.depends += 3rdparty/openwnn
diff --git a/src/plugins/openwnn/openwnninputmethod.cpp b/src/plugins/openwnn/openwnninputmethod.cpp
new file mode 100644
index 00000000..745edd14
--- /dev/null
+++ b/src/plugins/openwnn/openwnninputmethod.cpp
@@ -0,0 +1,806 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "openwnninputmethod_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#include <QLoggingCategory>
+#include <openwnnenginejajp.h>
+#include <composingtext.h>
+#include <romkan.h>
+#include <romkanfullkatakana.h>
+#include <romkanhalfkatakana.h>
+#include <QTextFormat>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(lcOpenWnn, "qt.virtualkeyboard.openwnn")
+
+class OpenWnnInputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(OpenWnnInputMethod)
+public:
+ enum EngineMode {
+ ENGINE_MODE_DEFAULT,
+ ENGINE_MODE_DIRECT,
+ ENGINE_MODE_NO_LV2_CONV,
+ ENGINE_MODE_FULL_KATAKANA,
+ ENGINE_MODE_HALF_KATAKANA,
+ };
+
+ enum ConvertType {
+ CONVERT_TYPE_NONE = 0,
+ CONVERT_TYPE_RENBUN = 1,
+ };
+
+ enum {
+ MAX_COMPOSING_TEXT = 30
+ };
+
+ OpenWnnInputMethodPrivate(OpenWnnInputMethod *q_ptr) :
+ q_ptr(q_ptr),
+ inputMode(QVirtualKeyboardInputEngine::InputMode::Latin),
+ exactMatchMode(false),
+ converter(nullptr),
+ converterJAJP(),
+ activeConvertType(CONVERT_TYPE_NONE),
+ preConverter(nullptr),
+ enableLearning(true),
+ enablePrediction(true),
+ enableConverter(true),
+ disableUpdate(false),
+ commitCount(0),
+ targetLayer(ComposingText::LAYER1),
+ activeWordIndex(-1)
+ {
+ }
+
+ void changeEngineMode(EngineMode mode)
+ {
+ switch (mode) {
+ case ENGINE_MODE_DIRECT:
+ /* Full/Half-width number or Full-width alphabet */
+ converter = nullptr;
+ preConverter.reset();
+ break;
+
+ case ENGINE_MODE_NO_LV2_CONV:
+ converter = nullptr;
+ preConverter.reset(new Romkan());
+ break;
+
+ case ENGINE_MODE_FULL_KATAKANA:
+ converter = nullptr;
+ preConverter.reset(new RomkanFullKatakana());
+ break;
+
+ case ENGINE_MODE_HALF_KATAKANA:
+ converter = nullptr;
+ preConverter.reset(new RomkanHalfKatakana());
+ break;
+
+ default:
+ /* HIRAGANA input mode */
+ setDictionary(OpenWnnEngineJAJP::DIC_LANG_JP);
+ converter = &converterJAJP;
+ preConverter.reset(new Romkan());
+ break;
+ }
+ }
+
+ void setDictionary(OpenWnnEngineJAJP::DictionaryType mode)
+ {
+ converterJAJP.setDictionary(mode);
+ }
+
+ void breakSequence()
+ {
+ converterJAJP.breakSequence();
+ }
+
+ bool isEnableL2Converter()
+ {
+ return converter != nullptr && enableConverter;
+ }
+
+ void startConvert(ConvertType convertType)
+ {
+ if (!isEnableL2Converter())
+ return;
+
+ if (activeConvertType != convertType) {
+ if (!exactMatchMode) {
+ if (convertType == CONVERT_TYPE_RENBUN) {
+ /* not specify */
+ composingText.setCursor(ComposingText::LAYER1, 0);
+ } else {
+ if (activeConvertType == CONVERT_TYPE_RENBUN) {
+ exactMatchMode = true;
+ } else {
+ /* specify all range */
+ composingText.setCursor(ComposingText::LAYER1,
+ composingText.size(ComposingText::LAYER1));
+ }
+ }
+ }
+
+ if (convertType == CONVERT_TYPE_RENBUN)
+ /* clears variables for the prediction */
+ exactMatchMode = false;
+
+ /* clears variables for the convert */
+ commitCount = 0;
+
+ activeConvertType = convertType;
+
+ updateViewStatus(ComposingText::LAYER2, true, true);
+
+ focusNextCandidate();
+ }
+ }
+
+ void changeL2Segment(const QSharedPointer<WnnWord> &word)
+ {
+ if (word.isNull())
+ return;
+ QList<StrSegment> ss;
+ ss.append(composingText.getStrSegment(ComposingText::LAYER2, 0));
+ if (!ss[0].clause.isNull())
+ ss[0].clause->candidate = word->candidate;
+ ss[0].string = word->candidate;
+ composingText.replaceStrSegment(ComposingText::LAYER2, ss);
+ if (lcOpenWnn().isDebugEnabled())
+ composingText.debugout();
+ updateViewStatus(ComposingText::LAYER2, false, false);
+ }
+
+ void initializeScreen()
+ {
+ if (composingText.size(ComposingText::LAYER0) != 0) {
+ Q_Q(OpenWnnInputMethod);
+ q->inputContext()->commit(QString());
+ }
+ composingText.clear();
+ exactMatchMode = false;
+ activeConvertType = CONVERT_TYPE_NONE;
+ clearCandidates();
+ }
+
+ void updateViewStatusForPrediction(bool updateCandidates, bool updateEmptyText)
+ {
+ activeConvertType = CONVERT_TYPE_NONE;
+
+ updateViewStatus(ComposingText::LAYER1, updateCandidates, updateEmptyText);
+ }
+
+ void updateViewStatus(ComposingText::TextLayer layer, bool updateCandidates, bool updateEmptyText)
+ {
+ targetLayer = layer;
+
+ if (updateCandidates)
+ updateCandidateView();
+
+ /* set the text for displaying as the composing text */
+ displayText.clear();
+ displayText.insert(0, composingText.toString(layer));
+
+ /* add decoration to the text */
+ if (!displayText.isEmpty() || updateEmptyText) {
+
+ QList<QInputMethodEvent::Attribute> attributes;
+
+ int cursor = composingText.getCursor(layer);
+ if (cursor != 0) {
+ int highlightEnd = 0;
+
+ if (exactMatchMode) {
+
+ QTextCharFormat textFormat;
+ textFormat.setBackground(QBrush(QColor(0x66, 0xCD, 0xAA)));
+ textFormat.setForeground(QBrush(Qt::black));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, cursor, textFormat));
+ highlightEnd = cursor;
+
+ } else if (layer == ComposingText::LAYER2) {
+
+ highlightEnd = composingText.toString(layer, 0, 0).size();
+
+ /* highlights the first segment */
+ QTextCharFormat textFormat;
+ textFormat.setBackground(QBrush(QColor(0x88, 0x88, 0xFF)));
+ textFormat.setForeground(QBrush(Qt::black));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, highlightEnd, textFormat));
+ }
+
+ if (highlightEnd != 0 && highlightEnd < displayText.size()) {
+ /* highlights remaining text */
+ QTextCharFormat textFormat;
+ textFormat.setBackground(QBrush(QColor(0xF0, 0xFF, 0xFF)));
+ textFormat.setForeground(QBrush(Qt::black));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightEnd, displayText.size() - highlightEnd, textFormat));
+ }
+ }
+
+ QTextCharFormat textFormat;
+ textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, displayText.size(), textFormat));
+
+ int displayCursor = composingText.toString(layer, 0, cursor - 1).size();
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, displayCursor, 1, QVariant()));
+
+ Q_Q(OpenWnnInputMethod);
+ q->inputContext()->setPreeditText(displayText, attributes);
+ }
+ }
+
+ void updateCandidateView()
+ {
+ switch (targetLayer) {
+ case ComposingText::LAYER0:
+ case ComposingText::LAYER1: /* prediction */
+ if (enablePrediction)
+ /* update the candidates view */
+ updatePrediction();
+ break;
+ case ComposingText::LAYER2: /* convert */
+ if (commitCount == 0)
+ converter->convert(composingText);
+
+ if (converter->makeCandidateListOf(commitCount) != 0) {
+ composingText.setCursor(ComposingText::LAYER2, 1);
+ displayCandidates();
+ } else {
+ composingText.setCursor(ComposingText::LAYER1,
+ composingText.toString(ComposingText::LAYER1).size());
+ clearCandidates();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ void updatePrediction()
+ {
+ int candidates = 0;
+ int cursor = composingText.getCursor(ComposingText::LAYER1);
+ if (isEnableL2Converter()) {
+ if (exactMatchMode)
+ /* exact matching */
+ candidates = converter->predict(composingText, 0, cursor);
+ else
+ /* normal prediction */
+ candidates = converter->predict(composingText, 0, -1);
+ }
+
+ /* update the candidates view */
+ if (candidates > 0)
+ displayCandidates();
+ else
+ clearCandidates();
+ }
+
+ void displayCandidates()
+ {
+ int previousActiveWordIndex = activeWordIndex;
+ bool wasEmpty = candidateList.isEmpty();
+ clearCandidates(true);
+
+ QSharedPointer<WnnWord> result;
+ while ((result = converter->getNextCandidate()))
+ candidateList.append(result);
+
+ Q_Q(OpenWnnInputMethod);
+ if (!candidateList.isEmpty() || !wasEmpty)
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ if (previousActiveWordIndex != activeWordIndex)
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ }
+
+ void clearCandidates(bool deferUpdate = false)
+ {
+ if (!candidateList.isEmpty()) {
+ candidateList.clear();
+ if (!deferUpdate) {
+ Q_Q(OpenWnnInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ }
+ clearFocusCandidate(deferUpdate);
+ }
+ }
+
+ QSharedPointer<WnnWord> focusNextCandidate()
+ {
+ Q_Q(OpenWnnInputMethod);
+ if (candidateList.isEmpty())
+ return QSharedPointer<WnnWord>();
+ activeWordIndex++;
+ if (activeWordIndex >= candidateList.size())
+ activeWordIndex = 0;
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ return candidateList.at(activeWordIndex);
+ }
+
+ void clearFocusCandidate(bool deferUpdate = false)
+ {
+ Q_Q(OpenWnnInputMethod);
+ if (activeWordIndex != -1) {
+ activeWordIndex = -1;
+ if (!deferUpdate)
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
+ }
+ }
+
+ void fitInputType()
+ {
+ Q_Q(OpenWnnInputMethod);
+ enableConverter = true;
+
+ Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
+ if (inputMethodHints.testFlag(Qt::ImhDigitsOnly) ||
+ inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly) ||
+ inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly)) {
+ enableConverter = false;
+ }
+
+ if (inputMethodHints.testFlag(Qt::ImhLatinOnly)) {
+ enableConverter = false;
+ }
+
+ if (inputMode != QVirtualKeyboardInputEngine::InputMode::Hiragana ||
+ inputMethodHints.testFlag(Qt::ImhHiddenText) ||
+ inputMethodHints.testFlag(Qt::ImhSensitiveData) ||
+ inputMethodHints.testFlag(Qt::ImhNoPredictiveText)) {
+ if (enablePrediction) {
+ enablePrediction = false;
+ emit q->selectionListsChanged();
+ }
+ } else if (inputMode == QVirtualKeyboardInputEngine::InputMode::Hiragana && !enablePrediction) {
+ enablePrediction = true;
+ emit q->selectionListsChanged();
+ }
+
+ activeConvertType = CONVERT_TYPE_NONE;
+ }
+
+ void learnWord(WnnWord &word)
+ {
+ if (enableLearning)
+ converter->learn(word);
+ }
+
+ void learnWord(int index)
+ {
+ if (enableLearning && index < composingText.size(ComposingText::LAYER2)) {
+ StrSegment seg = composingText.getStrSegment(ComposingText::LAYER2, index);
+ if (!seg.clause.isNull()) {
+ converter->learn(*seg.clause);
+ } else {
+ QString stroke = composingText.toString(ComposingText::LAYER1, seg.from, seg.to);
+ WnnWord word(seg.string, stroke);
+ converter->learn(word);
+ }
+ }
+ }
+
+ void commitAll()
+ {
+ if (activeConvertType != CONVERT_TYPE_NONE) {
+ commitConvertingText();
+ } else {
+ composingText.setCursor(ComposingText::LAYER1,
+ composingText.size(ComposingText::LAYER1));
+ commitText(true);
+ }
+ }
+
+ void commitConvertingText()
+ {
+ if (activeConvertType != CONVERT_TYPE_NONE) {
+ Q_Q(OpenWnnInputMethod);
+ int size = composingText.size(ComposingText::LAYER2);
+ for (int i = 0; i < size; i++) {
+ learnWord(i);
+ }
+
+ QString text = composingText.toString(ComposingText::LAYER2);
+ disableUpdate = true;
+ q->inputContext()->commit(text);
+ disableUpdate = false;
+
+ initializeScreen();
+ }
+ }
+
+ bool commitText(bool learn = false)
+ {
+ ComposingText::TextLayer layer = targetLayer;
+ int cursor = composingText.getCursor(layer);
+ if (cursor == 0) {
+ return false;
+ }
+ QString tmp = composingText.toString(layer, 0, cursor - 1);
+
+ if (converter != nullptr) {
+ if (learn) {
+ if (activeConvertType == CONVERT_TYPE_RENBUN) {
+ learnWord(0); /* select the top of the clauses */
+ } else {
+ if (composingText.size(ComposingText::LAYER1) != 0) {
+ QString stroke = composingText.toString(ComposingText::LAYER1, 0, composingText.getCursor(layer) - 1);
+ WnnWord word(tmp, stroke);
+ learnWord(word);
+ }
+ }
+ } else {
+ breakSequence();
+ }
+ }
+ return commitText(tmp);
+ }
+
+ bool commitText(const WnnWord &word)
+ {
+ return commitText(word.candidate);
+ }
+
+ bool commitText(const QString &string)
+ {
+ Q_Q(OpenWnnInputMethod);
+ ComposingText::TextLayer layer = targetLayer;
+
+ disableUpdate = true;
+ q->inputContext()->commit(string);
+ disableUpdate = false;
+
+ int cursor = composingText.getCursor(layer);
+ if (cursor > 0) {
+ composingText.deleteStrSegment(layer, 0, composingText.getCursor(layer) - 1);
+ composingText.setCursor(layer, composingText.size(layer));
+ }
+ exactMatchMode = false;
+ commitCount++;
+
+ if ((layer == ComposingText::LAYER2) && (composingText.size(layer) == 0))
+ layer = ComposingText::LAYER1; /* for connected prediction */
+
+ if (layer == ComposingText::LAYER2) {
+ activeConvertType = CONVERT_TYPE_RENBUN;
+ updateViewStatus(layer, true, false);
+ focusNextCandidate();
+ } else {
+ updateViewStatusForPrediction(true, false);
+ }
+
+ return composingText.size(ComposingText::LAYER0) > 0;
+ }
+
+ bool isAlphabetLast(const QString &str)
+ {
+ if (str.isEmpty())
+ return false;
+ ushort ch = str.at(str.size() - 1).unicode();
+ return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
+ }
+
+ void commitTextWithoutLastAlphabet()
+ {
+ QString last = composingText.getStrSegment(targetLayer, -1).string;
+
+ if (isAlphabetLast(last)) {
+ composingText.moveCursor(ComposingText::LAYER1, -1);
+ commitText(false);
+ composingText.moveCursor(ComposingText::LAYER1, 1);
+ } else {
+ commitText(false);
+ }
+ }
+
+ bool processLeftKeyEvent()
+ {
+ if (composingText.size(ComposingText::LAYER1) == 0)
+ return false;
+
+ if (activeConvertType != CONVERT_TYPE_NONE) {
+ if (composingText.getCursor(ComposingText::LAYER1) > 1) {
+ composingText.moveCursor(ComposingText::LAYER1, -1);
+ }
+ } else if (exactMatchMode) {
+ composingText.moveCursor(ComposingText::LAYER1, -1);
+ } else {
+ exactMatchMode = true;
+ }
+
+ if (lcOpenWnn().isDebugEnabled())
+ composingText.debugout();
+
+ commitCount = 0; /* retry consecutive clause conversion if necessary. */
+ updateViewStatus(targetLayer, true, true);
+
+ if (activeConvertType != CONVERT_TYPE_NONE)
+ focusNextCandidate();
+
+ return true;
+ }
+
+ bool processRightKeyEvent()
+ {
+ if (composingText.size(ComposingText::LAYER1) == 0)
+ return false;
+
+ ComposingText::TextLayer layer = targetLayer;
+ if (exactMatchMode || activeConvertType != CONVERT_TYPE_NONE) {
+ int textSize = composingText.size(ComposingText::LAYER1);
+ if (composingText.getCursor(ComposingText::LAYER1) == textSize) {
+ exactMatchMode = false;
+ layer = ComposingText::LAYER1; /* convert -> prediction */
+ activeConvertType = CONVERT_TYPE_NONE;
+ } else {
+ composingText.moveCursor(ComposingText::LAYER1, 1);
+ }
+ } else {
+ if (composingText.getCursor(ComposingText::LAYER1) < composingText.size(ComposingText::LAYER1)) {
+ composingText.moveCursor(ComposingText::LAYER1, 1);
+ }
+ }
+
+ if (lcOpenWnn().isDebugEnabled())
+ composingText.debugout();
+
+ commitCount = 0; /* retry consecutive clause conversion if necessary. */
+
+ updateViewStatus(layer, true, true);
+
+ if (activeConvertType != CONVERT_TYPE_NONE)
+ focusNextCandidate();
+
+ return true;
+ }
+
+ OpenWnnInputMethod *q_ptr;
+ QVirtualKeyboardInputEngine::InputMode inputMode;
+ bool exactMatchMode;
+ QString displayText;
+ OpenWnnEngineJAJP *converter;
+ OpenWnnEngineJAJP converterJAJP;
+ ConvertType activeConvertType;
+ ComposingText composingText;
+ QScopedPointer<LetterConverter> preConverter;
+ bool enableLearning;
+ bool enablePrediction;
+ bool enableConverter;
+ bool disableUpdate;
+ int commitCount;
+ ComposingText::TextLayer targetLayer;
+ QList<QSharedPointer<WnnWord> > candidateList;
+ int activeWordIndex;
+};
+
+/*!
+ \class QtVirtualKeyboard::OpenWnnInputMethod
+ \internal
+*/
+
+OpenWnnInputMethod::OpenWnnInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(parent),
+ d_ptr(new OpenWnnInputMethodPrivate(this))
+{
+}
+
+OpenWnnInputMethod::~OpenWnnInputMethod()
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> OpenWnnInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale);
+ return QList<QVirtualKeyboardInputEngine::InputMode>()
+ << QVirtualKeyboardInputEngine::InputMode::Hiragana
+ << QVirtualKeyboardInputEngine::InputMode::Katakana
+ << QVirtualKeyboardInputEngine::InputMode::FullwidthLatin
+ << QVirtualKeyboardInputEngine::InputMode::Latin;
+}
+
+bool OpenWnnInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(locale);
+ Q_D(OpenWnnInputMethod);
+ if (d->inputMode == inputMode)
+ return true;
+ update();
+ switch (inputMode) {
+ case QVirtualKeyboardInputEngine::InputMode::Hiragana:
+ d->changeEngineMode(OpenWnnInputMethodPrivate::ENGINE_MODE_DEFAULT);
+ break;
+
+ case QVirtualKeyboardInputEngine::InputMode::Katakana:
+ d->changeEngineMode(OpenWnnInputMethodPrivate::ENGINE_MODE_FULL_KATAKANA);
+ break;
+
+ default:
+ d->changeEngineMode(OpenWnnInputMethodPrivate::ENGINE_MODE_DIRECT);
+ break;
+ }
+ d->inputMode = inputMode;
+ d->fitInputType();
+ return true;
+}
+
+bool OpenWnnInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase);
+ return true;
+}
+
+bool OpenWnnInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(key);
+ Q_UNUSED(text);
+ Q_UNUSED(modifiers);
+ Q_D(OpenWnnInputMethod);
+
+ if (d->preConverter == nullptr && !d->isEnableL2Converter())
+ return false;
+
+ switch (key) {
+ case Qt::Key_Left:
+ if (d->isEnableL2Converter() && d->composingText.size(ComposingText::LAYER1) > 0)
+ return d->processLeftKeyEvent();
+ else
+ return d->commitText(false);
+ break;
+
+ case Qt::Key_Right:
+ if (d->isEnableL2Converter() && d->composingText.size(ComposingText::LAYER1) > 0)
+ return d->processRightKeyEvent();
+ else
+ return d->commitText(false);
+ break;
+
+ case Qt::Key_Backspace:
+ if (d->composingText.size(ComposingText::LAYER1) > 0) {
+ if (d->activeConvertType == OpenWnnInputMethodPrivate::CONVERT_TYPE_RENBUN) {
+ d->composingText.setCursor(ComposingText::LAYER1,
+ d->composingText.toString(ComposingText::LAYER1).size());
+ d->exactMatchMode = false;
+ d->clearFocusCandidate();
+ } else {
+ if ((d->composingText.size(ComposingText::LAYER1) == 1) &&
+ d->composingText.getCursor(ComposingText::LAYER1) != 0) {
+ d->initializeScreen();
+ return true;
+ } else {
+ d->composingText.deleteAt(ComposingText::LAYER1, false);
+ }
+ }
+ if (lcOpenWnn().isDebugEnabled())
+ d->composingText.debugout();
+ d->updateViewStatusForPrediction(true, true);
+ return true;
+ }
+ break;
+
+ case Qt::Key_Space:
+ if (d->composingText.size(ComposingText::LAYER0) == 0) {
+ d->clearCandidates();
+ d->breakSequence();
+ } else {
+ if (d->targetLayer == ComposingText::LAYER2)
+ d->changeL2Segment(d->focusNextCandidate());
+ else if (d->isEnableL2Converter())
+ d->startConvert(OpenWnnInputMethodPrivate::CONVERT_TYPE_RENBUN);
+ else
+ return d->commitText(false);
+ return true;
+ }
+ break;
+
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ if (d->composingText.size(ComposingText::LAYER0) > 0) {
+ d->commitText(true);
+ return true;
+ }
+ break;
+
+ default:
+ if (key < Qt::Key_Escape && !text.isEmpty() && text.at(0).isPrint()) {
+ if (d->composingText.size(ComposingText::LAYER1) + text.size() > OpenWnnInputMethodPrivate::MAX_COMPOSING_TEXT)
+ return true;
+ const int last = text.size() - 1;
+ for (int i = 0; i <= last; ++i) {
+ if (d->isEnableL2Converter()) {
+ d->commitConvertingText();
+ d->composingText.insertStrSegment(ComposingText::LAYER0, ComposingText::LAYER1, text.mid(i, 1));
+ if (d->preConverter != nullptr)
+ d->preConverter->convert(d->composingText);
+ if (i == last)
+ d->updateViewStatusForPrediction(true, true);
+ } else {
+ d->composingText.insertStrSegment(ComposingText::LAYER0, ComposingText::LAYER1, text.mid(i, 1));
+ QString layer1 = d->composingText.toString(ComposingText::LAYER1);
+ if (!d->isAlphabetLast(layer1)) {
+ d->commitText(false);
+ } else {
+ bool completed = d->preConverter->convert(d->composingText);
+ if (completed) {
+ d->commitTextWithoutLastAlphabet();
+ } else {
+ if (i == last)
+ d->updateViewStatusForPrediction(true, true);
+ }
+ }
+ }
+ }
+ if (lcOpenWnn().isDebugEnabled())
+ d->composingText.debugout();
+ return true;
+ }
+ break;
+ }
+
+ return false;
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> OpenWnnInputMethod::selectionLists()
+{
+ Q_D(OpenWnnInputMethod);
+ if (!d->enablePrediction)
+ return QList<QVirtualKeyboardSelectionListModel::Type>();
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int OpenWnnInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type);
+ Q_D(OpenWnnInputMethod);
+ return d->candidateList.size();
+}
+
+QVariant OpenWnnInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ QVariant result;
+ Q_D(OpenWnnInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->candidateList.at(index)->candidate);
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ result.setValue(0);
+ break;
+ default:
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ break;
+ }
+ return result;
+}
+
+void OpenWnnInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type);
+ Q_D(OpenWnnInputMethod);
+ d->activeWordIndex = index;
+ // Set selected text as preeditText to place cursor at the end of selected text
+ inputContext()->setPreeditText(d->candidateList.at(index)->candidate);
+ d->commitText(*d->candidateList.at(index));
+}
+
+void OpenWnnInputMethod::reset()
+{
+ Q_D(OpenWnnInputMethod);
+ d->composingText.clear();
+ d->initializeScreen();
+ d->fitInputType();
+}
+
+void OpenWnnInputMethod::update()
+{
+ Q_D(OpenWnnInputMethod);
+ if (!d->disableUpdate) {
+ d->commitAll();
+ reset();
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/openwnn/openwnninputmethod_p.h b/src/plugins/openwnn/openwnninputmethod_p.h
new file mode 100644
index 00000000..439cd0d3
--- /dev/null
+++ b/src/plugins/openwnn/openwnninputmethod_p.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef OPENWNNINPUTMETHOD_P_H
+#define OPENWNNINPUTMETHOD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class OpenWnnInputMethodPrivate;
+
+class OpenWnnInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(OpenWnnInputMethod)
+ QML_NAMED_ELEMENT(JapaneseInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit OpenWnnInputMethod(QObject *parent = nullptr);
+ ~OpenWnnInputMethod();
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
+ QVirtualKeyboardSelectionListModel::Role role) override;
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
+
+ void reset() override;
+ void update() override;
+
+private:
+ QScopedPointer<OpenWnnInputMethodPrivate> d_ptr;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/openwnn/plugin/.prev_CMakeLists.txt b/src/plugins/openwnn/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index 7f2117fc..00000000
--- a/src/plugins/openwnn/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardOpenWnnPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardOpenWnnPlugin
- OUTPUT_NAME qtvirtualkeyboard_openwnn
- TYPE virtualkeyboard
- SOURCES
- openwnninputmethod.cpp openwnninputmethod_p.h
- openwnnplugin.cpp openwnnplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
- openwnn
-)
-
-# Resources:
-set(qmake_virtualkeyboard_openwnn_layouts_resource_files
- "virtualkeyboard/content/layouts/ja_JP/dialpad.fallback"
- "virtualkeyboard/content/layouts/ja_JP/digits.fallback"
- "virtualkeyboard/content/layouts/ja_JP/main.qml"
- "virtualkeyboard/content/layouts/ja_JP/numbers.fallback"
- "virtualkeyboard/content/layouts/ja_JP/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardOpenWnnPlugin "qmake_virtualkeyboard_openwnn_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_openwnn_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "openwnn.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard OpenWNN (Qt $$QT_VERSION)"
diff --git a/src/plugins/openwnn/plugin/CMakeLists.txt b/src/plugins/openwnn/plugin/CMakeLists.txt
deleted file mode 100644
index 2bea3b1c..00000000
--- a/src/plugins/openwnn/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardOpenWnnPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardOpenWnnPlugin
- OUTPUT_NAME qtvirtualkeyboard_openwnn
- TYPE virtualkeyboard
- SOURCES
- openwnninputmethod.cpp openwnninputmethod_p.h
- openwnnplugin.cpp openwnnplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
- LIBRARIES # special case
- BundledOpenwnn
-)
-
-# Resources:
-set(qmake_virtualkeyboard_openwnn_layouts_resource_files
- "virtualkeyboard/content/layouts/ja_JP/dialpad.fallback"
- "virtualkeyboard/content/layouts/ja_JP/digits.fallback"
- "virtualkeyboard/content/layouts/ja_JP/main.qml"
- "virtualkeyboard/content/layouts/ja_JP/numbers.fallback"
- "virtualkeyboard/content/layouts/ja_JP/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardOpenWnnPlugin "qmake_virtualkeyboard_openwnn_layouts"
- PREFIX
- "${VKB_LAYOUTS_PREFIX}" #special case
- BASE
- "${VKB_LAYOUTS_BASE}" #special case
- FILES
- ${qmake_virtualkeyboard_openwnn_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "openwnn.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard OpenWNN (Qt $$QT_VERSION)"
diff --git a/src/plugins/openwnn/plugin/openwnn.json b/src/plugins/openwnn/plugin/openwnn.json
deleted file mode 100644
index 053875f0..00000000
--- a/src/plugins/openwnn/plugin/openwnn.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "japanese",
- "Provider": "Qt OpenWNN Extension",
- "InputMethod": "JapaneseInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/openwnn/plugin/openwnninputmethod.cpp b/src/plugins/openwnn/plugin/openwnninputmethod.cpp
deleted file mode 100644
index 81e933fc..00000000
--- a/src/plugins/openwnn/plugin/openwnninputmethod.cpp
+++ /dev/null
@@ -1,829 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "openwnninputmethod_p.h"
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#include <QLoggingCategory>
-#include <openwnnenginejajp.h>
-#include <composingtext.h>
-#include <romkan.h>
-#include <romkanfullkatakana.h>
-#include <romkanhalfkatakana.h>
-#include <QTextFormat>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_LOGGING_CATEGORY(lcOpenWnn, "qt.virtualkeyboard.openwnn")
-
-class OpenWnnInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(OpenWnnInputMethod)
-public:
- enum EngineMode {
- ENGINE_MODE_DEFAULT,
- ENGINE_MODE_DIRECT,
- ENGINE_MODE_NO_LV2_CONV,
- ENGINE_MODE_FULL_KATAKANA,
- ENGINE_MODE_HALF_KATAKANA,
- };
-
- enum ConvertType {
- CONVERT_TYPE_NONE = 0,
- CONVERT_TYPE_RENBUN = 1,
- };
-
- enum {
- MAX_COMPOSING_TEXT = 30
- };
-
- OpenWnnInputMethodPrivate(OpenWnnInputMethod *q_ptr) :
- q_ptr(q_ptr),
- inputMode(QVirtualKeyboardInputEngine::InputMode::Latin),
- exactMatchMode(false),
- converter(nullptr),
- converterJAJP(),
- activeConvertType(CONVERT_TYPE_NONE),
- preConverter(nullptr),
- enableLearning(true),
- enablePrediction(true),
- enableConverter(true),
- disableUpdate(false),
- commitCount(0),
- targetLayer(ComposingText::LAYER1),
- activeWordIndex(-1)
- {
- }
-
- void changeEngineMode(EngineMode mode)
- {
- switch (mode) {
- case ENGINE_MODE_DIRECT:
- /* Full/Half-width number or Full-width alphabet */
- converter = nullptr;
- preConverter.reset();
- break;
-
- case ENGINE_MODE_NO_LV2_CONV:
- converter = nullptr;
- preConverter.reset(new Romkan());
- break;
-
- case ENGINE_MODE_FULL_KATAKANA:
- converter = nullptr;
- preConverter.reset(new RomkanFullKatakana());
- break;
-
- case ENGINE_MODE_HALF_KATAKANA:
- converter = nullptr;
- preConverter.reset(new RomkanHalfKatakana());
- break;
-
- default:
- /* HIRAGANA input mode */
- setDictionary(OpenWnnEngineJAJP::DIC_LANG_JP);
- converter = &converterJAJP;
- preConverter.reset(new Romkan());
- break;
- }
- }
-
- void setDictionary(OpenWnnEngineJAJP::DictionaryType mode)
- {
- converterJAJP.setDictionary(mode);
- }
-
- void breakSequence()
- {
- converterJAJP.breakSequence();
- }
-
- bool isEnableL2Converter()
- {
- return converter != nullptr && enableConverter;
- }
-
- void startConvert(ConvertType convertType)
- {
- if (!isEnableL2Converter())
- return;
-
- if (activeConvertType != convertType) {
- if (!exactMatchMode) {
- if (convertType == CONVERT_TYPE_RENBUN) {
- /* not specify */
- composingText.setCursor(ComposingText::LAYER1, 0);
- } else {
- if (activeConvertType == CONVERT_TYPE_RENBUN) {
- exactMatchMode = true;
- } else {
- /* specify all range */
- composingText.setCursor(ComposingText::LAYER1,
- composingText.size(ComposingText::LAYER1));
- }
- }
- }
-
- if (convertType == CONVERT_TYPE_RENBUN)
- /* clears variables for the prediction */
- exactMatchMode = false;
-
- /* clears variables for the convert */
- commitCount = 0;
-
- activeConvertType = convertType;
-
- updateViewStatus(ComposingText::LAYER2, true, true);
-
- focusNextCandidate();
- }
- }
-
- void changeL2Segment(const QSharedPointer<WnnWord> &word)
- {
- if (word.isNull())
- return;
- QList<StrSegment> ss;
- ss.append(composingText.getStrSegment(ComposingText::LAYER2, 0));
- if (!ss[0].clause.isNull())
- ss[0].clause->candidate = word->candidate;
- ss[0].string = word->candidate;
- composingText.replaceStrSegment(ComposingText::LAYER2, ss);
- if (lcOpenWnn().isDebugEnabled())
- composingText.debugout();
- updateViewStatus(ComposingText::LAYER2, false, false);
- }
-
- void initializeScreen()
- {
- if (composingText.size(ComposingText::LAYER0) != 0) {
- Q_Q(OpenWnnInputMethod);
- q->inputContext()->commit(QString());
- }
- composingText.clear();
- exactMatchMode = false;
- activeConvertType = CONVERT_TYPE_NONE;
- clearCandidates();
- }
-
- void updateViewStatusForPrediction(bool updateCandidates, bool updateEmptyText)
- {
- activeConvertType = CONVERT_TYPE_NONE;
-
- updateViewStatus(ComposingText::LAYER1, updateCandidates, updateEmptyText);
- }
-
- void updateViewStatus(ComposingText::TextLayer layer, bool updateCandidates, bool updateEmptyText)
- {
- targetLayer = layer;
-
- if (updateCandidates)
- updateCandidateView();
-
- /* set the text for displaying as the composing text */
- displayText.clear();
- displayText.insert(0, composingText.toString(layer));
-
- /* add decoration to the text */
- if (!displayText.isEmpty() || updateEmptyText) {
-
- QList<QInputMethodEvent::Attribute> attributes;
-
- int cursor = composingText.getCursor(layer);
- if (cursor != 0) {
- int highlightEnd = 0;
-
- if (exactMatchMode) {
-
- QTextCharFormat textFormat;
- textFormat.setBackground(QBrush(QColor(0x66, 0xCD, 0xAA)));
- textFormat.setForeground(QBrush(Qt::black));
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, cursor, textFormat));
- highlightEnd = cursor;
-
- } else if (layer == ComposingText::LAYER2) {
-
- highlightEnd = composingText.toString(layer, 0, 0).length();
-
- /* highlights the first segment */
- QTextCharFormat textFormat;
- textFormat.setBackground(QBrush(QColor(0x88, 0x88, 0xFF)));
- textFormat.setForeground(QBrush(Qt::black));
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, highlightEnd, textFormat));
- }
-
- if (highlightEnd != 0 && highlightEnd < displayText.length()) {
- /* highlights remaining text */
- QTextCharFormat textFormat;
- textFormat.setBackground(QBrush(QColor(0xF0, 0xFF, 0xFF)));
- textFormat.setForeground(QBrush(Qt::black));
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, highlightEnd, displayText.length() - highlightEnd, textFormat));
- }
- }
-
- QTextCharFormat textFormat;
- textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, displayText.length(), textFormat));
-
- int displayCursor = composingText.toString(layer, 0, cursor - 1).length();
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, displayCursor, 1, QVariant()));
-
- Q_Q(OpenWnnInputMethod);
- q->inputContext()->setPreeditText(displayText, attributes);
- }
- }
-
- void updateCandidateView()
- {
- switch (targetLayer) {
- case ComposingText::LAYER0:
- case ComposingText::LAYER1: /* prediction */
- if (enablePrediction)
- /* update the candidates view */
- updatePrediction();
- break;
- case ComposingText::LAYER2: /* convert */
- if (commitCount == 0)
- converter->convert(composingText);
-
- if (converter->makeCandidateListOf(commitCount) != 0) {
- composingText.setCursor(ComposingText::LAYER2, 1);
- displayCandidates();
- } else {
- composingText.setCursor(ComposingText::LAYER1,
- composingText.toString(ComposingText::LAYER1).length());
- clearCandidates();
- }
- break;
- default:
- break;
- }
- }
-
- void updatePrediction()
- {
- int candidates = 0;
- int cursor = composingText.getCursor(ComposingText::LAYER1);
- if (isEnableL2Converter()) {
- if (exactMatchMode)
- /* exact matching */
- candidates = converter->predict(composingText, 0, cursor);
- else
- /* normal prediction */
- candidates = converter->predict(composingText, 0, -1);
- }
-
- /* update the candidates view */
- if (candidates > 0)
- displayCandidates();
- else
- clearCandidates();
- }
-
- void displayCandidates()
- {
- int previousActiveWordIndex = activeWordIndex;
- bool wasEmpty = candidateList.isEmpty();
- clearCandidates(true);
-
- QSharedPointer<WnnWord> result;
- while ((result = converter->getNextCandidate()))
- candidateList.append(result);
-
- Q_Q(OpenWnnInputMethod);
- if (!candidateList.isEmpty() || !wasEmpty)
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- if (previousActiveWordIndex != activeWordIndex)
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
- }
-
- void clearCandidates(bool deferUpdate = false)
- {
- if (!candidateList.isEmpty()) {
- candidateList.clear();
- if (!deferUpdate) {
- Q_Q(OpenWnnInputMethod);
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- }
- clearFocusCandidate(deferUpdate);
- }
- }
-
- QSharedPointer<WnnWord> focusNextCandidate()
- {
- Q_Q(OpenWnnInputMethod);
- if (candidateList.isEmpty())
- return QSharedPointer<WnnWord>();
- activeWordIndex++;
- if (activeWordIndex >= candidateList.size())
- activeWordIndex = 0;
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
- return candidateList.at(activeWordIndex);
- }
-
- void clearFocusCandidate(bool deferUpdate = false)
- {
- Q_Q(OpenWnnInputMethod);
- if (activeWordIndex != -1) {
- activeWordIndex = -1;
- if (!deferUpdate)
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
- }
- }
-
- void fitInputType()
- {
- Q_Q(OpenWnnInputMethod);
- enableConverter = true;
-
- Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
- if (inputMethodHints.testFlag(Qt::ImhDigitsOnly) ||
- inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly) ||
- inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly)) {
- enableConverter = false;
- }
-
- if (inputMethodHints.testFlag(Qt::ImhLatinOnly)) {
- enableConverter = false;
- }
-
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::Hiragana ||
- inputMethodHints.testFlag(Qt::ImhHiddenText) ||
- inputMethodHints.testFlag(Qt::ImhSensitiveData) ||
- inputMethodHints.testFlag(Qt::ImhNoPredictiveText)) {
- if (enablePrediction) {
- enablePrediction = false;
- emit q->selectionListsChanged();
- }
- } else if (inputMode == QVirtualKeyboardInputEngine::InputMode::Hiragana && !enablePrediction) {
- enablePrediction = true;
- emit q->selectionListsChanged();
- }
-
- activeConvertType = CONVERT_TYPE_NONE;
- }
-
- void learnWord(WnnWord &word)
- {
- if (enableLearning)
- converter->learn(word);
- }
-
- void learnWord(int index)
- {
- if (enableLearning && index < composingText.size(ComposingText::LAYER2)) {
- StrSegment seg = composingText.getStrSegment(ComposingText::LAYER2, index);
- if (!seg.clause.isNull()) {
- converter->learn(*seg.clause);
- } else {
- QString stroke = composingText.toString(ComposingText::LAYER1, seg.from, seg.to);
- WnnWord word(seg.string, stroke);
- converter->learn(word);
- }
- }
- }
-
- void commitAll()
- {
- if (activeConvertType != CONVERT_TYPE_NONE) {
- commitConvertingText();
- } else {
- composingText.setCursor(ComposingText::LAYER1,
- composingText.size(ComposingText::LAYER1));
- commitText(true);
- }
- }
-
- void commitConvertingText()
- {
- if (activeConvertType != CONVERT_TYPE_NONE) {
- Q_Q(OpenWnnInputMethod);
- int size = composingText.size(ComposingText::LAYER2);
- for (int i = 0; i < size; i++) {
- learnWord(i);
- }
-
- QString text = composingText.toString(ComposingText::LAYER2);
- disableUpdate = true;
- q->inputContext()->commit(text);
- disableUpdate = false;
-
- initializeScreen();
- }
- }
-
- bool commitText(bool learn = false)
- {
- ComposingText::TextLayer layer = targetLayer;
- int cursor = composingText.getCursor(layer);
- if (cursor == 0) {
- return false;
- }
- QString tmp = composingText.toString(layer, 0, cursor - 1);
-
- if (converter != nullptr) {
- if (learn) {
- if (activeConvertType == CONVERT_TYPE_RENBUN) {
- learnWord(0); /* select the top of the clauses */
- } else {
- if (composingText.size(ComposingText::LAYER1) != 0) {
- QString stroke = composingText.toString(ComposingText::LAYER1, 0, composingText.getCursor(layer) - 1);
- WnnWord word(tmp, stroke);
- learnWord(word);
- }
- }
- } else {
- breakSequence();
- }
- }
- return commitText(tmp);
- }
-
- bool commitText(const WnnWord &word)
- {
- return commitText(word.candidate);
- }
-
- bool commitText(const QString &string)
- {
- Q_Q(OpenWnnInputMethod);
- ComposingText::TextLayer layer = targetLayer;
-
- disableUpdate = true;
- q->inputContext()->commit(string);
- disableUpdate = false;
-
- int cursor = composingText.getCursor(layer);
- if (cursor > 0) {
- composingText.deleteStrSegment(layer, 0, composingText.getCursor(layer) - 1);
- composingText.setCursor(layer, composingText.size(layer));
- }
- exactMatchMode = false;
- commitCount++;
-
- if ((layer == ComposingText::LAYER2) && (composingText.size(layer) == 0))
- layer = ComposingText::LAYER1; /* for connected prediction */
-
- if (layer == ComposingText::LAYER2) {
- activeConvertType = CONVERT_TYPE_RENBUN;
- updateViewStatus(layer, true, false);
- focusNextCandidate();
- } else {
- updateViewStatusForPrediction(true, false);
- }
-
- return composingText.size(ComposingText::LAYER0) > 0;
- }
-
- bool isAlphabetLast(const QString &str)
- {
- if (str.isEmpty())
- return false;
- ushort ch = str.at(str.length() - 1).unicode();
- return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
- }
-
- void commitTextWithoutLastAlphabet()
- {
- QString last = composingText.getStrSegment(targetLayer, -1).string;
-
- if (isAlphabetLast(last)) {
- composingText.moveCursor(ComposingText::LAYER1, -1);
- commitText(false);
- composingText.moveCursor(ComposingText::LAYER1, 1);
- } else {
- commitText(false);
- }
- }
-
- bool processLeftKeyEvent()
- {
- if (composingText.size(ComposingText::LAYER1) == 0)
- return false;
-
- if (activeConvertType != CONVERT_TYPE_NONE) {
- if (composingText.getCursor(ComposingText::LAYER1) > 1) {
- composingText.moveCursor(ComposingText::LAYER1, -1);
- }
- } else if (exactMatchMode) {
- composingText.moveCursor(ComposingText::LAYER1, -1);
- } else {
- exactMatchMode = true;
- }
-
- if (lcOpenWnn().isDebugEnabled())
- composingText.debugout();
-
- commitCount = 0; /* retry consecutive clause conversion if necessary. */
- updateViewStatus(targetLayer, true, true);
-
- if (activeConvertType != CONVERT_TYPE_NONE)
- focusNextCandidate();
-
- return true;
- }
-
- bool processRightKeyEvent()
- {
- if (composingText.size(ComposingText::LAYER1) == 0)
- return false;
-
- ComposingText::TextLayer layer = targetLayer;
- if (exactMatchMode || activeConvertType != CONVERT_TYPE_NONE) {
- int textSize = composingText.size(ComposingText::LAYER1);
- if (composingText.getCursor(ComposingText::LAYER1) == textSize) {
- exactMatchMode = false;
- layer = ComposingText::LAYER1; /* convert -> prediction */
- activeConvertType = CONVERT_TYPE_NONE;
- } else {
- composingText.moveCursor(ComposingText::LAYER1, 1);
- }
- } else {
- if (composingText.getCursor(ComposingText::LAYER1) < composingText.size(ComposingText::LAYER1)) {
- composingText.moveCursor(ComposingText::LAYER1, 1);
- }
- }
-
- if (lcOpenWnn().isDebugEnabled())
- composingText.debugout();
-
- commitCount = 0; /* retry consecutive clause conversion if necessary. */
-
- updateViewStatus(layer, true, true);
-
- if (activeConvertType != CONVERT_TYPE_NONE)
- focusNextCandidate();
-
- return true;
- }
-
- OpenWnnInputMethod *q_ptr;
- QVirtualKeyboardInputEngine::InputMode inputMode;
- bool exactMatchMode;
- QString displayText;
- OpenWnnEngineJAJP *converter;
- OpenWnnEngineJAJP converterJAJP;
- ConvertType activeConvertType;
- ComposingText composingText;
- QScopedPointer<LetterConverter> preConverter;
- bool enableLearning;
- bool enablePrediction;
- bool enableConverter;
- bool disableUpdate;
- int commitCount;
- ComposingText::TextLayer targetLayer;
- QList<QSharedPointer<WnnWord> > candidateList;
- int activeWordIndex;
-};
-
-/*!
- \class QtVirtualKeyboard::OpenWnnInputMethod
- \internal
-*/
-
-OpenWnnInputMethod::OpenWnnInputMethod(QObject *parent) :
- QVirtualKeyboardAbstractInputMethod(parent),
- d_ptr(new OpenWnnInputMethodPrivate(this))
-{
-}
-
-OpenWnnInputMethod::~OpenWnnInputMethod()
-{
-}
-
-QList<QVirtualKeyboardInputEngine::InputMode> OpenWnnInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale);
- return QList<QVirtualKeyboardInputEngine::InputMode>()
- << QVirtualKeyboardInputEngine::InputMode::Hiragana
- << QVirtualKeyboardInputEngine::InputMode::Katakana
- << QVirtualKeyboardInputEngine::InputMode::FullwidthLatin
- << QVirtualKeyboardInputEngine::InputMode::Latin;
-}
-
-bool OpenWnnInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale);
- Q_D(OpenWnnInputMethod);
- if (d->inputMode == inputMode)
- return true;
- update();
- switch (inputMode) {
- case QVirtualKeyboardInputEngine::InputMode::Hiragana:
- d->changeEngineMode(OpenWnnInputMethodPrivate::ENGINE_MODE_DEFAULT);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Katakana:
- d->changeEngineMode(OpenWnnInputMethodPrivate::ENGINE_MODE_FULL_KATAKANA);
- break;
-
- default:
- d->changeEngineMode(OpenWnnInputMethodPrivate::ENGINE_MODE_DIRECT);
- break;
- }
- d->inputMode = inputMode;
- d->fitInputType();
- return true;
-}
-
-bool OpenWnnInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase);
- return true;
-}
-
-bool OpenWnnInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_UNUSED(key);
- Q_UNUSED(text);
- Q_UNUSED(modifiers);
- Q_D(OpenWnnInputMethod);
-
- if (d->preConverter == nullptr && !d->isEnableL2Converter())
- return false;
-
- switch (key) {
- case Qt::Key_Left:
- if (d->isEnableL2Converter() && d->composingText.size(ComposingText::LAYER1) > 0)
- return d->processLeftKeyEvent();
- else
- return d->commitText(false);
- break;
-
- case Qt::Key_Right:
- if (d->isEnableL2Converter() && d->composingText.size(ComposingText::LAYER1) > 0)
- return d->processRightKeyEvent();
- else
- return d->commitText(false);
- break;
-
- case Qt::Key_Backspace:
- if (d->composingText.size(ComposingText::LAYER1) > 0) {
- if (d->activeConvertType == OpenWnnInputMethodPrivate::CONVERT_TYPE_RENBUN) {
- d->composingText.setCursor(ComposingText::LAYER1,
- d->composingText.toString(ComposingText::LAYER1).length());
- d->exactMatchMode = false;
- d->clearFocusCandidate();
- } else {
- if ((d->composingText.size(ComposingText::LAYER1) == 1) &&
- d->composingText.getCursor(ComposingText::LAYER1) != 0) {
- d->initializeScreen();
- return true;
- } else {
- d->composingText.deleteAt(ComposingText::LAYER1, false);
- }
- }
- if (lcOpenWnn().isDebugEnabled())
- d->composingText.debugout();
- d->updateViewStatusForPrediction(true, true);
- return true;
- }
- break;
-
- case Qt::Key_Space:
- if (d->composingText.size(ComposingText::LAYER0) == 0) {
- d->clearCandidates();
- d->breakSequence();
- } else {
- if (d->targetLayer == ComposingText::LAYER2)
- d->changeL2Segment(d->focusNextCandidate());
- else if (d->isEnableL2Converter())
- d->startConvert(OpenWnnInputMethodPrivate::CONVERT_TYPE_RENBUN);
- else
- return d->commitText(false);
- return true;
- }
- break;
-
- case Qt::Key_Return:
- case Qt::Key_Enter:
- if (d->composingText.size(ComposingText::LAYER0) > 0) {
- d->commitText(true);
- return true;
- }
- break;
-
- default:
- if (key < Qt::Key_Escape && !text.isEmpty() && text.at(0).isPrint()) {
- if (d->composingText.size(ComposingText::LAYER1) + text.size() > OpenWnnInputMethodPrivate::MAX_COMPOSING_TEXT)
- return true;
- const int last = text.size() - 1;
- for (int i = 0; i <= last; ++i) {
- if (d->isEnableL2Converter()) {
- d->commitConvertingText();
- d->composingText.insertStrSegment(ComposingText::LAYER0, ComposingText::LAYER1, text.mid(i, 1));
- if (d->preConverter != nullptr)
- d->preConverter->convert(d->composingText);
- if (i == last)
- d->updateViewStatusForPrediction(true, true);
- } else {
- d->composingText.insertStrSegment(ComposingText::LAYER0, ComposingText::LAYER1, text.mid(i, 1));
- QString layer1 = d->composingText.toString(ComposingText::LAYER1);
- if (!d->isAlphabetLast(layer1)) {
- d->commitText(false);
- } else {
- bool completed = d->preConverter->convert(d->composingText);
- if (completed) {
- d->commitTextWithoutLastAlphabet();
- } else {
- if (i == last)
- d->updateViewStatusForPrediction(true, true);
- }
- }
- }
- }
- if (lcOpenWnn().isDebugEnabled())
- d->composingText.debugout();
- return true;
- }
- break;
- }
-
- return false;
-}
-
-QList<QVirtualKeyboardSelectionListModel::Type> OpenWnnInputMethod::selectionLists()
-{
- Q_D(OpenWnnInputMethod);
- if (!d->enablePrediction)
- return QList<QVirtualKeyboardSelectionListModel::Type>();
- return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
-}
-
-int OpenWnnInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
-{
- Q_UNUSED(type);
- Q_D(OpenWnnInputMethod);
- return d->candidateList.size();
-}
-
-QVariant OpenWnnInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
-{
- QVariant result;
- Q_D(OpenWnnInputMethod);
- switch (role) {
- case QVirtualKeyboardSelectionListModel::Role::Display:
- result = QVariant(d->candidateList.at(index)->candidate);
- break;
- case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
- result.setValue(0);
- break;
- default:
- result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void OpenWnnInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
-{
- Q_UNUSED(type);
- Q_D(OpenWnnInputMethod);
- // Set selected text as preeditText to place cursor at the end of selected text
- inputContext()->setPreeditText(d->candidateList.at(index)->candidate);
- d->commitText(*d->candidateList.at(index));
-}
-
-void OpenWnnInputMethod::reset()
-{
- Q_D(OpenWnnInputMethod);
- d->commitAll();
- d->initializeScreen();
- d->fitInputType();
-}
-
-void OpenWnnInputMethod::update()
-{
- Q_D(OpenWnnInputMethod);
- if (!d->disableUpdate)
- reset();
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/openwnn/plugin/openwnninputmethod_p.h b/src/plugins/openwnn/plugin/openwnninputmethod_p.h
deleted file mode 100644
index f2e9c6a9..00000000
--- a/src/plugins/openwnn/plugin/openwnninputmethod_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef OPENWNNINPUTMETHOD_P_H
-#define OPENWNNINPUTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class OpenWnnInputMethodPrivate;
-
-class OpenWnnInputMethod : public QVirtualKeyboardAbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(OpenWnnInputMethod)
-
-public:
- explicit OpenWnnInputMethod(QObject *parent = nullptr);
- ~OpenWnnInputMethod();
-
- QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
- bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
- bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
-
- QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
- int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
- QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
- QVirtualKeyboardSelectionListModel::Role role) override;
- void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
-
- void reset() override;
- void update() override;
-
-private:
- QScopedPointer<OpenWnnInputMethodPrivate> d_ptr;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/openwnn/plugin/openwnnplugin.cpp b/src/plugins/openwnn/plugin/openwnnplugin.cpp
deleted file mode 100644
index a8490960..00000000
--- a/src/plugins/openwnn/plugin/openwnnplugin.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "openwnnplugin.h"
-#include "openwnninputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardOpenWnnPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<OpenWnnInputMethod>(uri, 1, 3, "JapaneseInputMethod");
- qmlRegisterType<OpenWnnInputMethod>(uri, 2, 0, "JapaneseInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/openwnn/plugin/openwnnplugin.h b/src/plugins/openwnn/plugin/openwnnplugin.h
deleted file mode 100644
index b11132b5..00000000
--- a/src/plugins/openwnn/plugin/openwnnplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef OPENWNNPLUGIN_H
-#define OPENWNNPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardOpenWnnPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "openwnn.json")
-public:
- void registerTypes(const char *uri) const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/openwnn/plugin/plugin.pro b/src/plugins/openwnn/plugin/plugin.pro
deleted file mode 100644
index 51a4a2b7..00000000
--- a/src/plugins/openwnn/plugin/plugin.pro
+++ /dev/null
@@ -1,45 +0,0 @@
-TARGET = qtvirtualkeyboard_openwnn
-QT += qml virtualkeyboard
-
-include(../../../shared.pri)
-
-HEADERS += \
- openwnnplugin.h \
- openwnninputmethod_p.h
-SOURCES += \
- openwnnplugin.cpp \
- openwnninputmethod.cpp
-OTHER_FILES += \
- openwnn.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-LAYOUT_FILES += \
- $$LAYOUTS_BASE/content/layouts/ja_JP/dialpad.fallback \
- $$LAYOUTS_BASE/content/layouts/ja_JP/digits.fallback \
- $$LAYOUTS_BASE/content/layouts/ja_JP/main.qml \
- $$LAYOUTS_BASE/content/layouts/ja_JP/numbers.fallback \
- $$LAYOUTS_BASE/content/layouts/ja_JP/symbols.qml
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-virtualkeyboard_openwnn_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_openwnn_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_openwnn_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_openwnn_layouts
-
-QMAKE_USE += openwnn
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard OpenWNN (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardOpenWnnPlugin
-load(qt_plugin)
diff --git a/src/plugins/pinyin/3rdparty/pinyin/.prev_CMakeLists.txt b/src/plugins/pinyin/3rdparty/pinyin/.prev_CMakeLists.txt
deleted file mode 100644
index 2b2b97b1..00000000
--- a/src/plugins/pinyin/3rdparty/pinyin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-# Generated from pinyin.pro.
-
-#####################################################################
-## BundledPinyin Generic Library:
-#####################################################################
-
-qt_add_3rdparty_library(BundledPinyin
- STATIC
- SOURCES
- include/atomdictbase.h
- include/dictbuilder.h
- include/dictdef.h
- include/dictlist.h
- include/dicttrie.h
- include/lpicache.h
- include/matrixsearch.h
- include/mystdlib.h
- include/ngram.h
- include/pinyinime.h
- include/searchutility.h
- include/spellingtable.h
- include/spellingtrie.h
- include/splparser.h
- include/sync.h
- include/userdict.h
- include/utf16char.h
- include/utf16reader.h
- share/dictbuilder.cpp
- share/dictlist.cpp
- share/dicttrie.cpp
- share/lpicache.cpp
- share/matrixsearch.cpp
- share/mystdlib.cpp
- share/ngram.cpp
- share/pinyinime.cpp
- share/searchutility.cpp
- share/spellingtable.cpp
- share/spellingtrie.cpp
- share/splparser.cpp
- share/sync.cpp
- share/userdict.cpp
- share/utf16char.cpp
- share/utf16reader.cpp
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_DEFINES
- HAVE_PINYIN
- PUBLIC_INCLUDE_DIRECTORIES
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
- PUBLIC_LIBRARIES
- Qt::Core
-)
-qt_disable_warnings(BundledPinyin)
-
-#### Keys ignored in scope 1:.:.:pinyin.pro:<TRUE>:
-# OTHER_FILES = "data/rawdict_utf16_65105_freq.txt" "data/valid_utf16.txt"
-# VERSION = "1.0.0"
-
-## Scopes:
-#####################################################################
diff --git a/src/plugins/pinyin/3rdparty/pinyin/CMakeLists.txt b/src/plugins/pinyin/3rdparty/pinyin/CMakeLists.txt
index 1bd98c0e..bc37c90d 100644
--- a/src/plugins/pinyin/3rdparty/pinyin/CMakeLists.txt
+++ b/src/plugins/pinyin/3rdparty/pinyin/CMakeLists.txt
@@ -4,9 +4,15 @@
## BundledPinyin Generic Library:
#####################################################################
-find_package(Threads REQUIRED) # special case
+# special case begin
+# TODO: Prepare for removal, once Platform brings in Threads.
+if(NOT TARGET Threads::Threads)
+ find_package(Threads REQUIRED)
+endif()
+# special case end
-qt_add_3rdparty_library(BundledPinyin
+qt_internal_add_3rdparty_library(BundledPinyin
+ QMAKE_LIB_NAME pinyin
STATIC
SOURCES
include/atomdictbase.h
diff --git a/src/plugins/pinyin/3rdparty/pinyin/pinyin.pro b/src/plugins/pinyin/3rdparty/pinyin/pinyin.pro
deleted file mode 100644
index 193f571a..00000000
--- a/src/plugins/pinyin/3rdparty/pinyin/pinyin.pro
+++ /dev/null
@@ -1,64 +0,0 @@
-TARGET = qtpinyin
-
-VERSION = 1.0.0
-CONFIG += static
-CONFIG += warn_off
-
-MODULE_INCLUDEPATH = $$PWD/include
-MODULE_DEFINES += HAVE_PINYIN
-
-SOURCES += \
- share/dictbuilder.cpp \
- share/dictlist.cpp \
- share/dicttrie.cpp \
- share/lpicache.cpp \
- share/matrixsearch.cpp \
- share/mystdlib.cpp \
- share/ngram.cpp \
- share/pinyinime.cpp \
- share/searchutility.cpp \
- share/spellingtable.cpp \
- share/spellingtrie.cpp \
- share/splparser.cpp \
- share/sync.cpp \
- share/userdict.cpp \
- share/utf16char.cpp \
- share/utf16reader.cpp
-
-HEADERS += \
- include/atomdictbase.h \
- include/dictbuilder.h \
- include/dictdef.h \
- include/dictlist.h \
- include/dicttrie.h \
- include/lpicache.h \
- include/matrixsearch.h \
- include/mystdlib.h \
- include/ngram.h \
- include/pinyinime.h \
- include/searchutility.h \
- include/spellingtable.h \
- include/spellingtrie.h \
- include/splparser.h \
- include/sync.h \
- include/userdict.h \
- include/utf16char.h \
- include/utf16reader.h
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-OTHER_FILES +=\
- data/rawdict_utf16_65105_freq.txt \
- data/valid_utf16.txt
-
-load(qt_helper_lib)
-
-CONFIG += qt
-QT = core
-!win32 {
- CONFIG *= thread
-}
diff --git a/src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp
index d75aec6a..96405d2e 100644
--- a/src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/splparser.cpp
@@ -133,9 +133,9 @@ uint16 SpellingParser::splstr_to_idxs(const char *splstr, uint16 str_len,
idx_num++;
if (NULL != start_pos)
start_pos[idx_num] = str_pos;
- }
- last_is_pre = !last_is_splitter;
+ last_is_pre = !last_is_splitter;
+ }
return idx_num;
}
@@ -262,9 +262,9 @@ uint16 SpellingParser::splstr16_to_idxs(const char16 *splstr, uint16 str_len,
idx_num++;
if (NULL != start_pos)
start_pos[idx_num] = str_pos;
- }
- last_is_pre = !last_is_splitter;
+ last_is_pre = !last_is_splitter;
+ }
return idx_num;
}
diff --git a/src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp b/src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp
index 4687da2d..5090ad07 100644
--- a/src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp
+++ b/src/plugins/pinyin/3rdparty/pinyin/share/userdict.cpp
@@ -336,6 +336,9 @@ bool UserDict::close_dict() {
free(offsets_by_id_);
free(scores_);
free(ids_);
+#ifdef ___SYNC_ENABLED___
+ free(syncs_);
+#endif
#ifdef ___PREDICT_ENABLED___
free(predicts_);
#endif
diff --git a/src/plugins/pinyin/3rdparty/pinyin/update-patches.sh b/src/plugins/pinyin/3rdparty/pinyin/update-patches.sh
index ed67686a..100bb754 100644
--- a/src/plugins/pinyin/3rdparty/pinyin/update-patches.sh
+++ b/src/plugins/pinyin/3rdparty/pinyin/update-patches.sh
@@ -1,32 +1,6 @@
#!/bin/sh
-#############################################################################
-##
-## Copyright (C) 2018 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 or (at your option) any later version
-## approved by the KDE Free Qt Foundation. The licenses are as published by
-## the Free Software Foundation and appearing in the file LICENSE.GPL3
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2018 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
REV_FILTER=". :!./patches :!./update-patches.sh :!./pinyin.pro :!./qt_attribution.json"
REV_LIST=$(git rev-list --reverse 59208edaaf40be982904a6c8cad4eab2d14f938e..HEAD -- $REV_FILTER)
diff --git a/src/plugins/pinyin/CMakeLists.txt b/src/plugins/pinyin/CMakeLists.txt
index 1269695a..87c1f86e 100644
--- a/src/plugins/pinyin/CMakeLists.txt
+++ b/src/plugins/pinyin/CMakeLists.txt
@@ -1,4 +1,74 @@
-# Generated from pinyin.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(3rdparty/pinyin)
-add_subdirectory(plugin)
+
+#####################################################################
+## QtVirtualKeyboardPinyinPlugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(qtvkbpinyinplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Pinyin"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbpinyinplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ pinyindecoderservice.cpp pinyindecoderservice_p.h
+ pinyininputmethod.cpp pinyininputmethod_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboard
+ Qt::BundledPinyin
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# Resources:
+set(qmake_virtualkeyboard_pinyin_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_CN/dialpad.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_CN/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_CN/main.qml"
+ "${VKB_LAYOUTS_BASE}/zh_CN/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_CN/symbols.qml"
+)
+
+qt_internal_add_resource(qtvkbpinyinplugin "qmake_virtualkeyboard_pinyin_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}" #special case
+ BASE
+ "${VKB_LAYOUTS_BASE}" #special case
+ FILES
+ ${qmake_virtualkeyboard_pinyin_layouts_resource_files}
+)
+
+if (NOT FEATURE_vkb_no_bundle_pinyin)
+ # Resources:
+ set(qmake_pinyin_resource_files
+ "3rdparty/pinyin/data/dict_pinyin.dat"
+ )
+
+ qt_internal_add_resource(qtvkbpinyinplugin "qmake_pinyin"
+ PREFIX
+ "/qt-project.org/imports/QtQuick/VirtualKeyboard"
+ BASE
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ ${qmake_pinyin_resource_files}
+ )
+else()
+ qt_copy_or_install(
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/pinyin/data/"
+ DESTINATION "${VKB_INSTALL_DATA}/pinyin"
+ FILES_MATCHING
+ PATTERN "*.dat"
+ )
+endif()
diff --git a/src/plugins/pinyin/pinyin.pro b/src/plugins/pinyin/pinyin.pro
deleted file mode 100644
index fda9a573..00000000
--- a/src/plugins/pinyin/pinyin.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- 3rdparty/pinyin \
- plugin
-
-plugin.depends += 3rdparty/pinyin
diff --git a/src/plugins/pinyin/pinyindecoderservice.cpp b/src/plugins/pinyin/pinyindecoderservice.cpp
new file mode 100644
index 00000000..9613dd9e
--- /dev/null
+++ b/src/plugins/pinyin/pinyindecoderservice.cpp
@@ -0,0 +1,210 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "pinyindecoderservice_p.h"
+#include "pinyinime.h"
+#include "dictdef.h"
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+#include <QtCore/QLibraryInfo>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_DECLARE_LOGGING_CATEGORY(lcPinyin)
+
+using namespace ime_pinyin;
+
+QScopedPointer<PinyinDecoderService> PinyinDecoderService::_instance;
+
+/*!
+ \class QtVirtualKeyboard::PinyinDecoderService
+ \internal
+*/
+
+PinyinDecoderService::PinyinDecoderService(QObject *parent) :
+ QObject(parent),
+ initDone(false)
+{
+}
+
+PinyinDecoderService::~PinyinDecoderService()
+{
+ if (initDone) {
+ im_close_decoder();
+ initDone = false;
+ }
+}
+
+PinyinDecoderService *PinyinDecoderService::getInstance()
+{
+ if (!_instance)
+ _instance.reset(new PinyinDecoderService());
+ if (!_instance->init())
+ return nullptr;
+ return _instance.data();
+}
+
+bool PinyinDecoderService::init()
+{
+ if (initDone)
+ return true;
+
+ QString sysDict(qEnvironmentVariable("QT_VIRTUALKEYBOARD_PINYIN_DICTIONARY"));
+ if (!QFileInfo::exists(sysDict)) {
+ sysDict = QLibraryInfo::path(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/pinyin/dict_pinyin.dat");
+ if (!QFileInfo::exists(sysDict))
+ sysDict = QLatin1String(":/qt-project.org/imports/QtQuick/VirtualKeyboard/3rdparty/pinyin/data/dict_pinyin.dat");
+ }
+
+ QString usrDictPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
+ QFileInfo usrDictInfo(usrDictPath + QLatin1String("/qtvirtualkeyboard/pinyin/usr_dict.dat"));
+ if (!usrDictInfo.exists()) {
+ qCWarning(lcPinyin) << "PinyinDecoderService::init(): creating directory for user dictionary" << usrDictInfo.absolutePath();
+ QDir().mkpath(usrDictInfo.absolutePath());
+ }
+
+ initDone = im_open_decoder(sysDict.toUtf8().constData(), usrDictInfo.absoluteFilePath().toUtf8().constData());
+ if (!initDone)
+ qCWarning(lcPinyin) << "Could not initialize pinyin engine. sys_dict:" << sysDict << "usr_dict:" << usrDictInfo.absoluteFilePath();
+
+ return initDone;
+}
+
+void PinyinDecoderService::setUserDictionary(bool enabled)
+{
+ if (enabled == im_is_user_dictionary_enabled())
+ return;
+ if (enabled) {
+ QString usrDictPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
+ QFileInfo usrDictInfo(usrDictPath + QLatin1String("/qtvirtualkeyboard/pinyin/usr_dict.dat"));
+ im_init_user_dictionary(usrDictInfo.absoluteFilePath().toUtf8().constData());
+ } else {
+ im_init_user_dictionary(nullptr);
+ }
+}
+
+bool PinyinDecoderService::isUserDictionaryEnabled() const
+{
+ return im_is_user_dictionary_enabled();
+}
+
+void PinyinDecoderService::setLimits(int maxSpsLen, int maxHzsLen)
+{
+ if (maxSpsLen <= 0)
+ maxSpsLen = kMaxSearchSteps - 1;
+ if (maxHzsLen <= 0)
+ maxHzsLen = kMaxSearchSteps;
+ im_set_max_lens(size_t(maxSpsLen), size_t(maxHzsLen));
+}
+
+int PinyinDecoderService::search(const QString &spelling)
+{
+ QByteArray spellingBuf = spelling.toLatin1();
+ return int(im_search(spellingBuf.constData(), spellingBuf.size()));
+}
+
+int PinyinDecoderService::deleteSearch(int pos, bool isPosInSpellingId, bool clearFixedInThisStep)
+{
+ if (pos <= 0)
+ pos = 0;
+ return int(im_delsearch(size_t(pos), isPosInSpellingId, clearFixedInThisStep));
+}
+
+void PinyinDecoderService::resetSearch()
+{
+ im_reset_search();
+}
+
+QString PinyinDecoderService::pinyinString(bool decoded)
+{
+ size_t py_len;
+ const char *py = im_get_sps_str(&py_len);
+ if (!decoded)
+ py_len = strlen(py);
+
+ return QString(QLatin1String(py, (int)py_len));
+}
+
+int PinyinDecoderService::pinyinStringLength(bool decoded)
+{
+ size_t py_len;
+ const char *py = im_get_sps_str(&py_len);
+ if (!decoded)
+ py_len = strlen(py);
+ return (int)py_len;
+}
+
+QList<int> PinyinDecoderService::spellingStartPositions()
+{
+ const unsigned short *spl_start;
+ int len;
+ // There will be len + 1 elements in the buffer when len > 0.
+ len = (int)im_get_spl_start_pos(spl_start);
+
+ QList<int> arr;
+ arr.resize(len + 2);
+ arr[0] = len; // element 0 is used to store the length of buffer.
+ for (int i = 0; i <= len; i++)
+ arr[i + 1] = spl_start[i];
+ return arr;
+}
+
+QString PinyinDecoderService::candidateAt(int index)
+{
+ Q_ASSERT(index >= 0);
+ QList<QChar> candidateBuf;
+ candidateBuf.resize(kMaxSearchSteps + 1);
+ if (!im_get_candidate(size_t(index), (char16 *)candidateBuf.data(), candidateBuf.size() - 1))
+ return QString();
+ candidateBuf.last() = u'\0';
+ return QString(candidateBuf.data());
+}
+
+QList<QString> PinyinDecoderService::fetchCandidates(int index, int count, int sentFixedLen)
+{
+ QList<QString> candidatesList;
+ for (int i = index; i < index + count; i++) {
+ QString retStr = candidateAt(i);
+ if (0 == i)
+ retStr.remove(0, sentFixedLen);
+ candidatesList.append(retStr);
+ }
+ return candidatesList;
+}
+
+int PinyinDecoderService::chooceCandidate(int index)
+{
+ return int(im_choose(index));
+}
+
+int PinyinDecoderService::cancelLastChoice()
+{
+ return int(im_cancel_last_choice());
+}
+
+int PinyinDecoderService::fixedLength()
+{
+ return (int)im_get_fixed_len();
+}
+
+void PinyinDecoderService::flushCache()
+{
+ im_flush_cache();
+}
+
+QList<QString> PinyinDecoderService::predictionList(const QString &history)
+{
+ QList<QString> predictList;
+ char16 (*predictItems)[kMaxPredictSize + 1] = nullptr;
+ int predictNum = int(im_get_predicts(history.utf16(), predictItems));
+ predictList.reserve(predictNum);
+ for (int i = 0; i < predictNum; i++)
+ predictList.append(QString((QChar *)predictItems[i]));
+ return predictList;
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/pinyin/pinyindecoderservice_p.h b/src/plugins/pinyin/pinyindecoderservice_p.h
new file mode 100644
index 00000000..4cec9bdd
--- /dev/null
+++ b/src/plugins/pinyin/pinyindecoderservice_p.h
@@ -0,0 +1,60 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef PINYINDECODERSERVICE_P_H
+#define PINYINDECODERSERVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class PinyinDecoderService : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(PinyinDecoderService)
+ explicit PinyinDecoderService(QObject *parent = nullptr);
+
+public:
+ ~PinyinDecoderService();
+
+ static PinyinDecoderService *getInstance();
+
+ bool init();
+ void setUserDictionary(bool enabled);
+ bool isUserDictionaryEnabled() const;
+ void setLimits(int maxSpelling, int maxHzsLen);
+ int search(const QString &spelling);
+ int deleteSearch(int pos, bool isPosInSpellingId, bool clearFixedInThisStep);
+ void resetSearch();
+ QString pinyinString(bool decoded);
+ int pinyinStringLength(bool decoded);
+ QList<int> spellingStartPositions();
+ QString candidateAt(int index);
+ QList<QString> fetchCandidates(int index, int count, int sentFixedLen);
+ int chooceCandidate(int index);
+ int cancelLastChoice();
+ int fixedLength();
+ void flushCache();
+ QList<QString> predictionList(const QString &history);
+
+private:
+ static QScopedPointer<PinyinDecoderService> _instance;
+ bool initDone;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // PINYINDECODERSERVICE_P_H
diff --git a/src/plugins/pinyin/pinyininputmethod.cpp b/src/plugins/pinyin/pinyininputmethod.cpp
new file mode 100644
index 00000000..04753dd7
--- /dev/null
+++ b/src/plugins/pinyin/pinyininputmethod.cpp
@@ -0,0 +1,477 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "pinyininputmethod_p.h"
+#include "pinyindecoderservice_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+
+#include <QLoggingCategory>
+#include <QtCore/qpointer.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(lcPinyin, "qt.virtualkeyboard.pinyin")
+
+class PinyinInputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(PinyinInputMethod)
+
+public:
+ enum State
+ {
+ Idle,
+ Input,
+ Predict
+ };
+
+ PinyinInputMethodPrivate(PinyinInputMethod *q_ptr) :
+ q_ptr(q_ptr),
+ inputMode(QVirtualKeyboardInputEngine::InputMode::Pinyin),
+ pinyinDecoderService(PinyinDecoderService::getInstance()),
+ state(Idle),
+ surface(),
+ totalChoicesNum(0),
+ candidatesList(),
+ fixedLen(0),
+ composingStr(),
+ activeCmpsLen(0),
+ finishSelection(true),
+ posDelSpl(-1),
+ isPosInSpl(false)
+ {
+ }
+
+ void resetToIdleState()
+ {
+ Q_Q(PinyinInputMethod);
+
+ QVirtualKeyboardInputContext *inputContext = q->inputContext();
+
+ // Disable the user dictionary when entering sensitive data
+ if (inputContext && pinyinDecoderService) {
+ bool userDictionaryEnabled = !inputContext->inputMethodHints().testFlag(Qt::ImhSensitiveData);
+ if (userDictionaryEnabled != pinyinDecoderService->isUserDictionaryEnabled())
+ pinyinDecoderService->setUserDictionary(userDictionaryEnabled);
+ }
+
+ if (state == Idle)
+ return;
+
+ state = Idle;
+ surface.clear();
+ fixedLen = 0;
+ finishSelection = true;
+ composingStr.clear();
+ if (inputContext)
+ inputContext->setPreeditText(QString());
+ activeCmpsLen = 0;
+ posDelSpl = -1;
+ isPosInSpl = false;
+
+ resetCandidates();
+ }
+
+ bool addSpellingChar(QChar ch, bool reset)
+ {
+ if (reset) {
+ surface.clear();
+ pinyinDecoderService->resetSearch();
+ }
+ if (ch == u'\'') {
+ if (surface.isEmpty())
+ return false;
+ if (surface.endsWith(ch))
+ return true;
+ }
+ surface.append(ch);
+ return true;
+ }
+
+ bool removeSpellingChar()
+ {
+ if (surface.isEmpty())
+ return false;
+ QList<int> splStart = pinyinDecoderService->spellingStartPositions();
+ isPosInSpl = (surface.size() <= splStart[fixedLen + 1]);
+ posDelSpl = isPosInSpl ? fixedLen - 1 : surface.size() - 1;
+ return true;
+ }
+
+ void chooseAndUpdate(int candId)
+ {
+ Q_Q(PinyinInputMethod);
+
+ if (state == Predict)
+ choosePredictChoice(candId);
+ else
+ chooseDecodingCandidate(candId);
+
+ if (composingStr.size() > 0) {
+ if ((candId >= 0 || finishSelection) && composingStr.size() == fixedLen) {
+ QString resultStr = getComposingStrActivePart();
+ q->inputContext()->commit(resultStr);
+ tryPredict();
+ } else if (state == Idle) {
+ state = Input;
+ }
+ } else {
+ tryPredict();
+ }
+ }
+
+ bool chooseAndFinish()
+ {
+ if (state == Predict || !totalChoicesNum)
+ return false;
+
+ chooseAndUpdate(0);
+ if (state != Predict && totalChoicesNum > 0)
+ chooseAndUpdate(0);
+
+ return true;
+ }
+
+ int candidatesCount()
+ {
+ return totalChoicesNum;
+ }
+
+ QString candidateAt(int index)
+ {
+ if (index < 0 || index >= totalChoicesNum)
+ return QString();
+ if (index >= candidatesList.size()) {
+ int fetchMore = qMin(index + 20, totalChoicesNum - candidatesList.size());
+ candidatesList.append(pinyinDecoderService->fetchCandidates(candidatesList.size(), fetchMore, fixedLen));
+ if (index == 0 && totalChoicesNum == 1) {
+ int surfaceDecodedLen = pinyinDecoderService->pinyinStringLength(true);
+ if (surfaceDecodedLen < surface.size())
+ candidatesList[0] = candidatesList[0] + surface.mid(surfaceDecodedLen).toLower();
+ }
+ }
+ return index < candidatesList.size() ? candidatesList[index] : QString();
+ }
+
+ void chooseDecodingCandidate(int candId)
+ {
+ Q_Q(PinyinInputMethod);
+ Q_ASSERT(state != Predict);
+
+ int result = 0;
+ if (candId < 0) {
+ if (surface.size() > 0) {
+ if (posDelSpl < 0) {
+ result = pinyinDecoderService->search(surface);
+ } else {
+ result = pinyinDecoderService->deleteSearch(posDelSpl, isPosInSpl, false);
+ posDelSpl = -1;
+ }
+ }
+ } else {
+ if (totalChoicesNum > 1) {
+ result = pinyinDecoderService->chooceCandidate(candId);
+ } else {
+ QString resultStr;
+ if (totalChoicesNum == 1) {
+ QString undecodedStr = candId < candidatesList.size() ? candidatesList.at(candId) : QString();
+ resultStr = pinyinDecoderService->candidateAt(0).mid(0, fixedLen) + undecodedStr;
+ }
+ resetToIdleState();
+ if (!resultStr.isEmpty())
+ q->inputContext()->commit(resultStr);
+ return;
+ }
+ }
+
+ resetCandidates();
+ totalChoicesNum = result;
+
+ surface = pinyinDecoderService->pinyinString(false);
+ QList<int> splStart = pinyinDecoderService->spellingStartPositions();
+ QString fullSent = pinyinDecoderService->candidateAt(0);
+ fixedLen = pinyinDecoderService->fixedLength();
+ composingStr = fullSent.mid(0, fixedLen) + surface.mid(splStart[fixedLen + 1]);
+ activeCmpsLen = composingStr.size();
+
+ // Prepare the display string.
+ QString composingStrDisplay;
+ int surfaceDecodedLen = pinyinDecoderService->pinyinStringLength(true);
+ if (!surfaceDecodedLen) {
+ composingStrDisplay = composingStr.toLower();
+ if (!totalChoicesNum)
+ totalChoicesNum = 1;
+ } else {
+ activeCmpsLen = activeCmpsLen - (surface.size() - surfaceDecodedLen);
+ composingStrDisplay = fullSent.mid(0, fixedLen);
+ for (int pos = fixedLen + 1; pos < splStart.size() - 1; pos++) {
+ composingStrDisplay += surface.mid(splStart[pos], splStart[pos + 1] - splStart[pos]);
+ if (splStart[pos + 1] < surfaceDecodedLen)
+ composingStrDisplay += QLatin1String(" ");
+ }
+ if (surfaceDecodedLen < surface.size())
+ composingStrDisplay += surface.mid(surfaceDecodedLen);
+ }
+ q->inputContext()->setPreeditText(composingStrDisplay);
+
+ finishSelection = splStart.size() == (fixedLen + 2);
+ if (!finishSelection)
+ candidateAt(0);
+ }
+
+ void choosePredictChoice(int choiceId)
+ {
+ Q_ASSERT(state == Predict);
+
+ if (choiceId < 0 || choiceId >= totalChoicesNum)
+ return;
+
+ QString tmp = candidatesList.at(choiceId);
+
+ resetCandidates();
+
+ candidatesList.append(tmp);
+ totalChoicesNum = 1;
+
+ surface.clear();
+ fixedLen = tmp.size();
+ composingStr = tmp;
+ activeCmpsLen = fixedLen;
+
+ finishSelection = true;
+ }
+
+ QString getComposingStrActivePart()
+ {
+ return composingStr.mid(0, activeCmpsLen);
+ }
+
+ void resetCandidates()
+ {
+ candidatesList.clear();
+ if (totalChoicesNum) {
+ totalChoicesNum = 0;
+ }
+ }
+
+ void updateCandidateList()
+ {
+ Q_Q(PinyinInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList,
+ totalChoicesNum > 0 && state == PinyinInputMethodPrivate::Input ? 0 : -1);
+ }
+
+ bool canDoPrediction()
+ {
+ Q_Q(PinyinInputMethod);
+ QVirtualKeyboardInputContext *inputContext = q->inputContext();
+ return inputMode == QVirtualKeyboardInputEngine::InputMode::Pinyin &&
+ composingStr.size() == fixedLen &&
+ inputContext &&
+ !inputContext->inputMethodHints().testFlag(Qt::ImhNoPredictiveText);
+ }
+
+ void tryPredict()
+ {
+ // Try to get the prediction list.
+ if (canDoPrediction()) {
+ Q_Q(PinyinInputMethod);
+ if (state != Predict)
+ resetToIdleState();
+ QVirtualKeyboardInputContext *inputContext = q->inputContext();
+ int cursorPosition = inputContext->cursorPosition();
+ int historyStart = qMax(0, cursorPosition - 3);
+ QString history = inputContext->surroundingText().mid(historyStart, cursorPosition - historyStart);
+ candidatesList = pinyinDecoderService->predictionList(history);
+ totalChoicesNum = candidatesList.size();
+ finishSelection = false;
+ state = Predict;
+ } else {
+ resetCandidates();
+ }
+
+ if (!candidatesCount())
+ resetToIdleState();
+ }
+
+ PinyinInputMethod *q_ptr;
+ QVirtualKeyboardInputEngine::InputMode inputMode;
+ QPointer<PinyinDecoderService> pinyinDecoderService;
+ State state;
+ QString surface;
+ int totalChoicesNum;
+ QList<QString> candidatesList;
+ int fixedLen;
+ QString composingStr;
+ int activeCmpsLen;
+ bool finishSelection;
+ int posDelSpl;
+ bool isPosInSpl;
+};
+
+class ScopedCandidateListUpdate
+{
+ Q_DISABLE_COPY(ScopedCandidateListUpdate)
+public:
+ inline explicit ScopedCandidateListUpdate(PinyinInputMethodPrivate *d) :
+ d(d),
+ candidatesList(d->candidatesList),
+ totalChoicesNum(d->totalChoicesNum),
+ state(d->state)
+ {
+ }
+
+ inline ~ScopedCandidateListUpdate()
+ {
+ if (totalChoicesNum != d->totalChoicesNum || state != d->state || candidatesList != d->candidatesList)
+ d->updateCandidateList();
+ }
+
+private:
+ PinyinInputMethodPrivate *d;
+ QList<QString> candidatesList;
+ int totalChoicesNum;
+ PinyinInputMethodPrivate::State state;
+};
+
+/*!
+ \class QtVirtualKeyboard::PinyinInputMethod
+ \internal
+*/
+
+PinyinInputMethod::PinyinInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(parent),
+ d_ptr(new PinyinInputMethodPrivate(this))
+{
+}
+
+PinyinInputMethod::~PinyinInputMethod()
+{
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> PinyinInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale);
+ Q_D(PinyinInputMethod);
+ QList<QVirtualKeyboardInputEngine::InputMode> result;
+ if (d->pinyinDecoderService)
+ result << QVirtualKeyboardInputEngine::InputMode::Pinyin;
+ result << QVirtualKeyboardInputEngine::InputMode::Latin;
+ return result;
+}
+
+bool PinyinInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(locale);
+ Q_D(PinyinInputMethod);
+ reset();
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::Pinyin && !d->pinyinDecoderService)
+ return false;
+ d->inputMode = inputMode;
+ return true;
+}
+
+bool PinyinInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase);
+ return true;
+}
+
+bool PinyinInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(modifiers);
+ Q_D(PinyinInputMethod);
+ if (d->inputMode == QVirtualKeyboardInputEngine::InputMode::Pinyin) {
+ ScopedCandidateListUpdate scopedCandidateListUpdate(d);
+ Q_UNUSED(scopedCandidateListUpdate);
+ if ((key >= Qt::Key_A && key <= Qt::Key_Z) || (key == Qt::Key_Apostrophe)) {
+ if (d->state == PinyinInputMethodPrivate::Predict)
+ d->resetToIdleState();
+ if (d->addSpellingChar(text.at(0), d->state == PinyinInputMethodPrivate::Idle)) {
+ d->chooseAndUpdate(-1);
+ return true;
+ }
+ } else if (key == Qt::Key_Space) {
+ if (d->state != PinyinInputMethodPrivate::Predict && d->candidatesCount() > 0) {
+ d->chooseAndUpdate(0);
+ return true;
+ }
+ } else if (key == Qt::Key_Return) {
+ if (d->state != PinyinInputMethodPrivate::Predict && d->candidatesCount() > 0) {
+ QString surface = d->surface;
+ d->resetToIdleState();
+ inputContext()->commit(surface);
+ return true;
+ }
+ } else if (key == Qt::Key_Backspace) {
+ if (d->removeSpellingChar()) {
+ d->chooseAndUpdate(-1);
+ return true;
+ }
+ } else if (!text.isEmpty()) {
+ d->chooseAndFinish();
+ }
+ }
+ return false;
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> PinyinInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int PinyinInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type);
+ Q_D(PinyinInputMethod);
+ return d->candidatesCount();
+}
+
+QVariant PinyinInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ QVariant result;
+ Q_UNUSED(type);
+ Q_D(PinyinInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->candidateAt(index));
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ result.setValue(0);
+ break;
+ default:
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ break;
+ }
+ return result;
+}
+
+void PinyinInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type);
+ Q_D(PinyinInputMethod);
+ ScopedCandidateListUpdate scopedCandidateListUpdate(d);
+ Q_UNUSED(scopedCandidateListUpdate);
+ d->chooseAndUpdate(index);
+}
+
+void PinyinInputMethod::reset()
+{
+ Q_D(PinyinInputMethod);
+ ScopedCandidateListUpdate scopedCandidateListUpdate(d);
+ Q_UNUSED(scopedCandidateListUpdate);
+ d->resetToIdleState();
+}
+
+void PinyinInputMethod::update()
+{
+ Q_D(PinyinInputMethod);
+ ScopedCandidateListUpdate scopedCandidateListUpdate(d);
+ Q_UNUSED(scopedCandidateListUpdate);
+ d->chooseAndFinish();
+ d->tryPredict();
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/pinyin/pinyininputmethod_p.h b/src/plugins/pinyin/pinyininputmethod_p.h
new file mode 100644
index 00000000..d246d75a
--- /dev/null
+++ b/src/plugins/pinyin/pinyininputmethod_p.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef PINYININPUTMETHOD_P_H
+#define PINYININPUTMETHOD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class PinyinInputMethodPrivate;
+
+class PinyinInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(PinyinInputMethod)
+ QML_ELEMENT
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit PinyinInputMethod(QObject *parent = nullptr);
+ ~PinyinInputMethod();
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
+ QVirtualKeyboardSelectionListModel::Role role) override;
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
+
+ void reset() override;
+ void update() override;
+
+private:
+ QScopedPointer<PinyinInputMethodPrivate> d_ptr;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // PINYININPUTMETHOD_P_H
diff --git a/src/plugins/pinyin/plugin/.prev_CMakeLists.txt b/src/plugins/pinyin/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index 6fe4fe4f..00000000
--- a/src/plugins/pinyin/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardPinyinPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardPinyinPlugin
- OUTPUT_NAME qtvirtualkeyboard_pinyin
- TYPE virtualkeyboard
- SOURCES
- pinyindecoderservice.cpp pinyindecoderservice_p.h
- pinyininputmethod.cpp pinyininputmethod_p.h
- pinyinplugin.cpp pinyinplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
- pinyin
-)
-
-# Resources:
-set(qmake_virtualkeyboard_pinyin_layouts_resource_files
- "virtualkeyboard/content/layouts/zh_CN/dialpad.fallback"
- "virtualkeyboard/content/layouts/zh_CN/digits.fallback"
- "virtualkeyboard/content/layouts/zh_CN/main.qml"
- "virtualkeyboard/content/layouts/zh_CN/numbers.fallback"
- "virtualkeyboard/content/layouts/zh_CN/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardPinyinPlugin "qmake_virtualkeyboard_pinyin_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_pinyin_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "pinyin.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-if(NOT no-bundle-pinyin)
- # Resources:
- set(qmake_pinyin_resource_files
- "../3rdparty/pinyin/data/dict_pinyin.dat"
- )
-
- qt_add_resource(QtVirtualKeyboardPinyinPlugin "qmake_pinyin"
- PREFIX
- "/QtQuick/VirtualKeyboard"
- BASE
- "$$PWD/.."
- FILES
- ${qmake_pinyin_resource_files}
- )
-endif()
-
-#### Keys ignored in scope 3:.:.:plugin.pro:else:
-# INSTALLS = "pinyin_data"
-# pinyin_data.files = "$$PWD/../3rdparty/pinyin/data/dict_pinyin.dat"
-# pinyin_data.path = "$$DATAPATH/pinyin"
-
-#### Keys ignored in scope 4:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "pinyin_data"
-
-#### Keys ignored in scope 5:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Pinyin (Qt $$QT_VERSION)"
diff --git a/src/plugins/pinyin/plugin/CMakeLists.txt b/src/plugins/pinyin/plugin/CMakeLists.txt
deleted file mode 100644
index 41835575..00000000
--- a/src/plugins/pinyin/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardPinyinPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardPinyinPlugin
- OUTPUT_NAME qtvirtualkeyboard_pinyin
- TYPE virtualkeyboard
- SOURCES
- pinyindecoderservice.cpp pinyindecoderservice_p.h
- pinyininputmethod.cpp pinyininputmethod_p.h
- pinyinplugin.cpp pinyinplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
- LIBRARIES # special case
- BundledPinyin # special case
-)
-
-# Resources:
-set(qmake_virtualkeyboard_pinyin_layouts_resource_files
- "virtualkeyboard/content/layouts/zh_CN/dialpad.fallback"
- "virtualkeyboard/content/layouts/zh_CN/digits.fallback"
- "virtualkeyboard/content/layouts/zh_CN/main.qml"
- "virtualkeyboard/content/layouts/zh_CN/numbers.fallback"
- "virtualkeyboard/content/layouts/zh_CN/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardPinyinPlugin "qmake_virtualkeyboard_pinyin_layouts"
- PREFIX
- "${VKB_LAYOUTS_PREFIX}" #special case
- BASE
- "${VKB_LAYOUTS_BASE}" #special case
- FILES
- ${qmake_virtualkeyboard_pinyin_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "pinyin.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-if(NOT no-bundle-pinyin)
- # Resources:
- set(qmake_pinyin_resource_files
- "../3rdparty/pinyin/data/dict_pinyin.dat"
- )
-
- qt_add_resource(QtVirtualKeyboardPinyinPlugin "qmake_pinyin"
- PREFIX
- "/QtQuick/VirtualKeyboard"
- BASE
- "${CMAKE_CURRENT_SOURCE_DIR}" #special case
- FILES
- ${qmake_pinyin_resource_files}
- )
-endif()
-
-#### Keys ignored in scope 3:.:.:plugin.pro:else:
-# INSTALLS = "pinyin_data"
-# pinyin_data.files = "$$PWD/../3rdparty/pinyin/data/dict_pinyin.dat"
-# pinyin_data.path = "$$DATAPATH/pinyin"
-
-#### Keys ignored in scope 4:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "pinyin_data"
-
-#### Keys ignored in scope 5:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Pinyin (Qt $$QT_VERSION)"
diff --git a/src/plugins/pinyin/plugin/pinyin.json b/src/plugins/pinyin/plugin/pinyin.json
deleted file mode 100644
index 6bb19d11..00000000
--- a/src/plugins/pinyin/plugin/pinyin.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "pinyin",
- "Provider": "Qt Pinyin Extension",
- "InputMethod": "PinyinInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/pinyin/plugin/pinyindecoderservice.cpp b/src/plugins/pinyin/plugin/pinyindecoderservice.cpp
deleted file mode 100644
index 856c67d9..00000000
--- a/src/plugins/pinyin/plugin/pinyindecoderservice.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pinyindecoderservice_p.h"
-#include "pinyinime.h"
-#include "dictdef.h"
-#include <QStandardPaths>
-#include <QFileInfo>
-#include <QDir>
-#include <QtCore/QLibraryInfo>
-#include <QLoggingCategory>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_DECLARE_LOGGING_CATEGORY(lcPinyin)
-
-using namespace ime_pinyin;
-
-QScopedPointer<PinyinDecoderService> PinyinDecoderService::_instance;
-
-/*!
- \class QtVirtualKeyboard::PinyinDecoderService
- \internal
-*/
-
-PinyinDecoderService::PinyinDecoderService(QObject *parent) :
- QObject(parent),
- initDone(false)
-{
-}
-
-PinyinDecoderService::~PinyinDecoderService()
-{
- if (initDone) {
- im_close_decoder();
- initDone = false;
- }
-}
-
-PinyinDecoderService *PinyinDecoderService::getInstance()
-{
- if (!_instance)
- _instance.reset(new PinyinDecoderService());
- if (!_instance->init())
- return nullptr;
- return _instance.data();
-}
-
-bool PinyinDecoderService::init()
-{
- if (initDone)
- return true;
-
- QString sysDict(qEnvironmentVariable("QT_VIRTUALKEYBOARD_PINYIN_DICTIONARY"));
- if (!QFileInfo::exists(sysDict)) {
- sysDict = QLatin1String(":///QtQuick/VirtualKeyboard/3rdparty/pinyin/data/dict_pinyin.dat");
- if (!QFileInfo::exists(sysDict))
- sysDict = QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/pinyin/dict_pinyin.dat");
- }
-
- QString usrDictPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
- QFileInfo usrDictInfo(usrDictPath + QLatin1String("/qtvirtualkeyboard/pinyin/usr_dict.dat"));
- if (!usrDictInfo.exists()) {
- qCWarning(lcPinyin) << "PinyinDecoderService::init(): creating directory for user dictionary" << usrDictInfo.absolutePath();
- QDir().mkpath(usrDictInfo.absolutePath());
- }
-
- initDone = im_open_decoder(sysDict.toUtf8().constData(), usrDictInfo.absoluteFilePath().toUtf8().constData());
- if (!initDone)
- qCWarning(lcPinyin) << "Could not initialize pinyin engine. sys_dict:" << sysDict << "usr_dict:" << usrDictInfo.absoluteFilePath();
-
- return initDone;
-}
-
-void PinyinDecoderService::setUserDictionary(bool enabled)
-{
- if (enabled == im_is_user_dictionary_enabled())
- return;
- if (enabled) {
- QString usrDictPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
- QFileInfo usrDictInfo(usrDictPath + QLatin1String("/qtvirtualkeyboard/pinyin/usr_dict.dat"));
- im_init_user_dictionary(usrDictInfo.absoluteFilePath().toUtf8().constData());
- } else {
- im_init_user_dictionary(nullptr);
- }
-}
-
-bool PinyinDecoderService::isUserDictionaryEnabled() const
-{
- return im_is_user_dictionary_enabled();
-}
-
-void PinyinDecoderService::setLimits(int maxSpsLen, int maxHzsLen)
-{
- if (maxSpsLen <= 0)
- maxSpsLen = kMaxSearchSteps - 1;
- if (maxHzsLen <= 0)
- maxHzsLen = kMaxSearchSteps;
- im_set_max_lens(size_t(maxSpsLen), size_t(maxHzsLen));
-}
-
-int PinyinDecoderService::search(const QString &spelling)
-{
- QByteArray spellingBuf = spelling.toLatin1();
- return int(im_search(spellingBuf.constData(), spellingBuf.length()));
-}
-
-int PinyinDecoderService::deleteSearch(int pos, bool isPosInSpellingId, bool clearFixedInThisStep)
-{
- if (pos <= 0)
- pos = 0;
- return int(im_delsearch(size_t(pos), isPosInSpellingId, clearFixedInThisStep));
-}
-
-void PinyinDecoderService::resetSearch()
-{
- im_reset_search();
-}
-
-QString PinyinDecoderService::pinyinString(bool decoded)
-{
- size_t py_len;
- const char *py = im_get_sps_str(&py_len);
- if (!decoded)
- py_len = strlen(py);
-
- return QString(QLatin1String(py, (int)py_len));
-}
-
-int PinyinDecoderService::pinyinStringLength(bool decoded)
-{
- size_t py_len;
- const char *py = im_get_sps_str(&py_len);
- if (!decoded)
- py_len = strlen(py);
- return (int)py_len;
-}
-
-QList<int> PinyinDecoderService::spellingStartPositions()
-{
- const unsigned short *spl_start;
- int len;
- // There will be len + 1 elements in the buffer when len > 0.
- len = (int)im_get_spl_start_pos(spl_start);
-
- QList<int> arr;
- arr.resize(len + 2);
- arr[0] = len; // element 0 is used to store the length of buffer.
- for (int i = 0; i <= len; i++)
- arr[i + 1] = spl_start[i];
- return arr;
-}
-
-QString PinyinDecoderService::candidateAt(int index)
-{
- Q_ASSERT(index >= 0);
- QList<QChar> candidateBuf;
- candidateBuf.resize(kMaxSearchSteps + 1);
- if (!im_get_candidate(size_t(index), (char16 *)candidateBuf.data(), candidateBuf.length() - 1))
- return QString();
- candidateBuf.last() = u'\0';
- return QString(candidateBuf.data());
-}
-
-QList<QString> PinyinDecoderService::fetchCandidates(int index, int count, int sentFixedLen)
-{
- QList<QString> candidatesList;
- for (int i = index; i < index + count; i++) {
- QString retStr = candidateAt(i);
- if (0 == i)
- retStr.remove(0, sentFixedLen);
- candidatesList.append(retStr);
- }
- return candidatesList;
-}
-
-int PinyinDecoderService::chooceCandidate(int index)
-{
- return int(im_choose(index));
-}
-
-int PinyinDecoderService::cancelLastChoice()
-{
- return int(im_cancel_last_choice());
-}
-
-int PinyinDecoderService::fixedLength()
-{
- return (int)im_get_fixed_len();
-}
-
-void PinyinDecoderService::flushCache()
-{
- im_flush_cache();
-}
-
-QList<QString> PinyinDecoderService::predictionList(const QString &history)
-{
- QList<QString> predictList;
- char16 (*predictItems)[kMaxPredictSize + 1] = nullptr;
- int predictNum = int(im_get_predicts(history.utf16(), predictItems));
- predictList.reserve(predictNum);
- for (int i = 0; i < predictNum; i++)
- predictList.append(QString((QChar *)predictItems[i]));
- return predictList;
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/pinyin/plugin/pinyindecoderservice_p.h b/src/plugins/pinyin/plugin/pinyindecoderservice_p.h
deleted file mode 100644
index 4c5884dd..00000000
--- a/src/plugins/pinyin/plugin/pinyindecoderservice_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PINYINDECODERSERVICE_P_H
-#define PINYINDECODERSERVICE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class PinyinDecoderService : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(PinyinDecoderService)
- explicit PinyinDecoderService(QObject *parent = nullptr);
-
-public:
- ~PinyinDecoderService();
-
- static PinyinDecoderService *getInstance();
-
- bool init();
- void setUserDictionary(bool enabled);
- bool isUserDictionaryEnabled() const;
- void setLimits(int maxSpelling, int maxHzsLen);
- int search(const QString &spelling);
- int deleteSearch(int pos, bool isPosInSpellingId, bool clearFixedInThisStep);
- void resetSearch();
- QString pinyinString(bool decoded);
- int pinyinStringLength(bool decoded);
- QList<int> spellingStartPositions();
- QString candidateAt(int index);
- QList<QString> fetchCandidates(int index, int count, int sentFixedLen);
- int chooceCandidate(int index);
- int cancelLastChoice();
- int fixedLength();
- void flushCache();
- QList<QString> predictionList(const QString &history);
-
-private:
- static QScopedPointer<PinyinDecoderService> _instance;
- bool initDone;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // PINYINDECODERSERVICE_P_H
diff --git a/src/plugins/pinyin/plugin/pinyininputmethod.cpp b/src/plugins/pinyin/plugin/pinyininputmethod.cpp
deleted file mode 100644
index c70e31b5..00000000
--- a/src/plugins/pinyin/plugin/pinyininputmethod.cpp
+++ /dev/null
@@ -1,501 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pinyininputmethod_p.h"
-#include "pinyindecoderservice_p.h"
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#include <QLoggingCategory>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_LOGGING_CATEGORY(lcPinyin, "qt.virtualkeyboard.pinyin")
-
-class PinyinInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(PinyinInputMethod)
-
-public:
- enum State
- {
- Idle,
- Input,
- Predict
- };
-
- PinyinInputMethodPrivate(PinyinInputMethod *q_ptr) :
- q_ptr(q_ptr),
- inputMode(QVirtualKeyboardInputEngine::InputMode::Pinyin),
- pinyinDecoderService(PinyinDecoderService::getInstance()),
- state(Idle),
- surface(),
- totalChoicesNum(0),
- candidatesList(),
- fixedLen(0),
- composingStr(),
- activeCmpsLen(0),
- finishSelection(true),
- posDelSpl(-1),
- isPosInSpl(false)
- {
- }
-
- void resetToIdleState()
- {
- Q_Q(PinyinInputMethod);
-
- QVirtualKeyboardInputContext *inputContext = q->inputContext();
-
- // Disable the user dictionary when entering sensitive data
- if (inputContext) {
- bool userDictionaryEnabled = !inputContext->inputMethodHints().testFlag(Qt::ImhSensitiveData);
- if (userDictionaryEnabled != pinyinDecoderService->isUserDictionaryEnabled())
- pinyinDecoderService->setUserDictionary(userDictionaryEnabled);
- }
-
- if (state == Idle)
- return;
-
- state = Idle;
- surface.clear();
- fixedLen = 0;
- finishSelection = true;
- composingStr.clear();
- if (inputContext)
- inputContext->setPreeditText(QString());
- activeCmpsLen = 0;
- posDelSpl = -1;
- isPosInSpl = false;
-
- resetCandidates();
- }
-
- bool addSpellingChar(QChar ch, bool reset)
- {
- if (reset) {
- surface.clear();
- pinyinDecoderService->resetSearch();
- }
- if (ch == u'\'') {
- if (surface.isEmpty())
- return false;
- if (surface.endsWith(ch))
- return true;
- }
- surface.append(ch);
- return true;
- }
-
- bool removeSpellingChar()
- {
- if (surface.isEmpty())
- return false;
- QList<int> splStart = pinyinDecoderService->spellingStartPositions();
- isPosInSpl = (surface.length() <= splStart[fixedLen + 1]);
- posDelSpl = isPosInSpl ? fixedLen - 1 : surface.length() - 1;
- return true;
- }
-
- void chooseAndUpdate(int candId)
- {
- Q_Q(PinyinInputMethod);
-
- if (state == Predict)
- choosePredictChoice(candId);
- else
- chooseDecodingCandidate(candId);
-
- if (composingStr.length() > 0) {
- if ((candId >= 0 || finishSelection) && composingStr.length() == fixedLen) {
- QString resultStr = getComposingStrActivePart();
- tryPredict();
- q->inputContext()->commit(resultStr);
- } else if (state == Idle) {
- state = Input;
- }
- } else {
- tryPredict();
- }
- }
-
- bool chooseAndFinish()
- {
- if (state == Predict || !totalChoicesNum)
- return false;
-
- chooseAndUpdate(0);
- if (state != Predict && totalChoicesNum > 0)
- chooseAndUpdate(0);
-
- return true;
- }
-
- int candidatesCount()
- {
- return totalChoicesNum;
- }
-
- QString candidateAt(int index)
- {
- if (index < 0 || index >= totalChoicesNum)
- return QString();
- if (index >= candidatesList.size()) {
- int fetchMore = qMin(index + 20, totalChoicesNum - candidatesList.size());
- candidatesList.append(pinyinDecoderService->fetchCandidates(candidatesList.size(), fetchMore, fixedLen));
- if (index == 0 && totalChoicesNum == 1) {
- int surfaceDecodedLen = pinyinDecoderService->pinyinStringLength(true);
- if (surfaceDecodedLen < surface.length())
- candidatesList[0] = candidatesList[0] + surface.mid(surfaceDecodedLen).toLower();
- }
- }
- return index < candidatesList.size() ? candidatesList[index] : QString();
- }
-
- void chooseDecodingCandidate(int candId)
- {
- Q_Q(PinyinInputMethod);
- Q_ASSERT(state != Predict);
-
- int result = 0;
- if (candId < 0) {
- if (surface.length() > 0) {
- if (posDelSpl < 0) {
- result = pinyinDecoderService->search(surface);
- } else {
- result = pinyinDecoderService->deleteSearch(posDelSpl, isPosInSpl, false);
- posDelSpl = -1;
- }
- }
- } else {
- if (totalChoicesNum > 1) {
- result = pinyinDecoderService->chooceCandidate(candId);
- } else {
- QString resultStr;
- if (totalChoicesNum == 1) {
- QString undecodedStr = candId < candidatesList.length() ? candidatesList.at(candId) : QString();
- resultStr = pinyinDecoderService->candidateAt(0).mid(0, fixedLen) + undecodedStr;
- }
- resetToIdleState();
- if (!resultStr.isEmpty())
- q->inputContext()->commit(resultStr);
- return;
- }
- }
-
- resetCandidates();
- totalChoicesNum = result;
-
- surface = pinyinDecoderService->pinyinString(false);
- QList<int> splStart = pinyinDecoderService->spellingStartPositions();
- QString fullSent = pinyinDecoderService->candidateAt(0);
- fixedLen = pinyinDecoderService->fixedLength();
- composingStr = fullSent.mid(0, fixedLen) + surface.mid(splStart[fixedLen + 1]);
- activeCmpsLen = composingStr.length();
-
- // Prepare the display string.
- QString composingStrDisplay;
- int surfaceDecodedLen = pinyinDecoderService->pinyinStringLength(true);
- if (!surfaceDecodedLen) {
- composingStrDisplay = composingStr.toLower();
- if (!totalChoicesNum)
- totalChoicesNum = 1;
- } else {
- activeCmpsLen = activeCmpsLen - (surface.length() - surfaceDecodedLen);
- composingStrDisplay = fullSent.mid(0, fixedLen);
- for (int pos = fixedLen + 1; pos < splStart.size() - 1; pos++) {
- composingStrDisplay += surface.mid(splStart[pos], splStart[pos + 1] - splStart[pos]).toUpper();
- if (splStart[pos + 1] < surfaceDecodedLen)
- composingStrDisplay += QLatin1String(" ");
- }
- if (surfaceDecodedLen < surface.length())
- composingStrDisplay += surface.mid(surfaceDecodedLen).toLower();
- }
- q->inputContext()->setPreeditText(composingStrDisplay);
-
- finishSelection = splStart.size() == (fixedLen + 2);
- if (!finishSelection)
- candidateAt(0);
- }
-
- void choosePredictChoice(int choiceId)
- {
- Q_ASSERT(state == Predict);
-
- if (choiceId < 0 || choiceId >= totalChoicesNum)
- return;
-
- QString tmp = candidatesList.at(choiceId);
-
- resetCandidates();
-
- candidatesList.append(tmp);
- totalChoicesNum = 1;
-
- surface.clear();
- fixedLen = tmp.length();
- composingStr = tmp;
- activeCmpsLen = fixedLen;
-
- finishSelection = true;
- }
-
- QString getComposingStrActivePart()
- {
- return composingStr.mid(0, activeCmpsLen);
- }
-
- void resetCandidates()
- {
- candidatesList.clear();
- if (totalChoicesNum) {
- totalChoicesNum = 0;
- }
- }
-
- void updateCandidateList()
- {
- Q_Q(PinyinInputMethod);
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList,
- totalChoicesNum > 0 && state == PinyinInputMethodPrivate::Input ? 0 : -1);
- }
-
- bool canDoPrediction()
- {
- Q_Q(PinyinInputMethod);
- QVirtualKeyboardInputContext *inputContext = q->inputContext();
- return inputMode == QVirtualKeyboardInputEngine::InputMode::Pinyin &&
- composingStr.length() == fixedLen &&
- inputContext &&
- !inputContext->inputMethodHints().testFlag(Qt::ImhNoPredictiveText);
- }
-
- void tryPredict()
- {
- // Try to get the prediction list.
- if (canDoPrediction()) {
- Q_Q(PinyinInputMethod);
- if (state != Predict)
- resetToIdleState();
- QVirtualKeyboardInputContext *inputContext = q->inputContext();
- int cursorPosition = inputContext->cursorPosition();
- int historyStart = qMax(0, cursorPosition - 3);
- QString history = inputContext->surroundingText().mid(historyStart, cursorPosition - historyStart);
- candidatesList = pinyinDecoderService->predictionList(history);
- totalChoicesNum = candidatesList.size();
- finishSelection = false;
- state = Predict;
- } else {
- resetCandidates();
- }
-
- if (!candidatesCount())
- resetToIdleState();
- }
-
- PinyinInputMethod *q_ptr;
- QVirtualKeyboardInputEngine::InputMode inputMode;
- QPointer<PinyinDecoderService> pinyinDecoderService;
- State state;
- QString surface;
- int totalChoicesNum;
- QList<QString> candidatesList;
- int fixedLen;
- QString composingStr;
- int activeCmpsLen;
- bool finishSelection;
- int posDelSpl;
- bool isPosInSpl;
-};
-
-class ScopedCandidateListUpdate
-{
- Q_DISABLE_COPY(ScopedCandidateListUpdate)
-public:
- inline explicit ScopedCandidateListUpdate(PinyinInputMethodPrivate *d) :
- d(d),
- candidatesList(d->candidatesList),
- totalChoicesNum(d->totalChoicesNum),
- state(d->state)
- {
- }
-
- inline ~ScopedCandidateListUpdate()
- {
- if (totalChoicesNum != d->totalChoicesNum || state != d->state || candidatesList != d->candidatesList)
- d->updateCandidateList();
- }
-
-private:
- PinyinInputMethodPrivate *d;
- QList<QString> candidatesList;
- int totalChoicesNum;
- PinyinInputMethodPrivate::State state;
-};
-
-/*!
- \class QtVirtualKeyboard::PinyinInputMethod
- \internal
-*/
-
-PinyinInputMethod::PinyinInputMethod(QObject *parent) :
- QVirtualKeyboardAbstractInputMethod(parent),
- d_ptr(new PinyinInputMethodPrivate(this))
-{
-}
-
-PinyinInputMethod::~PinyinInputMethod()
-{
-}
-
-QList<QVirtualKeyboardInputEngine::InputMode> PinyinInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale);
- Q_D(PinyinInputMethod);
- QList<QVirtualKeyboardInputEngine::InputMode> result;
- if (d->pinyinDecoderService)
- result << QVirtualKeyboardInputEngine::InputMode::Pinyin;
- result << QVirtualKeyboardInputEngine::InputMode::Latin;
- return result;
-}
-
-bool PinyinInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale);
- Q_D(PinyinInputMethod);
- reset();
- if (inputMode == QVirtualKeyboardInputEngine::InputMode::Pinyin && !d->pinyinDecoderService)
- return false;
- d->inputMode = inputMode;
- return true;
-}
-
-bool PinyinInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase);
- return true;
-}
-
-bool PinyinInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_UNUSED(modifiers);
- Q_D(PinyinInputMethod);
- if (d->inputMode == QVirtualKeyboardInputEngine::InputMode::Pinyin) {
- ScopedCandidateListUpdate scopedCandidateListUpdate(d);
- Q_UNUSED(scopedCandidateListUpdate);
- if ((key >= Qt::Key_A && key <= Qt::Key_Z) || (key == Qt::Key_Apostrophe)) {
- if (d->state == PinyinInputMethodPrivate::Predict)
- d->resetToIdleState();
- if (d->addSpellingChar(text.at(0), d->state == PinyinInputMethodPrivate::Idle)) {
- d->chooseAndUpdate(-1);
- return true;
- }
- } else if (key == Qt::Key_Space) {
- if (d->state != PinyinInputMethodPrivate::Predict && d->candidatesCount() > 0) {
- d->chooseAndUpdate(0);
- return true;
- }
- } else if (key == Qt::Key_Return) {
- if (d->state != PinyinInputMethodPrivate::Predict && d->candidatesCount() > 0) {
- QString surface = d->surface;
- d->resetToIdleState();
- inputContext()->commit(surface);
- return true;
- }
- } else if (key == Qt::Key_Backspace) {
- if (d->removeSpellingChar()) {
- d->chooseAndUpdate(-1);
- return true;
- }
- } else if (!text.isEmpty()) {
- d->chooseAndFinish();
- }
- }
- return false;
-}
-
-QList<QVirtualKeyboardSelectionListModel::Type> PinyinInputMethod::selectionLists()
-{
- return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
-}
-
-int PinyinInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
-{
- Q_UNUSED(type);
- Q_D(PinyinInputMethod);
- return d->candidatesCount();
-}
-
-QVariant PinyinInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
-{
- QVariant result;
- Q_UNUSED(type);
- Q_D(PinyinInputMethod);
- switch (role) {
- case QVirtualKeyboardSelectionListModel::Role::Display:
- result = QVariant(d->candidateAt(index));
- break;
- case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
- result.setValue(0);
- break;
- default:
- result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void PinyinInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
-{
- Q_UNUSED(type);
- Q_D(PinyinInputMethod);
- ScopedCandidateListUpdate scopedCandidateListUpdate(d);
- Q_UNUSED(scopedCandidateListUpdate);
- d->chooseAndUpdate(index);
-}
-
-void PinyinInputMethod::reset()
-{
- Q_D(PinyinInputMethod);
- ScopedCandidateListUpdate scopedCandidateListUpdate(d);
- Q_UNUSED(scopedCandidateListUpdate);
- d->resetToIdleState();
-}
-
-void PinyinInputMethod::update()
-{
- Q_D(PinyinInputMethod);
- ScopedCandidateListUpdate scopedCandidateListUpdate(d);
- Q_UNUSED(scopedCandidateListUpdate);
- d->chooseAndFinish();
- d->tryPredict();
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/pinyin/plugin/pinyininputmethod_p.h b/src/plugins/pinyin/plugin/pinyininputmethod_p.h
deleted file mode 100644
index 14df2e55..00000000
--- a/src/plugins/pinyin/plugin/pinyininputmethod_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PINYININPUTMETHOD_P_H
-#define PINYININPUTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class PinyinInputMethodPrivate;
-
-class PinyinInputMethod : public QVirtualKeyboardAbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(PinyinInputMethod)
-
-public:
- explicit PinyinInputMethod(QObject *parent = nullptr);
- ~PinyinInputMethod();
-
- QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
- bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
- bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
-
- QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
- int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
- QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
- QVirtualKeyboardSelectionListModel::Role role) override;
- void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
-
- void reset() override;
- void update() override;
-
-private:
- QScopedPointer<PinyinInputMethodPrivate> d_ptr;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // PINYININPUTMETHOD_P_H
diff --git a/src/plugins/pinyin/plugin/pinyinplugin.cpp b/src/plugins/pinyin/plugin/pinyinplugin.cpp
deleted file mode 100644
index 6edef332..00000000
--- a/src/plugins/pinyin/plugin/pinyinplugin.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pinyinplugin.h"
-#include "pinyininputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardPinyinPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<PinyinInputMethod>(uri, 1, 1, "PinyinInputMethod");
- qmlRegisterType<PinyinInputMethod>(uri, 2, 0, "PinyinInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/pinyin/plugin/pinyinplugin.h b/src/plugins/pinyin/plugin/pinyinplugin.h
deleted file mode 100644
index c642919c..00000000
--- a/src/plugins/pinyin/plugin/pinyinplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PINYINPLUGIN_H
-#define PINYINPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardPinyinPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "pinyin.json")
-public:
- void registerTypes(const char *uri) const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/pinyin/plugin/plugin.pro b/src/plugins/pinyin/plugin/plugin.pro
deleted file mode 100644
index 5b11fe8c..00000000
--- a/src/plugins/pinyin/plugin/plugin.pro
+++ /dev/null
@@ -1,59 +0,0 @@
-TARGET = qtvirtualkeyboard_pinyin
-QT += qml virtualkeyboard
-
-include(../../../shared.pri)
-
-HEADERS += \
- pinyindecoderservice_p.h \
- pinyininputmethod_p.h \
- pinyinplugin.h
-SOURCES += \
- pinyindecoderservice.cpp \
- pinyininputmethod.cpp \
- pinyinplugin.cpp
-OTHER_FILES += \
- pinyin.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-LAYOUT_FILES += \
- $$LAYOUTS_BASE/content/layouts/zh_CN/dialpad.fallback \
- $$LAYOUTS_BASE/content/layouts/zh_CN/digits.fallback \
- $$LAYOUTS_BASE/content/layouts/zh_CN/main.qml \
- $$LAYOUTS_BASE/content/layouts/zh_CN/numbers.fallback \
- $$LAYOUTS_BASE/content/layouts/zh_CN/symbols.qml
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-virtualkeyboard_pinyin_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_pinyin_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_pinyin_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_pinyin_layouts
-
-QMAKE_USE += pinyin
-!no-bundle-pinyin {
- PINYIN_FILES += ../3rdparty/pinyin/data/dict_pinyin.dat
- pinyin.files = $$PINYIN_FILES
- pinyin.base = $$PWD/..
- pinyin.prefix = /QtQuick/VirtualKeyboard
- RESOURCES += pinyin
-} else {
- pinyin_data.files = $$PWD/../3rdparty/pinyin/data/dict_pinyin.dat
- pinyin_data.path = $$DATAPATH/pinyin
- INSTALLS += pinyin_data
- !prefix_build: COPIES += pinyin_data
-}
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Pinyin (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardPinyinPlugin
-load(qt_plugin)
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
deleted file mode 100644
index 12ee3f67..00000000
--- a/src/plugins/plugins.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = subdirs
-
-QT_FOR_CONFIG += virtualkeyboard-private
-
-qtConfig(hangul): SUBDIRS += hangul
-qtConfig(hunspell): SUBDIRS += hunspell
-qtConfig(lipi-toolkit) {
- SUBDIRS += lipi-toolkit
- qtConfig(hunspell): lipi-toolkit.depends += hunspell
-}
-qtConfig(openwnn): SUBDIRS += openwnn
-qtConfig(pinyin): SUBDIRS += pinyin
-qtConfig(t9write): SUBDIRS += t9write
-qtConfig(tcime): SUBDIRS += tcime
-qtConfig(vkb-myscript): SUBDIRS += myscript
-qtConfig(thai) {
- SUBDIRS += thai
- qtConfig(hunspell): thai.depends += hunspell
-}
diff --git a/src/plugins/t9write/3rdparty/t9write/CMakeLists.txt b/src/plugins/t9write/3rdparty/t9write/CMakeLists.txt
deleted file mode 100644
index 8f3baf69..00000000
--- a/src/plugins/t9write/3rdparty/t9write/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-# Generated from t9write.pro.
-
-#####################################################################
-## BundledT9Write_Db Generic Library:
-#####################################################################
-
-qt_add_3rdparty_library(BundledT9Write_Db
- STATIC
- SOURCES
- api/*
- PUBLIC_LIBRARIES
- Qt::Core
-)
-
-file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/arabic/*.bin")
-foreach(file IN LISTS resource_glob_0)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/hebrew/*.bin")
-foreach(file IN LISTS resource_glob_1)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_2 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/thai/*.bin")
-foreach(file IN LISTS resource_glob_2)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_3 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.bin")
-foreach(file IN LISTS resource_glob_3)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_4 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.ldb")
-foreach(file IN LISTS resource_glob_4)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_5 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.hdb")
-foreach(file IN LISTS resource_glob_5)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_6 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.phd")
-foreach(file IN LISTS resource_glob_6)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-# Resources:
-set(qmake_t9write_db_resource_files
- ${resource_glob_0}
- ${resource_glob_1}
- ${resource_glob_2}
- ${resource_glob_3}
- ${resource_glob_4}
- ${resource_glob_5}
- ${resource_glob_6}
-)
-
-qt_add_resource(BundledT9Write_Db "qmake_t9write_db"
- PREFIX
- "/QtQuick/VirtualKeyboard/T9Write"
- FILES
- ${qmake_t9write_db_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:t9write.pro:<TRUE>:
-# QMAKE_RESOURCE_FLAGS = "-no-compress"
diff --git a/src/plugins/t9write/3rdparty/t9write/t9write-build.pri b/src/plugins/t9write/3rdparty/t9write/t9write-build.pri
deleted file mode 100644
index a39291fa..00000000
--- a/src/plugins/t9write/3rdparty/t9write/t9write-build.pri
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Automatically detects the T9Write build directory and sets the following variables:
-#
-# T9WRITE_FOUND: 0/1 T9Write SDK found
-# T9WRITE_BUILD_STATIC: 0/1 Static libraries found (0 == shared libraries)
-# T9WRITE_ALPHABETIC_FOUND: 0/1 T9 Write Alphabetic API header found
-# T9WRITE_CJK_FOUND: 0/1 T9 Write CJK API header found
-# T9WRITE_INCLUDE_DIRS: T9 Write include directories
-# T9WRITE_ALPHABETIC_LIBS: Absolute path to the target library file
-# T9WRITE_ALPHABETIC_BINS: Absolute path to the target binary file (shared library)
-# T9WRITE_CJK_LIBS: Absolute path to the target library file
-# T9WRITE_CJK_BINS: Absolute path to the target binary file (shared library)
-#
-
-T9WRITE_FOUND = 0
-T9WRITE_ALPHABETIC_FOUND = 0
-T9WRITE_CJK_FOUND = 0
-T9WRITE_INCLUDE_DIRS = $$PWD/api
-contains(QT_ARCH, arm) {
- T9WRITE_BUILD_SHARED_DIR = lib/arm/shared
- T9WRITE_BUILD_STATIC_DIR = lib/arm/static
-} else:linux {
- T9WRITE_BUILD_SHARED_DIR = lib/linux/shared
- T9WRITE_BUILD_STATIC_DIR = lib/linux/static
-} else:win32 {
- T9WRITE_BUILD_SHARED_DIR = lib/win32/shared
- T9WRITE_BUILD_STATIC_DIR = lib/win32/static
-}
-
-defineReplace(findStaticLibrary) {
- win32 {
- result = $$files($$1/*.obj)
- isEmpty(result): result = $$files($$1/*.lib)
- } else {
- result = $$files($$1/*.o)
- isEmpty(result): result = $$files($$1/*.a)
- }
- return($$result)
-}
-
-defineReplace(findSharedLibrary) {
- win32 {
- result = $$files($$1/*.lib)
- } else {
- result = $$files($$1/*.so)
- }
- return($$result)
-}
-
-defineReplace(findSharedBinary) {
- win32 {
- result = $$files($$1/*.dll)
- } else {
- result = $$files($$1/*.so)
- }
- return($$result)
-}
-
-for(include_dir, T9WRITE_INCLUDE_DIRS) {
- exists($${include_dir}/decuma_hwr.h): T9WRITE_ALPHABETIC_FOUND = 1
- exists($${include_dir}/decuma_hwr_cjk.h): T9WRITE_CJK_FOUND = 1
-}
-
-equals(T9WRITE_ALPHABETIC_FOUND, 1)|equals(T9WRITE_CJK_FOUND, 1) {
- equals(T9WRITE_ALPHABETIC_FOUND, 1) {
- T9WRITE_ALPHABETIC_LIBS = $$findSharedLibrary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/alphabetic)
- !isEmpty(T9WRITE_ALPHABETIC_LIBS) {
- T9WRITE_ALPHABETIC_BINS = $$findSharedBinary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/alphabetic)
- } else {
- T9WRITE_ALPHABETIC_LIBS = $$findStaticLibrary($$PWD/$$T9WRITE_BUILD_STATIC_DIR/alphabetic)
- }
- }
- equals(T9WRITE_CJK_FOUND, 1) {
- T9WRITE_CJK_LIBS = $$findSharedLibrary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/cjk)
- !isEmpty(T9WRITE_CJK_LIBS) {
- T9WRITE_CJK_BINS = $$findSharedBinary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/cjk)
- } else {
- T9WRITE_CJK_LIBS = $$findStaticLibrary($$PWD/$$T9WRITE_BUILD_STATIC_DIR/cjk)
- }
- }
- equals(T9WRITE_ALPHABETIC_FOUND, 1):!isEmpty(T9WRITE_ALPHABETIC_LIBS): T9WRITE_FOUND = 1
- equals(T9WRITE_CJK_FOUND, 1):!isEmpty(T9WRITE_CJK_LIBS): T9WRITE_FOUND = 1
-}
diff --git a/src/plugins/t9write/3rdparty/t9write/t9write.pro b/src/plugins/t9write/3rdparty/t9write/t9write.pro
deleted file mode 100644
index c7f0a86b..00000000
--- a/src/plugins/t9write/3rdparty/t9write/t9write.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-TARGET = qtt9write_db
-CONFIG += static
-
-HEADERS += $$files(api/*)
-
-T9WRITE_RESOURCE_FILES = \
- $$files(data/arabic/*.bin) \
- $$files(data/hebrew/*.bin) \
- $$files(data/thai/*.bin) \
- $$files(data/*.bin) \
- $$files(data/*.ldb) \
- $$files(data/*.hdb) \
- $$files(data/*.phd)
-
-# Note: Compression is disabled, because the resource is accessed directly from the memory
-QMAKE_RESOURCE_FLAGS += -no-compress
-CONFIG += resources_big
-
-t9write_db.files = $$T9WRITE_RESOURCE_FILES
-t9write_db.prefix =/QtQuick/VirtualKeyboard/T9Write
-RESOURCES += t9write_db
-
-load(qt_helper_lib)
-
-# Needed for resources
-CONFIG += qt
-QT = core
diff --git a/src/plugins/t9write/3rdparty/t9write/unpack.py b/src/plugins/t9write/3rdparty/t9write/unpack.py
deleted file mode 100644
index 4fc1f4dc..00000000
--- a/src/plugins/t9write/3rdparty/t9write/unpack.py
+++ /dev/null
@@ -1,278 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2017 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 or (at your option) any later version
-## approved by the KDE Free Qt Foundation. The licenses are as published by
-## the Free Software Foundation and appearing in the file LICENSE.GPL3
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import os
-import sys
-import zipfile
-import tempfile
-import shutil
-import fnmatch
-
-#
-# This utility script unpacks the T9 Write SDK to appropriate directory
-# structure for Qt Virtual Keyboard.
-#
-# Usage: unpack.py <filename.zip> <target dir>
-# unpack.py <input dir> <target dir>
-#
-# The script will happily overwrite existing files, so be careful.
-#
-
-#
-# Unpack rule list
-#
-# Each list entry is a dictionary consisting of target directory as
-# key and matching pattern as value. The dictionary can be defined in
-# the following ways:
-#
-# Note: The rules within the dictionary are executed in arbitrary order.
-# Add a new list entry if the order is significant.
-#
-# Format:
-# 1. { 'target dir 1': [ 'pattern1', 'pattern2', ... ], 'target dir 2': ... }
-# - Each pattern is matched against the zip file contents. The file is
-# copied to target dir if the pattern matches. Each pattern is handled
-# independent of each other.
-#
-# 2. { 'target dir 1': [ [ 'file group pattern', 'sub pattern1', ... ] ], 'target dir 2': ... }
-# - First the file group pattern is matched against the zip file contents.
-# Then all the sub patterns are matched in the sub directory specified by
-# the first match. If all the sub patterns match, then first match from
-# file group pattern and all the matching files from sub pattterns are copied.
-# The purpose of this option is to copy coupled files, e.g. DLL and LIB
-# files found in the same directory.
-#
-
-UNPACK_RULES = [
-{ # Header files
-'api': [
- '*/decuma_hwr.h',
- '*/decuma_hwr_cjk.h',
- '*/decuma_hwr_types.h',
- '*/decuma_point.h',
- '*/decumaBasicTypes.h',
- '*/decumaBasicTypesMinMax.h',
- '*/decumaCharacterSetType.h',
- '*/decumaCurve.h',
- '*/decumaFunctionalSupport.h',
- '*/decumaFunctionalSupportCheck.h',
- '*/decumaLanguages.h',
- '*/decumaLiteFunctionalSupport.h',
- '*/decumaPlusFunctionalSupport.h',
- '*/decumaRuntimeMallocData.h',
- '*/decumaStatus.h',
- '*/decumaStorageSpecifiers.h',
- '*/decumaSymbolCategories.h',
- '*/decumaUnicodeTypes.h',
- '*/t9write_alpha_version.h',
- '*/t9write_api_version.h',
- '*/t9write_cjk_version.h',
- '*/xxt9wApiOem.h',
- '*/xxt9wOem.h',
-],
-}, { # Data: Arabic and Hebrew database must be copied first (the file name collides with Alphabetic database)
-'data/arabic': [
- '*/Arabic/*_le.bin',
-],
-'data/hebrew': [
- '*/Hebrew/*_le.bin',
-],
-'data/thai': [
- '*/*Thai*/*_le.bin',
-],
-}, { # Data: Alphabetic and CJK databases
-'data': [
- '*/*_le.bin',
- '*/*.hdb',
- '*/*.phd',
- '*/*.ldb',
-],
-}, { # Libraries
-'lib/arm/static/alphabetic': [
- '*T9Write_Alpha*/*Android_ARM*/*.a',
- '*T9Write_Alpha*/*Android_ARM*/*.o',
-],
-'lib/arm/shared/alphabetic': [
- '*T9Write_Alpha*/*Android_ARM*/*.so',
-],
-'lib/arm/static/cjk': [
- '*T9Write_CJK*/*Android_ARM*/*.a',
- '*T9Write_CJK*/*Android_ARM*/*.o',
-],
-'lib/arm/shared/cjk': [
- '*T9Write_CJK*/*Android_ARM*/*.so',
-],
-'lib/linux/static/alphabetic': [
- '*T9Write_Alpha*/*Android_x86*/*.a',
- '*T9Write_Alpha*/*Android_x86*/*.o',
-],
-'lib/linux/shared/alphabetic': [
- '*T9Write_Alpha*/*Android_x86*/*.so',
-],
-'lib/linux/static/cjk': [
- '*T9Write_CJK*/*Android_x86*/*.a',
- '*T9Write_CJK*/*Android_x86*/*.o',
-],
-'lib/linux/shared/cjk': [
- '*T9Write_CJK*/*Android_x86*/*.so',
-],
-'lib/win32/static/alphabetic': [
- '*T9Write_Alpha*/*.obj',
-],
-'lib/win32/shared/alphabetic': [
- [ '*T9Write_Alpha*/*.dll', '*.lib' ],
-],
-'lib/win32/static/cjk': [
- '*T9Write_CJK*/*.obj',
-],
-'lib/win32/shared/cjk': [
- [ '*T9Write_CJK*/*.dll', '*.lib' ],
-],
-'lib/win32/shared/alphabetic': [
- [ '*T9Write_Alpha*/*.dll', '*.lib' ],
-],
-}
-]
-
-#
-# Blacklist
-#
-# File matching rules for blacklisted items. Matched before UNPACK_RULES.
-#
-
-BLACKLIST_RULES = [
-'*__MACOSX*',
-'*/.DS_Store',
-]
-
-def blacklist(file_list):
- result = []
- for file_name in file_list:
- match = False
- for blacklist_rule in BLACKLIST_RULES:
- match = fnmatch.fnmatch(file_name, blacklist_rule)
- if match:
- break
- if not match:
- result.append(file_name)
- return result
-
-def unzip(zip_file, target_dir):
- zip_list = []
- if os.path.isdir(zip_file):
- base_dir, sdk_dir = os.path.split(zip_file.replace('\\', '/').rstrip('/'))
- base_dir_length = len(base_dir) + 1 if base_dir else 0
- if not 'T9Write' in sdk_dir:
- print("Error: The input directory name '" + sdk_dir + "' does not contain 'T9Write'.")
- print("Please unzip the file to a directory named after the zip file and try again.")
- return zip_list
- for root, dirs, files in os.walk(zip_file):
- for file_name in files:
- sub_dir = root[base_dir_length:]
- dst_dir = os.path.join(target_dir, sub_dir)
- if not os.path.exists(dst_dir):
- os.makedirs(dst_dir)
- shutil.copy2(os.path.join(root, file_name), dst_dir)
- os.chmod(os.path.join(dst_dir, file_name), 0o644)
- zip_list.append(os.path.join(sub_dir, file_name).replace('\\', '/'))
- return zip_list
- with zipfile.ZipFile(zip_file, 'r') as z:
- zip_list = sorted(blacklist(z.namelist()))
- zip_basename = os.path.splitext(os.path.basename(zip_file))[0]
- if zip_list and zip_basename in zip_list[0]:
- zip_basename = ''
- zip_list = [os.path.join(zip_basename, zip_name).replace('\\', '/') for zip_name in zip_list]
- z.extractall(os.path.join(target_dir, zip_basename))
- return zip_list
-
-def match_file_list(file_list, base_dir, fnpattern):
- return [file_name for file_name in file_list \
- if fnmatch.fnmatch(file_name, fnpattern) and \
- os.path.isfile(os.path.join(base_dir, file_name))]
-
-def unpack(zip_list, zip_dir, out_dir):
- if not zip_list:
- return
-
- for unpack_rules in UNPACK_RULES:
- process_unpack_rules(zip_list, zip_dir, out_dir, unpack_rules)
-
-def process_unpack_rules(zip_list, zip_dir, out_dir, unpack_rules):
- for (target_dir, match_rules) in unpack_rules.items():
- for match_rule in match_rules:
- # Match
- match_rule_group = match_rule if isinstance(match_rule, list) else [match_rule]
- match_group_candidates = [match_file_list(zip_list, zip_dir, match_rule_group[0])]
- if len(match_rule_group) > 1:
- while len(match_group_candidates[0]) > 0:
- match_group0_candidate = match_group_candidates[0][0]
- all_sub_groups_match = True
- for sub_group_rule in match_rule_group[1:]:
- fnpattern = os.path.join(os.path.dirname(match_group0_candidate), sub_group_rule).replace('\\', '/')
- sub_group_candidates = match_file_list(zip_list, zip_dir, fnpattern)
- if not sub_group_candidates:
- all_sub_groups_match = False
- break
- match_group_candidates.append(sub_group_candidates)
- if all_sub_groups_match:
- match_group_candidates[0] = [match_group0_candidate]
- break
- else:
- match_group_candidates = [match_group_candidates[0][1:]]
-
- # Copy
- if match_group_candidates:
- for match_group_candidate in match_group_candidates:
- for zip_name in match_group_candidate:
- dst_dir = os.path.join(out_dir, target_dir)
- if not os.path.exists(dst_dir):
- os.makedirs(dst_dir)
- src = os.path.join(zip_dir, zip_name).replace('\\', '/')
- dst = os.path.join(dst_dir, os.path.basename(zip_name)).replace('\\', '/')
- print(zip_name + ' -> ' + dst)
- shutil.copy2(src, dst)
- zip_list.remove(zip_name)
-
-if __name__ == '__main__':
- if len(sys.argv) != 3:
- print("Usage: %s <filename.zip> <target dir>" % os.path.basename(__file__))
- exit()
-
- out_dir = sys.argv[2]
- zip_dir = tempfile.mkdtemp()
-
- try:
- unpack(unzip(sys.argv[1], zip_dir), zip_dir, out_dir)
- except Exception as e:
- print(e)
- finally:
- shutil.rmtree(zip_dir)
diff --git a/src/plugins/t9write/CMakeLists.txt b/src/plugins/t9write/CMakeLists.txt
deleted file mode 100644
index f136b3f3..00000000
--- a/src/plugins/t9write/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from t9write.pro.
-
-add_subdirectory(3rdparty/t9write)
-add_subdirectory(plugin)
diff --git a/src/plugins/t9write/plugin/CMakeLists.txt b/src/plugins/t9write/plugin/CMakeLists.txt
deleted file mode 100644
index 31e806ad..00000000
--- a/src/plugins/t9write/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,264 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardT9WritePlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardT9WritePlugin
- OUTPUT_NAME qtvirtualkeyboard_t9write
- TYPE virtualkeyboard
- SOURCES
- t9write_p.h
- t9writedictionary.cpp t9writedictionary_p.h
- t9writeinputmethod.cpp t9writeinputmethod_p.h
- t9writeplugin.cpp t9writeplugin.h
- t9writeworker.cpp t9writeworker_p.h
- DEFINES
- HAVE_T9WRITE
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- INCLUDE_DIRECTORIES
- api
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboardPrivate
- t9write_db
-)
-
-# Resources:
-set(qmake_virtualkeyboard_t9write_layouts_resource_files
- "virtualkeyboard/content/layouts/fallback/handwriting.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardT9WritePlugin "qmake_virtualkeyboard_t9write_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_t9write_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "t9write.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QtVirtualKeyboardT9WritePlugin CONDITION QT_FEATURE_t9write_alphabetic
- DEFINES
- HAVE_T9WRITE_ALPHABETIC
-)
-
-#### Keys ignored in scope 4:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_GB:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback"
-
-#### Keys ignored in scope 5:.:.:plugin.pro:QT_FEATURE_vkb_lang_en_US:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback"
-
-#### Keys ignored in scope 6:.:.:plugin.pro:QT_FEATURE_vkb_lang_ar_AR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ar_AR/handwriting.qml"
-
-#### Keys ignored in scope 7:.:.:plugin.pro:QT_FEATURE_vkb_lang_bg_BG:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/bg_BG/handwriting.qml"
-
-#### Keys ignored in scope 8:.:.:plugin.pro:QT_FEATURE_vkb_lang_cs_CZ:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/cs_CZ/handwriting.qml"
-
-#### Keys ignored in scope 9:.:.:plugin.pro:QT_FEATURE_vkb_lang_da_DK:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/da_DK/handwriting.fallback"
-
-#### Keys ignored in scope 10:.:.:plugin.pro:QT_FEATURE_vkb_lang_de_DE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/de_DE/handwriting.fallback"
-
-#### Keys ignored in scope 11:.:.:plugin.pro:QT_FEATURE_vkb_lang_el_GR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/el_GR/handwriting.qml"
-
-#### Keys ignored in scope 12:.:.:plugin.pro:QT_FEATURE_vkb_lang_es_ES:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/es_ES/handwriting.qml"
-
-#### Keys ignored in scope 13:.:.:plugin.pro:QT_FEATURE_vkb_lang_es_MX:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/es_MX/handwriting.qml"
-
-#### Keys ignored in scope 14:.:.:plugin.pro:QT_FEATURE_vkb_lang_et_EE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/et_EE/handwriting.fallback"
-
-#### Keys ignored in scope 15:.:.:plugin.pro:QT_FEATURE_vkb_lang_fa_FA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fa_FA/handwriting.qml"
-
-#### Keys ignored in scope 16:.:.:plugin.pro:QT_FEATURE_vkb_lang_fi_FI:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fi_FI/handwriting.fallback"
-
-#### Keys ignored in scope 17:.:.:plugin.pro:QT_FEATURE_vkb_lang_fr_FR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fr_FR/handwriting.fallback"
-
-#### Keys ignored in scope 18:.:.:plugin.pro:QT_FEATURE_vkb_lang_fr_CA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/fr_CA/handwriting.fallback"
-
-#### Keys ignored in scope 19:.:.:plugin.pro:QT_FEATURE_vkb_lang_he_IL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/he_IL/handwriting.qml"
-
-#### Keys ignored in scope 20:.:.:plugin.pro:QT_FEATURE_vkb_lang_hr_HR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hr_HR/handwriting.qml"
-
-#### Keys ignored in scope 21:.:.:plugin.pro:QT_FEATURE_vkb_lang_hu_HU:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/hu_HU/handwriting.qml"
-
-#### Keys ignored in scope 22:.:.:plugin.pro:QT_FEATURE_vkb_lang_id_ID:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback"
-
-#### Keys ignored in scope 23:.:.:plugin.pro:QT_FEATURE_vkb_lang_it_IT:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/it_IT/handwriting.fallback"
-
-#### Keys ignored in scope 24:.:.:plugin.pro:QT_FEATURE_vkb_lang_ms_MY:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback"
-
-#### Keys ignored in scope 25:.:.:plugin.pro:QT_FEATURE_vkb_lang_nb_NO:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nb_NO/handwriting.fallback"
-
-#### Keys ignored in scope 26:.:.:plugin.pro:QT_FEATURE_vkb_lang_nl_NL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback"
-
-#### Keys ignored in scope 27:.:.:plugin.pro:QT_FEATURE_vkb_lang_pl_PL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pl_PL/handwriting.fallback"
-
-#### Keys ignored in scope 28:.:.:plugin.pro:QT_FEATURE_vkb_lang_pt_BR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pt_BR/handwriting.fallback"
-
-#### Keys ignored in scope 29:.:.:plugin.pro:QT_FEATURE_vkb_lang_pt_PT:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/pt_PT/handwriting.fallback"
-
-#### Keys ignored in scope 30:.:.:plugin.pro:QT_FEATURE_vkb_lang_ro_RO:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ro_RO/handwriting.qml"
-
-#### Keys ignored in scope 31:.:.:plugin.pro:QT_FEATURE_vkb_lang_ru_RU:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ru_RU/handwriting.fallback"
-
-#### Keys ignored in scope 32:.:.:plugin.pro:QT_FEATURE_vkb_lang_sk_SK:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sk_SK/handwriting.fallback"
-
-#### Keys ignored in scope 33:.:.:plugin.pro:QT_FEATURE_vkb_lang_sl_SI:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sl_SI/handwriting.fallback"
-
-#### Keys ignored in scope 34:.:.:plugin.pro:QT_FEATURE_vkb_lang_sq_AL:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sq_AL/handwriting.fallback"
-
-#### Keys ignored in scope 35:.:.:plugin.pro:QT_FEATURE_vkb_lang_sr_SP:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sr_SP/handwriting.qml"
-
-#### Keys ignored in scope 36:.:.:plugin.pro:QT_FEATURE_vkb_lang_sv_SE:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/sv_SE/handwriting.fallback"
-
-#### Keys ignored in scope 37:.:.:plugin.pro:QT_FEATURE_vkb_lang_th_TH:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/th_TH/handwriting.qml"
-
-#### Keys ignored in scope 38:.:.:plugin.pro:QT_FEATURE_vkb_lang_tr_TR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/tr_TR/handwriting.fallback"
-
-#### Keys ignored in scope 39:.:.:plugin.pro:QT_FEATURE_vkb_lang_uk_UA:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/uk_UA/handwriting.fallback"
-
-#### Keys ignored in scope 40:.:.:plugin.pro:QT_FEATURE_vkb_lang_vi_VN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/vi_VN/handwriting.fallback"
-
-qt_extend_target(QtVirtualKeyboardT9WritePlugin CONDITION QT_FEATURE_t9write_cjk
- DEFINES
- HAVE_T9WRITE_CJK
-)
-
-#### Keys ignored in scope 42:.:.:plugin.pro:QT_FEATURE_vkb_lang_ja_JP:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ja_JP/handwriting.qml"
-
-#### Keys ignored in scope 43:.:.:plugin.pro:QT_FEATURE_vkb_lang_ko_KR:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/ko_KR/handwriting.qml"
-
-#### Keys ignored in scope 44:.:.:plugin.pro:QT_FEATURE_vkb_lang_zh_CN:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/zh_CN/handwriting.qml"
-
-#### Keys ignored in scope 45:.:.:plugin.pro:QT_FEATURE_vkb_lang_zh_TW:
-# LAYOUT_FILES = "$$LAYOUTS_BASE/content/layouts/zh_TW/handwriting.qml"
-
-#### Keys ignored in scope 47:.:.:plugin.pro:NOT T9WRITE_ALPHABETIC_BINS_ISEMPTY:
-# INSTALLS = "t9write_alphabetic_bins"
-# t9write_alphabetic_bins.files = "$$T9WRITE_ALPHABETIC_BINS"
-# t9write_alphabetic_bins.path = "$$[QT_INSTALL_BINS]"
-
-#### Keys ignored in scope 48:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "t9write_alphabetic_bins"
-
-#### Keys ignored in scope 50:.:.:plugin.pro:NOT T9WRITE_CJK_BINS_ISEMPTY:
-# INSTALLS = "t9write_cjk_bins"
-# t9write_cjk_bins.files = "$$T9WRITE_CJK_BINS"
-# t9write_cjk_bins.path = "$$[QT_INSTALL_BINS]"
-
-#### Keys ignored in scope 51:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "t9write_cjk_bins"
-
-#### Keys ignored in scope 52:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard T9 Write (Qt $$QT_VERSION)"
-
-#### Keys ignored in scope 55:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:QT_ARCH___contains___arm:
-# T9WRITE_BUILD_SHARED_DIR = "lib/arm/shared"
-# T9WRITE_BUILD_STATIC_DIR = "lib/arm/static"
-
-#### Keys ignored in scope 57:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:LINUX:
-# T9WRITE_BUILD_SHARED_DIR = "lib/linux/shared"
-# T9WRITE_BUILD_STATIC_DIR = "lib/linux/static"
-
-#### Keys ignored in scope 59:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:WIN32:
-# T9WRITE_BUILD_SHARED_DIR = "lib/win32/shared"
-# T9WRITE_BUILD_STATIC_DIR = "lib/win32/static"
-
-#### Keys ignored in scope 61:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:WIN32:
-# result = "$$1/*.obj"
-
-#### Keys ignored in scope 62:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:result_ISEMPTY:
-# result = "$$1/*.lib"
-
-#### Keys ignored in scope 63:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:else:
-# result = "$$1/*.o"
-
-#### Keys ignored in scope 64:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:result_ISEMPTY:
-# result = "$$1/*.a"
-
-#### Keys ignored in scope 66:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:WIN32:
-# result = "$$1/*.lib"
-
-#### Keys ignored in scope 67:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:else:
-# result = "$$1/*.so"
-
-#### Keys ignored in scope 69:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:WIN32:
-# result = "$$1/*.dll"
-
-#### Keys ignored in scope 70:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:else:
-# result = "$$1/*.so"
-
-#### Keys ignored in scope 72:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:(T9WRITE_ALPHABETIC_FOUND EQUAL 1):
-# T9WRITE_ALPHABETIC_LIBS = "$$findSharedLibrary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/alphabetic)"
-
-#### Keys ignored in scope 73:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:NOT T9WRITE_ALPHABETIC_LIBS_ISEMPTY:
-# T9WRITE_ALPHABETIC_BINS = "$$findSharedBinary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/alphabetic)"
-
-#### Keys ignored in scope 74:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:else:
-# T9WRITE_ALPHABETIC_LIBS = "$$findStaticLibrary($$PWD/$$T9WRITE_BUILD_STATIC_DIR/alphabetic)"
-
-#### Keys ignored in scope 75:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:(T9WRITE_CJK_FOUND EQUAL 1):
-# T9WRITE_CJK_LIBS = "$$findSharedLibrary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/cjk)"
-
-#### Keys ignored in scope 76:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:NOT T9WRITE_CJK_LIBS_ISEMPTY:
-# T9WRITE_CJK_BINS = "$$findSharedBinary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/cjk)"
-
-#### Keys ignored in scope 77:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:else:
-# T9WRITE_CJK_LIBS = "$$findStaticLibrary($$PWD/$$T9WRITE_BUILD_STATIC_DIR/cjk)"
-
-#### Keys ignored in scope 78:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:(T9WRITE_ALPHABETIC_FOUND EQUAL 1) AND NOT T9WRITE_ALPHABETIC_LIBS_ISEMPTY:
-# T9WRITE_FOUND = "1"
-
-#### Keys ignored in scope 79:.:../3rdparty/t9write:../3rdparty/t9write/t9write-build.pri:(T9WRITE_CJK_FOUND EQUAL 1) AND NOT T9WRITE_CJK_LIBS_ISEMPTY:
-# T9WRITE_FOUND = "1"
diff --git a/src/plugins/t9write/plugin/plugin.pro b/src/plugins/t9write/plugin/plugin.pro
deleted file mode 100644
index 98156373..00000000
--- a/src/plugins/t9write/plugin/plugin.pro
+++ /dev/null
@@ -1,118 +0,0 @@
-TARGET = qtvirtualkeyboard_t9write
-QT += qml virtualkeyboard-private
-
-include(../../../shared.pri)
-
-HEADERS += \
- t9write_p.h \
- t9writedictionary_p.h \
- t9writeinputmethod_p.h \
- t9writeplugin.h \
- t9writeworker_p.h
-SOURCES += \
- t9writedictionary.cpp \
- t9writeinputmethod.cpp \
- t9writeplugin.cpp \
- t9writeworker.cpp
-OTHER_FILES += \
- t9write.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-include(../3rdparty/t9write/t9write-build.pri)
-
-!qtConfig(t9write-cjk): \
- error("T9Write SDK could not be found. For more information, see" \
- "the documentation in Building Qt Virtual Keyboard")
-
-LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fallback/handwriting.qml
-qtConfig(t9write-alphabetic) {
- qtConfig(vkb-lang-en_GB): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_GB/handwriting.fallback
- qtConfig(vkb-lang-en_US): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/en_US/handwriting.fallback
- qtConfig(vkb-lang-ar_AR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ar_AR/handwriting.qml
- qtConfig(vkb-lang-bg_BG): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/bg_BG/handwriting.qml
- qtConfig(vkb-lang-cs_CZ): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/cs_CZ/handwriting.qml
- qtConfig(vkb-lang-da_DK): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/da_DK/handwriting.fallback
- qtConfig(vkb-lang-de_DE): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/de_DE/handwriting.fallback
- qtConfig(vkb-lang-el_GR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/el_GR/handwriting.qml
- qtConfig(vkb-lang-es_ES): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_ES/handwriting.qml
- qtConfig(vkb-lang-es_MX): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/es_MX/handwriting.qml
- qtConfig(vkb-lang-et_EE): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/et_EE/handwriting.fallback
- qtConfig(vkb-lang-fa_FA): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fa_FA/handwriting.qml
- qtConfig(vkb-lang-fi_FI): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fi_FI/handwriting.fallback
- qtConfig(vkb-lang-fr_FR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_FR/handwriting.fallback
- qtConfig(vkb-lang-fr_CA): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/fr_CA/handwriting.fallback
- qtConfig(vkb-lang-he_IL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/he_IL/handwriting.qml
- qtConfig(vkb-lang-hr_HR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hr_HR/handwriting.qml
- qtConfig(vkb-lang-hu_HU): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/hu_HU/handwriting.qml
- qtConfig(vkb-lang-id_ID): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/id_ID/handwriting.fallback
- qtConfig(vkb-lang-it_IT): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/it_IT/handwriting.fallback
- qtConfig(vkb-lang-ms_MY): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ms_MY/handwriting.fallback
- qtConfig(vkb-lang-nb_NO): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nb_NO/handwriting.fallback
- qtConfig(vkb-lang-nl_NL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/nl_NL/handwriting.fallback
- qtConfig(vkb-lang-pl_PL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pl_PL/handwriting.fallback
- qtConfig(vkb-lang-pt_BR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_BR/handwriting.fallback
- qtConfig(vkb-lang-pt_PT): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/pt_PT/handwriting.fallback
- qtConfig(vkb-lang-ro_RO): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ro_RO/handwriting.qml
- qtConfig(vkb-lang-ru_RU): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ru_RU/handwriting.fallback
- qtConfig(vkb-lang-sk_SK): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sk_SK/handwriting.fallback
- qtConfig(vkb-lang-sl_SI): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sl_SI/handwriting.fallback
- qtConfig(vkb-lang-sq_AL): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sq_AL/handwriting.fallback
- qtConfig(vkb-lang-sr_SP): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sr_SP/handwriting.qml
- qtConfig(vkb-lang-sv_SE): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/sv_SE/handwriting.fallback
- qtConfig(vkb-lang-th_TH): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/th_TH/handwriting.qml
- qtConfig(vkb-lang-tr_TR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/tr_TR/handwriting.fallback
- qtConfig(vkb-lang-uk_UA): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/uk_UA/handwriting.fallback
- qtConfig(vkb-lang-vi_VN): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/vi_VN/handwriting.fallback
-}
-qtConfig(t9write-cjk) {
- qtConfig(vkb-lang-ja_JP): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ja_JP/handwriting.qml
- qtConfig(vkb-lang-ko_KR): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/ko_KR/handwriting.qml
- qtConfig(vkb-lang-zh_CN): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/zh_CN/handwriting.qml
- qtConfig(vkb-lang-zh_TW): LAYOUT_FILES += $$LAYOUTS_BASE/content/layouts/zh_TW/handwriting.qml
-}
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-virtualkeyboard_t9write_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_t9write_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_t9write_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_t9write_layouts
-
-DEFINES += HAVE_T9WRITE
-QMAKE_USE += t9write_db
-INCLUDEPATH += $$T9WRITE_INCLUDE_DIRS
-qtConfig(t9write-alphabetic) {
- LIBS += $$T9WRITE_ALPHABETIC_LIBS
- DEFINES += HAVE_T9WRITE_ALPHABETIC
- !isEmpty(T9WRITE_ALPHABETIC_BINS) {
- t9write_alphabetic_bins.files = $$T9WRITE_ALPHABETIC_BINS
- t9write_alphabetic_bins.path = $$[QT_INSTALL_BINS]
- INSTALLS += t9write_alphabetic_bins
- !prefix_build: COPIES += t9write_alphabetic_bins
- }
-}
-qtConfig(t9write-cjk) {
- LIBS += $$T9WRITE_CJK_LIBS
- DEFINES += HAVE_T9WRITE_CJK
- !isEmpty(T9WRITE_CJK_BINS) {
- t9write_cjk_bins.files = $$T9WRITE_CJK_BINS
- t9write_cjk_bins.path = $$[QT_INSTALL_BINS]
- INSTALLS += t9write_cjk_bins
- !prefix_build: COPIES += t9write_cjk_bins
- }
-}
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard T9 Write (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardT9WritePlugin
-load(qt_plugin)
diff --git a/src/plugins/t9write/plugin/t9write.json b/src/plugins/t9write/plugin/t9write.json
deleted file mode 100644
index ac71f7cc..00000000
--- a/src/plugins/t9write/plugin/t9write.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "handwriting",
- "Provider": "Qt T9 Write Extension",
- "InputMethod": "HandwritingInputMethod",
- "Version": 200
-}
diff --git a/src/plugins/t9write/plugin/t9write_p.h b/src/plugins/t9write/plugin/t9write_p.h
deleted file mode 100644
index 5e85b19c..00000000
--- a/src/plugins/t9write/plugin/t9write_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef T9WRITE_P_H
-#define T9WRITE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/private/qvirtualkeyboard_global_p.h>
-
-#include "t9write_api_version.h"
-#if QT_CONFIG(t9write_alphabetic)
-#include "decuma_hwr.h"
-#endif
-#if QT_CONFIG(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)
-#elif defined(HAVE_T9WRITE_CJK)
-#define DECUMA_API(FUNC_NAME) (decumaCJK ## FUNC_NAME)
-#else // defined(HAVE_T9WRITE_ALPHABETIC)
-#define DECUMA_API(FUNC_NAME) (decuma ## FUNC_NAME)
-#endif
-
-#endif // T9WRITE_P_H
diff --git a/src/plugins/t9write/plugin/t9writedictionary.cpp b/src/plugins/t9write/plugin/t9writedictionary.cpp
deleted file mode 100644
index 5a17ae6d..00000000
--- a/src/plugins/t9write/plugin/t9writedictionary.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "t9writedictionary_p.h"
-#include <QLoggingCategory>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_DECLARE_LOGGING_CATEGORY(lcT9Write)
-
-T9WriteDictionary::T9WriteDictionary(DECUMA_SESSION *decumaSession,
- const DECUMA_MEM_FUNCTIONS &memFuncs,
- bool cjk) :
- decumaSession(decumaSession),
- memFuncs(memFuncs),
- cjk(cjk),
- sourceData(nullptr),
- sourceSize(0),
- convertedData(nullptr),
- convertedSize(0)
-{
-}
-
-T9WriteDictionary::~T9WriteDictionary()
-{
- if (convertedData) {
- DECUMA_STATUS status = DECUMA_API(DestroyConvertedDictionary)(&convertedData, &memFuncs);
- Q_ASSERT(status == decumaNoError);
- Q_ASSERT(convertedData == nullptr);
- }
-}
-
-bool T9WriteDictionary::load(const QString &fileName)
-{
- if (sourceData || convertedData)
- return false;
-
- file.setFileName(fileName);
- if (file.open(QIODevice::ReadOnly)) {
- sourceSize = file.size();
- sourceData = file.map(0, sourceSize, QFile::NoOptions);
- if (!sourceData) {
- sourceSize = 0;
- qCWarning(lcT9Write) << "Could not read dictionary file" << fileName;
- }
- file.close();
- } else {
- qCWarning(lcT9Write) << "Could not open dictionary file" << fileName;
- }
-
- return sourceData != nullptr;
-}
-
-bool T9WriteDictionary::convert(const DECUMA_SRC_DICTIONARY_INFO &dictionaryInfo)
-{
- if (!sourceData || convertedData)
- return false;
-
- DECUMA_STATUS status;
- status = DECUMA_API(ConvertDictionary)(&convertedData, sourceData, (DECUMA_UINT32)sourceSize,
- &dictionaryInfo, &convertedSize, &memFuncs);
-
- if (status != decumaNoError) {
- qCWarning(lcT9Write) << "Could not convert dictionary" << file.fileName();
- file.unmap((uchar *)sourceData);
- sourceSize = 0;
- sourceData = nullptr;
- }
-
- return status == decumaNoError;
-}
-
-QString T9WriteDictionary::fileName() const
-{
- return file.fileName();
-}
-
-const void *T9WriteDictionary::data() const
-{
- return convertedData ? convertedData : sourceData;
-}
-
-qint64 T9WriteDictionary::size() const
-{
- return convertedData ? convertedSize : sourceSize;
-}
-
-bool T9WriteDictionary::isConverted() const
-{
- return convertedData != nullptr;
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/t9write/plugin/t9writedictionary_p.h b/src/plugins/t9write/plugin/t9writedictionary_p.h
deleted file mode 100644
index d728a583..00000000
--- a/src/plugins/t9write/plugin/t9writedictionary_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef T9WRITEDICTIONARY_P_H
-#define T9WRITEDICTIONARY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGlobal>
-#include <QFile>
-#include "t9write_p.h"
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class T9WriteDictionary
-{
- Q_DISABLE_COPY(T9WriteDictionary)
-public:
- explicit T9WriteDictionary(DECUMA_SESSION *decumaSession, const DECUMA_MEM_FUNCTIONS &memFuncs, bool cjk);
- ~T9WriteDictionary();
-
- bool load(const QString &fileName);
- bool convert(const DECUMA_SRC_DICTIONARY_INFO &dictionaryInfo);
-
- QString fileName() const;
- const void *data() const;
- qint64 size() const;
- bool isConverted() const;
-
-private:
- QFile file;
- DECUMA_SESSION *decumaSession;
- const DECUMA_MEM_FUNCTIONS &memFuncs;
- bool cjk;
- void *sourceData;
- qint64 sourceSize;
- void *convertedData;
- DECUMA_UINT32 convertedSize;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // T9WRITEDICTIONARY_P_H
diff --git a/src/plugins/t9write/plugin/t9writeinputmethod.cpp b/src/plugins/t9write/plugin/t9writeinputmethod.cpp
deleted file mode 100644
index 007a1989..00000000
--- a/src/plugins/t9write/plugin/t9writeinputmethod.cpp
+++ /dev/null
@@ -1,2177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "t9writeinputmethod_p.h"
-#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
-#include "t9writeworker_p.h"
-#include <QLoggingCategory>
-#include <QDirIterator>
-#include <QCryptographicHash>
-#include <QTime>
-#include <QMetaEnum>
-#include <QtVirtualKeyboard/private/handwritinggesturerecognizer_p.h>
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
-#include <QtVirtualKeyboard/private/unipentrace_p.h>
-#include <QStandardPaths>
-#endif
-
-#include "decumaStatus.h"
-#include "decumaSymbolCategories.h"
-#include "decumaLanguages.h"
-#include "xxt9wOem.h"
-
-/* Set to 1 to enable T9 Write log.
-
- The log is routed to qDebug() and it can be enabled for troubleshooting
- and when reporting issues. The log must not to be enabled in production
- build.
-*/
-#define QT_VIRTUALKEYBOARD_T9WRITE_LOG 0
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_LOGGING_CATEGORY(lcT9Write, "qt.virtualkeyboard.t9write")
-
-class T9WriteCaseFormatter
-{
-public:
- T9WriteCaseFormatter() :
- preferLowercase(false)
- {
- }
-
- void clear()
- {
- textCaseList.clear();
- }
-
- void ensureLength(int length, QVirtualKeyboardInputEngine::TextCase textCase)
- {
- if (length <= 0) {
- textCaseList.clear();
- return;
- }
- while (length < textCaseList.length())
- textCaseList.removeLast();
- while (length > textCaseList.length())
- textCaseList.append(textCase);
- }
-
- QString formatString(const QString &str) const
- {
- QString result;
- QVirtualKeyboardInputEngine::TextCase textCase = QVirtualKeyboardInputEngine::TextCase::Lower;
- for (int i = 0; i < str.length(); ++i) {
- if (i < textCaseList.length())
- textCase = textCaseList.at(i);
- result.append(textCase == QVirtualKeyboardInputEngine::TextCase::Upper ? str.at(i).toUpper() : (preferLowercase ? str.at(i).toLower() : str.at(i)));
- }
- return result;
- }
-
- bool preferLowercase;
-
-private:
- QList<QVirtualKeyboardInputEngine::TextCase> textCaseList;
-};
-
-class T9WriteInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(T9WriteInputMethod)
-public:
- T9WriteInputMethodPrivate(T9WriteInputMethod *q_ptr) :
- q_ptr(q_ptr),
- cjk(false),
- engineMode(T9WriteInputMethod::EngineMode::Uninitialized),
- defaultHwrDbPath(QLatin1String(":/QtQuick/VirtualKeyboard/T9Write/data/")),
- defaultDictionaryDbPath(defaultHwrDbPath),
- traceListHardLimit(32),
- attachedDictionary(nullptr),
- resultId(0),
- lastResultId(0),
- resultTimer(0),
- decumaSession(nullptr),
- activeWordIndex(-1),
- arcAdditionStarted(false),
- ignoreUpdate(false),
- textCase(QVirtualKeyboardInputEngine::TextCase::Lower)
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- , unipenTrace()
-#endif
- {
- }
-
- static void *decumaMalloc(size_t size, void *pPrivate)
- {
- Q_UNUSED(pPrivate);
- return malloc(size);
- }
-
- static void *decumaCalloc(size_t elements, size_t size, void *pPrivate)
- {
- Q_UNUSED(pPrivate);
- return calloc(elements, size);
- }
-
- static void decumaFree(void *ptr, void *pPrivate)
- {
- Q_UNUSED(pPrivate);
- free(ptr);
- }
-
-#if QT_VIRTUALKEYBOARD_T9WRITE_LOG
- static void decumaLogString(void *pUserData, const char *pLogString, DECUMA_UINT32 nLogStringLength)
- {
- static QMutex s_logMutex;
- static QByteArray s_logString;
- Q_UNUSED(pUserData);
- QMutexLocker guard(&s_logMutex);
- s_logString.append(pLogString, nLogStringLength);
- if (s_logString.endsWith('\n')) {
- while (s_logString.endsWith('\n'))
- s_logString.chop(1);
- qDebug() << (const char *)s_logString.constData();
- s_logString.clear();
- }
- }
-#endif
-
- static const char *engineModeToString(T9WriteInputMethod::EngineMode mode)
- {
- return QMetaEnum::fromType<T9WriteInputMethod::EngineMode>().key(static_cast<int>(mode));
- }
-
- bool initEngine(T9WriteInputMethod::EngineMode newEngineMode)
- {
- if (engineMode == newEngineMode)
- return engineMode != T9WriteInputMethod::EngineMode::Uninitialized;
-
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::initEngine()" << engineModeToString(newEngineMode);
-
- if (decumaSession)
- exitEngine();
-
- if (newEngineMode == T9WriteInputMethod::EngineMode::Uninitialized)
- return false;
-
- switch (newEngineMode) {
- case T9WriteInputMethod::EngineMode::Alphabetic:
- case T9WriteInputMethod::EngineMode::Arabic:
- case T9WriteInputMethod::EngineMode::Hebrew:
- case T9WriteInputMethod::EngineMode::Thai:
- cjk = false;
- break;
- case T9WriteInputMethod::EngineMode::SimplifiedChinese:
- case T9WriteInputMethod::EngineMode::TraditionalChinese:
- case T9WriteInputMethod::EngineMode::HongKongChinese:
- case T9WriteInputMethod::EngineMode::Japanese:
- case T9WriteInputMethod::EngineMode::Korean:
- cjk = true;
- break;
- default:
- Q_ASSERT(0 && "Invalid T9WriteInputMethod::EngineMode!");
- return false;
- }
- engineMode = newEngineMode;
-
- memset(&sessionSettings, 0, sizeof(sessionSettings));
-
- QString hwrDb = findHwrDb(engineMode, defaultHwrDbPath);
- hwrDbFile.setFileName(hwrDb);
- if (!hwrDbFile.open(QIODevice::ReadOnly)) {
- qCCritical(lcT9Write) << "Could not open HWR database" << hwrDb;
- exitEngine();
- return false;
- }
-
- sessionSettings.pStaticDB = (DECUMA_STATIC_DB_PTR)hwrDbFile.map(0, hwrDbFile.size(), QFile::NoOptions);
- if (!sessionSettings.pStaticDB) {
- qCCritical(lcT9Write) << "Could not read HWR database" << hwrDb;
- exitEngine();
- return false;
- }
-
- symbolCategories.append(DECUMA_CATEGORY_ANSI);
- languageCategories.append(DECUMA_LANG_EN);
-
- sessionSettings.recognitionMode = mcrMode;
- sessionSettings.writingDirection = unknownWriting;
- sessionSettings.charSet.pSymbolCategories = symbolCategories.data();
- sessionSettings.charSet.nSymbolCategories = symbolCategories.size();
- sessionSettings.charSet.pLanguages = languageCategories.data();
- sessionSettings.charSet.nLanguages = languageCategories.size();
-
- session = QByteArray(DECUMA_API(GetSessionSize)(), 0);
- decumaSession = (DECUMA_SESSION *)(!session.isEmpty() ? session.data() : nullptr);
-
- DECUMA_STATUS status = DECUMA_API(BeginSession)(decumaSession, &sessionSettings, &memFuncs);
- Q_ASSERT(status == decumaNoError);
- if (status != decumaNoError) {
- qCCritical(lcT9Write) << "Could not initialize engine" << status;
- exitEngine();
- return false;
- }
-
-#if QT_VIRTUALKEYBOARD_T9WRITE_LOG
- DECUMA_API(StartLogging)(decumaSession, 0, decumaLogString);
-#endif
-
- worker.reset(new T9WriteWorker(decumaSession, cjk));
- worker->start();
-
- Q_Q(T9WriteInputMethod);
- processResultConnection = QObject::connect(q, &T9WriteInputMethod::resultListChanged, q, &T9WriteInputMethod::processResult, Qt::QueuedConnection);
-
- return true;
- }
-
- void exitEngine()
- {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::exitEngine()";
-
- if (processResultConnection)
- QObject::disconnect(processResultConnection);
-
- worker.reset();
-
- if (sessionSettings.pStaticDB) {
- hwrDbFile.unmap((uchar *)sessionSettings.pStaticDB);
- hwrDbFile.close();
- }
-
- if (attachedDictionary) {
- detachDictionary(attachedDictionary);
- attachedDictionary.reset();
- }
- loadedDictionary.reset();
-
- if (decumaSession) {
-#if QT_VIRTUALKEYBOARD_T9WRITE_LOG
- DECUMA_API(StopLogging)(decumaSession);
-#endif
- DECUMA_API(EndSession)(decumaSession);
- decumaSession = nullptr;
- session.clear();
- }
-
- memset(&sessionSettings, 0, sizeof(sessionSettings));
-
- symbolCategories.clear();
- languageCategories.clear();
-
- engineMode = T9WriteInputMethod::EngineMode::Uninitialized;
- cjk = false;
- }
-
- QString findHwrDb(T9WriteInputMethod::EngineMode mode, const QString &dir) const
- {
- QString hwrDbPath(dir);
- switch (mode) {
- case T9WriteInputMethod::EngineMode::Alphabetic:
-#if T9WRITEAPIMAJORVERNUM >= 21
- hwrDbPath.append(QLatin1String("hwrDB_le.bin"));
-#else
- hwrDbPath.append(QLatin1String("_databas_le.bin"));
-#endif
- break;
- case T9WriteInputMethod::EngineMode::Arabic:
-#if T9WRITEAPIMAJORVERNUM >= 21
- hwrDbPath.append(QLatin1String("arabic/hwrDB_le.bin"));
-#else
- hwrDbPath.append(QLatin1String("arabic/_databas_le.bin"));
-#endif
- break;
- case T9WriteInputMethod::EngineMode::Hebrew:
-#if T9WRITEAPIMAJORVERNUM >= 21
- hwrDbPath.append(QLatin1String("hebrew/hwrDB_le.bin"));
-#else
- hwrDbPath.append(QLatin1String("hebrew/_databas_le.bin"));
-#endif
- break;
- case T9WriteInputMethod::EngineMode::Thai:
-#if T9WRITEAPIMAJORVERNUM >= 21
- hwrDbPath.append(QLatin1String("thai/hwrDB_le.bin"));
-#else
- hwrDbPath.append(QLatin1String("thai/_databas_le.bin"));
-#endif
- break;
- case T9WriteInputMethod::EngineMode::SimplifiedChinese:
- hwrDbPath.append(QLatin1String("cjk_S_gb18030_le.hdb"));
- break;
- case T9WriteInputMethod::EngineMode::TraditionalChinese:
- hwrDbPath.append(QLatin1String("cjk_T_std_le.hdb"));
- break;
- case T9WriteInputMethod::EngineMode::HongKongChinese:
- hwrDbPath.append(QLatin1String("cjk_HK_std_le.hdb"));
- break;
- case T9WriteInputMethod::EngineMode::Japanese:
- hwrDbPath.append(QLatin1String("cjk_J_std_le.hdb"));
- break;
- case T9WriteInputMethod::EngineMode::Korean:
- hwrDbPath.append(QLatin1String("cjk_K_mkt_le.hdb"));
- break;
- default:
- return QString();
- }
- if (!QFileInfo::exists(hwrDbPath)) {
- qCCritical(lcT9Write) << "Could not find HWR database for" << engineModeToString(mode);
- return QString();
- }
- return hwrDbPath;
- }
-
- QString findDictionary(const QString &dir, const QLocale &locale, DECUMA_SRC_DICTIONARY_TYPE &srcType)
- {
- srcType = numberOfSrcDictionaryTypes;
-
- QStringList languageCountry = locale.name().split(QLatin1String("_"));
- if (languageCountry.length() != 2)
- return QString();
- const QString language = languageCountry[0].toUpper();
-
- QString dictionary;
- QDirIterator it(dir, QDirIterator::NoIteratorFlags);
- while (it.hasNext()) {
- QString fileEntry = it.next();
- const QFileInfo fileInfo(fileEntry);
-
- if (fileInfo.isDir())
- continue;
-
- const QString fileName(fileInfo.fileName());
- if (!fileName.startsWith(language) &&
- !fileName.startsWith(QLatin1String("zzEval_") + language))
- continue;
-
- if (fileEntry.endsWith(QLatin1String(".ldb"))) {
-#if T9WRITEAPIMAJORVERNUM >= 20
- qCCritical(lcT9Write) << "Incompatible dictionary" << fileEntry;
- continue;
-#else
- srcType = decumaXT9LDB;
-#endif
- } else if (fileEntry.endsWith(QLatin1String(".phd"))) {
-#if T9WRITEAPIMAJORVERNUM >= 20
- srcType = decumaPortableHWRDictionary;
-#else
- qCCritical(lcT9Write) << "Incompatible dictionary" << fileEntry;
- continue;
-#endif
- } else {
- qCCritical(lcT9Write) << "Incompatible dictionary" << fileEntry;
- continue;
- }
-
- dictionary = fileEntry;
- break;
- }
-
- return dictionary;
- }
-
- bool attachDictionary(const QSharedPointer<T9WriteDictionary> &dictionary)
- {
- const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
- Q_ASSERT(decumaSession != nullptr);
- Q_ASSERT(dictionary != nullptr);
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::attachDictionary():" << dictionary->fileName();
-#if T9WRITEAPIMAJORVERNUM >= 20
- DECUMA_STATUS status = DECUMA_API(AttachDictionary)(decumaSession, dictionary->data(), dictionary->size());
-#else
- DECUMA_STATUS status = DECUMA_API(AttachConvertedDictionary)(decumaSession, dictionary->data());
-#endif
- return status == decumaNoError;
- }
-
- void detachDictionary(const QSharedPointer<T9WriteDictionary> &dictionary)
- {
- const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
- if (!dictionary)
- return;
-
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::detachDictionary():" << dictionary->fileName();
-
- Q_ASSERT(decumaSession != nullptr);
- DECUMA_STATUS status = DECUMA_API(DetachDictionary)(decumaSession, dictionary->data());
- Q_UNUSED(status);
- Q_ASSERT(status == decumaNoError);
- }
-
- bool setInputMode(const QLocale &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
- {
- Q_Q(T9WriteInputMethod);
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::setInputMode():" << locale << inputMode;
-
- finishRecognition();
-
- DECUMA_UINT32 language = mapToDecumaLanguage(locale, inputMode);
- if (language == DECUMA_LANG_GSMDEFAULT) {
- qCCritical(lcT9Write) << "Language is not supported" << locale.name();
- return false;
- }
-
- if (!initEngine(mapLocaleToEngineMode(locale, language)))
- return false;
-
- int isLanguageSupported = 0;
- DECUMA_API(DatabaseIsLanguageSupported)(sessionSettings.pStaticDB, language, &isLanguageSupported);
- if (!isLanguageSupported) {
- qCCritical(lcT9Write) << "Language is not supported" << locale.name();
- return false;
- }
-
- bool languageChanged = languageCategories.isEmpty() || languageCategories.first() != language;
- languageCategories.clear();
- languageCategories.append(language);
-
- // Add English as secondary language for non-latin languages.
- // T9 Write requires it for punctuation and latin symbols if
- // included in the symbol categories.
- if (locale.script() != QLocale::LatinScript)
- languageCategories.append(DECUMA_LANG_EN);
-
- if (!updateSymbolCategories(language, locale, inputMode))
- return false;
- updateRecognitionMode(language, locale, inputMode);
- updateDictionary(language, locale, languageChanged);
- static const QList<DECUMA_UINT32> rtlLanguages = QList<DECUMA_UINT32>()
- << DECUMA_LANG_AR << DECUMA_LANG_IW << DECUMA_LANG_FA << DECUMA_LANG_UR;
- sessionSettings.writingDirection = rtlLanguages.contains(language) ? rightToLeft : leftToRight;
-
- // Enable multi-threaded recognition if available.
-#ifdef DECUMA_USE_MULTI_THREAD
- // Note: This feature requires T9 Write v8.0.0 or later,
- // and feature enabled in the SDK.
- sessionSettings.nMaxThreads = qMax(QThread::idealThreadCount(), 0);
-#endif
-
- qCDebug(lcT9Write) << " -> language categories:" << languageCategories;
- qCDebug(lcT9Write) << " -> symbol categories:" << symbolCategories;
- qCDebug(lcT9Write) << " -> recognition mode:" << sessionSettings.recognitionMode;
-
- // Change session settings
- sessionSettings.charSet.pSymbolCategories = symbolCategories.data();
- sessionSettings.charSet.nSymbolCategories = symbolCategories.size();
- sessionSettings.charSet.pLanguages = languageCategories.data();
- sessionSettings.charSet.nLanguages = languageCategories.size();
- DECUMA_STATUS status = DECUMA_API(ChangeSessionSettings)(decumaSession, &sessionSettings);
- Q_ASSERT(status == decumaNoError);
-
- caseFormatter.preferLowercase = q->inputContext()->inputMethodHints().testFlag(Qt::ImhPreferLowercase);
-
- return status == decumaNoError;
- }
-
- T9WriteInputMethod::EngineMode mapLocaleToEngineMode(const QLocale &locale, DECUMA_UINT32 language = 0)
- {
-#ifdef HAVE_T9WRITE_CJK
- switch (locale.language()) {
- case QLocale::Chinese: {
- if (locale.script() == QLocale::TraditionalChineseScript)
- return locale.country() == QLocale::HongKong ? T9WriteInputMethod::EngineMode::HongKongChinese : T9WriteInputMethod::EngineMode::TraditionalChinese;
- return T9WriteInputMethod::EngineMode::SimplifiedChinese;
- break;
- }
- case QLocale::Japanese:
- return T9WriteInputMethod::EngineMode::Japanese;
- break;
- case QLocale::Korean:
- return T9WriteInputMethod::EngineMode::Korean;
- default:
- break;
- }
-#else
- Q_UNUSED(locale);
- Q_UNUSED(language);
-#endif
-
-#ifdef HAVE_T9WRITE_ALPHABETIC
- switch (locale.script()) {
- case QLocale::ArabicScript:
- return T9WriteInputMethod::EngineMode::Arabic;
- case QLocale::HebrewScript:
- return T9WriteInputMethod::EngineMode::Hebrew;
- case QLocale::ThaiScript:
- return language == DECUMA_LANG_EN ? T9WriteInputMethod::EngineMode::Alphabetic
- : T9WriteInputMethod::EngineMode::Thai;
- default:
- return T9WriteInputMethod::EngineMode::Alphabetic;
- }
-#else
- return T9WriteInputMethod::EngineMode::Uninitialized;
-#endif
- }
-
- DECUMA_UINT32 mapToDecumaLanguage(const QLocale &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
- {
- static const QLocale::Language maxLanguage = QLocale::Vietnamese;
- static const DECUMA_UINT32 languageMap[maxLanguage + 1] = {
- DECUMA_LANG_GSMDEFAULT, // AnyLanguage = 0
- DECUMA_LANG_GSMDEFAULT, // C = 1
- DECUMA_LANG_GSMDEFAULT, // Abkhazian = 2
- DECUMA_LANG_GSMDEFAULT, // Oromo = 3
- DECUMA_LANG_GSMDEFAULT, // Afar = 4
- DECUMA_LANG_AF, // Afrikaans = 5
- DECUMA_LANG_SQ, // Albanian = 6
- DECUMA_LANG_GSMDEFAULT, // Amharic = 7
- DECUMA_LANG_AR, // Arabic = 8
- DECUMA_LANG_GSMDEFAULT, // Armenian = 9
- DECUMA_LANG_GSMDEFAULT, // Assamese = 10
- DECUMA_LANG_GSMDEFAULT, // Aymara = 11
- DECUMA_LANG_AZ, // Azerbaijani = 12
- DECUMA_LANG_GSMDEFAULT, // Bashkir = 13
- DECUMA_LANG_EU, // Basque = 14
- DECUMA_LANG_BN, // Bengali = 15
- DECUMA_LANG_GSMDEFAULT, // Dzongkha = 16
- DECUMA_LANG_GSMDEFAULT, // Bihari = 17
- DECUMA_LANG_GSMDEFAULT, // Bislama = 18
- DECUMA_LANG_GSMDEFAULT, // Breton = 19
- DECUMA_LANG_BG, // Bulgarian = 20
- DECUMA_LANG_GSMDEFAULT, // Burmese = 21
- DECUMA_LANG_BE, // Belarusian = 22
- DECUMA_LANG_KM, // Khmer = 23
- DECUMA_LANG_CA, // Catalan = 24
- DECUMA_LANG_PRC, // Chinese = 25
- DECUMA_LANG_GSMDEFAULT, // Corsican = 26
- DECUMA_LANG_HR, // Croatian = 27
- DECUMA_LANG_CS, // Czech = 28
- DECUMA_LANG_DA, // Danish = 29
- DECUMA_LANG_NL, // Dutch = 30
- DECUMA_LANG_EN, // English = 31
- DECUMA_LANG_GSMDEFAULT, // Esperanto = 32
- DECUMA_LANG_ET, // Estonian = 33
- DECUMA_LANG_GSMDEFAULT, // Faroese = 34
- DECUMA_LANG_GSMDEFAULT, // Fijian = 35
- DECUMA_LANG_FI, // Finnish = 36
- DECUMA_LANG_FR, // French = 37
- DECUMA_LANG_GSMDEFAULT, // WesternFrisian = 38
- DECUMA_LANG_GSMDEFAULT, // Gaelic = 39
- DECUMA_LANG_GL, // Galician = 40
- DECUMA_LANG_GSMDEFAULT, // Georgian = 41
- DECUMA_LANG_DE, // German = 42
- DECUMA_LANG_EL, // Greek = 43
- DECUMA_LANG_GSMDEFAULT, // Greenlandic = 44
- DECUMA_LANG_GSMDEFAULT, // Guarani = 45
- DECUMA_LANG_GU, // Gujarati = 46
- DECUMA_LANG_HA, // Hausa = 47
- DECUMA_LANG_IW, // Hebrew = 48
- DECUMA_LANG_HI, // Hindi = 49
- DECUMA_LANG_HU, // Hungarian = 50
- DECUMA_LANG_IS, // Icelandic = 51
- DECUMA_LANG_IN, // Indonesian = 52
- DECUMA_LANG_GSMDEFAULT, // Interlingua = 53
- DECUMA_LANG_GSMDEFAULT, // Interlingue = 54
- DECUMA_LANG_GSMDEFAULT, // Inuktitut = 55
- DECUMA_LANG_GSMDEFAULT, // Inupiak = 56
- DECUMA_LANG_GSMDEFAULT, // Irish = 57
- DECUMA_LANG_IT, // Italian = 58
- DECUMA_LANG_JP, // Japanese = 59
- DECUMA_LANG_GSMDEFAULT, // Javanese = 60
- DECUMA_LANG_KN, // Kannada = 61
- DECUMA_LANG_GSMDEFAULT, // Kashmiri = 62
- DECUMA_LANG_KK, // Kazakh = 63
- DECUMA_LANG_GSMDEFAULT, // Kinyarwanda = 64
- DECUMA_LANG_KY, // Kirghiz = 65
- DECUMA_LANG_KO, // Korean = 66
- DECUMA_LANG_GSMDEFAULT, // Kurdish = 67
- DECUMA_LANG_GSMDEFAULT, // Rundi = 68
- DECUMA_LANG_GSMDEFAULT, // Lao = 69
- DECUMA_LANG_GSMDEFAULT, // Latin = 70
- DECUMA_LANG_LV, // Latvian = 71
- DECUMA_LANG_GSMDEFAULT, // Lingala = 72
- DECUMA_LANG_LT, // Lithuanian = 73
- DECUMA_LANG_MK, // Macedonian = 74
- DECUMA_LANG_GSMDEFAULT, // Malagasy = 75
- DECUMA_LANG_MS, // Malay = 76
- DECUMA_LANG_ML, // Malayalam = 77
- DECUMA_LANG_GSMDEFAULT, // Maltese = 78
- DECUMA_LANG_GSMDEFAULT, // Maori = 79
- DECUMA_LANG_MR, // Marathi = 80
- DECUMA_LANG_GSMDEFAULT, // Marshallese = 81
- DECUMA_LANG_MN, // Mongolian = 82
- DECUMA_LANG_GSMDEFAULT, // NauruLanguage = 83
- DECUMA_LANG_GSMDEFAULT, // Nepali = 84
- DECUMA_LANG_NO, // NorwegianBokmal = 85
- DECUMA_LANG_GSMDEFAULT, // Occitan = 86
- DECUMA_LANG_GSMDEFAULT, // Oriya = 87
- DECUMA_LANG_GSMDEFAULT, // Pashto = 88
- DECUMA_LANG_FA, // Persian = 89
- DECUMA_LANG_PL, // Polish = 90
- DECUMA_LANG_PT, // Portuguese = 91
- DECUMA_LANG_PA, // Punjabi = 92
- DECUMA_LANG_GSMDEFAULT, // Quechua = 93
- DECUMA_LANG_GSMDEFAULT, // Romansh = 94
- DECUMA_LANG_RO, // Romanian = 95
- DECUMA_LANG_RU, // Russian = 96
- DECUMA_LANG_GSMDEFAULT, // Samoan = 97
- DECUMA_LANG_GSMDEFAULT, // Sango = 98
- DECUMA_LANG_GSMDEFAULT, // Sanskrit = 99
- DECUMA_LANG_SRCY, // Serbian = 100
- DECUMA_LANG_GSMDEFAULT, // Ossetic = 101
- DECUMA_LANG_ST, // SouthernSotho = 102
- DECUMA_LANG_GSMDEFAULT, // Tswana = 103
- DECUMA_LANG_GSMDEFAULT, // Shona = 104
- DECUMA_LANG_GSMDEFAULT, // Sindhi = 105
- DECUMA_LANG_SI, // Sinhala = 106
- DECUMA_LANG_GSMDEFAULT, // Swati = 107
- DECUMA_LANG_SK, // Slovak = 108
- DECUMA_LANG_SL, // Slovenian = 109
- DECUMA_LANG_GSMDEFAULT, // Somali = 110
- DECUMA_LANG_ES, // Spanish = 111
- DECUMA_LANG_GSMDEFAULT, // Sundanese = 112
- DECUMA_LANG_SW, // Swahili = 113
- DECUMA_LANG_SV, // Swedish = 114
- DECUMA_LANG_GSMDEFAULT, // Sardinian = 115
- DECUMA_LANG_TG, // Tajik = 116
- DECUMA_LANG_TA, // Tamil = 117
- DECUMA_LANG_GSMDEFAULT, // Tatar = 118
- DECUMA_LANG_TE, // Telugu = 119
- DECUMA_LANG_TH, // Thai = 120
- DECUMA_LANG_GSMDEFAULT, // Tibetan = 121
- DECUMA_LANG_GSMDEFAULT, // Tigrinya = 122
- DECUMA_LANG_GSMDEFAULT, // Tongan = 123
- DECUMA_LANG_GSMDEFAULT, // Tsonga = 124
- DECUMA_LANG_TR, // Turkish = 125
- DECUMA_LANG_GSMDEFAULT, // Turkmen = 126
- DECUMA_LANG_GSMDEFAULT, // Tahitian = 127
- DECUMA_LANG_GSMDEFAULT, // Uighur = 128
- DECUMA_LANG_UK, // Ukrainian = 129
- DECUMA_LANG_UR, // Urdu = 130
- DECUMA_LANG_UZ, // Uzbek = 131
- DECUMA_LANG_VI // Vietnamese = 132
- };
-
- int localeLanguage = locale.language();
- if (locale.language() > maxLanguage)
- return DECUMA_LANG_GSMDEFAULT;
-
- DECUMA_UINT32 language = languageMap[localeLanguage];
- if (language == DECUMA_LANG_PRC) {
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting)
- language = DECUMA_LANG_EN;
- else if (locale.script() == QLocale::TraditionalChineseScript)
- language = (locale.country() == QLocale::HongKong) ? DECUMA_LANG_HK : DECUMA_LANG_TW;
- } else if (language == DECUMA_LANG_JP) {
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting)
- language = DECUMA_LANG_EN;
- } else if (language == DECUMA_LANG_KO) {
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting)
- language = DECUMA_LANG_EN;
- } else if (language == DECUMA_LANG_SRCY) {
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::Cyrillic)
- language = DECUMA_LANG_SRLA;
- } else if (language == DECUMA_LANG_AR || language == DECUMA_LANG_FA) {
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::Arabic && inputMode != QVirtualKeyboardInputEngine::InputMode::Numeric)
- language = DECUMA_LANG_EN;
- } else if (language == DECUMA_LANG_IW) {
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::Hebrew)
- language = DECUMA_LANG_EN;
- } else if (language == DECUMA_LANG_TH) {
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::Thai)
- language = DECUMA_LANG_EN;
- }
-
- return language;
- }
-
- void updateRecognitionMode(DECUMA_UINT32 language, const QLocale &locale,
- QVirtualKeyboardInputEngine::InputMode inputMode)
- {
- Q_Q(T9WriteInputMethod);
- Q_UNUSED(language);
- Q_UNUSED(locale);
-
- // Select recognition mode
- // Note: MCR mode is preferred, as it does not require recognition
- // timer and provides better user experience.
- sessionSettings.recognitionMode = mcrMode;
-
- // T9 Write Alphabetic v8.0.0 supports UCR mode for specific languages
-#if T9WRITEAPIMAJORVERNUM >= 21
- if (!cjk) {
- switch (inputMode) {
- case QVirtualKeyboardInputEngine::InputMode::Latin:
- switch (language) {
- case DECUMA_LANG_EN:
- case DECUMA_LANG_FR:
- case DECUMA_LANG_IT:
- case DECUMA_LANG_DE:
- case DECUMA_LANG_ES:
- sessionSettings.recognitionMode = ucrMode;
- break;
- default:
- break;
- }
- break;
- case QVirtualKeyboardInputEngine::InputMode::Arabic:
- sessionSettings.recognitionMode = ucrMode;
- break;
- default:
- break;
- }
- }
-#endif
-
- // Use scrMode with hidden text or with no predictive mode
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
- const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
- if (inputMethodHints.testFlag(Qt::ImhHiddenText) || inputMethodHints.testFlag(Qt::ImhNoPredictiveText))
- sessionSettings.recognitionMode = scrMode;
- }
- }
-
- bool updateSymbolCategories(DECUMA_UINT32 language, const QLocale &locale,
- QVirtualKeyboardInputEngine::InputMode inputMode)
- {
- // Handle CJK in separate method
- if (cjk)
- return updateSymbolCategoriesCjk(language, locale, inputMode);
-
- symbolCategories.clear();
-
- // Choose the symbol categories by input mode, script and input method hints
- bool leftToRightGestures = true;
- Q_Q(T9WriteInputMethod);
- const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
- switch (inputMode) {
- case QVirtualKeyboardInputEngine::InputMode::Latin:
- if (inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly)) {
- symbolCategories.append(DECUMA_CATEGORY_EMAIL);
- } else if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly)) {
- symbolCategories.append(DECUMA_CATEGORY_URL);
- } else {
- if (language == DECUMA_LANG_EN || language == DECUMA_LANG_NL ||
- language == DECUMA_LANG_MS || language == DECUMA_LANG_IN)
- symbolCategories.append(DECUMA_CATEGORY_ANSI);
- else
- symbolCategories.append(DECUMA_CATEGORY_ISO8859_1);
- symbolCategories.append(DECUMA_CATEGORY_DIGIT);
- symbolCategories.append(DECUMA_CATEGORY_BASIC_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
- if (language == DECUMA_LANG_ES)
- symbolCategories.append(DECUMA_CATEGORY_SPANISH_PUNCTUATIONS);
- else if (language == DECUMA_LANG_VI)
- symbolCategories.append(DECUMA_CATEGORY_VIETNAMESE_SUPPLEMENTS);
- }
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Numeric:
- if (language == DECUMA_LANG_AR || language == DECUMA_LANG_FA) {
- symbolCategories.append(DECUMA_CATEGORY_ARABIC_NUM_MODE);
- symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES);
- leftToRightGestures = false;
- break;
- }
- symbolCategories.append(DECUMA_CATEGORY_DIGIT);
- if (!inputMethodHints.testFlag(Qt::ImhDigitsOnly))
- symbolCategories.append(DECUMA_CATEGORY_NUM_SUP);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Dialable:
- symbolCategories.append(DECUMA_CATEGORY_PHONE_NUMBER);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Greek:
- symbolCategories.append(DECUMA_CATEGORY_GREEK);
- symbolCategories.append(DECUMA_CATEGORY_QUEST_EXCL_MARK_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_PERIOD_COMMA_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_COLON_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
- symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Cyrillic:
- symbolCategories.append(DECUMA_CATEGORY_CYRILLIC);
- symbolCategories.append(DECUMA_CATEGORY_QUEST_EXCL_MARK_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_PERIOD_COMMA_PUNCTUATIONS);
- // Ukrainian needs contraction mark, but not Russian or Bulgarian
- if (language == DECUMA_LANG_UK)
- symbolCategories.append(DECUMA_CATEGORY_CONTRACTION_MARK);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Arabic:
- symbolCategories.append(DECUMA_CATEGORY_ARABIC_ISOLATED_LETTER_MODE);
- symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES);
- leftToRightGestures = false;
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Hebrew:
- symbolCategories.append(DECUMA_CATEGORY_HEBREW_GL_HEBREW_CURSIVE_MODE);
- symbolCategories.append(DECUMA_CATEGORY_HEBREW_GL_HEBREW_LETTERSYMBOLS);
- symbolCategories.append(DECUMA_CATEGORY_HEBREW_SHEQEL);
- symbolCategories.append(DECUMA_CATEGORY_ARABIC_GESTURES);
- leftToRightGestures = false;
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Thai:
- symbolCategories.append(DECUMA_CATEGORY_THAI_BASE);
- symbolCategories.append(DECUMA_CATEGORY_THAI_NON_BASE);
- break;
-
- default:
- qCCritical(lcT9Write) << "Invalid input mode" << inputMode;
- return false;
- }
-
- if (leftToRightGestures) {
- symbolCategories.append(DECUMA_CATEGORY_BACKSPACE_STROKE);
- symbolCategories.append(DECUMA_CATEGORY_RETURN_STROKE);
- symbolCategories.append(DECUMA_CATEGORY_WHITESPACE_STROKE);
- }
-
- return true;
- }
-
- bool updateSymbolCategoriesCjk(DECUMA_UINT32 language, const QLocale &locale,
- QVirtualKeyboardInputEngine::InputMode inputMode)
- {
- Q_ASSERT(cjk);
-
- symbolCategories.clear();
-
- switch (inputMode) {
- case QVirtualKeyboardInputEngine::InputMode::Latin:
- symbolCategories.append(DECUMA_CATEGORY_ANSI);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Numeric:
- symbolCategories.append(DECUMA_CATEGORY_DIGIT);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::Dialable:
- symbolCategories.append(DECUMA_CATEGORY_DIGIT);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting:
- switch (locale.script()) {
- case QLocale::SimplifiedChineseScript:
- symbolCategories.append(DECUMA_CATEGORY_GB2312_A);
- symbolCategories.append(DECUMA_CATEGORY_GB2312_B_CHARS_ONLY);
- symbolCategories.append(DECUMA_CATEGORY_GBK_3);
- symbolCategories.append(DECUMA_CATEGORY_GBK_4);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- case QLocale::TraditionalChineseScript:
- symbolCategories.append(DECUMA_CATEGORY_BIGFIVE);
- if (language == DECUMA_LANG_HK)
- symbolCategories.append(DECUMA_CATEGORY_HKSCS_CHARS_ONLY);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- default:
- qCCritical(lcT9Write) << "Invalid locale" << locale << "for" << engineModeToString(engineMode);
- return false;
- }
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting:
- symbolCategories.append(DECUMA_CATEGORY_JIS_LEVEL_1);
- symbolCategories.append(DECUMA_CATEGORY_JIS_LEVEL_2);
- symbolCategories.append(DECUMA_CATEGORY_HIRAGANA);
- symbolCategories.append(DECUMA_CATEGORY_KATAKANA);
- symbolCategories.append(DECUMA_CATEGORY_HIRAGANASMALL);
- symbolCategories.append(DECUMA_CATEGORY_KATAKANASMALL);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- case QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting:
- symbolCategories.append(DECUMA_CATEGORY_HANGUL_1001_A);
- symbolCategories.append(DECUMA_CATEGORY_HANGUL_1001_B);
- symbolCategories.append(DECUMA_CATEGORY_CJK_SYMBOL);
- symbolCategories.append(DECUMA_CATEGORY_CJK_GENERAL_PUNCTUATIONS);
- symbolCategories.append(DECUMA_CATEGORY_PUNCTUATIONS);
- break;
-
- default:
- return false;
- }
-
- return true;
- }
-
- void updateDictionary(DECUMA_UINT32 language, const QLocale &locale, bool languageChanged)
- {
- Q_Q(T9WriteInputMethod);
-
- /* The dictionary is loaded in the background thread. Once the loading is
- complete the dictionary will be attached to the current session. The
- attachment happens in the worker thread context, thus the direct
- connection for the signal handler and the mutex protecting the
- converted dictionary for concurrent access.
- The loading operation is blocking for the main thread only if the
- user starts handwriting input before the operation is complete.
- */
- const std::lock_guard<QRecursiveMutex> dictionaryGuard(dictionaryLock);
-
- // Detach previous dictionary if the language is being changed
- // or the recognizer mode is single-character mode
- const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
- if ((languageChanged || inputMethodHints.testFlag(Qt::ImhNoPredictiveText) || sessionSettings.recognitionMode == scrMode) && attachedDictionary) {
- detachDictionary(attachedDictionary);
- attachedDictionary.reset();
- }
-
- // Check if a dictionary needs to be loaded
- if (languageChanged || !loadedDictionary) {
- loadedDictionary.reset();
-
- DECUMA_SRC_DICTIONARY_INFO dictionaryInfo;
- memset(&dictionaryInfo, 0, sizeof(dictionaryInfo));
-
- QList<QLocale> decumaLocales;
- decumaLocales.append(locale);
-
- // CJK: No dictionary for latin input
- if (cjk && language == DECUMA_LANG_EN)
- decumaLocales.clear();
-
- dictionaryFileName.clear();
- QLocale decumaLocale;
- for (QLocale tryLocale : decumaLocales) {
- dictionaryFileName = findDictionary(defaultDictionaryDbPath, tryLocale, dictionaryInfo.srcType);
- if (!dictionaryFileName.isEmpty()) {
- decumaLocale = tryLocale;
- break;
- }
- }
- if (!dictionaryFileName.isEmpty()) {
- if (dictionaryTask.isNull() || dictionaryTask->dictionaryFileName != dictionaryFileName) {
- qCDebug(lcT9Write) << " -> load dictionary:" << dictionaryFileName;
-
- bool convertDictionary = true;
-#if defined(HAVE_T9WRITE_CJK) && T9WRITEAPIMAJORVERNUM >= 20
- // Chinese dictionary cannot be converted (PHD)
- if (dictionaryInfo.srcType == decumaPortableHWRDictionary && decumaLocale.language() == QLocale::Chinese)
- convertDictionary = false;
-#endif
-
- QSharedPointer<T9WriteDictionary> newDictionary(new T9WriteDictionary(decumaSession, memFuncs, cjk));
- dictionaryTask.reset(new T9WriteDictionaryTask(newDictionary, dictionaryFileName, convertDictionary, dictionaryInfo));
-
- QObject::connect(dictionaryTask.data(), &T9WriteDictionaryTask::completed,
- q, &T9WriteInputMethod::dictionaryLoadCompleted, Qt::DirectConnection);
- worker->addTask(dictionaryTask);
- }
- }
- }
-
- // Attach existing dictionary, if available
- if (sessionSettings.recognitionMode != scrMode && !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) &&
- loadedDictionary && !attachedDictionary) {
- if (attachDictionary(loadedDictionary))
- attachedDictionary = loadedDictionary;
- }
- }
-
- QByteArray getContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo,
- const QVariantMap &traceScreenInfo) const
- {
- QCryptographicHash hash(QCryptographicHash::Md5);
-
- hash.addData((const char *)&patternRecognitionMode, sizeof(patternRecognitionMode));
-
- QByteArray mapData;
- QDataStream ds(&mapData, QIODevice::WriteOnly);
- ds << traceCaptureDeviceInfo;
- ds << traceScreenInfo;
- hash.addData(mapData);
-
- return hash.result();
- }
-
- void setContext(QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo,
- const QVariantMap &traceScreenInfo,
- const QByteArray &context)
- {
- Q_UNUSED(patternRecognitionMode);
- if (context == currentContext)
- return;
- currentContext = context;
-
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::setContext():" << QLatin1String((context.toHex()));
-
- // Finish recognition, but preserve current input
- Q_Q(T9WriteInputMethod);
- QString preeditText = q->inputContext()->preeditText();
- // WA: T9Write CJK may crash in some cases with long stringStart.
- // Therefore we don't restore the current input in this mode.
- bool preserveCurrentInput = !preeditText.isEmpty() && !cjk;
- T9WriteCaseFormatter oldCaseFormatter(caseFormatter);
- finishRecognition(!preserveCurrentInput);
-
- if (preserveCurrentInput) {
- caseFormatter = oldCaseFormatter;
- stringStart = preeditText;
- wordCandidates.append(preeditText);
- activeWordIndex = 0;
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
- }
-
- const int dpi = traceCaptureDeviceInfo.value(QLatin1String("dpi"), 96).toInt();
- static const int INSTANT_GESTURE_WIDTH_THRESHOLD_MM = 25;
- static const int INSTANT_GESTURE_HEIGHT_THRESHOLD_MM = 25;
- instantGestureSettings.widthThreshold = INSTANT_GESTURE_WIDTH_THRESHOLD_MM / 25.4 * dpi;
- instantGestureSettings.heightThreshold = INSTANT_GESTURE_HEIGHT_THRESHOLD_MM / 25.4 * dpi;
-
- gestureRecognizer.setDpi(dpi);
-
- QVariantList horizontalRulers(traceScreenInfo.value(QLatin1String("horizontalRulers"), QVariantList()).toList());
- if (horizontalRulers.count() > 2) {
- sessionSettings.baseline = horizontalRulers.last().toInt();
- sessionSettings.helpline = 0;
- sessionSettings.topline = horizontalRulers.first().toInt();
- sessionSettings.supportLineSet = baselineAndTopline;
- sessionSettings.UIInputGuide = supportlines;
- } else if (horizontalRulers.count() == 2) {
- sessionSettings.baseline = horizontalRulers.last().toInt();
- sessionSettings.helpline = horizontalRulers.first().toInt();
- sessionSettings.topline = 0;
- sessionSettings.supportLineSet = baselineAndHelpline;
- sessionSettings.UIInputGuide = supportlines;
- } else {
- sessionSettings.baseline = 0;
- sessionSettings.helpline = 0;
- sessionSettings.topline = 0;
- sessionSettings.supportLineSet = baselineAndHelpline;
- sessionSettings.UIInputGuide = none;
- }
-
- DECUMA_STATUS status = DECUMA_API(ChangeSessionSettings)(decumaSession, &sessionSettings);
- Q_ASSERT(status == decumaNoError);
- }
-
- QVirtualKeyboardTrace *traceBegin(
- int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
- {
- if (!worker)
- return nullptr;
-
- // The result id follows the trace id so that the (previous)
- // results completed during the handwriting can be rejected.
- resultId = traceId;
-
- stopResultTimer();
-
- // Dictionary must be completed before the arc addition can begin
- if (dictionaryTask) {
- dictionaryTask->wait();
- dictionaryTask.reset();
- }
-
- // Cancel the current recognition task
- worker->removeAllTasks<T9WriteRecognitionResultsTask>();
- worker->removeAllTasks<T9WriteRecognitionTask>();
- if (recognitionTask) {
- recognitionTask->cancelRecognition();
- recognitionTask.reset();
- }
-
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- if (!unipenTrace)
- unipenTrace.reset(new UnipenTrace(traceCaptureDeviceInfo, traceScreenInfo));
-#endif
-
- QByteArray context = getContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
- if (context != currentContext) {
- worker->waitForAllTasks();
- setContext(patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo, context);
- }
-
- DECUMA_STATUS status;
-
- if (!arcAdditionStarted) {
- worker->waitForAllTasks();
- status = DECUMA_API(BeginArcAddition)(decumaSession);
- Q_ASSERT(status == decumaNoError);
- arcAdditionStarted = true;
- }
-
- QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace();
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- trace->setChannels(QStringList(QLatin1String("t")));
-#endif
- traceList.append(trace);
-
- return trace;
- }
-
- void traceEnd(QVirtualKeyboardTrace *trace)
- {
- if (trace->isCanceled()) {
- traceList.removeOne(trace);
- delete trace;
- } else {
- if (cjk && countActiveTraces() == 0) {
- // For some reason gestures don't seem to work in CJK mode
- // Using our own gesture recognizer as fallback
- if (handleGesture())
- return;
- }
- worker->addTask(QSharedPointer<T9WriteAddArcTask>(new T9WriteAddArcTask(trace)));
- }
- if (!traceList.isEmpty()) {
- Q_ASSERT(arcAdditionStarted);
- if (countActiveTraces() == 0)
- restartRecognition();
- }
- }
-
- int countActiveTraces() const
- {
- int count = 0;
- for (QVirtualKeyboardTrace *trace : qAsConst(traceList)) {
- if (!trace->isFinal())
- count++;
- }
- return count;
- }
-
- void clearTraces()
- {
- worker->waitForAllTasks();
- qDeleteAll(traceList);
- traceList.clear();
- }
-
- void noteSelected(int index)
- {
- if (wordCandidatesHwrResultIndex.isEmpty())
- return;
-
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::noteSelected():" << index;
- Q_ASSERT(index >= 0 && index < wordCandidatesHwrResultIndex.length());
- int resultIndex = wordCandidatesHwrResultIndex[index];
- DECUMA_API(NoteSelectedCandidate)(decumaSession, resultIndex);
- }
-
- void restartRecognition()
- {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::restartRecognition()";
-
- Q_Q(T9WriteInputMethod);
-
- worker->removeAllTasks<T9WriteRecognitionResultsTask>();
- if (recognitionTask) {
- recognitionTask->cancelRecognition();
- recognitionTask.reset();
- }
-
- // Boost dictionary words by default
- BOOST_LEVEL boostLevel = attachedDictionary ? boostDictWords : noBoost;
-
- // Disable dictionary boost in UCR mode for URL and E-mail input
- // Otherwise it will completely mess input
- const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints();
- if (sessionSettings.recognitionMode == ucrMode && (inputMethodHints & (Qt::ImhUrlCharactersOnly | Qt::ImhEmailCharactersOnly)))
- boostLevel = noBoost;
-
- QSharedPointer<T9WriteRecognitionResult> recognitionResult(new T9WriteRecognitionResult(resultId, 9, 64));
- recognitionTask.reset(new T9WriteRecognitionTask(recognitionResult, instantGestureSettings,
- boostLevel, stringStart));
- worker->addTask(recognitionTask);
-
- QSharedPointer<T9WriteRecognitionResultsTask> resultsTask(new T9WriteRecognitionResultsTask(recognitionResult));
- q->connect(resultsTask.data(), SIGNAL(resultsAvailable(const QVariantList &)), SLOT(resultsAvailable(const QVariantList &)));
- worker->addTask(resultsTask);
-
- resetResultTimer();
- }
-
- void waitForRecognitionResults()
- {
- if (!worker)
- return;
-
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::waitForRecognitionResults()";
- worker->waitForAllTasks();
- processResult();
- }
-
- bool finishRecognition(bool emitSelectionListChanged = true)
- {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::finishRecognition()";
- if (!worker)
- return false;
-
- bool result = !traceList.isEmpty();
-
- Q_ASSERT(decumaSession != nullptr);
-
- stopResultTimer();
-
- worker->removeAllTasks<T9WriteAddArcTask>();
- worker->removeAllTasks<T9WriteRecognitionResultsTask>();
- if (recognitionTask) {
- recognitionTask->cancelRecognition();
- recognitionTask.reset();
- result = true;
- }
-
- clearTraces();
-
- if (arcAdditionStarted) {
- DECUMA_API(EndArcAddition)(decumaSession);
- arcAdditionStarted = false;
- }
-
- if (!wordCandidates.isEmpty()) {
- wordCandidates.clear();
- wordCandidatesHwrResultIndex.clear();
- activeWordIndex = -1;
- if (emitSelectionListChanged) {
- Q_Q(T9WriteInputMethod);
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
- }
- result = true;
- }
-
- stringStart.clear();
- scrResult.clear();
- caseFormatter.clear();
-
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- unipenTrace.reset();
-#endif
-
- return result;
- }
-
- bool select(int index = -1)
- {
- if (!worker)
- return false;
-
- if (sessionSettings.recognitionMode != scrMode && wordCandidates.isEmpty()) {
- finishRecognition();
- return false;
- }
- if (sessionSettings.recognitionMode == scrMode && scrResult.isEmpty()) {
- finishRecognition();
- return false;
- }
-
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::select():" << index;
-
- Q_Q(T9WriteInputMethod);
- if (sessionSettings.recognitionMode != scrMode) {
- index = index >= 0 ? index : activeWordIndex;
- noteSelected(index);
- QString finalWord = wordCandidates.at(index);
-
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- // Record trace
- if (unipenTrace) {
- if (finalWord.length() == 1) {
- // In recording mode, the text case must match with the current text case
- QChar ch(finalWord.at(0));
- if (!ch.isLetter() || (ch.isUpper() == (textCase == QVirtualKeyboardInputEngine::TextCase::Upper))) {
- QStringList homeLocations = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
- if (!homeLocations.isEmpty()) {
- unipenTrace->setDirectory(QStringLiteral("%1/%2").arg(homeLocations.at(0)).arg(QLatin1String("VIRTUAL_KEYBOARD_TRACES")));
- unipenTrace->record(traceList);
- unipenTrace->save(ch.unicode(), 100);
- }
- }
- }
- }
-#endif
-
- finishRecognition();
- QChar gesture = T9WriteInputMethodPrivate::mapSymbolToGesture(finalWord.right(1).at(0));
- if (!gesture.isNull())
- finalWord.chop(1);
- q->inputContext()->commit(finalWord);
- applyGesture(gesture);
- } else if (sessionSettings.recognitionMode == scrMode) {
- QString finalWord = scrResult;
- finishRecognition();
- q->inputContext()->inputEngine()->virtualKeyClick((Qt::Key)finalWord.at(0).unicode(), finalWord, Qt::NoModifier);
- }
-
- return true;
- }
-
- void resetResultTimer(int interval = 500)
- {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::resetResultTimer():" << interval;
- Q_Q(T9WriteInputMethod);
- stopResultTimer();
- resultTimer = q->startTimer(interval);
- }
-
- void stopResultTimer()
- {
- if (resultTimer) {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::stopResultTimer()";
- Q_Q(T9WriteInputMethod);
- q->killTimer(resultTimer);
- resultTimer = 0;
- }
- }
-
- void processResult()
- {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult()";
- Q_Q(T9WriteInputMethod);
- QVirtualKeyboardInputContext *ic = q->inputContext();
- if (!ic)
- return;
-
- QStringList newWordCandidates;
- QList<int> newWordCandidatesHwrResultIndex;
- QString resultString;
- QString gesture;
- QVariantList symbolStrokes;
- {
- QMutexLocker resultListGuard(&resultListLock);
- if (resultList.isEmpty())
- return;
-
- if (resultList.first().toMap()[QLatin1String("resultId")] != resultId) {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult(): resultId mismatch" << resultList.first().toMap()[QLatin1String("resultId")] << "(" << resultId << ")";
- resultList.clear();
- return;
- }
- lastResultId = resultId;
-
- for (int i = 0; i < resultList.size(); i++) {
- QVariantMap result = resultList.at(i).toMap();
- QString resultChars = result[QLatin1String("chars")].toString();
- if (i == 0) {
- if (ic->isShiftActive()) {
- caseFormatter.ensureLength(1, textCase);
- caseFormatter.ensureLength(resultChars.length(), QVirtualKeyboardInputEngine::TextCase::Lower);
- } else {
- caseFormatter.ensureLength(resultChars.length(), textCase);
- }
- }
- if (!resultChars.isEmpty()) {
- resultChars = caseFormatter.formatString(resultChars);
- if (sessionSettings.recognitionMode != scrMode) {
- newWordCandidates.append(resultChars);
- newWordCandidatesHwrResultIndex.append(i);
- }
- }
- if (i == 0) {
- resultString = resultChars;
- if (result.contains(QLatin1String("gesture")))
- gesture = result[QLatin1String("gesture")].toString();
- if (sessionSettings.recognitionMode != scrMode && result.contains(QLatin1String("symbolStrokes")))
- symbolStrokes = result[QLatin1String("symbolStrokes")].toList();
- if (sessionSettings.recognitionMode == scrMode)
- break;
- } else {
- // Add a gesture symbol to the secondary candidate
- if (sessionSettings.recognitionMode != scrMode && result.contains(QLatin1String("gesture"))) {
- QString gesture2 = result[QLatin1String("gesture")].toString();
- if (gesture2.length() == 1) {
- QChar symbol = T9WriteInputMethodPrivate::mapGestureToSymbol(gesture2.at(0).unicode());
- if (!symbol.isNull()) {
- // Check for duplicates
- bool duplicateFound = false;
- for (const QString &wordCandidate : newWordCandidates) {
- duplicateFound = wordCandidate.size() == 1 && wordCandidate.at(0) == symbol;
- if (duplicateFound)
- break;
- }
- if (!duplicateFound) {
- if (!resultChars.isEmpty()) {
- newWordCandidates.last().append(symbol);
- } else {
- newWordCandidates.append(symbol);
- newWordCandidatesHwrResultIndex.append(i);
- }
- }
- }
- }
- }
- }
- }
-
- resultList.clear();
- }
-
- bool wordCandidatesChanged = wordCandidates != newWordCandidates;
-
-#ifndef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- // Delete trace history
- // Note: We have to be sure there are no background tasks
- // running since the QVirtualKeyboardTrace objects consumed there.
- if (worker->numberOfPendingTasks() == 0) {
-
- const QVirtualKeyboardInputEngine::InputMode inputMode = q->inputEngine()->inputMode();
- if (sessionSettings.recognitionMode == mcrMode && !symbolStrokes.isEmpty() &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
- int activeTraces = symbolStrokes.at(symbolStrokes.count() - 1).toInt();
- if (symbolStrokes.count() > 1)
- activeTraces += symbolStrokes.at(symbolStrokes.count() - 2).toInt();
- while (activeTraces < traceList.count())
- delete traceList.takeFirst();
- }
-
- // Enforce hard limit for number of traces
- if (traceList.count() >= traceListHardLimit) {
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::processResult(): Clearing traces (hard limit):" << traceList.count();
- clearTraces();
- }
- }
-#endif
-
- // Find a gesture at the end of the first result
- if (!gesture.isEmpty()) {
-
- DECUMA_UNICODE gestureSymbol = gesture.at(0).unicode();
- if (!applyGesture(gestureSymbol)) {
- ic->commit(ic->preeditText());
- finishRecognition();
- }
-
- return;
- }
-
- if (sessionSettings.recognitionMode != scrMode) {
- ignoreUpdate = true;
- ic->setPreeditText(resultString);
- ignoreUpdate = false;
- } else {
- scrResult = resultString;
- }
-
- if (wordCandidatesChanged) {
- wordCandidates = newWordCandidates;
- wordCandidatesHwrResultIndex = newWordCandidatesHwrResultIndex;
- activeWordIndex = wordCandidates.isEmpty() ? -1 : 0;
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, activeWordIndex);
- }
-
- if (arcAdditionStarted && traceList.isEmpty() && worker->numberOfPendingTasks() == 0) {
- DECUMA_API(EndArcAddition)(decumaSession);
- arcAdditionStarted = false;
- }
- }
-
- static QChar mapGestureToSymbol(const QChar &gesture)
- {
- switch (gesture.unicode()) {
- case '\r':
- return QChar(0x23CE);
- case ' ':
- return QChar(0x2423);
- default:
- return QChar();
- }
- }
-
- static QChar mapSymbolToGesture(const QChar &symbol)
- {
- switch (symbol.unicode()) {
- case 0x23CE:
- return QLatin1Char('\r');
- case 0x2423:
- return QLatin1Char(' ');
- default:
- return QChar();
- }
- }
-
- bool applyGesture(const QChar &gesture)
- {
- Q_Q(T9WriteInputMethod);
- QVirtualKeyboardInputContext *ic = q->inputContext();
- switch (gesture.unicode()) {
- case '\b':
- return ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
- case '\r':
- return ic->inputEngine()->virtualKeyClick(Qt::Key_Return, QLatin1String("\n"), Qt::NoModifier);
- case ' ':
- return ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
- default:
- return false;
- }
- }
-
- bool handleGesture()
- {
- if (countActiveTraces() > 0)
- return false;
-
- QVariantMap gesture(gestureRecognizer.recognize(traceList.mid(traceList.length() - 1, 1)));
- if (gesture.isEmpty())
- return false;
-
- qCDebug(lcT9Write) << "T9WriteInputMethodPrivate::handleGesture():" << gesture;
-
- if (gesture[QLatin1String("type")].toString() == QLatin1String("swipe")) {
-
- static const int SWIPE_ANGLE_THRESHOLD = 15; // degrees +-
-
- qreal swipeLength = gesture[QLatin1String("length")].toReal();
- if (swipeLength >= instantGestureSettings.widthThreshold) {
-
- Q_Q(T9WriteInputMethod);
- QVirtualKeyboardInputContext *ic = q->inputContext();
- if (!ic)
- return false;
-
- qreal swipeAngle = gesture[QLatin1String("angle_degrees")].toReal();
- int swipeTouchCount = gesture[QLatin1String("touch_count")].toInt();
-
- // Swipe left
- if (swipeAngle <= 180 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 180 - SWIPE_ANGLE_THRESHOLD) {
- if (swipeTouchCount == 1) {
- // Single swipe: backspace
- ic->inputEngine()->virtualKeyClick(Qt::Key_Backspace, QString(), Qt::NoModifier);
- return true;
- }
- return false;
- }
-
- // Swipe right
- const QVirtualKeyboardInputEngine::InputMode inputMode = q->inputEngine()->inputMode();
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
- if (swipeAngle <= SWIPE_ANGLE_THRESHOLD || swipeAngle >= 360 - SWIPE_ANGLE_THRESHOLD) {
- if (swipeTouchCount == 1) {
- // Single swipe: space
- ic->inputEngine()->virtualKeyClick(Qt::Key_Space, QLatin1String(" "), Qt::NoModifier);
- return true;
- }
- return false;
- }
- }
-
- // Swipe up
- if (swipeAngle <= 270 + SWIPE_ANGLE_THRESHOLD && swipeAngle >= 270 - SWIPE_ANGLE_THRESHOLD) {
- if (swipeTouchCount == 1) {
- // Single swipe: toggle input mode
- select();
- if (!(ic->inputMethodHints() & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly))) {
- QList<int> inputModes = ic->inputEngine()->inputModes();
- // Filter out duplicate numeric mode (in favor of Numeric)
- int indexOfNumericInputMode = inputModes.indexOf(static_cast<const int>(QVirtualKeyboardInputEngine::InputMode::Numeric));
- int indexOfDialableInputMode = inputModes.indexOf(static_cast<const int>(QVirtualKeyboardInputEngine::InputMode::Dialable));
- if (indexOfNumericInputMode != -1 && indexOfDialableInputMode != -1)
- inputModes.removeAt(inputMode != QVirtualKeyboardInputEngine::InputMode::Dialable ?
- indexOfDialableInputMode :
- indexOfNumericInputMode);
- if (inputModes.count() > 1) {
- int inputModeIndex = inputModes.indexOf(static_cast<const int>(inputMode)) + 1;
- if (inputModeIndex >= inputModes.count())
- inputModeIndex = 0;
- ic->inputEngine()->setInputMode(static_cast<QVirtualKeyboardInputEngine::InputMode>(inputModes.at(inputModeIndex)));
- }
- }
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- bool isValidInputChar(const QChar &c) const
- {
- if (c.isLetterOrNumber())
- return true;
- if (isJoiner(c))
- return true;
- return false;
- }
-
- bool isJoiner(const QChar &c) const
- {
- if (c.isPunct() || c.isSymbol()) {
- Q_Q(const T9WriteInputMethod);
- QVirtualKeyboardInputContext *ic = q->inputContext();
- if (ic) {
- Qt::InputMethodHints inputMethodHints = ic->inputMethodHints();
- if (inputMethodHints.testFlag(Qt::ImhUrlCharactersOnly) || inputMethodHints.testFlag(Qt::ImhEmailCharactersOnly))
- return QString(QStringLiteral(":/?#[]@!$&'()*+,;=-_.%")).contains(c);
- }
- ushort unicode = c.unicode();
- if (unicode == Qt::Key_Apostrophe || unicode == Qt::Key_Minus)
- return true;
- }
- return false;
- }
-
- T9WriteInputMethod *q_ptr;
- static const DECUMA_MEM_FUNCTIONS memFuncs;
- bool cjk;
- T9WriteInputMethod::EngineMode engineMode;
- QByteArray currentContext;
- DECUMA_SESSION_SETTINGS sessionSettings;
- DECUMA_INSTANT_GESTURE_SETTINGS instantGestureSettings;
- QString defaultHwrDbPath;
- QString defaultDictionaryDbPath;
- QFile hwrDbFile;
- QList<DECUMA_UINT32> languageCategories;
- QList<DECUMA_UINT32> symbolCategories;
- QScopedPointer<T9WriteWorker> worker;
- QList<QVirtualKeyboardTrace *> traceList;
- int traceListHardLimit;
- QRecursiveMutex dictionaryLock;
- QString dictionaryFileName;
- QSharedPointer<T9WriteDictionary> loadedDictionary;
- QSharedPointer<T9WriteDictionary> attachedDictionary;
- QSharedPointer<T9WriteDictionaryTask> dictionaryTask;
- QSharedPointer<T9WriteRecognitionTask> recognitionTask;
- QMutex resultListLock;
- QVariantList resultList;
- int resultId;
- int lastResultId;
- int resultTimer;
- QMetaObject::Connection processResultConnection;
- QByteArray session;
- DECUMA_SESSION *decumaSession;
- QStringList wordCandidates;
- QList<int> wordCandidatesHwrResultIndex;
- QString stringStart;
- QString scrResult;
- int activeWordIndex;
- bool arcAdditionStarted;
- bool ignoreUpdate;
- QVirtualKeyboardInputEngine::TextCase textCase;
- T9WriteCaseFormatter caseFormatter;
- HandwritingGestureRecognizer gestureRecognizer;
-#ifdef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- QScopedPointer<UnipenTrace> unipenTrace;
-#endif
-};
-
-const DECUMA_MEM_FUNCTIONS T9WriteInputMethodPrivate::memFuncs = {
- T9WriteInputMethodPrivate::decumaMalloc,
- T9WriteInputMethodPrivate::decumaCalloc,
- T9WriteInputMethodPrivate::decumaFree,
- nullptr
-};
-
-/*!
- \class QtVirtualKeyboard::T9WriteInputMethod
- \internal
-*/
-
-T9WriteInputMethod::T9WriteInputMethod(QObject *parent) :
- QVirtualKeyboardAbstractInputMethod(parent),
- d_ptr(new T9WriteInputMethodPrivate(this))
-{
-}
-
-T9WriteInputMethod::~T9WriteInputMethod()
-{
- Q_D(T9WriteInputMethod);
- d->exitEngine();
-}
-
-QList<QVirtualKeyboardInputEngine::InputMode> T9WriteInputMethod::inputModes(const QString &locale)
-{
- Q_D(T9WriteInputMethod);
- QList<QVirtualKeyboardInputEngine::InputMode> availableInputModes;
- const Qt::InputMethodHints inputMethodHints(inputContext()->inputMethodHints());
- const QLocale loc(locale);
- T9WriteInputMethod::EngineMode mode = d->mapLocaleToEngineMode(loc);
-
- // Add primary input mode
- switch (mode) {
-#ifdef HAVE_T9WRITE_ALPHABETIC
- case T9WriteInputMethod::EngineMode::Alphabetic:
- if (d->findHwrDb(T9WriteInputMethod::EngineMode::Alphabetic, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly))) {
- switch (loc.script()) {
- case QLocale::GreekScript:
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Greek);
- break;
- case QLocale::CyrillicScript:
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Cyrillic);
- break;
- case QLocale::ThaiScript:
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Thai);
- break;
- default:
- break;
- }
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Latin);
- }
- break;
- case T9WriteInputMethod::EngineMode::Arabic:
- if (d->findHwrDb(T9WriteInputMethod::EngineMode::Arabic, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Arabic);
- break;
- case T9WriteInputMethod::EngineMode::Hebrew:
- if (d->findHwrDb(T9WriteInputMethod::EngineMode::Hebrew, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Hebrew);
- break;
- case T9WriteInputMethod::EngineMode::Thai:
- if (d->findHwrDb(T9WriteInputMethod::EngineMode::Thai, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Thai);
- break;
-#endif
-#ifdef HAVE_T9WRITE_CJK
- case T9WriteInputMethod::EngineMode::SimplifiedChinese:
- case T9WriteInputMethod::EngineMode::TraditionalChinese:
- case T9WriteInputMethod::EngineMode::HongKongChinese:
- if (d->findHwrDb(mode, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting);
- break;
- case T9WriteInputMethod::EngineMode::Japanese:
- if (d->findHwrDb(T9WriteInputMethod::EngineMode::Japanese, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting);
- break;
- case T9WriteInputMethod::EngineMode::Korean:
- if (d->findHwrDb(T9WriteInputMethod::EngineMode::Korean, d->defaultHwrDbPath).isEmpty())
- return availableInputModes;
- if (!(inputMethodHints & (Qt::ImhDialableCharactersOnly | Qt::ImhFormattedNumbersOnly | Qt::ImhDigitsOnly | Qt::ImhLatinOnly)))
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting);
- break;
-#endif
- default:
- return availableInputModes;
- }
-
- // Add exclusive input modes
- if (inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly) || inputMethodHints.testFlag(Qt::ImhDigitsOnly)) {
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Dialable);
- } else if (inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly)) {
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
- } else if (inputMethodHints.testFlag(Qt::ImhLatinOnly)) {
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Latin);
- } else {
- // Add other input modes
- Q_ASSERT(!availableInputModes.isEmpty());
- if (!availableInputModes.contains(QVirtualKeyboardInputEngine::InputMode::Latin))
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Latin);
- availableInputModes.append(QVirtualKeyboardInputEngine::InputMode::Numeric);
- }
-
- return availableInputModes;
-}
-
-bool T9WriteInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
-{
- Q_D(T9WriteInputMethod);
- d->select();
- return d->setInputMode(QLocale(locale), inputMode);
-}
-
-bool T9WriteInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
-{
- Q_D(T9WriteInputMethod);
- d->textCase = textCase;
- return true;
-}
-
-bool T9WriteInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_UNUSED(modifiers);
- Q_D(T9WriteInputMethod);
- switch (key) {
- case Qt::Key_Enter:
- case Qt::Key_Return:
- case Qt::Key_Tab:
- case Qt::Key_Space:
- d->select();
- update();
- break;
-
- case Qt::Key_Backspace:
- {
- QVirtualKeyboardInputContext *ic = inputContext();
- QString preeditText = ic->preeditText();
- if (preeditText.length() > 1) {
- preeditText.chop(1);
- ic->setPreeditText(preeditText);
- // WA: T9Write CJK may crash in some cases with long stringStart.
- // Therefore we commit the current input and finish the recognition.
- if (d->cjk) {
- d->waitForRecognitionResults();
- ic->commit();
- d->finishRecognition();
- return true;
- }
- d->caseFormatter.ensureLength(preeditText.length(), d->textCase);
- T9WriteCaseFormatter caseFormatter(d->caseFormatter);
- d->finishRecognition(false);
- d->caseFormatter = caseFormatter;
- d->stringStart = preeditText;
- d->wordCandidates.append(preeditText);
- d->activeWordIndex = 0;
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
- return true;
- } else {
- bool result = !preeditText.isEmpty();
- if (result)
- ic->clear();
- else
- result = !d->scrResult.isEmpty();
- d->finishRecognition();
- return result;
- }
- break;
- }
-
- default:
- if (d->sessionSettings.recognitionMode != scrMode && text.length() > 0) {
- d->waitForRecognitionResults();
- QVirtualKeyboardInputContext *ic = inputContext();
- QString preeditText = ic->preeditText();
- QChar c = text.at(0);
- bool addToWord = d->isValidInputChar(c) && (!preeditText.isEmpty() || !d->isJoiner(c));
- if (addToWord) {
- preeditText.append(text);
- ic->setPreeditText(preeditText);
- d->caseFormatter.ensureLength(preeditText.length(), d->textCase);
- T9WriteCaseFormatter caseFormatter(d->caseFormatter);
- d->finishRecognition(false);
- d->caseFormatter = caseFormatter;
- d->stringStart = preeditText;
- d->wordCandidates.append(preeditText);
- d->activeWordIndex = 0;
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
- return true;
- } else {
- ic->commit();
- d->finishRecognition();
- }
- break;
- } else if (d->sessionSettings.recognitionMode == scrMode) {
- d->finishRecognition();
- }
- }
- return false;
-}
-
-void T9WriteInputMethod::reset()
-{
- Q_D(T9WriteInputMethod);
- d->finishRecognition();
- d->setInputMode(QLocale(inputContext()->locale()), inputEngine()->inputMode());
-}
-
-void T9WriteInputMethod::update()
-{
- Q_D(T9WriteInputMethod);
- if (d->ignoreUpdate)
- return;
- d->select();
-}
-
-QList<QVirtualKeyboardSelectionListModel::Type> T9WriteInputMethod::selectionLists()
-{
- return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
-}
-
-int T9WriteInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
-{
- Q_UNUSED(type);
- Q_D(T9WriteInputMethod);
- return d->wordCandidates.count();
-}
-
-QVariant T9WriteInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
-{
- QVariant result;
- Q_D(T9WriteInputMethod);
- switch (role) {
- case QVirtualKeyboardSelectionListModel::Role::Display:
- result = QVariant(d->wordCandidates.at(index));
- break;
- case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
- result.setValue(0);
- break;
- default:
- result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void T9WriteInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
-{
- Q_UNUSED(type);
- Q_D(T9WriteInputMethod);
- d->select(index);
-}
-
-QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> T9WriteInputMethod::patternRecognitionModes() const
-{
- return QList<QVirtualKeyboardInputEngine::PatternRecognitionMode>()
- << QVirtualKeyboardInputEngine::PatternRecognitionMode::Handwriting;
-}
-
-QVirtualKeyboardTrace *T9WriteInputMethod::traceBegin(
- int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo)
-{
- Q_D(T9WriteInputMethod);
- return d->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
-}
-
-bool T9WriteInputMethod::traceEnd(QVirtualKeyboardTrace *trace)
-{
- Q_D(T9WriteInputMethod);
- d->traceEnd(trace);
- return true;
-}
-
-bool T9WriteInputMethod::reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags)
-{
- Q_D(T9WriteInputMethod);
-
- if (d->sessionSettings.recognitionMode == scrMode)
- return false;
-
- QVirtualKeyboardInputContext *ic = inputContext();
- if (!ic)
- return false;
-
- const QVirtualKeyboardInputEngine::InputMode inputMode = inputEngine()->inputMode();
- const int maxLength = (inputMode == QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting ||
- inputMode == QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting ||
- inputMode == QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) ? 0 : 32;
- const QString surroundingText = ic->surroundingText();
- int replaceFrom = 0;
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor)) {
- for (int i = cursorPosition - 1; i >= 0 && d->stringStart.length() < maxLength; --i) {
- QChar c = surroundingText.at(i);
- if (!d->isValidInputChar(c))
- break;
- d->stringStart.insert(0, c);
- --replaceFrom;
- }
-
- while (replaceFrom < 0 && d->isJoiner(d->stringStart.at(0))) {
- d->stringStart.remove(0, 1);
- ++replaceFrom;
- }
- }
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == 0) {
- d->stringStart.clear();
- return false;
- }
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAfterCursor)) {
- for (int i = cursorPosition; i < surroundingText.length() && d->stringStart.length() < maxLength; ++i) {
- QChar c = surroundingText.at(i);
- if (!d->isValidInputChar(c))
- break;
- d->stringStart.append(c);
- }
-
- while (replaceFrom > -d->stringStart.length()) {
- int lastPos = d->stringStart.length() - 1;
- if (!d->isJoiner(d->stringStart.at(lastPos)))
- break;
- d->stringStart.remove(lastPos, 1);
- }
- }
-
- if (d->stringStart.isEmpty())
- return false;
-
- if (reselectFlags.testFlag(QVirtualKeyboardInputEngine::ReselectFlag::WordAtCursor) && replaceFrom == -d->stringStart.length() && d->stringStart.length() < maxLength) {
- d->stringStart.clear();
- return false;
- }
-
- if (d->isJoiner(d->stringStart.at(0))) {
- d->stringStart.clear();
- return false;
- }
-
- if (d->isJoiner(d->stringStart.at(d->stringStart.length() - 1))) {
- d->stringStart.clear();
- return false;
- }
-
- ic->setPreeditText(d->stringStart, QList<QInputMethodEvent::Attribute>(), replaceFrom, d->stringStart.length());
- for (int i = 0; i < d->stringStart.length(); ++i)
- d->caseFormatter.ensureLength(i + 1, d->stringStart.at(i).isUpper() ? QVirtualKeyboardInputEngine::TextCase::Upper : QVirtualKeyboardInputEngine::TextCase::Lower);
- d->wordCandidates.append(d->stringStart);
- d->activeWordIndex = 0;
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->activeWordIndex);
-
- return true;
-}
-
-void T9WriteInputMethod::timerEvent(QTimerEvent *timerEvent)
-{
- Q_D(T9WriteInputMethod);
- int timerId = timerEvent->timerId();
- qCDebug(lcT9Write) << "T9WriteInputMethod::timerEvent():" << timerId;
- if (timerId == d->resultTimer) {
- d->stopResultTimer();
-
- // Ignore if the result is not yet available
- if (d->resultId != d->lastResultId) {
- qCDebug(lcT9Write) << "T9WriteInputMethod::timerEvent(): Result not yet available";
- return;
- }
-
- if (d->sessionSettings.recognitionMode != scrMode) {
-#ifndef QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
- // Don't clear traces in UCR mode if dictionary is loaded.
- // In UCR mode the whole purpose is to write the word with
- // one or few strokes.
- if (d->sessionSettings.recognitionMode == ucrMode) {
- const std::lock_guard<QRecursiveMutex> dictionaryGuard(d->dictionaryLock);
- if (d->attachedDictionary)
- return;
- }
-
- const QVirtualKeyboardInputEngine::InputMode inputMode = inputEngine()->inputMode();
- if (inputMode != QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting &&
- inputMode != QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting) {
- d->clearTraces();
- }
-#endif
- } else {
- d->select();
- }
- }
-}
-
-void T9WriteInputMethod::dictionaryLoadCompleted(QSharedPointer<T9WriteDictionary> dictionary)
-{
- Q_D(T9WriteInputMethod);
- // Note: This method is called in worker thread context
- const std::lock_guard<QRecursiveMutex> dictionaryGuard(d->dictionaryLock);
-
- if (!dictionary)
- return;
-
- qCDebug(lcT9Write) << "T9WriteInputMethod::dictionaryLoadCompleted():"
- << dictionary->fileName() << dictionary->data() << dictionary->size();
-
- QVirtualKeyboardInputContext *ic = inputContext();
- if (ic && dictionary->fileName() == d->dictionaryFileName) {
- d->loadedDictionary = dictionary;
- if (d->sessionSettings.recognitionMode != scrMode &&
- !ic->inputMethodHints().testFlag(Qt::ImhNoPredictiveText) &&
- !d->attachedDictionary) {
- if (d->attachDictionary(d->loadedDictionary))
- d->attachedDictionary = d->loadedDictionary;
- }
- }
-}
-
-void T9WriteInputMethod::resultsAvailable(const QVariantList &resultList)
-{
-#ifdef SENSITIVE_DEBUG
- if (lcT9Write().isDebugEnabled()) {
- qCDebug(lcT9Write) << "T9WriteInputMethod::resultsAvailable():";
- for (int i = 0; i < resultList.size(); i++) {
- QVariantMap result = resultList.at(i).toMap();
- QString resultPrint = QStringLiteral("%1: ").arg(i + 1);
- QString resultChars = result.value(QLatin1String("chars")).toString();
- if (!resultChars.isEmpty())
- resultPrint.append(resultChars);
- if (result.contains(QLatin1String("gesture"))) {
- if (!resultChars.isEmpty())
- resultPrint.append(QLatin1String(", "));
- QString gesture = result[QLatin1String("gesture")].toString();
- resultPrint.append(QLatin1String("gesture ="));
- for (const QChar &chr : gesture) {
- resultPrint.append(QString::fromLatin1(" 0x%1").arg(chr.unicode(), 0, 16));
- }
- }
- qCDebug(lcT9Write) << resultPrint.toUtf8().constData();
- }
- }
-#endif
- Q_D(T9WriteInputMethod);
- QMutexLocker resultListGuard(&d->resultListLock);
- d->resultList = resultList;
- emit resultListChanged();
-}
-
-void T9WriteInputMethod::processResult()
-{
- Q_D(T9WriteInputMethod);
- bool resultTimerWasRunning = d->resultTimer != 0;
-
- d->processResult();
-
- // Restart the result timer now if it stopped before the results were completed
- if (!resultTimerWasRunning && (!d->scrResult.isEmpty() || !d->wordCandidates.isEmpty()))
- d->resetResultTimer(0);
-
-}
-
-void T9WriteInputMethod::recognitionError(int status)
-{
- qCDebug(lcT9Write) << "T9WriteInputMethod::recognitionError():" << status;
- reset();
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/t9write/plugin/t9writeinputmethod_p.h b/src/plugins/t9write/plugin/t9writeinputmethod_p.h
deleted file mode 100644
index 39a0b2ac..00000000
--- a/src/plugins/t9write/plugin/t9writeinputmethod_p.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef T9WRITEINPUTMETHOD_P_H
-#define T9WRITEINPUTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-#include <QSharedPointer>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class T9WriteInputMethodPrivate;
-class T9WriteDictionary;
-
-class T9WriteInputMethod : public QVirtualKeyboardAbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(T9WriteInputMethod)
-
-public:
- enum class EngineMode {
- Uninitialized,
- Alphabetic,
- Arabic,
- Hebrew,
- Thai,
- SimplifiedChinese,
- TraditionalChinese,
- HongKongChinese,
- Japanese,
- Korean
- };
- Q_ENUM(EngineMode)
-
- explicit T9WriteInputMethod(QObject *parent = nullptr);
- ~T9WriteInputMethod();
-
- QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale);
- bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode);
- bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase);
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);
-
- void reset();
- void update();
-
- QList<QVirtualKeyboardSelectionListModel::Type> selectionLists();
- int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type);
- QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role);
- void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index);
-
- QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patternRecognitionModes() const;
- QVirtualKeyboardTrace *traceBegin(
- int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
- const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo);
- bool traceEnd(QVirtualKeyboardTrace *trace);
-
- bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags);
-
-signals:
- void resultListChanged();
-
-protected:
- void timerEvent(QTimerEvent *timerEvent);
-
-protected slots:
- void dictionaryLoadCompleted(QSharedPointer<T9WriteDictionary> dictionary);
- void resultsAvailable(const QVariantList &resultList);
- void processResult();
- void recognitionError(int status);
-
-private:
- QScopedPointer<T9WriteInputMethodPrivate> d_ptr;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/t9write/plugin/t9writeplugin.cpp b/src/plugins/t9write/plugin/t9writeplugin.cpp
deleted file mode 100644
index 25c1366f..00000000
--- a/src/plugins/t9write/plugin/t9writeplugin.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "t9writeplugin.h"
-#include "t9writeinputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardT9WritePlugin::registerTypes(const char *uri) const
-{
- Q_INIT_RESOURCE(qmake_t9write_db);
- qmlRegisterType<T9WriteInputMethod>(uri, 2, 0, "HandwritingInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/t9write/plugin/t9writeplugin.h b/src/plugins/t9write/plugin/t9writeplugin.h
deleted file mode 100644
index 570aea46..00000000
--- a/src/plugins/t9write/plugin/t9writeplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef T9WRITEPLUGIN_H
-#define T9WRITEPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardT9WritePlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "t9write.json")
-public:
- void registerTypes(const char *uri) const;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/t9write/plugin/t9writeworker.cpp b/src/plugins/t9write/plugin/t9writeworker.cpp
deleted file mode 100644
index 7ed1a4b7..00000000
--- a/src/plugins/t9write/plugin/t9writeworker.cpp
+++ /dev/null
@@ -1,406 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "t9writeworker_p.h"
-#include <QLoggingCategory>
-
-#include <QFile>
-#include <QTime>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_DECLARE_LOGGING_CATEGORY(lcT9Write)
-
-/*!
- \class QtVirtualKeyboard::T9WriteTask
- \internal
-*/
-
-T9WriteTask::T9WriteTask(QObject *parent) :
- QObject(parent),
- decumaSession(nullptr),
- runSema()
-{
-}
-
-void T9WriteTask::wait()
-{
- runSema.acquire();
- runSema.release();
-}
-
-/*!
- \class QtVirtualKeyboard::T9WriteDictionaryTask
- \internal
-*/
-
-T9WriteDictionaryTask::T9WriteDictionaryTask(QSharedPointer<T9WriteDictionary> dictionary,
- const QString &dictionaryFileName,
- bool convertDictionary,
- const DECUMA_SRC_DICTIONARY_INFO &dictionaryInfo) :
- dictionary(dictionary),
- dictionaryFileName(dictionaryFileName),
- convertDictionary(convertDictionary),
- dictionaryInfo(dictionaryInfo)
-{
-}
-
-void T9WriteDictionaryTask::run()
-{
- qCDebug(lcT9Write) << "T9WriteDictionaryTask::run()";
-
- QTime perf;
- perf.start();
-
- bool result = false;
- if (dictionary) {
- result = dictionary->load(dictionaryFileName);
- if (result && convertDictionary)
- result = dictionary->convert(dictionaryInfo);
- }
-
- qCDebug(lcT9Write) << "T9WriteDictionaryTask::run(): time:" << perf.elapsed() << "ms";
-
- if (result)
- emit completed(dictionary);
-}
-
-T9WriteAddArcTask::T9WriteAddArcTask(QVirtualKeyboardTrace *trace) :
- trace(trace)
-{
-}
-
-void T9WriteAddArcTask::run()
-{
- QTime perf;
- perf.start();
- DECUMA_UINT32 arcID = (DECUMA_UINT32)trace->traceId();
- DECUMA_STATUS status = DECUMA_API(StartNewArc)(decumaSession, arcID);
- Q_ASSERT(status == decumaNoError);
- if (status != decumaNoError) {
- qCWarning(lcT9Write) << "T9WriteAddArcTask::run(): Failed to start new arc, status:" << status;
- return;
- }
-
- const QVariantList points = trace->points();
- Q_ASSERT(!points.isEmpty());
-
- for (const QVariant &p : points) {
- const QPoint pt(p.toPointF().toPoint());
- status = DECUMA_API(AddPoint)(decumaSession, (DECUMA_COORD)pt.x(),(DECUMA_COORD)pt.y(), arcID);
- if (status != decumaNoError) {
- qCWarning(lcT9Write) << "T9WriteAddArcTask::run(): Failed to add point, status:" << status;
- DECUMA_API(CancelArc)(decumaSession, arcID);
- return;
- }
- }
-
- status = DECUMA_API(CommitArc)(decumaSession, arcID);
- if (status != decumaNoError)
- qCWarning(lcT9Write) << "T9WriteAddArcTask::run(): Failed to commit arc, status:" << status;
- else
- qCDebug(lcT9Write) << "T9WriteAddArcTask::run(): time:" << perf.elapsed() << "ms";
-}
-
-/*!
- \class QtVirtualKeyboard::T9WriteRecognitionResult
- \internal
-*/
-
-T9WriteRecognitionResult::T9WriteRecognitionResult(int id, int maxResults, int maxCharsPerWord) :
- status(decumaNoError),
- numResults(0),
- instantGesture(0),
- id(id),
- maxResults(maxResults),
- maxCharsPerWord(maxCharsPerWord)
-{
- Q_ASSERT(maxResults > 0);
- Q_ASSERT(maxCharsPerWord > 0);
- results.resize(maxResults);
- int bufferLength = (maxCharsPerWord + 1);
- _chars.resize(maxResults * bufferLength);
- _symbolChars.resize(maxResults * bufferLength);
- _symbolStrokes.resize(maxResults * bufferLength);
- for (int i = 0; i < maxResults; i++) {
- DECUMA_HWR_RESULT &hwrResult = results[i];
- hwrResult.pChars = &_chars[i * bufferLength];
- hwrResult.pSymbolChars = &_symbolChars[i * bufferLength];
- hwrResult.pSymbolStrokes = &_symbolStrokes[i * bufferLength];
- }
-}
-
-/*!
- \class QtVirtualKeyboard::T9WriteRecognitionTask
- \internal
-*/
-
-T9WriteRecognitionTask::T9WriteRecognitionTask(QSharedPointer<T9WriteRecognitionResult> result,
- const DECUMA_INSTANT_GESTURE_SETTINGS &instantGestureSettings,
- BOOST_LEVEL boostLevel,
- const QString &stringStart) :
- T9WriteTask(),
- result(result),
- instantGestureSettings(instantGestureSettings),
- boostLevel(boostLevel),
- stringStart(stringStart),
- stateCancelled(false)
-{
-#ifdef SENSITIVE_DEBUG
- qCDebug(lcT9Write) << "T9WriteRecognitionTask():" << "boostLevel:" << boostLevel << "stringStart:" << stringStart;
-#endif
-}
-
-void T9WriteRecognitionTask::run()
-{
- if (!decumaSession)
- return;
-
- {
- QMutexLocker stateGuard(&stateLock);
- Q_UNUSED(stateGuard);
- if (stateCancelled)
- return;
- }
-
- //In a normal text composition case boostDictWords and canBeContinued are the preffered settings
- DECUMA_RECOGNITION_SETTINGS recSettings;
- memset(&recSettings, 0, sizeof(recSettings));
- recSettings.boostLevel = boostLevel;
- recSettings.stringCompleteness = canBeContinued;
- if (!stringStart.isEmpty())
- recSettings.pStringStart = (DECUMA_UNICODE *)stringStart.utf16();
-
- QTime perf;
- perf.start();
-
-#if SUPPORTS_ABORTRECOGNITION
- DECUMA_INTERRUPT_FUNCTIONS interruptFunctions;
- interruptFunctions.pShouldAbortRecognize = shouldAbortRecognize;
- interruptFunctions.pUserData = (void *)this;
- DECUMA_INTERRUPT_FUNCTIONS *pInterruptFunctions = &interruptFunctions;
-#else
- DECUMA_INTERRUPT_FUNCTIONS *pInterruptFunctions = nullptr;
-#endif
- result->status = DECUMA_API(Recognize)(decumaSession, result->results.data(), result->results.size(), &result->numResults, result->maxCharsPerWord, &recSettings, pInterruptFunctions);
- if (result->status != decumaNoError)
- qCWarning(lcT9Write) << "T9WriteRecognitionTask::run(): Recognition failed, status:" << result->status;
-
- int perfElapsed = perf.elapsed();
-
- {
- QMutexLocker stateGuard(&stateLock);
- Q_UNUSED(stateGuard);
- if (stateCancelled)
- result.reset();
- qCDebug(lcT9Write) << "T9WriteRecognitionTask::run(): time:" << perfElapsed << "ms" << (stateCancelled ? "(cancelled)" : "");
- }
-}
-
-int T9WriteRecognitionTask::shouldAbortRecognize(void *pUserData)
-{
- T9WriteRecognitionTask *pThis = (T9WriteRecognitionTask *)pUserData;
- QMutexLocker stateGuard(&pThis->stateLock);
- Q_UNUSED(stateGuard);
- return pThis->stateCancelled;
-}
-
-bool T9WriteRecognitionTask::cancelRecognition()
-{
- QMutexLocker stateGuard(&stateLock);
- Q_UNUSED(stateGuard);
- stateCancelled = true;
- return true;
-}
-
-int T9WriteRecognitionTask::resultId() const
-{
- return result != nullptr ? result->id : -1;
-}
-
-/*!
- \class QtVirtualKeyboard::T9WriteRecognitionResultsTask
- \internal
-*/
-
-T9WriteRecognitionResultsTask::T9WriteRecognitionResultsTask(QSharedPointer<T9WriteRecognitionResult> result) :
- T9WriteTask(),
- result(result)
-{
-}
-
-void T9WriteRecognitionResultsTask::run()
-{
- if (!result)
- return;
-
- if (result->status != decumaNoError) {
- emit recognitionError(result->status);
- return;
- }
-
- QVariantList resultList;
- for (int i = 0; i < result->numResults; i++)
- {
- QVariantMap resultMap;
- QString resultString;
- QString gesture;
- const DECUMA_HWR_RESULT &hwrResult = result->results.at(i);
- resultString.reserve(hwrResult.nChars);
- QVariantList symbolStrokes;
- int charPos = 0;
- for (int symbolIndex = 0; symbolIndex < hwrResult.nSymbols; symbolIndex++) {
- int symbolLength = hwrResult.pSymbolChars[symbolIndex];
- QString symbol(QString::fromUtf16(&hwrResult.pChars[charPos], symbolLength));
- // Do not append gesture symbol to result string
- 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]));
- }
-
- resultMap[QLatin1String("resultId")] = result->id;
- resultMap[QLatin1String("chars")] = resultString;
- resultMap[QLatin1String("symbolStrokes")] = symbolStrokes;
- if (!gesture.isEmpty())
- resultMap[QLatin1String("gesture")] = gesture;
-
- resultList.append(resultMap);
- }
-
- if (resultList.isEmpty())
- return;
-
- emit resultsAvailable(resultList);
-}
-
-/*!
- \class QtVirtualKeyboard::T9WriteWorker
- \internal
-*/
-
-T9WriteWorker::T9WriteWorker(DECUMA_SESSION *decumaSession, const bool cjk, QObject *parent) :
- QThread(parent),
- taskSema(),
- taskLock(),
- decumaSession(decumaSession),
- cjk(cjk)
-{
- abort = false;
-}
-
-T9WriteWorker::~T9WriteWorker()
-{
- abort = true;
- taskSema.release();
- wait();
-}
-
-void T9WriteWorker::addTask(QSharedPointer<T9WriteTask> task)
-{
- if (task) {
- QMutexLocker guard(&taskLock);
- task->moveToThread(this);
- taskList.append(task);
- taskSema.release();
- }
-}
-
-int T9WriteWorker::removeTask(QSharedPointer<T9WriteTask> task)
-{
- int count = 0;
- if (task) {
- QMutexLocker guard(&taskLock);
- count = taskList.removeAll(task);
- taskSema.acquire(qMin(count, taskSema.available()));
- }
- return count;
-}
-
-int T9WriteWorker::removeAllTasks()
-{
- QMutexLocker guard(&taskLock);
- int count = taskList.count();
- taskList.clear();
- if (taskSema.available())
- taskSema.acquire(taskSema.available());
- return count;
-}
-
-void T9WriteWorker::waitForAllTasks()
-{
- while (isRunning()) {
- idleSema.acquire();
- QMutexLocker guard(&taskLock);
- if (taskList.isEmpty()) {
- idleSema.release();
- break;
- }
- idleSema.release();
- }
-}
-
-int T9WriteWorker::numberOfPendingTasks()
-{
- QMutexLocker guard(&taskLock);
- return taskList.count() + (!idleSema.available() ? 1 : 0);
-}
-
-void T9WriteWorker::run()
-{
- while (!abort) {
- idleSema.release();
- taskSema.acquire();
- if (abort)
- break;
- idleSema.acquire();
- QSharedPointer<T9WriteTask> currentTask;
- {
- QMutexLocker guard(&taskLock);
- if (!taskList.isEmpty()) {
- currentTask = taskList.front();
- taskList.pop_front();
- }
- }
- if (currentTask) {
- currentTask->decumaSession = decumaSession;
- currentTask->cjk = cjk;
- currentTask->run();
- currentTask->runSema.release();
- }
- }
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/t9write/plugin/t9writeworker_p.h b/src/plugins/t9write/plugin/t9writeworker_p.h
deleted file mode 100644
index 0cdb19a4..00000000
--- a/src/plugins/t9write/plugin/t9writeworker_p.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef T9WRITEWORKER_H
-#define T9WRITEWORKER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
-
-#include <QThread>
-#include <QSemaphore>
-#include <QMutex>
-#include <QStringList>
-#include <QSharedPointer>
-#include <QPointer>
-#include <QMap>
-#include <QList>
-
-#include "t9write_p.h"
-#include "t9writedictionary_p.h"
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class T9WriteTask : public QObject
-{
- Q_OBJECT
-public:
- explicit T9WriteTask(QObject *parent = nullptr);
-
- virtual void run() = 0;
-
- void wait();
-
- friend class T9WriteWorker;
-
-protected:
- DECUMA_SESSION *decumaSession;
- bool cjk;
-
-private:
- QSemaphore runSema;
-};
-
-class T9WriteDictionaryTask : public T9WriteTask
-{
- Q_OBJECT
-public:
- explicit T9WriteDictionaryTask(QSharedPointer<T9WriteDictionary> dictionary,
- const QString &dictionaryFileName,
- bool convertDictionary,
- const DECUMA_SRC_DICTIONARY_INFO &dictionaryInfo);
-
- void run();
-
- QSharedPointer<T9WriteDictionary> dictionary;
- const QString dictionaryFileName;
- bool convertDictionary;
- const DECUMA_SRC_DICTIONARY_INFO dictionaryInfo;
-
-signals:
- void completed(QSharedPointer<T9WriteDictionary> dictionary);
-};
-
-class T9WriteAddArcTask : public T9WriteTask
-{
- Q_OBJECT
-public:
- explicit T9WriteAddArcTask(QVirtualKeyboardTrace *trace);
-
- void run();
-
-private:
- QVirtualKeyboardTrace *trace;
-};
-
-class T9WriteRecognitionResult
-{
- Q_DISABLE_COPY(T9WriteRecognitionResult)
-
-public:
- explicit T9WriteRecognitionResult(int id, int maxResults, int maxCharsPerWord);
-
- DECUMA_STATUS status;
- QList<DECUMA_HWR_RESULT> results;
- DECUMA_UINT16 numResults;
- int instantGesture;
- const int id;
- const int maxResults;
- const int maxCharsPerWord;
-
-private:
- QList<DECUMA_UNICODE> _chars;
- QList<DECUMA_INT16> _symbolChars;
- QList<DECUMA_INT16> _symbolStrokes;
-};
-
-class T9WriteRecognitionTask : public T9WriteTask
-{
- Q_OBJECT
-public:
- explicit T9WriteRecognitionTask(QSharedPointer<T9WriteRecognitionResult> result,
- const DECUMA_INSTANT_GESTURE_SETTINGS &instantGestureSettings,
- BOOST_LEVEL boostLevel,
- const QString &stringStart);
-
- void run();
- bool cancelRecognition();
- int resultId() const;
-
-private:
- static int shouldAbortRecognize(void *pUserData);
- friend int shouldAbortRecognize(void *pUserData);
-
-private:
- QSharedPointer<T9WriteRecognitionResult> result;
- DECUMA_INSTANT_GESTURE_SETTINGS instantGestureSettings;
- BOOST_LEVEL boostLevel;
- QString stringStart;
- QMutex stateLock;
- bool stateCancelled;
-};
-
-class T9WriteRecognitionResultsTask : public T9WriteTask
-{
- Q_OBJECT
-public:
- explicit T9WriteRecognitionResultsTask(QSharedPointer<T9WriteRecognitionResult> result);
-
- void run();
-
-signals:
- void resultsAvailable(const QVariantList &resultList);
- void recognitionError(int status);
-
-private:
- QSharedPointer<T9WriteRecognitionResult> result;
-};
-
-class T9WriteWorker : public QThread
-{
- Q_OBJECT
-public:
- explicit T9WriteWorker(DECUMA_SESSION *decumaSession, const bool cjk, QObject *parent = nullptr);
- ~T9WriteWorker();
-
- void addTask(QSharedPointer<T9WriteTask> task);
- int removeTask(QSharedPointer<T9WriteTask> task);
- int removeAllTasks();
- void waitForAllTasks();
- int numberOfPendingTasks();
-
- template <class X>
- int removeAllTasks() {
- QMutexLocker guard(&taskLock);
- int count = 0;
- for (int i = 0; i < taskList.size();) {
- QSharedPointer<X> task(taskList[i].objectCast<X>());
- if (task) {
- taskList.removeAt(i);
- ++count;
- } else {
- ++i;
- }
- }
- return count;
- }
-
-protected:
- void run();
-
-private:
- QList<QSharedPointer<T9WriteTask> > taskList;
- QSemaphore idleSema;
- QSemaphore taskSema;
- QMutex taskLock;
- DECUMA_SESSION *decumaSession;
- QBasicAtomicInt abort;
- const bool cjk;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // T9WRITEWORKER_H
diff --git a/src/plugins/t9write/t9write.pro b/src/plugins/t9write/t9write.pro
deleted file mode 100644
index 5b59353a..00000000
--- a/src/plugins/t9write/t9write.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- 3rdparty/t9write \
- plugin
-
-plugin.depends += 3rdparty/t9write
diff --git a/src/plugins/tcime/3rdparty/tcime/CMakeLists.txt b/src/plugins/tcime/3rdparty/tcime/CMakeLists.txt
index 8d09ed10..6261df76 100644
--- a/src/plugins/tcime/3rdparty/tcime/CMakeLists.txt
+++ b/src/plugins/tcime/3rdparty/tcime/CMakeLists.txt
@@ -4,7 +4,8 @@
## BundledTcime Generic Library:
#####################################################################
-qt_add_3rdparty_library(BundledTcime
+qt_internal_add_3rdparty_library(BundledTcime
+ QMAKE_LIB_NAME tcime
STATIC
SOURCES
cangjiedictionary.cpp cangjiedictionary.h
diff --git a/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
index 6bc62d84..3c6f6de1 100644
--- a/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/phrasedictionary.cpp
@@ -30,7 +30,7 @@ PhraseDictionary::PhraseDictionary() :
QStringList PhraseDictionary::getWords(const QString &input) const
{
- if (input.length() != 1)
+ if (input.size() != 1)
return QStringList();
// Phrases are stored in an array consisting of three character arrays.
@@ -42,7 +42,7 @@ QStringList PhraseDictionary::getWords(const QString &input) const
// char[1][] { 0, 2, 4 }
// char[2][] { a, a', b, b', c}
const Dictionary &dict = dictionary();
- if (dict.length() != 3)
+ if (dict.size() != 3)
return QStringList();
const DictionaryEntry &words = dict[0];
@@ -55,8 +55,8 @@ QStringList PhraseDictionary::getWords(const QString &input) const
const DictionaryEntry &offsets = dict[1];
const DictionaryEntry &phrases = dict[2];
int offset = (int)offsets[index].unicode();
- int count = (index < offsets.length() - 1) ?
- ((int)offsets[index + 1].unicode() - offset) : (phrases.length() - offset);
+ int count = (index < offsets.size() - 1) ?
+ ((int)offsets[index + 1].unicode() - offset) : (phrases.size() - offset);
QStringList result;
for (int i = 0; i < count; ++i)
diff --git a/src/plugins/tcime/3rdparty/tcime/qt_attribution.json b/src/plugins/tcime/3rdparty/tcime/qt_attribution.json
index 717f87ac..71b16654 100644
--- a/src/plugins/tcime/3rdparty/tcime/qt_attribution.json
+++ b/src/plugins/tcime/3rdparty/tcime/qt_attribution.json
@@ -8,9 +8,9 @@
"License": "Apache License 2.0 and BSD 3-clause \"New\" or \"Revised\" License",
"LicenseId": "Apache-2.0 AND BSD-3-Clause",
"LicenseFile": "COPYING",
- "Copyright": "Copyright 2010 Google Inc.
-Copyrighy (c) 1999 TaBE Project.
-Copyright (c) 1999 Pai-Hsiang Hsiao.
-Copyright (c) 1999 Computer Systems and Communication Lab, Institute of Information Science, Academia Sinica.
-Copyright 1996 Chih-Hao Tsai @ Beckman Institute, University of Illinois"
+ "Copyright": ["Copyright 2010 Google Inc.",
+ "Copyrighy (c) 1999 TaBE Project.",
+ "Copyright (c) 1999 Pai-Hsiang Hsiao.",
+ "Copyright (c) 1999 Computer Systems and Communication Lab, Institute of Information Science, Academia Sinica.",
+ "Copyright 1996 Chih-Hao Tsai @ Beckman Institute, University of Illinois"]
}
diff --git a/src/plugins/tcime/3rdparty/tcime/tcime.pro b/src/plugins/tcime/3rdparty/tcime/tcime.pro
deleted file mode 100644
index d9fc4f2e..00000000
--- a/src/plugins/tcime/3rdparty/tcime/tcime.pro
+++ /dev/null
@@ -1,37 +0,0 @@
-TARGET = qttcime
-
-CONFIG += static
-
-SOURCES += \
- cangjiedictionary.cpp \
- cangjietable.cpp \
- phrasedictionary.cpp \
- worddictionary.cpp \
- zhuyindictionary.cpp \
- zhuyintable.cpp
-
-HEADERS += \
- cangjiedictionary.h \
- cangjietable.h \
- phrasedictionary.h \
- worddictionary.h \
- zhuyindictionary.h \
- zhuyintable.h
-
-OTHER_FILES += \
- data/dict_cangjie.dat \
- data/dict_phrases.dat
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-MODULE_INCLUDEPATH = $$PWD
-MODULE_DEFINES = HAVE_TCIME
-
-load(qt_helper_lib)
-
-CONFIG += qt
-QT = core
diff --git a/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
index ce68618b..b7baef78 100644
--- a/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
+++ b/src/plugins/tcime/3rdparty/tcime/zhuyintable.cpp
@@ -66,11 +66,11 @@ int ZhuyinTable::getInitials(QChar initials) noexcept
int ZhuyinTable::getFinals(QStringView finals) noexcept
{
- if (finals.length() == 0)
+ if (finals.size() == 0)
// Syllables ending with no finals can still be valid.
return 0;
- if (finals.length() > 2)
+ if (finals.size() > 2)
return -1;
// Compute the index instead of direct lookup the whole array to save
@@ -96,7 +96,7 @@ int ZhuyinTable::getFinals(QStringView finals) noexcept
return -1;
}
- if (finals.length() == 1)
+ if (finals.size() == 1)
return index;
for (int i = 0; i < endingFinals.size(); ++i) {
diff --git a/src/plugins/tcime/CMakeLists.txt b/src/plugins/tcime/CMakeLists.txt
index abb63707..0883ca1a 100644
--- a/src/plugins/tcime/CMakeLists.txt
+++ b/src/plugins/tcime/CMakeLists.txt
@@ -1,4 +1,74 @@
-# Generated from tcime.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(3rdparty/tcime)
-add_subdirectory(plugin)
+
+#####################################################################
+## QtVirtualKeyboardTCImePlugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(qtvkbtcimeplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.TCIme"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbtcimeplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ tcinputmethod.cpp tcinputmethod_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboardPrivate
+ Qt::BundledTcime
+ NO_GENERATE_CPP_EXPORTS
+)
+
+set(qmake_virtualkeyboard_tcime_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/zh_TW/dialpad.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_TW/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_TW/main.qml"
+ "${VKB_LAYOUTS_BASE}/zh_TW/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/zh_TW/symbols.qml"
+)
+
+qt_internal_add_resource(qtvkbtcimeplugin "qmake_virtualkeyboard_tcime_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${VKB_LAYOUTS_BASE}"
+ FILES
+ ${qmake_virtualkeyboard_tcime_layouts_resource_files}
+)
+
+if (NOT FEATURE_vkb_no_bundle_tcime)
+ # Resources:
+ set(qmake_tcime_resource_files
+ "3rdparty/tcime/data/qt/dict_cangjie.dat"
+ "3rdparty/tcime/data/qt/dict_phrases.dat"
+ "3rdparty/tcime/data/qt/dict_zhuyin.dat"
+ )
+
+ qt_internal_add_resource(qtvkbtcimeplugin "qmake_tcime"
+ PREFIX
+ "/qt-project.org/imports/QtQuick/VirtualKeyboard"
+ BASE
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ ${qmake_tcime_resource_files}
+ )
+else()
+ qt_copy_or_install(
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tcime/data/qt/"
+ DESTINATION "${VKB_INSTALL_DATA}/tcime"
+ FILES_MATCHING
+ PATTERN "*.dat"
+ )
+endif()
diff --git a/src/plugins/tcime/plugin/.prev_CMakeLists.txt b/src/plugins/tcime/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index c9d598b0..00000000
--- a/src/plugins/tcime/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardTCImePlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardTCImePlugin
- OUTPUT_NAME qtvirtualkeyboard_tcime
- TYPE virtualkeyboard
- SOURCES
- tcimeplugin.cpp tcimeplugin.h
- tcinputmethod.cpp tcinputmethod_p.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboardPrivate
- tcime
-)
-
-# Resources:
-set(qmake_virtualkeyboard_tcime_layouts_resource_files
- "virtualkeyboard/content/layouts/zh_TW/dialpad.fallback"
- "virtualkeyboard/content/layouts/zh_TW/digits.fallback"
- "virtualkeyboard/content/layouts/zh_TW/main.qml"
- "virtualkeyboard/content/layouts/zh_TW/numbers.fallback"
- "virtualkeyboard/content/layouts/zh_TW/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardTCImePlugin "qmake_virtualkeyboard_tcime_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_tcime_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "tcime.json"
-
-## Scopes:
-#####################################################################
-
-if(NOT no-bundle-tcime)
- # Resources:
- set(qmake_tcime_resource_files
- "../3rdparty/tcime/data/qt/dict_phrases.dat"
- )
-
- qt_add_resource(QtVirtualKeyboardTCImePlugin "qmake_tcime"
- PREFIX
- "/QtQuick/VirtualKeyboard"
- BASE
- "$$PWD/.."
- FILES
- ${qmake_tcime_resource_files}
- )
-endif()
-
-#### Keys ignored in scope 3:.:.:plugin.pro:QT_FEATURE_cangjie:
-# TCIME_FILES = "../3rdparty/tcime/data/qt/dict_cangjie.dat"
-
-#### Keys ignored in scope 4:.:.:plugin.pro:QT_FEATURE_zhuyin:
-# TCIME_FILES = "../3rdparty/tcime/data/qt/dict_zhuyin.dat"
-
-#### Keys ignored in scope 5:.:.:plugin.pro:else:
-# INSTALLS = "tcime_data"
-# tcime_data.files = "$$PWD/../3rdparty/tcime/data/qt/dict_phrases.dat"
-# tcime_data.path = "$$VIRTUALKEYBOARD_INSTALL_DATA/tcime"
-
-#### Keys ignored in scope 6:.:.:plugin.pro:QT_FEATURE_cangjie:
-# tcime_data.files = "$$PWD/../3rdparty/tcime/data/qt/dict_cangjie.dat"
-
-#### Keys ignored in scope 7:.:.:plugin.pro:QT_FEATURE_zhuyin:
-# tcime_data.files = "$$PWD/../3rdparty/tcime/data/qt/dict_zhuyin.dat"
-
-#### Keys ignored in scope 8:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "tcime_data"
-
-#### Keys ignored in scope 9:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard TCIME (Qt $$QT_VERSION)"
diff --git a/src/plugins/tcime/plugin/CMakeLists.txt b/src/plugins/tcime/plugin/CMakeLists.txt
deleted file mode 100644
index 0cf08fdf..00000000
--- a/src/plugins/tcime/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardTCImePlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardTCImePlugin
- OUTPUT_NAME qtvirtualkeyboard_tcime
- TYPE virtualkeyboard
- SOURCES
- tcimeplugin.cpp tcimeplugin.h
- tcinputmethod.cpp tcinputmethod_p.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboardPrivate
- LIBRARIES # special case
- BundledTcime # special case
-)
-
-# Resources:
-set(qmake_virtualkeyboard_tcime_layouts_resource_files
- "virtualkeyboard/content/layouts/zh_TW/dialpad.fallback"
- "virtualkeyboard/content/layouts/zh_TW/digits.fallback"
- "virtualkeyboard/content/layouts/zh_TW/main.qml"
- "virtualkeyboard/content/layouts/zh_TW/numbers.fallback"
- "virtualkeyboard/content/layouts/zh_TW/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardTCImePlugin "qmake_virtualkeyboard_tcime_layouts"
- PREFIX
- "${VKB_LAYOUTS_PREFIX}" #special case
- BASE
- "${VKB_LAYOUTS_BASE}" #special case
- FILES
- ${qmake_virtualkeyboard_tcime_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "tcime.json"
-
-## Scopes:
-#####################################################################
-
-if(NOT no-bundle-tcime)
- # Resources:
- set(qmake_tcime_resource_files
- "../3rdparty/tcime/data/qt/dict_phrases.dat"
- )
-
- qt_add_resource(QtVirtualKeyboardTCImePlugin "qmake_tcime"
- PREFIX
- "/QtQuick/VirtualKeyboard"
- BASE
- "${CMAKE_CURRENT_SOURCE_DIR}" #special case
- FILES
- ${qmake_tcime_resource_files}
- )
-endif()
-
-#### Keys ignored in scope 3:.:.:plugin.pro:QT_FEATURE_cangjie:
-# TCIME_FILES = "../3rdparty/tcime/data/qt/dict_cangjie.dat"
-
-#### Keys ignored in scope 4:.:.:plugin.pro:QT_FEATURE_zhuyin:
-# TCIME_FILES = "../3rdparty/tcime/data/qt/dict_zhuyin.dat"
-
-#### Keys ignored in scope 5:.:.:plugin.pro:else:
-# INSTALLS = "tcime_data"
-# tcime_data.files = "$$PWD/../3rdparty/tcime/data/qt/dict_phrases.dat"
-# tcime_data.path = "$$VIRTUALKEYBOARD_INSTALL_DATA/tcime"
-
-#### Keys ignored in scope 6:.:.:plugin.pro:QT_FEATURE_cangjie:
-# tcime_data.files = "$$PWD/../3rdparty/tcime/data/qt/dict_cangjie.dat"
-
-#### Keys ignored in scope 7:.:.:plugin.pro:QT_FEATURE_zhuyin:
-# tcime_data.files = "$$PWD/../3rdparty/tcime/data/qt/dict_zhuyin.dat"
-
-#### Keys ignored in scope 8:.:.:plugin.pro:NOT prefix_build:
-# COPIES = "tcime_data"
-
-#### Keys ignored in scope 9:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard TCIME (Qt $$QT_VERSION)"
diff --git a/src/plugins/tcime/plugin/plugin.pro b/src/plugins/tcime/plugin/plugin.pro
deleted file mode 100644
index c11eb09a..00000000
--- a/src/plugins/tcime/plugin/plugin.pro
+++ /dev/null
@@ -1,63 +0,0 @@
-TARGET = qtvirtualkeyboard_tcime
-QT += qml virtualkeyboard-private
-
-include(../../../shared.pri)
-
-HEADERS += \
- tcinputmethod_p.h \
- tcimeplugin.h
-SOURCES += \
- tcinputmethod.cpp \
- tcimeplugin.cpp
-OTHER_FILES += \
- tcime.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-LAYOUT_FILES += \
- $$LAYOUTS_BASE/content/layouts/zh_TW/dialpad.fallback \
- $$LAYOUTS_BASE/content/layouts/zh_TW/digits.fallback \
- $$LAYOUTS_BASE/content/layouts/zh_TW/main.qml \
- $$LAYOUTS_BASE/content/layouts/zh_TW/numbers.fallback \
- $$LAYOUTS_BASE/content/layouts/zh_TW/symbols.qml
-
-virtualkeyboard_tcime_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_tcime_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_tcime_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_tcime_layouts
-
-QMAKE_USE += tcime
-!no-bundle-tcime {
- TCIME_FILES += ../3rdparty/tcime/data/qt/dict_phrases.dat
- qtConfig(cangjie): TCIME_FILES += \
- ../3rdparty/tcime/data/qt/dict_cangjie.dat
- qtConfig(zhuyin): TCIME_FILES += \
- ../3rdparty/tcime/data/qt/dict_zhuyin.dat
- tcime.files = $$TCIME_FILES
- tcime.base = $$PWD/..
- tcime.prefix = /QtQuick/VirtualKeyboard
- RESOURCES += tcime
-} else {
- tcime_data.files = \
- $$PWD/../3rdparty/tcime/data/qt/dict_phrases.dat
- qtConfig(cangjie): tcime_data.files += \
- $$PWD/../3rdparty/tcime/data/qt/dict_cangjie.dat
- qtConfig(zhuyin): tcime_data.files += \
- $$PWD/../3rdparty/tcime/data/qt/dict_zhuyin.dat
- tcime_data.path = $$VIRTUALKEYBOARD_INSTALL_DATA/tcime
- INSTALLS += tcime_data
- !prefix_build: COPIES += tcime_data
-}
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard TCIME (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardTCImePlugin
-load(qt_plugin)
diff --git a/src/plugins/tcime/plugin/tcime.json b/src/plugins/tcime/plugin/tcime.json
deleted file mode 100644
index 421ae0cc..00000000
--- a/src/plugins/tcime/plugin/tcime.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "traditional_chinese",
- "Provider": "Qt TCIME Extension",
- "InputMethod": "TCInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/tcime/plugin/tcimeplugin.cpp b/src/plugins/tcime/plugin/tcimeplugin.cpp
deleted file mode 100644
index a8ba9a4e..00000000
--- a/src/plugins/tcime/plugin/tcimeplugin.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tcimeplugin.h"
-#include "tcinputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardTCImePlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<TCInputMethod>(uri, 2, 0, "TCInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/tcime/plugin/tcimeplugin.h b/src/plugins/tcime/plugin/tcimeplugin.h
deleted file mode 100644
index d7bb588a..00000000
--- a/src/plugins/tcime/plugin/tcimeplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TCIMEPLUGIN_H
-#define TCIMEPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardTCImePlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "tcime.json")
-public:
- void registerTypes(const char *uri) const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/tcime/plugin/tcinputmethod.cpp b/src/plugins/tcime/plugin/tcinputmethod.cpp
deleted file mode 100644
index b434d66f..00000000
--- a/src/plugins/tcime/plugin/tcinputmethod.cpp
+++ /dev/null
@@ -1,556 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tcinputmethod_p.h"
-#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-#if QT_CONFIG(cangjie)
-#include "cangjiedictionary.h"
-#include "cangjietable.h"
-#endif
-#if QT_CONFIG(zhuyin)
-#include "zhuyindictionary.h"
-#include "zhuyintable.h"
-#endif
-#include "phrasedictionary.h"
-#include <QLoggingCategory>
-
-#include <QLibraryInfo>
-#include <QFileInfo>
-
-#include <array>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-Q_LOGGING_CATEGORY(lcTCIme, "qt.virtualkeyboard.tcime")
-
-using namespace tcime;
-
-class TCInputMethodPrivate
-{
- Q_DECLARE_PUBLIC(TCInputMethod)
-public:
-
- TCInputMethodPrivate(TCInputMethod *q_ptr) :
- q_ptr(q_ptr),
- inputMode(QVirtualKeyboardInputEngine::InputMode::Latin),
- wordDictionary(nullptr),
- highlightIndex(-1)
- {}
-
- bool setCandidates(const QStringList &values, bool highlightDefault)
- {
- bool candidatesChanged = candidates != values;
- candidates = values;
- highlightIndex = !candidates.isEmpty() && highlightDefault ? 0 : -1;
- return candidatesChanged;
- }
-
- bool clearCandidates()
- {
- if (candidates.isEmpty())
- return false;
-
- candidates.clear();
- highlightIndex = -1;
- return true;
- }
-
- QString pickHighlighted() const
- {
- return (highlightIndex >= 0 && highlightIndex < candidates.count()) ? candidates[highlightIndex] : QString();
- }
-
- void reset()
- {
- if (clearCandidates()) {
- Q_Q(TCInputMethod);
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
- }
- input.clear();
- }
-
- bool compose(const QChar &c)
- {
- bool accept;
- Q_Q(TCInputMethod);
- QVirtualKeyboardInputContext *ic = q->inputContext();
- switch (inputMode)
- {
-#if QT_CONFIG(cangjie)
- case QVirtualKeyboardInputEngine::InputMode::Cangjie:
- accept = composeCangjie(ic, c);
- break;
-#endif
-#if QT_CONFIG(zhuyin)
- case QVirtualKeyboardInputEngine::InputMode::Zhuyin:
- accept = composeZhuyin(ic, c);
- break;
-#endif
- default:
- accept = false;
- break;
- }
- return accept;
- }
-
-#if QT_CONFIG(cangjie)
- bool composeCangjie(QVirtualKeyboardInputContext *ic, const QChar &c)
- {
- bool accept = false;
- if (!input.contains(QChar(0x91CD)) && CangjieTable::isLetter(c)) {
- if (input.length() < (cangjieDictionary.simplified() ? CangjieTable::MAX_SIMPLIFIED_CODE_LENGTH : CangjieTable::MAX_CODE_LENGTH)) {
- input.append(c);
- ic->setPreeditText(input);
- if (setCandidates(wordDictionary->getWords(input), true)) {
- Q_Q(TCInputMethod);
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
- }
- }
- accept = true;
- } else if (c.unicode() == 0x91CD) {
- if (input.isEmpty()) {
- input.append(c);
- ic->setPreeditText(input);
- checkSpecialCharInput();
- }
- accept = true;
- } else if (c.unicode() == 0x96E3) {
- if (input.length() == 1) {
- Q_ASSERT(input.at(0).unicode() == 0x91CD);
- input.append(c);
- ic->setPreeditText(input);
- checkSpecialCharInput();
- }
- accept = true;
- }
- return accept;
- }
-
- bool checkSpecialCharInput()
- {
- if (input.length() == 1 && input.at(0).unicode() == 0x91CD) {
- static const QStringList specialChars1 = QStringList()
- << QChar(0xFF01) << QChar(0x2018) << QChar(0x3000) << QChar(0xFF0C)
- << QChar(0x3001) << QChar(0x3002) << QChar(0xFF0E) << QChar(0xFF1B)
- << QChar(0xFF1A) << QChar(0xFF1F) << QChar(0x300E) << QChar(0x300F)
- << QChar(0x3010) << QChar(0x3011) << QChar(0xFE57) << QChar(0x2026)
- << QChar(0x2025) << QChar(0xFE50) << QChar(0xFE51) << QChar(0xFE52)
- << QChar(0x00B7) << QChar(0xFE54) << QChar(0x2574) << QChar(0x2027)
- << QChar(0x2032) << QChar(0x2035) << QChar(0x301E) << QChar(0x301D)
- << QChar(0x201D) << QChar(0x201C) << QChar(0x2019) << QChar(0xFE55)
- << QChar(0xFE5D) << QChar(0xFE5E) << QChar(0xFE59) << QChar(0xFE5A)
- << QChar(0xFE5B) << QChar(0xFE5C) << QChar(0xFE43) << QChar(0xFE44);
- Q_Q(TCInputMethod);
- if (setCandidates(specialChars1, true)) {
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
- }
- q->inputContext()->setPreeditText(candidates[highlightIndex]);
- return true;
- } else if (input.length() == 2 && input.at(0).unicode() == 0x91CD && input.at(1).unicode() == 0x96E3) {
- static const QStringList specialChars2 = QStringList()
- << QChar(0x3008) << QChar(0x3009) << QChar(0xFE31) << QChar(0x2013)
- << QChar(0xFF5C) << QChar(0x300C) << QChar(0x300D) << QChar(0xFE40)
- << QChar(0xFE3F) << QChar(0x2014) << QChar(0xFE3E) << QChar(0xFE3D)
- << QChar(0x300A) << QChar(0x300B) << QChar(0xFE3B) << QChar(0xFE3C)
- << QChar(0xFE56) << QChar(0xFE30) << QChar(0xFE39) << QChar(0xFE3A)
- << QChar(0x3014) << QChar(0x3015) << QChar(0xFE37) << QChar(0xFE38)
- << QChar(0xFE41) << QChar(0xFE42) << QChar(0xFF5B) << QChar(0xFF5D)
- << QChar(0xFE35) << QChar(0xFE36) << QChar(0xFF08) << QChar(0xFF09)
- << QChar(0xFE4F) << QChar(0xFE34) << QChar(0xFE33);
- Q_Q(TCInputMethod);
- if (setCandidates(specialChars2, true)) {
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
- }
- q->inputContext()->setPreeditText(candidates[highlightIndex]);
- return true;
- }
- return false;
- }
-#endif
-
-#if QT_CONFIG(zhuyin)
- bool composeZhuyin(QVirtualKeyboardInputContext *ic, const QChar &c)
- {
- if (ZhuyinTable::isTone(c)) {
- if (input.isEmpty())
- // Tones are accepted only when there's text in composing.
- return false;
-
- auto strippedTones = ZhuyinTable::stripTones(input);
- if (!strippedTones.ok)
- // Tones cannot be composed if there's no syllables.
- return false;
-
- // Replace the original tone with the new tone, but the default tone
- // character should not be composed into the composing text.
- QChar tone = strippedTones.pair[1].at(0);
- if (c == ZhuyinTable::DEFAULT_TONE) {
- if (tone != ZhuyinTable::DEFAULT_TONE)
- input.remove(input.length() - 1, 1);
- } else {
- if (tone == ZhuyinTable::DEFAULT_TONE)
- input.append(c);
- else
- input.replace(input.length() - 1, 1, c);
- }
- } else if (ZhuyinTable::getInitials(c) > 0) {
- // Insert the initial or replace the original initial.
- if (input.isEmpty() || !ZhuyinTable::getInitials(input.at(0)))
- input.insert(0, c);
- else
- input.replace(0, 1, c);
- } else if (ZhuyinTable::getFinals(QStringView(&c, 1)) > 0) {
- // Replace the finals in the decomposed of syllables and tones.
- std::array<QChar, 4> decomposed = decomposeZhuyin();
- if (ZhuyinTable::isYiWuYuFinals(c)) {
- decomposed[1] = c;
- } else {
- decomposed[2] = c;
- }
-
- // Compose back the text after the finals replacement.
- input.clear();
- for (QChar ch : decomposed) {
- if (!ch.isNull())
- input.append(ch);
- }
- } else {
- return false;
- }
-
- ic->setPreeditText(input);
- if (setCandidates(wordDictionary->getWords(input), true)) {
- Q_Q(TCInputMethod);
- emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
- }
-
- return true;
- }
-
- std::array<QChar, 4> decomposeZhuyin()
- {
- std::array<QChar, 4> results = {};
- auto strippedTones = ZhuyinTable::stripTones(input);
- if (strippedTones.ok) {
- // Decompose tones.
- QChar tone = strippedTones.pair[1].at(0);
- if (tone != ZhuyinTable::DEFAULT_TONE)
- results[3] = tone;
-
- // Decompose initials.
- QStringView syllables = strippedTones.pair[0];
- if (ZhuyinTable::getInitials(syllables.at(0)) > 0) {
- results[0] = syllables.at(0);
- syllables = syllables.mid(1);
- }
-
- // Decompose finals.
- if (!syllables.isEmpty()) {
- if (ZhuyinTable::isYiWuYuFinals(syllables.at(0))) {
- results[1] = syllables.at(0);
- if (syllables.length() > 1)
- results[2] = syllables.at(1);
- } else {
- results[2] = syllables.at(0);
- }
- }
- }
- return results;
- }
-#endif
-
- TCInputMethod *q_ptr;
- QVirtualKeyboardInputEngine::InputMode inputMode;
-#if QT_CONFIG(cangjie)
- CangjieDictionary cangjieDictionary;
-#endif
-#if QT_CONFIG(zhuyin)
- ZhuyinDictionary zhuyinDictionary;
-#endif
- PhraseDictionary phraseDictionary;
- WordDictionary *wordDictionary;
- QString input;
- QStringList candidates;
- int highlightIndex;
-};
-
-/*!
- \class QtVirtualKeyboard::TCInputMethod
- \internal
-*/
-
-TCInputMethod::TCInputMethod(QObject *parent) :
- QVirtualKeyboardAbstractInputMethod(parent),
- d_ptr(new TCInputMethodPrivate(this))
-{
-}
-
-TCInputMethod::~TCInputMethod()
-{
-}
-
-bool TCInputMethod::simplified() const
-{
-#if QT_CONFIG(cangjie)
- Q_D(const TCInputMethod);
- return d->cangjieDictionary.simplified();
-#else
- return false;
-#endif
-}
-
-void TCInputMethod::setSimplified(bool simplified)
-{
- qCDebug(lcTCIme) << "TCInputMethod::setSimplified(): " << simplified;
-#if QT_CONFIG(cangjie)
- Q_D(TCInputMethod);
- if (d->cangjieDictionary.simplified() != simplified) {
- d->reset();
- QVirtualKeyboardInputContext *ic = inputContext();
- if (ic)
- ic->clear();
- d->cangjieDictionary.setSimplified(simplified);
- emit simplifiedChanged();
- }
-#else
- Q_UNUSED(simplified);
-#endif
-}
-
-QList<QVirtualKeyboardInputEngine::InputMode> TCInputMethod::inputModes(const QString &locale)
-{
- Q_UNUSED(locale);
- return QList<QVirtualKeyboardInputEngine::InputMode>()
-#if QT_CONFIG(zhuyin)
- << QVirtualKeyboardInputEngine::InputMode::Zhuyin
-#endif
-#if QT_CONFIG(cangjie)
- << QVirtualKeyboardInputEngine::InputMode::Cangjie
-#endif
- ;
-}
-
-bool TCInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale);
- Q_D(TCInputMethod);
- if (d->inputMode == inputMode)
- return true;
- update();
- bool result = false;
- d->inputMode = inputMode;
- d->wordDictionary = nullptr;
-#if QT_CONFIG(cangjie)
- if (inputMode == QVirtualKeyboardInputEngine::InputMode::Cangjie) {
- if (d->cangjieDictionary.isEmpty()) {
- QString cangjieDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_CANGJIE_DICTIONARY"));
- if (!QFileInfo::exists(cangjieDictionary)) {
- cangjieDictionary = QLatin1String(":///QtQuick/VirtualKeyboard/3rdparty/tcime/data/qt/dict_cangjie.dat");
- if (!QFileInfo::exists(cangjieDictionary))
- cangjieDictionary = QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/tcime/dict_cangjie.dat");
- }
- d->cangjieDictionary.load(cangjieDictionary);
- }
- d->wordDictionary = &d->cangjieDictionary;
- }
-#endif
-#if QT_CONFIG(zhuyin)
- if (inputMode == QVirtualKeyboardInputEngine::InputMode::Zhuyin) {
- if (d->zhuyinDictionary.isEmpty()) {
- QString zhuyinDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_ZHUYIN_DICTIONARY"));
- if (!QFileInfo::exists(zhuyinDictionary)) {
- zhuyinDictionary = QLatin1String(":///QtQuick/VirtualKeyboard/3rdparty/tcime/data/qt/dict_zhuyin.dat");
- if (!QFileInfo::exists(zhuyinDictionary))
- zhuyinDictionary = QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/tcime/dict_zhuyin.dat");
- }
- d->zhuyinDictionary.load(zhuyinDictionary);
- }
- d->wordDictionary = &d->zhuyinDictionary;
- }
-#endif
- result = d->wordDictionary && !d->wordDictionary->isEmpty();
- if (result && d->phraseDictionary.isEmpty()) {
- QString phraseDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_PHRASE_DICTIONARY"));
- if (!QFileInfo::exists(phraseDictionary)) {
- phraseDictionary = QLatin1String(":///QtQuick/VirtualKeyboard/3rdparty/tcime/data/qt/dict_phrases.dat");
- if (!QFileInfo::exists(phraseDictionary))
- phraseDictionary = QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/tcime/dict_phrases.dat");
- }
- d->phraseDictionary.load(phraseDictionary);
- }
- if (!result)
- inputMode = QVirtualKeyboardInputEngine::InputMode::Latin;
- return result;
-}
-
-bool TCInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase);
- return true;
-}
-
-bool TCInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
-{
- Q_UNUSED(key);
- Q_UNUSED(text);
- Q_UNUSED(modifiers);
- Q_D(TCInputMethod);
- QVirtualKeyboardInputContext *ic = inputContext();
- bool accept = false;
- switch (key) {
- case Qt::Key_Context1:
- // Do nothing on symbol mode switch
- accept = true;
- break;
-
- case Qt::Key_Enter:
- case Qt::Key_Return:
- update();
- break;
-
- case Qt::Key_Tab:
- case Qt::Key_Space:
- if (!d->input.isEmpty()) {
- accept = true;
- if (d->highlightIndex >= 0) {
- QString finalWord = d->pickHighlighted();
- d->reset();
- inputContext()->commit(finalWord);
- if (d->setCandidates(d->phraseDictionary.getWords(finalWord.left(1)), false)) {
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
- }
- }
- } else {
- update();
- }
- break;
-
- case Qt::Key_Backspace:
- if (!d->input.isEmpty()) {
- d->input.remove(d->input.length() - 1, 1);
- ic->setPreeditText(d->input);
-#if QT_CONFIG(cangjie)
- if (!d->checkSpecialCharInput()) {
-#endif
- if (d->setCandidates(d->wordDictionary->getWords(d->input), true)) {
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
- }
-#if QT_CONFIG(cangjie)
- }
-#endif
- accept = true;
- } else if (d->clearCandidates()) {
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
- }
- break;
-
- default:
- if (text.length() == 1)
- accept = d->compose(text.at(0));
- if (!accept)
- update();
- break;
- }
- return accept;
-}
-
-QList<QVirtualKeyboardSelectionListModel::Type> TCInputMethod::selectionLists()
-{
- return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
-}
-
-int TCInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
-{
- Q_UNUSED(type);
- Q_D(TCInputMethod);
- return d->candidates.count();
-}
-
-QVariant TCInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
-{
- QVariant result;
- Q_D(TCInputMethod);
- switch (role) {
- case QVirtualKeyboardSelectionListModel::Role::Display:
- result = QVariant(d->candidates.at(index));
- break;
- case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
- result.setValue(0);
- break;
- default:
- result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
- break;
- }
- return result;
-}
-
-void TCInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
-{
- Q_UNUSED(type);
- Q_D(TCInputMethod);
- QString finalWord = d->candidates.at(index);
- reset();
- inputContext()->commit(finalWord);
- if (d->setCandidates(d->phraseDictionary.getWords(finalWord.left(1)), false)) {
- emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
- emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
- }
-}
-
-void TCInputMethod::reset()
-{
- Q_D(TCInputMethod);
- d->reset();
-}
-
-void TCInputMethod::update()
-{
- Q_D(TCInputMethod);
- if (d->highlightIndex >= 0) {
- QString finalWord = d->pickHighlighted();
- d->reset();
- inputContext()->commit(finalWord);
- } else {
- inputContext()->clear();
- d->reset();
- }
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/tcime/plugin/tcinputmethod_p.h b/src/plugins/tcime/plugin/tcinputmethod_p.h
deleted file mode 100644
index cdfe8525..00000000
--- a/src/plugins/tcime/plugin/tcinputmethod_p.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TCINPUTMETHOD_P_H
-#define TCINPUTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtVirtualKeyboard/private/qvirtualkeyboard_global_p.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class TCInputMethodPrivate;
-
-class TCInputMethod : public QVirtualKeyboardAbstractInputMethod
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(TCInputMethod)
- Q_PROPERTY(bool simplified READ simplified WRITE setSimplified NOTIFY simplifiedChanged)
-
-public:
- explicit TCInputMethod(QObject *parent = nullptr);
- ~TCInputMethod();
-
- bool simplified() const;
- void setSimplified(bool simplified);
-
- QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
- bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
- bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
-
- QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
- int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
- QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
- QVirtualKeyboardSelectionListModel::Role role) override;
- void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
-
- void reset() override;
- void update() override;
-
-signals:
- void simplifiedChanged();
-
-private:
- QScopedPointer<TCInputMethodPrivate> d_ptr;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/tcime/tcime.pro b/src/plugins/tcime/tcime.pro
deleted file mode 100644
index 558d431a..00000000
--- a/src/plugins/tcime/tcime.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- 3rdparty/tcime \
- plugin
-
-plugin.depends += 3rdparty/tcime
diff --git a/src/plugins/tcime/tcinputmethod.cpp b/src/plugins/tcime/tcinputmethod.cpp
new file mode 100644
index 00000000..c887062a
--- /dev/null
+++ b/src/plugins/tcime/tcinputmethod.cpp
@@ -0,0 +1,530 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "tcinputmethod_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+#if QT_CONFIG(cangjie)
+#include "cangjiedictionary.h"
+#include "cangjietable.h"
+#endif
+#if QT_CONFIG(zhuyin)
+#include "zhuyindictionary.h"
+#include "zhuyintable.h"
+#endif
+#include "phrasedictionary.h"
+#include <QLoggingCategory>
+
+#include <QLibraryInfo>
+#include <QFileInfo>
+
+#include <array>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+Q_LOGGING_CATEGORY(lcTCIme, "qt.virtualkeyboard.tcime")
+
+using namespace tcime;
+
+class TCInputMethodPrivate
+{
+ Q_DECLARE_PUBLIC(TCInputMethod)
+public:
+
+ TCInputMethodPrivate(TCInputMethod *q_ptr) :
+ q_ptr(q_ptr),
+ inputMode(QVirtualKeyboardInputEngine::InputMode::Latin),
+ wordDictionary(nullptr),
+ highlightIndex(-1)
+ {}
+
+ bool setCandidates(const QStringList &values, bool highlightDefault)
+ {
+ bool candidatesChanged = candidates != values;
+ candidates = values;
+ highlightIndex = !candidates.isEmpty() && highlightDefault ? 0 : -1;
+ return candidatesChanged;
+ }
+
+ bool clearCandidates()
+ {
+ if (candidates.isEmpty())
+ return false;
+
+ candidates.clear();
+ highlightIndex = -1;
+ return true;
+ }
+
+ QString pickHighlighted() const
+ {
+ return (highlightIndex >= 0 && highlightIndex < candidates.size()) ? candidates[highlightIndex] : QString();
+ }
+
+ void reset()
+ {
+ if (clearCandidates()) {
+ Q_Q(TCInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
+ }
+ input.clear();
+ }
+
+ bool compose(const QChar &c)
+ {
+ bool accept;
+ Q_Q(TCInputMethod);
+ QVirtualKeyboardInputContext *ic = q->inputContext();
+ switch (inputMode)
+ {
+#if QT_CONFIG(cangjie)
+ case QVirtualKeyboardInputEngine::InputMode::Cangjie:
+ accept = composeCangjie(ic, c);
+ break;
+#endif
+#if QT_CONFIG(zhuyin)
+ case QVirtualKeyboardInputEngine::InputMode::Zhuyin:
+ accept = composeZhuyin(ic, c);
+ break;
+#endif
+ default:
+ accept = false;
+ break;
+ }
+ return accept;
+ }
+
+#if QT_CONFIG(cangjie)
+ bool composeCangjie(QVirtualKeyboardInputContext *ic, const QChar &c)
+ {
+ bool accept = false;
+ if (!input.contains(QChar(0x91CD)) && CangjieTable::isLetter(c)) {
+ if (input.size() < (cangjieDictionary.simplified() ? CangjieTable::MAX_SIMPLIFIED_CODE_LENGTH : CangjieTable::MAX_CODE_LENGTH)) {
+ input.append(c);
+ ic->setPreeditText(input);
+ if (setCandidates(wordDictionary->getWords(input), true)) {
+ Q_Q(TCInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
+ }
+ }
+ accept = true;
+ } else if (c.unicode() == 0x91CD) {
+ if (input.isEmpty()) {
+ input.append(c);
+ ic->setPreeditText(input);
+ checkSpecialCharInput();
+ }
+ accept = true;
+ } else if (c.unicode() == 0x96E3) {
+ if (input.size() == 1) {
+ Q_ASSERT(input.at(0).unicode() == 0x91CD);
+ input.append(c);
+ ic->setPreeditText(input);
+ checkSpecialCharInput();
+ }
+ accept = true;
+ }
+ return accept;
+ }
+
+ bool checkSpecialCharInput()
+ {
+ if (input.size() == 1 && input.at(0).unicode() == 0x91CD) {
+ static const QStringList specialChars1 = QStringList()
+ << QChar(0xFF01) << QChar(0x2018) << QChar(0x3000) << QChar(0xFF0C)
+ << QChar(0x3001) << QChar(0x3002) << QChar(0xFF0E) << QChar(0xFF1B)
+ << QChar(0xFF1A) << QChar(0xFF1F) << QChar(0x300E) << QChar(0x300F)
+ << QChar(0x3010) << QChar(0x3011) << QChar(0xFE57) << QChar(0x2026)
+ << QChar(0x2025) << QChar(0xFE50) << QChar(0xFE51) << QChar(0xFE52)
+ << QChar(0x00B7) << QChar(0xFE54) << QChar(0x2574) << QChar(0x2027)
+ << QChar(0x2032) << QChar(0x2035) << QChar(0x301E) << QChar(0x301D)
+ << QChar(0x201D) << QChar(0x201C) << QChar(0x2019) << QChar(0xFE55)
+ << QChar(0xFE5D) << QChar(0xFE5E) << QChar(0xFE59) << QChar(0xFE5A)
+ << QChar(0xFE5B) << QChar(0xFE5C) << QChar(0xFE43) << QChar(0xFE44);
+ Q_Q(TCInputMethod);
+ if (setCandidates(specialChars1, true)) {
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
+ }
+ q->inputContext()->setPreeditText(candidates[highlightIndex]);
+ return true;
+ } else if (input.size() == 2 && input.at(0).unicode() == 0x91CD && input.at(1).unicode() == 0x96E3) {
+ static const QStringList specialChars2 = QStringList()
+ << QChar(0x3008) << QChar(0x3009) << QChar(0xFE31) << QChar(0x2013)
+ << QChar(0xFF5C) << QChar(0x300C) << QChar(0x300D) << QChar(0xFE40)
+ << QChar(0xFE3F) << QChar(0x2014) << QChar(0xFE3E) << QChar(0xFE3D)
+ << QChar(0x300A) << QChar(0x300B) << QChar(0xFE3B) << QChar(0xFE3C)
+ << QChar(0xFE56) << QChar(0xFE30) << QChar(0xFE39) << QChar(0xFE3A)
+ << QChar(0x3014) << QChar(0x3015) << QChar(0xFE37) << QChar(0xFE38)
+ << QChar(0xFE41) << QChar(0xFE42) << QChar(0xFF5B) << QChar(0xFF5D)
+ << QChar(0xFE35) << QChar(0xFE36) << QChar(0xFF08) << QChar(0xFF09)
+ << QChar(0xFE4F) << QChar(0xFE34) << QChar(0xFE33);
+ Q_Q(TCInputMethod);
+ if (setCandidates(specialChars2, true)) {
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
+ }
+ q->inputContext()->setPreeditText(candidates[highlightIndex]);
+ return true;
+ }
+ return false;
+ }
+#endif
+
+#if QT_CONFIG(zhuyin)
+ bool composeZhuyin(QVirtualKeyboardInputContext *ic, const QChar &c)
+ {
+ if (ZhuyinTable::isTone(c)) {
+ if (input.isEmpty())
+ // Tones are accepted only when there's text in composing.
+ return false;
+
+ auto strippedTones = ZhuyinTable::stripTones(input);
+ if (!strippedTones.ok)
+ // Tones cannot be composed if there's no syllables.
+ return false;
+
+ // Replace the original tone with the new tone, but the default tone
+ // character should not be composed into the composing text.
+ QChar tone = strippedTones.pair[1].at(0);
+ if (c == ZhuyinTable::DEFAULT_TONE) {
+ if (tone != ZhuyinTable::DEFAULT_TONE)
+ input.remove(input.size() - 1, 1);
+ } else {
+ if (tone == ZhuyinTable::DEFAULT_TONE)
+ input.append(c);
+ else
+ input.replace(input.size() - 1, 1, c);
+ }
+ } else if (ZhuyinTable::getInitials(c) > 0) {
+ // Insert the initial or replace the original initial.
+ if (input.isEmpty() || !ZhuyinTable::getInitials(input.at(0)))
+ input.insert(0, c);
+ else
+ input.replace(0, 1, c);
+ } else if (ZhuyinTable::getFinals(QStringView(&c, 1)) > 0) {
+ // Replace the finals in the decomposed of syllables and tones.
+ std::array<QChar, 4> decomposed = decomposeZhuyin();
+ if (ZhuyinTable::isYiWuYuFinals(c)) {
+ decomposed[1] = c;
+ } else {
+ decomposed[2] = c;
+ }
+
+ // Compose back the text after the finals replacement.
+ input.clear();
+ for (QChar ch : decomposed) {
+ if (!ch.isNull())
+ input.append(ch);
+ }
+ } else {
+ return false;
+ }
+
+ ic->setPreeditText(input);
+ if (setCandidates(wordDictionary->getWords(input), true)) {
+ Q_Q(TCInputMethod);
+ emit q->selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit q->selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, highlightIndex);
+ }
+
+ return true;
+ }
+
+ std::array<QChar, 4> decomposeZhuyin()
+ {
+ std::array<QChar, 4> results = {};
+ auto strippedTones = ZhuyinTable::stripTones(input);
+ if (strippedTones.ok) {
+ // Decompose tones.
+ QChar tone = strippedTones.pair[1].at(0);
+ if (tone != ZhuyinTable::DEFAULT_TONE)
+ results[3] = tone;
+
+ // Decompose initials.
+ QStringView syllables = strippedTones.pair[0];
+ if (ZhuyinTable::getInitials(syllables.at(0)) > 0) {
+ results[0] = syllables.at(0);
+ syllables = syllables.mid(1);
+ }
+
+ // Decompose finals.
+ if (!syllables.isEmpty()) {
+ if (ZhuyinTable::isYiWuYuFinals(syllables.at(0))) {
+ results[1] = syllables.at(0);
+ if (syllables.size() > 1)
+ results[2] = syllables.at(1);
+ } else {
+ results[2] = syllables.at(0);
+ }
+ }
+ }
+ return results;
+ }
+#endif
+
+ TCInputMethod *q_ptr;
+ QVirtualKeyboardInputEngine::InputMode inputMode;
+#if QT_CONFIG(cangjie)
+ CangjieDictionary cangjieDictionary;
+#endif
+#if QT_CONFIG(zhuyin)
+ ZhuyinDictionary zhuyinDictionary;
+#endif
+ PhraseDictionary phraseDictionary;
+ WordDictionary *wordDictionary;
+ QString input;
+ QStringList candidates;
+ int highlightIndex;
+};
+
+/*!
+ \class QtVirtualKeyboard::TCInputMethod
+ \internal
+*/
+
+TCInputMethod::TCInputMethod(QObject *parent) :
+ QVirtualKeyboardAbstractInputMethod(parent),
+ d_ptr(new TCInputMethodPrivate(this))
+{
+}
+
+TCInputMethod::~TCInputMethod()
+{
+}
+
+bool TCInputMethod::simplified() const
+{
+#if QT_CONFIG(cangjie)
+ Q_D(const TCInputMethod);
+ return d->cangjieDictionary.simplified();
+#else
+ return false;
+#endif
+}
+
+void TCInputMethod::setSimplified(bool simplified)
+{
+ qCDebug(lcTCIme) << "TCInputMethod::setSimplified(): " << simplified;
+#if QT_CONFIG(cangjie)
+ Q_D(TCInputMethod);
+ if (d->cangjieDictionary.simplified() != simplified) {
+ d->reset();
+ QVirtualKeyboardInputContext *ic = inputContext();
+ if (ic)
+ ic->clear();
+ d->cangjieDictionary.setSimplified(simplified);
+ emit simplifiedChanged();
+ }
+#else
+ Q_UNUSED(simplified);
+#endif
+}
+
+QList<QVirtualKeyboardInputEngine::InputMode> TCInputMethod::inputModes(const QString &locale)
+{
+ Q_UNUSED(locale);
+ return QList<QVirtualKeyboardInputEngine::InputMode>()
+#if QT_CONFIG(zhuyin)
+ << QVirtualKeyboardInputEngine::InputMode::Zhuyin
+#endif
+#if QT_CONFIG(cangjie)
+ << QVirtualKeyboardInputEngine::InputMode::Cangjie
+#endif
+ ;
+}
+
+bool TCInputMethod::setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(locale);
+ Q_D(TCInputMethod);
+ if (d->inputMode == inputMode)
+ return true;
+ update();
+ bool result = false;
+ d->inputMode = inputMode;
+ d->wordDictionary = nullptr;
+#if QT_CONFIG(cangjie)
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::Cangjie) {
+ if (d->cangjieDictionary.isEmpty()) {
+ QString cangjieDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_CANGJIE_DICTIONARY"));
+ if (!QFileInfo::exists(cangjieDictionary)) {
+ cangjieDictionary = QLibraryInfo::path(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/tcime/dict_cangjie.dat");
+ if (!QFileInfo::exists(cangjieDictionary))
+ cangjieDictionary = QLatin1String(":/qt-project.org/imports/QtQuick/VirtualKeyboard/3rdparty/tcime/data/qt/dict_cangjie.dat");
+ }
+ d->cangjieDictionary.load(cangjieDictionary);
+ }
+ d->wordDictionary = &d->cangjieDictionary;
+ }
+#endif
+#if QT_CONFIG(zhuyin)
+ if (inputMode == QVirtualKeyboardInputEngine::InputMode::Zhuyin) {
+ if (d->zhuyinDictionary.isEmpty()) {
+ QString zhuyinDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_ZHUYIN_DICTIONARY"));
+ if (!QFileInfo::exists(zhuyinDictionary)) {
+ zhuyinDictionary = QLibraryInfo::path(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/tcime/dict_zhuyin.dat");
+ if (!QFileInfo::exists(zhuyinDictionary))
+ zhuyinDictionary = QLatin1String(":/qt-project.org/imports/QtQuick/VirtualKeyboard/3rdparty/tcime/data/qt/dict_zhuyin.dat");
+ }
+ d->zhuyinDictionary.load(zhuyinDictionary);
+ }
+ d->wordDictionary = &d->zhuyinDictionary;
+ }
+#endif
+ result = d->wordDictionary && !d->wordDictionary->isEmpty();
+ if (result && d->phraseDictionary.isEmpty()) {
+ QString phraseDictionary(qEnvironmentVariable("QT_VIRTUALKEYBOARD_PHRASE_DICTIONARY"));
+ if (!QFileInfo::exists(phraseDictionary)) {
+ phraseDictionary = QLibraryInfo::path(QLibraryInfo::DataPath) + QLatin1String("/qtvirtualkeyboard/tcime/dict_phrases.dat");
+ if (!QFileInfo::exists(phraseDictionary))
+ phraseDictionary = QLatin1String(":/qt-project.org/imports/QtQuick/VirtualKeyboard/3rdparty/tcime/data/qt/dict_phrases.dat");
+ }
+ d->phraseDictionary.load(phraseDictionary);
+ }
+ if (!result)
+ inputMode = QVirtualKeyboardInputEngine::InputMode::Latin;
+ return result;
+}
+
+bool TCInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase);
+ return true;
+}
+
+bool TCInputMethod::keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers)
+{
+ Q_UNUSED(key);
+ Q_UNUSED(text);
+ Q_UNUSED(modifiers);
+ Q_D(TCInputMethod);
+ QVirtualKeyboardInputContext *ic = inputContext();
+ bool accept = false;
+ switch (key) {
+ case Qt::Key_Context1:
+ // Do nothing on symbol mode switch
+ accept = true;
+ break;
+
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ update();
+ break;
+
+ case Qt::Key_Tab:
+ case Qt::Key_Space:
+ if (!d->input.isEmpty()) {
+ accept = true;
+ if (d->highlightIndex >= 0) {
+ QString finalWord = d->pickHighlighted();
+ d->reset();
+ inputContext()->commit(finalWord);
+ if (d->setCandidates(d->phraseDictionary.getWords(finalWord.left(1)), false)) {
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
+ }
+ }
+ } else {
+ update();
+ }
+ break;
+
+ case Qt::Key_Backspace:
+ if (!d->input.isEmpty()) {
+ d->input.remove(d->input.size() - 1, 1);
+ ic->setPreeditText(d->input);
+#if QT_CONFIG(cangjie)
+ if (!d->checkSpecialCharInput()) {
+#endif
+ if (d->setCandidates(d->wordDictionary->getWords(d->input), true)) {
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
+ }
+#if QT_CONFIG(cangjie)
+ }
+#endif
+ accept = true;
+ } else if (d->clearCandidates()) {
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
+ }
+ break;
+
+ default:
+ if (text.size() == 1)
+ accept = d->compose(text.at(0));
+ if (!accept)
+ update();
+ break;
+ }
+ return accept;
+}
+
+QList<QVirtualKeyboardSelectionListModel::Type> TCInputMethod::selectionLists()
+{
+ return QList<QVirtualKeyboardSelectionListModel::Type>() << QVirtualKeyboardSelectionListModel::Type::WordCandidateList;
+}
+
+int TCInputMethod::selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type)
+{
+ Q_UNUSED(type);
+ Q_D(TCInputMethod);
+ return d->candidates.size();
+}
+
+QVariant TCInputMethod::selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role)
+{
+ QVariant result;
+ Q_D(TCInputMethod);
+ switch (role) {
+ case QVirtualKeyboardSelectionListModel::Role::Display:
+ result = QVariant(d->candidates.at(index));
+ break;
+ case QVirtualKeyboardSelectionListModel::Role::WordCompletionLength:
+ result.setValue(0);
+ break;
+ default:
+ result = QVirtualKeyboardAbstractInputMethod::selectionListData(type, index, role);
+ break;
+ }
+ return result;
+}
+
+void TCInputMethod::selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index)
+{
+ Q_UNUSED(type);
+ Q_D(TCInputMethod);
+ QString finalWord = d->candidates.at(index);
+ reset();
+ inputContext()->commit(finalWord);
+ if (d->setCandidates(d->phraseDictionary.getWords(finalWord.left(1)), false)) {
+ emit selectionListChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList);
+ emit selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type::WordCandidateList, d->highlightIndex);
+ }
+}
+
+void TCInputMethod::reset()
+{
+ Q_D(TCInputMethod);
+ d->reset();
+}
+
+void TCInputMethod::update()
+{
+ Q_D(TCInputMethod);
+ if (d->highlightIndex >= 0) {
+ QString finalWord = d->pickHighlighted();
+ d->reset();
+ inputContext()->commit(finalWord);
+ } else {
+ inputContext()->clear();
+ d->reset();
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/tcime/tcinputmethod_p.h b/src/plugins/tcime/tcinputmethod_p.h
new file mode 100644
index 00000000..eee0278e
--- /dev/null
+++ b/src/plugins/tcime/tcinputmethod_p.h
@@ -0,0 +1,66 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TCINPUTMETHOD_P_H
+#define TCINPUTMETHOD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/private/qvirtualkeyboard_global_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class TCInputMethodPrivate;
+
+class TCInputMethod : public QVirtualKeyboardAbstractInputMethod
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(TCInputMethod)
+ Q_PROPERTY(bool simplified READ simplified WRITE setSimplified NOTIFY simplifiedChanged)
+ QML_ELEMENT
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit TCInputMethod(QObject *parent = nullptr);
+ ~TCInputMethod();
+
+ bool simplified() const;
+ void setSimplified(bool simplified);
+
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+
+ QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
+ int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
+ QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
+ QVirtualKeyboardSelectionListModel::Role role) override;
+ void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
+
+ void reset() override;
+ void update() override;
+
+signals:
+ void simplifiedChanged();
+
+private:
+ QScopedPointer<TCInputMethodPrivate> d_ptr;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/thai/CMakeLists.txt b/src/plugins/thai/CMakeLists.txt
index c70b9a73..64b7b440 100644
--- a/src/plugins/thai/CMakeLists.txt
+++ b/src/plugins/thai/CMakeLists.txt
@@ -1,3 +1,52 @@
-# Generated from thai.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-add_subdirectory(plugin)
+#####################################################################
+## QtVirtualKeyboardThaiPlugin Plugin:
+#####################################################################
+
+qt_internal_add_qml_module(qtvkbthaiplugin
+ URI "QtQuick.VirtualKeyboard.Plugins.Thai"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2
+ PLUGIN_TARGET qtvkbthaiplugin
+ NO_PLUGIN_OPTIONAL
+ DEPENDENCIES
+ QtQuick.VirtualKeyboard/auto
+ SOURCES
+ thaiinputmethod.cpp thaiinputmethod_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::VirtualKeyboard
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# Resources:
+set(qmake_virtualkeyboard_thai_layouts_resource_files
+ "${VKB_LAYOUTS_BASE}/th_TH/dialpad.fallback"
+ "${VKB_LAYOUTS_BASE}/th_TH/digits.fallback"
+ "${VKB_LAYOUTS_BASE}/th_TH/main.qml"
+ "${VKB_LAYOUTS_BASE}/th_TH/numbers.fallback"
+ "${VKB_LAYOUTS_BASE}/th_TH/symbols.qml"
+)
+
+qt_internal_add_resource(qtvkbthaiplugin "qmake_virtualkeyboard_thai_layouts"
+ PREFIX
+ "${VKB_LAYOUTS_PREFIX}"
+ BASE
+ "${VKB_LAYOUTS_BASE}"
+ FILES
+ ${qmake_virtualkeyboard_thai_layouts_resource_files}
+)
+
+qt_internal_extend_target(qtvkbthaiplugin CONDITION QT_FEATURE_hunspell
+ LIBRARIES
+ Qt::HunspellInputMethodPrivate
+)
diff --git a/src/plugins/thai/plugin/.prev_CMakeLists.txt b/src/plugins/thai/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index 36694722..00000000
--- a/src/plugins/thai/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardThaiPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardThaiPlugin
- OUTPUT_NAME qtvirtualkeyboard_thai
- TYPE virtualkeyboard
- SOURCES
- thaiinputmethod.cpp thaiinputmethod_p.h
- thaiplugin.cpp thaiplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
-)
-
-# Resources:
-set(qmake_virtualkeyboard_thai_layouts_resource_files
- "virtualkeyboard/content/layouts/th_TH/dialpad.fallback"
- "virtualkeyboard/content/layouts/th_TH/digits.fallback"
- "virtualkeyboard/content/layouts/th_TH/main.qml"
- "virtualkeyboard/content/layouts/th_TH/numbers.fallback"
- "virtualkeyboard/content/layouts/th_TH/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardThaiPlugin "qmake_virtualkeyboard_thai_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- BASE
- "$$LAYOUTS_BASE"
- FILES
- ${qmake_virtualkeyboard_thai_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "thai.json" "$$LAYOUT_FILES"
-# QT_FOR_CONFIG = "virtualkeyboard-private"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QtVirtualKeyboardThaiPlugin CONDITION QT_FEATURE_hunspell
- PUBLIC_LIBRARIES
- Qt::HunspellInputMethodPrivate
-)
-
-#### Keys ignored in scope 3:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Thai (Qt $$QT_VERSION)"
diff --git a/src/plugins/thai/plugin/CMakeLists.txt b/src/plugins/thai/plugin/CMakeLists.txt
deleted file mode 100644
index 846e1ea0..00000000
--- a/src/plugins/thai/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-# Generated from plugin.pro.
-
-#####################################################################
-## QtVirtualKeyboardThaiPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QtVirtualKeyboardThaiPlugin
- OUTPUT_NAME qtvirtualkeyboard_thai
- TYPE virtualkeyboard
- SOURCES
- thaiinputmethod.cpp thaiinputmethod_p.h
- thaiplugin.cpp thaiplugin.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::VirtualKeyboard
-)
-
-# Resources:
-set(qmake_virtualkeyboard_thai_layouts_resource_files
- "virtualkeyboard/content/layouts/th_TH/dialpad.fallback"
- "virtualkeyboard/content/layouts/th_TH/digits.fallback"
- "virtualkeyboard/content/layouts/th_TH/main.qml"
- "virtualkeyboard/content/layouts/th_TH/numbers.fallback"
- "virtualkeyboard/content/layouts/th_TH/symbols.qml"
-)
-
-qt_add_resource(QtVirtualKeyboardThaiPlugin "qmake_virtualkeyboard_thai_layouts"
- PREFIX
- "${VKB_LAYOUTS_PREFIX}" #special case
- BASE
- "${VKB_LAYOUTS_BASE}" #special case
- FILES
- ${qmake_virtualkeyboard_thai_layouts_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:plugin.pro:<TRUE>:
-# OTHER_FILES = "thai.json" "$$LAYOUT_FILES"
-# QT_FOR_CONFIG = "virtualkeyboard-private"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QtVirtualKeyboardThaiPlugin CONDITION QT_FEATURE_hunspell
- PUBLIC_LIBRARIES
- Qt::HunspellInputMethodPrivate
-)
-
-#### Keys ignored in scope 3:.:.:plugin.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Thai (Qt $$QT_VERSION)"
diff --git a/src/plugins/thai/plugin/plugin.pro b/src/plugins/thai/plugin/plugin.pro
deleted file mode 100644
index dd756029..00000000
--- a/src/plugins/thai/plugin/plugin.pro
+++ /dev/null
@@ -1,50 +0,0 @@
-TARGET = qtvirtualkeyboard_thai
-QT += qml virtualkeyboard
-
-QT_FOR_CONFIG += virtualkeyboard-private
-
-include(../../../shared.pri)
-
-HEADERS += \
- thaiinputmethod_p.h \
- thaiplugin.h
-SOURCES += \
- thaiinputmethod.cpp \
- thaiplugin.cpp
-OTHER_FILES += \
- thai.json
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-
-qtConfig(hunspell) {
- QT += hunspellinputmethod-private
-}
-
-LAYOUT_FILES += \
- $$LAYOUTS_BASE/content/layouts/th_TH/dialpad.fallback \
- $$LAYOUTS_BASE/content/layouts/th_TH/digits.fallback \
- $$LAYOUTS_BASE/content/layouts/th_TH/main.qml \
- $$LAYOUTS_BASE/content/layouts/th_TH/numbers.fallback \
- $$LAYOUTS_BASE/content/layouts/th_TH/symbols.qml
-
-OTHER_FILES += \
- $$LAYOUT_FILES
-
-virtualkeyboard_thai_layouts.files = $$LAYOUT_FILES
-virtualkeyboard_thai_layouts.base = $$LAYOUTS_BASE
-virtualkeyboard_thai_layouts.prefix = $$LAYOUTS_PREFIX
-RESOURCES += virtualkeyboard_thai_layouts
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard Thai (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard Extension for Qt."
-}
-
-PLUGIN_TYPE = virtualkeyboard
-PLUGIN_CLASS_NAME = QtVirtualKeyboardThaiPlugin
-load(qt_plugin)
diff --git a/src/plugins/thai/plugin/thai.json b/src/plugins/thai/plugin/thai.json
deleted file mode 100644
index aac036cb..00000000
--- a/src/plugins/thai/plugin/thai.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "Name": "thai",
- "Provider": "Qt Thai Extension",
- "InputMethod": "ThaiInputMethod",
- "Version": 100
-}
diff --git a/src/plugins/thai/plugin/thaiinputmethod.cpp b/src/plugins/thai/plugin/thaiinputmethod.cpp
deleted file mode 100644
index f4e9663e..00000000
--- a/src/plugins/thai/plugin/thaiinputmethod.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "thaiinputmethod_p.h"
-#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
-#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-/*!
- \class QtVirtualKeyboard::ThaiInputMethod
- \internal
-*/
-
-ThaiInputMethod::ThaiInputMethod(QObject *parent) :
- ThaiInputMethodBase(parent)
-{
-}
-
-#ifndef QT_HUNSPELLINPUTMETHOD_LIB
-QList<QVirtualKeyboardInputEngine::InputMode> ThaiInputMethod::inputModes(
- const QString &locale)
-{
- Q_UNUSED(locale);
- return QList<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::Latin;
-}
-
-bool ThaiInputMethod::setInputMode(const QString &locale,
- QVirtualKeyboardInputEngine::InputMode inputMode)
-{
- Q_UNUSED(locale);
- Q_UNUSED(inputMode);
- return true;
-}
-
-bool ThaiInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
-{
- Q_UNUSED(textCase);
- return true;
-}
-#endif
-
-bool ThaiInputMethod::keyEvent(Qt::Key key,
- const QString &text,
- Qt::KeyboardModifiers modifiers)
-{
- const bool isMark = text.length() == 2 && text.at(0) == QLatin1Char(' ');
-#ifdef QT_HUNSPELLINPUTMETHOD_LIB
- if (isMark) {
- const QString mark(text.right(1));
- return ThaiInputMethodBase::keyEvent(static_cast<Qt::Key>(mark.at(0).unicode()),
- mark, modifiers);
- }
- return ThaiInputMethodBase::keyEvent(key, text, modifiers);
-#else
- Q_UNUSED(key);
- if (isMark) {
- const QString mark(text.right(1));
- inputContext()->sendKeyClick(static_cast<Qt::Key>(mark.at(0).unicode()), mark, modifiers);
- return true;
- }
- return false;
-#endif
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/plugins/thai/plugin/thaiinputmethod_p.h b/src/plugins/thai/plugin/thaiinputmethod_p.h
deleted file mode 100644
index ef1dd547..00000000
--- a/src/plugins/thai/plugin/thaiinputmethod_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef THAIINPUTMETHOD_H
-#define THAIINPUTMETHOD_H
-
-#ifdef QT_HUNSPELLINPUTMETHOD_LIB
-#include <QtHunspellInputMethod/private/hunspellinputmethod_p.h>
-#define ThaiInputMethodBase HunspellInputMethod
-#else
-#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-#define ThaiInputMethodBase QVirtualKeyboardAbstractInputMethod
-#endif
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class ThaiInputMethodPrivate;
-
-class ThaiInputMethod : public ThaiInputMethodBase
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(ThaiInputMethod)
-public:
- explicit ThaiInputMethod(QObject *parent = nullptr);
-
-#ifndef QT_HUNSPELLINPUTMETHOD_LIB
- QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
- bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
- bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
-#endif
-
- bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/thai/plugin/thaiplugin.cpp b/src/plugins/thai/plugin/thaiplugin.cpp
deleted file mode 100644
index 1f9428fc..00000000
--- a/src/plugins/thai/plugin/thaiplugin.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "thaiplugin.h"
-#include "thaiinputmethod_p.h"
-#include <QtQml>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtVirtualKeyboardThaiPlugin::registerTypes(const char *uri) const
-{
- qmlRegisterType<ThaiInputMethod>(uri, 2, 3, "ThaiInputMethod");
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/thai/plugin/thaiplugin.h b/src/plugins/thai/plugin/thaiplugin.h
deleted file mode 100644
index 6af272cb..00000000
--- a/src/plugins/thai/plugin/thaiplugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef THAIPLUGIN_H
-#define THAIPLUGIN_H
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtVirtualKeyboardThaiPlugin : public QVirtualKeyboardExtensionPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QVirtualKeyboardExtensionPlugin)
- Q_PLUGIN_METADATA(IID QVirtualKeyboardExtensionPluginFactoryInterface_iid
- FILE "thai.json")
-public:
- void registerTypes(const char *uri) const override;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/thai/thai.pro b/src/plugins/thai/thai.pro
deleted file mode 100644
index b6e92972..00000000
--- a/src/plugins/thai/thai.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- plugin
diff --git a/src/plugins/thai/thaiinputmethod.cpp b/src/plugins/thai/thaiinputmethod.cpp
new file mode 100644
index 00000000..670b7958
--- /dev/null
+++ b/src/plugins/thai/thaiinputmethod.cpp
@@ -0,0 +1,68 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "thaiinputmethod_p.h"
+#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::ThaiInputMethod
+ \internal
+*/
+
+ThaiInputMethod::ThaiInputMethod(QObject *parent) :
+ ThaiInputMethodBase(parent)
+{
+}
+
+#ifndef QT_HUNSPELLINPUTMETHOD_LIB
+QList<QVirtualKeyboardInputEngine::InputMode> ThaiInputMethod::inputModes(
+ const QString &locale)
+{
+ Q_UNUSED(locale);
+ return QList<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::Latin;
+}
+
+bool ThaiInputMethod::setInputMode(const QString &locale,
+ QVirtualKeyboardInputEngine::InputMode inputMode)
+{
+ Q_UNUSED(locale);
+ Q_UNUSED(inputMode);
+ return true;
+}
+
+bool ThaiInputMethod::setTextCase(QVirtualKeyboardInputEngine::TextCase textCase)
+{
+ Q_UNUSED(textCase);
+ return true;
+}
+#endif
+
+bool ThaiInputMethod::keyEvent(Qt::Key key,
+ const QString &text,
+ Qt::KeyboardModifiers modifiers)
+{
+ const bool isMark = text.size() == 2 && text.at(0) == QLatin1Char(' ');
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+ if (isMark) {
+ const QString mark(text.right(1));
+ return ThaiInputMethodBase::keyEvent(static_cast<Qt::Key>(mark.at(0).unicode()),
+ mark, modifiers);
+ }
+ return ThaiInputMethodBase::keyEvent(key, text, modifiers);
+#else
+ Q_UNUSED(key);
+ if (isMark) {
+ const QString mark(text.right(1));
+ inputContext()->sendKeyClick(static_cast<Qt::Key>(mark.at(0).unicode()), mark, modifiers);
+ return true;
+ }
+ return false;
+#endif
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/plugins/thai/thaiinputmethod_p.h b/src/plugins/thai/thaiinputmethod_p.h
new file mode 100644
index 00000000..af1f4217
--- /dev/null
+++ b/src/plugins/thai/thaiinputmethod_p.h
@@ -0,0 +1,42 @@
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef THAIINPUTMETHOD_H
+#define THAIINPUTMETHOD_H
+
+#ifdef QT_HUNSPELLINPUTMETHOD_LIB
+#include <QtHunspellInputMethod/private/hunspellinputmethod_p.h>
+#define ThaiInputMethodBase HunspellInputMethod
+#else
+#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+#define ThaiInputMethodBase QVirtualKeyboardAbstractInputMethod
+#endif
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class ThaiInputMethodPrivate;
+
+class ThaiInputMethod : public ThaiInputMethodBase
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(ThaiInputMethod)
+ QML_ELEMENT
+ QML_ADDED_IN_VERSION(2, 0)
+
+public:
+ explicit ThaiInputMethod(QObject *parent = nullptr);
+
+#ifndef QT_HUNSPELLINPUTMETHOD_LIB
+ QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
+ bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
+ bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
+#endif
+
+ bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/settings/CMakeLists.txt b/src/settings/CMakeLists.txt
index 32da7913..7ac69291 100644
--- a/src/settings/CMakeLists.txt
+++ b/src/settings/CMakeLists.txt
@@ -1,34 +1,46 @@
-# Generated from settings.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## qtquickvirtualkeyboardsettingsplugin Plugin:
+## qtvkbsettingsplugin Plugin:
#####################################################################
-qt_add_qml_module(qtquickvirtualkeyboardsettingsplugin
+qt_internal_add_qml_module(VirtualKeyboardSettings
URI "QtQuick.VirtualKeyboard.Settings"
- VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}"
- CLASSNAME QtQuickVirtualKeyboardSettingsPlugin
- DEPENDENCIES
- QtQuick/2.0
- SKIP_TYPE_REGISTRATION
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2 1
+ PLUGIN_TARGET qtvkbsettingsplugin
+ NO_PLUGIN_OPTIONAL
SOURCES
- qtquickvirtualkeyboardsettingsplugin.cpp qtquickvirtualkeyboardsettingsplugin.h
- PUBLIC_LIBRARIES
+ qquickvirtualkeyboardsettings.cpp
+ qquickvirtualkeyboardsettings_p.h
+ DEFINES
+ QT_ASCII_CAST_WARNINGS
+ QT_NO_CAST_FROM_ASCII
+ QT_NO_CAST_FROM_BYTEARRAY
+ QT_NO_CAST_TO_ASCII
+ QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR="qrc:${VKB_LAYOUTS_PREFIX}"
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
Qt::VirtualKeyboardPrivate
+ NO_GENERATE_CPP_EXPORTS
)
-#### Keys ignored in scope 1:.:.:settings.pro:<TRUE>:
-# IMPORT_VERSION = "2.$$QT_MINOR_VERSION"
-# OTHER_FILES = "plugins.qmltypes" "qmldir"
-# TARGETPATH = "QtQuick/VirtualKeyboard/Settings"
+qt_internal_extend_target(VirtualKeyboardSettings CONDITION QT_FEATURE_vkb_no_builtin_style
+ DEFINES
+ QT_VIRTUALKEYBOARD_DEFAULT_STYLE=""
+)
-## Scopes:
-#####################################################################
+qt_internal_extend_target(VirtualKeyboardSettings CONDITION QT_FEATURE_vkb_retro_style AND NOT QT_FEATURE_vkb_no_builtin_style
+ DEFINES
+ QT_VIRTUALKEYBOARD_DEFAULT_STYLE="retro"
+)
+
+qt_internal_extend_target(VirtualKeyboardSettings CONDITION NOT QT_FEATURE_vkb_no_builtin_style AND NOT QT_FEATURE_vkb_retro_style
+ DEFINES
+ QT_VIRTUALKEYBOARD_DEFAULT_STYLE="default"
+)
-#### Keys ignored in scope 2:.:.:settings.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
diff --git a/src/settings/dependencies.json b/src/settings/dependencies.json
deleted file mode 100644
index 0d4f101c..00000000
--- a/src/settings/dependencies.json
+++ /dev/null
@@ -1,2 +0,0 @@
-[
-]
diff --git a/src/settings/plugins.qmltypes b/src/settings/plugins.qmltypes
deleted file mode 100644
index 8b1402e6..00000000
--- a/src/settings/plugins.qmltypes
+++ /dev/null
@@ -1,50 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.VirtualKeyboard.Settings 2.14'
-
-Module {
- dependencies: []
- Component {
- name: "QtVirtualKeyboard::VirtualKeyboardSettings"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 1.0",
- "QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 1.1",
- "QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 1.2",
- "QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 2.0",
- "QtQuick.VirtualKeyboard.Settings/VirtualKeyboardSettings 2.1"
- ]
- isCreatable: false
- isSingleton: true
- exportMetaObjectRevisions: [0, 0, 0, 0, 0]
- Property { name: "style"; type: "QUrl"; isReadonly: true }
- Property { name: "layoutPath"; type: "QUrl" }
- Property { name: "styleName"; type: "string" }
- Property { name: "locale"; type: "string" }
- Property { name: "availableLocales"; type: "QStringList"; isReadonly: true }
- Property { name: "activeLocales"; type: "QStringList" }
- Property {
- name: "wordCandidateList"
- type: "WordCandidateListSettings"
- isReadonly: true
- isPointer: true
- }
- Property { name: "fullScreenMode"; type: "bool" }
- }
- Component {
- name: "QtVirtualKeyboard::WordCandidateListSettings"
- prototype: "QObject"
- exports: [
- "QtQuick.VirtualKeyboard.Settings/WordCandidateListSettings 2.2"
- ]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "autoHideDelay"; type: "int" }
- Property { name: "alwaysVisible"; type: "bool" }
- Property { name: "autoCommitWord"; type: "bool" }
- }
-}
diff --git a/src/settings/qmldir b/src/settings/qmldir
deleted file mode 100644
index ac07347d..00000000
--- a/src/settings/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module QtQuick.VirtualKeyboard.Settings
-plugin qtquickvirtualkeyboardsettingsplugin
-classname QtQuickVirtualKeyboardSettingsPlugin
-typeinfo plugins.qmltypes
-depends QtQuick 2.0
diff --git a/src/settings/qquickvirtualkeyboardsettings.cpp b/src/settings/qquickvirtualkeyboardsettings.cpp
new file mode 100644
index 00000000..8a0d529b
--- /dev/null
+++ b/src/settings/qquickvirtualkeyboardsettings.cpp
@@ -0,0 +1,669 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qquickvirtualkeyboardsettings_p.h"
+#include <QtVirtualKeyboard/private/settings_p.h>
+#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QFileInfo>
+#include <QDir>
+#include <QRegularExpression>
+#include <QtCore/private/qobject_p.h>
+#include <QtCore/qmutex.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QQuickVirtualKeyboardSettingsPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickVirtualKeyboardSettings)
+public:
+ QQuickVirtualKeyboardSettingsPrivate(QQuickVirtualKeyboardSettings *q_ptr, QQmlEngine *engine) :
+ QObjectPrivate(),
+ q_ptr(q_ptr),
+ engine(engine)
+ {}
+
+ QString buildStylePath(const QString &path, const QString &name) const
+ {
+ QString importPath(path + name + QLatin1String("/style.qml"));
+ if (!importPath.startsWith(QLatin1String("qrc:"))) {
+ QUrl url = QUrl::fromLocalFile(importPath);
+ importPath = url.toString();
+ }
+ return importPath;
+ }
+
+ QString buildStyleFilePath(const QString &path, const QString &name) const
+ {
+ QString filePath(path);
+ if (filePath.startsWith(QLatin1String("qrc:")))
+ filePath.remove(0, 3);
+ return filePath + name + QLatin1String("/style.qml");
+ }
+
+ QStringList qmlImportPathList() const
+ {
+ return engine ? engine->importPathList() : QStringList();
+ }
+
+ QString stylePath(const QString &name) const
+ {
+ if (name.isEmpty())
+ return QString();
+
+ QStringList stylePathList;
+ stylePathList << QLatin1String("qrc:/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/");
+ const QStringList importPathList = qmlImportPathList();
+ // Add QML import path (Note: the QML base dir is usually the last entry in the list)
+ for (int i = importPathList.size() - 1; i >= 0; --i) {
+ const QString stylesPath = importPathList.at(i)
+ + QLatin1String("/QtQuick/VirtualKeyboard/Styles/");
+ stylePathList += stylesPath;
+ }
+
+ // Path for backwards compatibility
+ stylePathList << QLatin1String("qrc:/QtQuick/VirtualKeyboard/content/styles/");
+
+ for (const QString &stylePath : std::as_const(stylePathList)) {
+ QString filePath = buildStyleFilePath(stylePath, name);
+ bool pathExist = false;
+ pathExist = QFileInfo::exists(filePath);
+ if (pathExist)
+ return buildStylePath(stylePath, name);
+ }
+ return QString();
+ }
+
+ QQuickVirtualKeyboardSettings *q_ptr;
+ QQmlEngine *engine;
+ QQuickWordCandidateListSettings wordCandidateListSettings;
+};
+
+/*!
+ \qmlmodule QtQuick.VirtualKeyboard.Settings
+ \title Qt Quick Virtual Keyboard Settings QML Types
+ \ingroup qmlmodules
+
+ \brief Provides settings for Qt Virtual Keyboard.
+
+ The QML types can be imported into your application using the following
+ import statements in your .qml file:
+
+ \qml
+ import QtQuick.VirtualKeyboard.Settings
+ \endqml
+*/
+
+/*!
+ \qmltype VirtualKeyboardSettings
+ \inqmlmodule QtQuick.VirtualKeyboard.Settings
+ \ingroup qtvirtualkeyboard-settings-qml
+ \since QtQuick.VirtualKeyboard 1.2
+ \brief Provides settings for virtual keyboard.
+
+ This type provides a VirtualKeyboardSettings singleton instance,
+ which can be used to configure the virtual keyboard settings.
+
+ Please note that the settings have only effect in the current
+ application's lifetime, that is, configuration changes are not
+ permanent.
+
+ For example, to change the keyboard style in application:
+
+ \code
+ Component.onCompleted: VirtualKeyboardSettings.styleName = "retro"
+ \endcode
+*/
+
+/*!
+ \class QtVirtualKeyboard::VirtualKeyboardSettings
+ \internal
+*/
+
+/*!
+ \internal
+*/
+QQuickVirtualKeyboardSettings::QQuickVirtualKeyboardSettings(QQmlEngine *engine, QObject *parent) :
+ QObject(*new QQuickVirtualKeyboardSettingsPrivate(this, engine), parent)
+{
+ Q_D(QQuickVirtualKeyboardSettings);
+ Settings *settings = Settings::instance();
+ if (settings->styleName().isEmpty())
+ resetStyle();
+ if (settings->layoutPath().isEmpty())
+ resetLayoutPath();
+ connect(settings, SIGNAL(styleChanged()), SIGNAL(styleChanged()));
+ connect(settings, SIGNAL(styleNameChanged()), SIGNAL(styleNameChanged()));
+ connect(settings, SIGNAL(localeChanged()), SIGNAL(localeChanged()));
+ connect(settings, SIGNAL(availableLocalesChanged()), SIGNAL(availableLocalesChanged()));
+ connect(settings, SIGNAL(activeLocalesChanged()), SIGNAL(activeLocalesChanged()));
+ connect(settings, SIGNAL(layoutPathChanged()), SIGNAL(layoutPathChanged()));
+ connect(settings, SIGNAL(wclAutoHideDelayChanged()), &d->wordCandidateListSettings, SIGNAL(autoHideDelayChanged()));
+ connect(settings, SIGNAL(wclAlwaysVisibleChanged()), &d->wordCandidateListSettings, SIGNAL(alwaysVisibleChanged()));
+ connect(settings, SIGNAL(wclAutoCommitWordChanged()), &d->wordCandidateListSettings, SIGNAL(autoCommitWordChanged()));
+ connect(settings, SIGNAL(fullScreenModeChanged()), SIGNAL(fullScreenModeChanged()));
+ connect(settings, SIGNAL(userDataPathChanged()), SIGNAL(userDataPathChanged()));
+ settings->connect(this, SIGNAL(userDataReset()), SIGNAL(userDataReset()));
+ connect(settings, SIGNAL(hwrTimeoutForAlphabeticChanged()), SIGNAL(hwrTimeoutForAlphabeticChanged()));
+ connect(settings, SIGNAL(hwrTimeoutForCjkChanged()), SIGNAL(hwrTimeoutForCjkChanged()));
+ connect(settings, SIGNAL(inputMethodHintsChanged()), SIGNAL(inputMethodHintsChanged()));
+ connect(settings, SIGNAL(handwritingModeDisabledChanged()), SIGNAL(handwritingModeDisabledChanged()));
+ connect(settings, SIGNAL(defaultInputMethodDisabledChanged()), SIGNAL(defaultInputMethodDisabledChanged()));
+ connect(settings, SIGNAL(defaultDictionaryDisabledChanged()), SIGNAL(defaultDictionaryDisabledChanged()));
+ connect(settings, SIGNAL(visibleFunctionKeysChanged()), SIGNAL(visibleFunctionKeysChanged()));
+}
+
+/*!
+ \internal
+ TODO: Remove this method when QML stops creating separate singleton instances for each version.
+ */
+QQuickVirtualKeyboardSettings *QQuickVirtualKeyboardSettings::create(
+ QQmlEngine *qmlEngine, QJSEngine *)
+{
+ static QMutex mutex;
+ static QHash<QQmlEngine *, QQuickVirtualKeyboardSettings *> instances;
+ QMutexLocker locker(&mutex);
+ QQuickVirtualKeyboardSettings *&instance = instances[qmlEngine];
+ if (instance == nullptr)
+ instance = new QQuickVirtualKeyboardSettings(qmlEngine);
+ return instance;
+}
+
+/*!
+ \internal
+*/
+QString QQuickVirtualKeyboardSettings::style() const
+{
+ return Settings::instance()->style();
+}
+
+/*!
+ \internal
+*/
+QString QQuickVirtualKeyboardSettings::styleName() const
+{
+ return Settings::instance()->styleName();
+}
+
+/*!
+ \internal
+*/
+void QQuickVirtualKeyboardSettings::setStyleName(const QString &styleName)
+{
+ Q_D(QQuickVirtualKeyboardSettings);
+ Settings *settings = Settings::instance();
+ QString style = d->stylePath(styleName);
+ if (style.isEmpty()) {
+ qWarning() << "WARNING: Cannot find style" << styleName << "- fallback:" << settings->styleName();
+ return;
+ }
+ settings->setStyleName(styleName);
+ settings->setStyle(style);
+}
+
+/*!
+ \internal
+*/
+QUrl QQuickVirtualKeyboardSettings::layoutPath() const
+{
+ return Settings::instance()->layoutPath();
+}
+
+/*!
+ \internal
+*/
+void QQuickVirtualKeyboardSettings::setLayoutPath(const QUrl &layoutPath)
+{
+ Settings *settings = Settings::instance();
+ QDir layoutDirectory(layoutPath.toLocalFile());
+ if (!layoutDirectory.exists()) {
+ qWarning() << "WARNING: Cannot find layout path" << layoutPath;
+ return;
+ }
+ settings->setLayoutPath(layoutPath);
+}
+
+void QQuickVirtualKeyboardSettings::resetLayoutPath()
+{
+ Settings *settings = Settings::instance();
+ QUrl layoutPath(QLatin1String(QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR));
+ const QString customLayoutPath(QDir::fromNativeSeparators(qEnvironmentVariable("QT_VIRTUALKEYBOARD_LAYOUT_PATH")));
+ if (!customLayoutPath.isEmpty()) {
+ bool found = false;
+ QDir customLayoutDirectory(customLayoutPath);
+ if (customLayoutDirectory.exists()) {
+ found = true;
+ layoutPath = QUrl::fromLocalFile(customLayoutPath);
+ } else {
+ customLayoutDirectory = QDir(QUrl(customLayoutPath).toLocalFile());
+ if (customLayoutDirectory.exists()) {
+ found = true;
+ layoutPath = QUrl(customLayoutPath);
+ }
+ }
+ if (!found) {
+ qWarning() << "WARNING: Cannot assign custom layout path" << customLayoutPath << "- fallback:" << layoutPath;
+ }
+ }
+ settings->setLayoutPath(layoutPath);
+}
+
+QString QQuickVirtualKeyboardSettings::locale() const
+{
+ return Settings::instance()->locale();
+}
+
+void QQuickVirtualKeyboardSettings::setLocale(const QString &locale)
+{
+ Settings::instance()->setLocale(locale);
+}
+
+QStringList QQuickVirtualKeyboardSettings::availableLocales() const
+{
+ return Settings::instance()->availableLocales();
+}
+
+void QQuickVirtualKeyboardSettings::setActiveLocales(const QStringList &activeLocales)
+{
+ Settings::instance()->setActiveLocales(activeLocales);
+}
+
+QStringList QQuickVirtualKeyboardSettings::activeLocales() const
+{
+ return Settings::instance()->activeLocales();
+}
+
+QQuickWordCandidateListSettings *QQuickVirtualKeyboardSettings::wordCandidateList() const
+{
+ Q_D(const QQuickVirtualKeyboardSettings);
+ return const_cast<QQuickWordCandidateListSettings *>(&d->wordCandidateListSettings);
+}
+
+bool QQuickVirtualKeyboardSettings::fullScreenMode() const
+{
+ return Settings::instance()->fullScreenMode();
+}
+
+void QQuickVirtualKeyboardSettings::setFullScreenMode(bool fullScreenMode)
+{
+ return Settings::instance()->setFullScreenMode(fullScreenMode);
+}
+
+QString QQuickVirtualKeyboardSettings::userDataPath() const
+{
+ return Settings::instance()->userDataPath();
+}
+
+void QQuickVirtualKeyboardSettings::setUserDataPath(const QString &userDataPath)
+{
+ return Settings::instance()->setUserDataPath(userDataPath);
+}
+
+int QQuickVirtualKeyboardSettings::hwrTimeoutForAlphabetic() const
+{
+ return Settings::instance()->hwrTimeoutForAlphabetic();
+}
+
+void QQuickVirtualKeyboardSettings::setHwrTimeoutForAlphabetic(int hwrTimeoutForAlphabetic)
+{
+ return Settings::instance()->setHwrTimeoutForAlphabetic(hwrTimeoutForAlphabetic);
+}
+
+int QQuickVirtualKeyboardSettings::hwrTimeoutForCjk() const
+{
+ return Settings::instance()->hwrTimeoutForCjk();
+}
+
+void QQuickVirtualKeyboardSettings::setHwrTimeoutForCjk(int hwrTimeoutForCjk)
+{
+ return Settings::instance()->setHwrTimeoutForCjk(hwrTimeoutForCjk);
+}
+
+Qt::InputMethodHints QQuickVirtualKeyboardSettings::inputMethodHints() const
+{
+ return Settings::instance()->inputMethodHints();
+}
+
+void QQuickVirtualKeyboardSettings::setInputMethodHints(const Qt::InputMethodHints &inputMethodHints)
+{
+ Settings::instance()->setInputMethodHints(inputMethodHints);
+}
+
+bool QQuickVirtualKeyboardSettings::isHandwritingModeDisabled() const
+{
+ return Settings::instance()->isHandwritingModeDisabled();
+}
+
+void QQuickVirtualKeyboardSettings::setHandwritingModeDisabled(bool handwritingModeDisabled)
+{
+ Settings::instance()->setHandwritingModeDisabled(handwritingModeDisabled);
+}
+
+bool QQuickVirtualKeyboardSettings::isDefaultInputMethodDisabled() const
+{
+ return Settings::instance()->isDefaultInputMethodDisabled();
+}
+
+void QQuickVirtualKeyboardSettings::setDefaultInputMethodDisabled(bool defaultInputMethodDisabled)
+{
+ return Settings::instance()->setDefaultInputMethodDisabled(defaultInputMethodDisabled);
+}
+
+bool QQuickVirtualKeyboardSettings::isDefaultDictionaryDisabled() const
+{
+ return Settings::instance()->isDefaultDictionaryDisabled();
+}
+
+void QQuickVirtualKeyboardSettings::setDefaultDictionaryDisabled(bool defaultDictionaryDisabled)
+{
+ return Settings::instance()->setDefaultDictionaryDisabled(defaultDictionaryDisabled);
+}
+
+QtVirtualKeyboard::KeyboardFunctionKeys QQuickVirtualKeyboardSettings::visibleFunctionKeys() const
+{
+ return Settings::instance()->visibleFunctionKeys();
+}
+
+void QQuickVirtualKeyboardSettings::setVisibleFunctionKeys(QtVirtualKeyboard::KeyboardFunctionKeys newVisibleFunctionKeys)
+{
+ Settings::instance()->setVisibleFunctionKeys(newVisibleFunctionKeys);
+}
+
+bool QQuickVirtualKeyboardSettings::closeOnReturn() const
+{
+ return Settings::instance()->closeOnReturn();
+}
+
+void QQuickVirtualKeyboardSettings::setCloseOnReturn(bool closeOnReturn)
+{
+ Settings::instance()->setCloseOnReturn(closeOnReturn);
+}
+
+void QQuickVirtualKeyboardSettings::resetStyle()
+{
+ Q_D(QQuickVirtualKeyboardSettings);
+ Settings *settings = Settings::instance();
+ QString styleName = QLatin1String(QT_VIRTUALKEYBOARD_DEFAULT_STYLE);
+ QString style = d->stylePath(styleName);
+ QString customStyleName = QString::fromLatin1(qgetenv("QT_VIRTUALKEYBOARD_STYLE"));
+ if (!customStyleName.isEmpty()) {
+ bool found = false;
+ QRegularExpression styleNameValidator(QLatin1String("\\A(?:\\w+)\\z"));
+ QRegularExpressionMatch match = styleNameValidator.match(customStyleName);
+ if (match.hasMatch()) {
+ QString customStyle = d->stylePath(customStyleName);
+ if (!customStyle.isEmpty()) {
+ styleName = customStyleName;
+ style = customStyle;
+ found = true;
+ }
+ }
+ if (!found) {
+ qWarning() << "WARNING: Cannot find style" << customStyleName << "- fallback:" << styleName;
+ }
+ }
+ if (!style.isEmpty()) {
+ settings->setStyleName(styleName);
+ settings->setStyle(style);
+ }
+}
+
+/*!
+ \qmlproperty string VirtualKeyboardSettings::style
+ \internal
+*/
+
+/*!
+ \qmlproperty string VirtualKeyboardSettings::styleName
+
+ This property provides the current style. Application can change
+ the keyboard style by setting the styleName to different value.
+
+ The system wide keyboard style can be affected by setting
+ the QT_VIRTUALKEYBOARD_STYLE environment variable.
+*/
+
+/*!
+ \qmlproperty string VirtualKeyboardSettings::locale
+ \since QtQuick.VirtualKeyboard.Settings 2.0
+
+ This property provides the default locale for the keyboard.
+
+ When the locale is not specified, the default system locale is used instead.
+
+ If the keyboard locale is different from the new default locale, keyboard
+ language is changed immediately to reflect the new locale. If the locale setting
+ is incorrect, or it is not in the list of supported locales, it is ignored and
+ the default setting is used instead.
+
+ A locale is supported if it is included in the list of availableLocales.
+*/
+
+/*!
+ \qmlproperty list<string> VirtualKeyboardSettings::availableLocales
+ \since QtQuick.VirtualKeyboard.Settings 2.0
+ \readonly
+
+ This property contains a list of languages supported by the virtual keyboard.
+
+ This list is read-only and depends on the build-time configuration of the
+ virtual keyboard.
+*/
+
+/*!
+ \qmlproperty list<string> VirtualKeyboardSettings::activeLocales
+ \since QtQuick.VirtualKeyboard.Settings 2.0
+
+ This property contains a list of activated languages of the virtual keyboard.
+
+ The list of active languages is a subset of the available languages, and can be
+ used to limit the list of available languages in the application lifetime.
+
+ The list of languages will be shown based on the specified ordering.
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::fullScreenMode
+ \since QtQuick.VirtualKeyboard.Settings 2.2
+
+ This property enables the fullscreen mode for the virtual keyboard.
+
+ In fullscreen mode, the virtual keyboard replicates the contents of the
+ focused input field to the fullscreen input field located at the top of the
+ keyboard.
+
+ For example, to activate the fullscreen mode when the screen aspect ratio
+ is greater than 16:9:
+
+ \code
+ Binding {
+ target: VirtualKeyboardSettings
+ property: "fullScreenMode"
+ value: (Screen.width / Screen.height) > (16.0 / 9.0)
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::userDataPath
+ \since QtQuick.VirtualKeyboard.Settings 6.1
+
+ This property sets the user data path for the virtual keyboard and its plugins.
+
+ By default, the user data path is set to \l {QStandardPaths::GenericConfigLocation}{GenericConfigLocation} + "/qtvirtualkeyboard".
+*/
+
+/*!
+ \qmlsignal VirtualKeyboardSettings::userDataReset()
+
+ The application triggers this signal prior to the user's data being reset to
+ indicate to the virtual keyboard that all files must be closed
+ in the user data directory.
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::hwrTimeoutForAlphabetic
+ \since QtQuick.VirtualKeyboard.Settings 6.1
+
+ This property sets the handwriting recognition timeout for alphabetical languages.
+
+ By default, the timeout is 500 millliseconds.
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::hwrTimeoutForCjk
+ \since QtQuick.VirtualKeyboard.Settings 6.1
+
+ This property sets the handwriting recognition timeout for Chinese / Japanese / Korean languages.
+
+ By default, the timeout is 500 millliseconds.
+*/
+
+/*!
+ \qmlproperty int VirtualKeyboardSettings::inputMethodHints
+ \since QtQuick.VirtualKeyboard.Settings 6.1
+
+ This property allows to set persistent input method hints.
+
+ The value of this property is combined with the input method
+ hints from the input control. For example, to disable predictive
+ text input, this property can be set to \c Qt::ImhNoPredictiveText.
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::handwritingModeDisabled
+ \since QtQuick.VirtualKeyboard.Settings 6.1
+
+ This property allows to disable handwriting input mode, if it is
+ otherwise available in the system.
+
+ When this property is set to \c true, the handwriting button is hidden
+ from the keyboard layout and the user cannot switch to handwriting
+ input mode.
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::defaultInputMethodDisabled
+ \since QtQuick.VirtualKeyboard.Settings 6.1
+
+ This property disables the default input method. The purpose of this setting is to be able to
+ override the default input method with the plain input method, disabling its functionality.
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::defaultDictionaryDisabled
+ \since QtQuick.VirtualKeyboard.Settings 6.1
+
+ This property disables the default dictionary. The purpose of this setting is to be able to
+ use a custom dictionary only instead of the standard dictionary.
+*/
+
+/*!
+ \qmlproperty enumeration VirtualKeyboardSettings::visibleFunctionKeys
+ \since QtQuick.VirtualKeyboard.Settings 6.6
+
+ This setting adjusts the visibility of specific function keys in the keyboard layout, allowing
+ them to be either displayed or hidden. When a function key is not visible, its functionality
+ remains accessible through the gear menu.
+
+ The value can be combination of the following flags:
+
+ \list
+ \li \c QtVirtualKeyboard.KeyboardFunctionKeys.None All function keys are hidden
+ \li \c QtVirtualKeyboard.KeyboardFunctionKeys.Hide Hide function key is visible
+ \li \c QtVirtualKeyboard.KeyboardFunctionKeys.Language Language function key is visible
+ \li \c QtVirtualKeyboard.KeyboardFunctionKeys.All All function keys are visible
+ \endlist
+
+ The default is \c QtVirtualKeyboard.KeyboardFunctionKeys.All.
+*/
+
+/*!
+ \qmlproperty bool VirtualKeyboardSettings::closeOnReturn
+ \since QtQuick.VirtualKeyboard.Settings 6.8
+
+ This property enables hiding of virtual keyboard.
+
+ When this property is set to \c true, the virtual keyboard is hidden when \l Qt::Key_Enter
+ or \l Qt::Key_Return key released. The default is \c false.
+*/
+
+/*!
+ \since QtQuick.VirtualKeyboard.Settings 2.2
+ \qmlproperty int VirtualKeyboardSettings::wordCandidateList.autoHideDelay
+ \qmlproperty bool VirtualKeyboardSettings::wordCandidateList.alwaysVisible
+
+ \table
+ \header
+ \li Name
+ \li Description
+ \row
+ \li autoHideDelay
+ \li This property defines the delay, in milliseconds, after which the
+ word candidate list is hidden if empty.
+
+ If the value is \c 0, the list is immediately hidden when cleared.
+
+ If the value is \c -1, the list is visible until input focus
+ changes, or the input panel is hidden.
+
+ The default value is \c 5000 milliseconds.
+ \row
+ \li alwaysVisible
+ \li This property defines whether the word candidate list should always
+ remain visible.
+
+ The default value is \c false.
+ \row
+ \li autoCommitWord
+ \li This property enables the automatic commit feature that is activated
+ when the word candidate list is narrowed down to a single candidate.
+
+ The automatic commit feature takes effect when the word candidate
+ list initially contains multiple words and is reduced to single word
+ after additional input. This word will be selected and committed
+ automatically without user interaction.
+
+ This property is set to \c false by default.
+ \endtable
+*/
+
+QQuickWordCandidateListSettings::QQuickWordCandidateListSettings(QObject *parent) :
+ QObject(parent)
+{
+}
+
+int QQuickWordCandidateListSettings::autoHideDelay() const
+{
+ return Settings::instance()->wclAutoHideDelay();
+}
+
+void QQuickWordCandidateListSettings::setAutoHideDelay(int autoHideDelay)
+{
+ Settings::instance()->setWclAutoHideDelay(autoHideDelay);
+}
+
+bool QQuickWordCandidateListSettings::alwaysVisible() const
+{
+ return Settings::instance()->wclAlwaysVisible();
+}
+
+void QQuickWordCandidateListSettings::setAlwaysVisible(bool alwaysVisible)
+{
+ Settings::instance()->setWclAlwaysVisible(alwaysVisible);
+}
+
+bool QQuickWordCandidateListSettings::autoCommitWord() const
+{
+ return Settings::instance()->wclAutoCommitWord();
+}
+
+void QQuickWordCandidateListSettings::setAutoCommitWord(bool autoCommitWord)
+{
+ Settings::instance()->setWclAutoCommitWord(autoCommitWord);
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/settings/qquickvirtualkeyboardsettings_p.h b/src/settings/qquickvirtualkeyboardsettings_p.h
new file mode 100644
index 00000000..3f03ff80
--- /dev/null
+++ b/src/settings/qquickvirtualkeyboardsettings_p.h
@@ -0,0 +1,160 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef VIRTUALKEYBOARDSETTINGS_H
+#define VIRTUALKEYBOARDSETTINGS_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/private/qvirtualkeyboardnamespace_p.h>
+#include <QtQml/qqml.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class QQuickWordCandidateListSettings;
+class QQuickVirtualKeyboardSettingsPrivate;
+
+class QQuickVirtualKeyboardSettings : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QQuickVirtualKeyboardSettings)
+ Q_PROPERTY(QUrl style READ style NOTIFY styleChanged)
+ Q_PROPERTY(QUrl layoutPath READ layoutPath WRITE setLayoutPath NOTIFY layoutPathChanged)
+ Q_PROPERTY(QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged)
+ Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged)
+ Q_PROPERTY(QStringList availableLocales READ availableLocales NOTIFY availableLocalesChanged)
+ Q_PROPERTY(QStringList activeLocales READ activeLocales WRITE setActiveLocales NOTIFY activeLocalesChanged)
+ Q_PROPERTY(QQuickWordCandidateListSettings *wordCandidateList READ wordCandidateList CONSTANT)
+ Q_PROPERTY(bool fullScreenMode READ fullScreenMode WRITE setFullScreenMode NOTIFY fullScreenModeChanged)
+ Q_PROPERTY(QString userDataPath READ userDataPath WRITE setUserDataPath NOTIFY userDataPathChanged REVISION(6, 1))
+ Q_PROPERTY(int hwrTimeoutForAlphabetic READ hwrTimeoutForAlphabetic WRITE setHwrTimeoutForAlphabetic NOTIFY hwrTimeoutForAlphabeticChanged REVISION(6, 1))
+ Q_PROPERTY(int hwrTimeoutForCjk READ hwrTimeoutForCjk WRITE setHwrTimeoutForCjk NOTIFY hwrTimeoutForCjkChanged REVISION(6, 1))
+ Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged REVISION(6, 1))
+ Q_PROPERTY(bool handwritingModeDisabled READ isHandwritingModeDisabled WRITE setHandwritingModeDisabled NOTIFY handwritingModeDisabledChanged REVISION(6, 1))
+ Q_PROPERTY(bool defaultInputMethodDisabled READ isDefaultInputMethodDisabled WRITE setDefaultInputMethodDisabled NOTIFY defaultInputMethodDisabledChanged REVISION(6, 1))
+ Q_PROPERTY(bool defaultDictionaryDisabled READ isDefaultDictionaryDisabled WRITE setDefaultDictionaryDisabled NOTIFY defaultDictionaryDisabledChanged REVISION(6, 1))
+ Q_PROPERTY(QtVirtualKeyboard::KeyboardFunctionKeys visibleFunctionKeys READ visibleFunctionKeys WRITE setVisibleFunctionKeys NOTIFY visibleFunctionKeysChanged REVISION(6, 6))
+ Q_PROPERTY(bool closeOnReturn READ closeOnReturn WRITE setCloseOnReturn NOTIFY closeOnReturnChanged REVISION(6, 8))
+ QML_NAMED_ELEMENT(VirtualKeyboardSettings)
+ QML_SINGLETON
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
+
+ explicit QQuickVirtualKeyboardSettings(QQmlEngine *engine, QObject *parent = nullptr);
+
+public:
+ static QQuickVirtualKeyboardSettings *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine);
+ QString style() const;
+
+ QUrl layoutPath() const;
+ void setLayoutPath(const QUrl &layoutPath);
+
+ QString styleName() const;
+ void setStyleName(const QString &styleName);
+
+ QString locale() const;
+ void setLocale(const QString &locale);
+
+ QStringList availableLocales() const;
+
+ void setActiveLocales(const QStringList &activeLocales);
+ QStringList activeLocales() const;
+
+ QQuickWordCandidateListSettings *wordCandidateList() const;
+
+ bool fullScreenMode() const;
+ void setFullScreenMode(bool fullScreenMode);
+
+ QString userDataPath() const;
+ void setUserDataPath(const QString &userDataPath);
+
+ int hwrTimeoutForAlphabetic() const;
+ void setHwrTimeoutForAlphabetic(int hwrTimeoutForAlphabetic);
+
+ int hwrTimeoutForCjk() const;
+ void setHwrTimeoutForCjk(int hwrTimeoutForCjk);
+
+ Qt::InputMethodHints inputMethodHints() const;
+ void setInputMethodHints(const Qt::InputMethodHints &inputMethodHints);
+
+ bool isHandwritingModeDisabled() const;
+ void setHandwritingModeDisabled(bool handwritingModeDisabled);
+
+ bool isDefaultInputMethodDisabled() const;
+ void setDefaultInputMethodDisabled(bool defaultInputMethodDisabled);
+
+ bool isDefaultDictionaryDisabled() const;
+ void setDefaultDictionaryDisabled(bool defaultDictionaryDisabled);
+
+ QtVirtualKeyboard::KeyboardFunctionKeys visibleFunctionKeys() const;
+ void setVisibleFunctionKeys(QtVirtualKeyboard::KeyboardFunctionKeys newVisibleFunctionKeys);
+
+ bool closeOnReturn() const;
+ void setCloseOnReturn(bool enable);
+
+signals:
+ void styleChanged();
+ void styleNameChanged();
+ void localeChanged();
+ void availableLocalesChanged();
+ void activeLocalesChanged();
+ void layoutPathChanged();
+ void fullScreenModeChanged();
+ Q_REVISION(6, 1) void userDataPathChanged();
+ Q_REVISION(6, 1) void userDataReset();
+ Q_REVISION(6, 1) void hwrTimeoutForAlphabeticChanged();
+ Q_REVISION(6, 1) void hwrTimeoutForCjkChanged();
+ Q_REVISION(6, 1) void inputMethodHintsChanged();
+ Q_REVISION(6, 1) void handwritingModeDisabledChanged();
+ Q_REVISION(6, 1) void defaultInputMethodDisabledChanged();
+ Q_REVISION(6, 1) void defaultDictionaryDisabledChanged();
+ Q_REVISION(6, 6) void visibleFunctionKeysChanged();
+ Q_REVISION(6, 8) void closeOnReturnChanged();
+
+private:
+ void resetStyle();
+ void resetLayoutPath();
+};
+
+class QQuickWordCandidateListSettings : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int autoHideDelay READ autoHideDelay WRITE setAutoHideDelay NOTIFY autoHideDelayChanged)
+ Q_PROPERTY(bool alwaysVisible READ alwaysVisible WRITE setAlwaysVisible NOTIFY alwaysVisibleChanged)
+ Q_PROPERTY(bool autoCommitWord READ autoCommitWord WRITE setAutoCommitWord NOTIFY autoCommitWordChanged)
+ QML_ANONYMOUS
+
+ explicit QQuickWordCandidateListSettings(QObject *parent = nullptr);
+ friend class QQuickVirtualKeyboardSettingsPrivate;
+
+public:
+ int autoHideDelay() const;
+ void setAutoHideDelay(int autoHideDelay);
+
+ bool alwaysVisible() const;
+ void setAlwaysVisible(bool alwaysVisible);
+
+ bool autoCommitWord() const;
+ void setAutoCommitWord(bool autoCommitWord);
+
+signals:
+ void autoHideDelayChanged();
+ void alwaysVisibleChanged();
+ void autoCommitWordChanged();
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif // VIRTUALKEYBOARDSETTINGS_H
diff --git a/src/settings/qtquickvirtualkeyboardsettingsplugin.cpp b/src/settings/qtquickvirtualkeyboardsettingsplugin.cpp
deleted file mode 100644
index 06758db8..00000000
--- a/src/settings/qtquickvirtualkeyboardsettingsplugin.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtquickvirtualkeyboardsettingsplugin.h"
-#include <QtVirtualKeyboard/private/virtualkeyboardsettings_p.h>
-#include <QtVirtualKeyboard/private/qvirtualkeyboard_staticplugin_p.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QtVirtualKeyboard;
-
-void QtQuickVirtualKeyboardSettingsPlugin::registerTypes(const char *uri)
-{
-#if defined(QT_STATICPLUGIN)
- Q_VKB_IMPORT_PLUGIN(QtQuick2Plugin)
-#endif
-
- qmlRegisterSingletonType<VirtualKeyboardSettings>(uri, 1, 0, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(uri, 1, 1, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(uri, 1, 2, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(uri, 2, 0, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qmlRegisterSingletonType<VirtualKeyboardSettings>(uri, 2, 1, "VirtualKeyboardSettings", VirtualKeyboardSettings::registerSettingsModule);
- qRegisterMetaType<WordCandidateListSettings *>("WordCandidateListSettings*");
- qmlRegisterUncreatableType<WordCandidateListSettings>(uri, 2, 2, "WordCandidateListSettings", QLatin1String("Cannot create word candidate list settings"));
-
- // The minor version used to be the current Qt 5 minor. For compatibility it is the last
- // Qt 5 release.
- qmlRegisterModule(uri, 2, 15);
-}
-
-QT_END_NAMESPACE
diff --git a/src/settings/qtquickvirtualkeyboardsettingsplugin.h b/src/settings/qtquickvirtualkeyboardsettingsplugin.h
deleted file mode 100644
index 355a2d66..00000000
--- a/src/settings/qtquickvirtualkeyboardsettingsplugin.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTQUICKVIRTUALKEYBOARDSETTINGSPLUGIN_H
-#define QTQUICKVIRTUALKEYBOARDSETTINGSPLUGIN_H
-
-#include <QQmlExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-class QtQuickVirtualKeyboardSettingsPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- QtQuickVirtualKeyboardSettingsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override;
-};
-
-QT_END_NAMESPACE
-
-#endif // QTQUICKVIRTUALKEYBOARDSETTINGSPLUGIN_H
-
diff --git a/src/settings/settings.pro b/src/settings/settings.pro
deleted file mode 100644
index c4d97c16..00000000
--- a/src/settings/settings.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGET = qtquickvirtualkeyboardsettingsplugin
-TARGETPATH = QtQuick/VirtualKeyboard/Settings
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
-QT += qml quick virtualkeyboard-private
-
-CONFIG += no_cxx_module
-
-SOURCES += \
- qtquickvirtualkeyboardsettingsplugin.cpp
-
-HEADERS += \
- qtquickvirtualkeyboardsettingsplugin.h
-
-OTHER_FILES += \
- plugins.qmltypes \
- qmldir
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-}
-
-load(qml_plugin)
diff --git a/src/shared.pri b/src/shared.pri
deleted file mode 100644
index 4e2654ae..00000000
--- a/src/shared.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-# Common variables
-LAYOUTS_BASE = $$PWD/virtualkeyboard
-LAYOUTS_PREFIX = /QtQuick/VirtualKeyboard
-VIRTUALKEYBOARD_INSTALL_DATA = $$[QT_INSTALL_DATA]/qtvirtualkeyboard
-
diff --git a/src/src.pro b/src/src.pro
deleted file mode 100644
index cee8f573..00000000
--- a/src/src.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TEMPLATE = subdirs
-
-
-SUBDIRS += \
- virtualkeyboard \
- import \
- settings \
- styles \
- plugin \
- plugins
-
-import.depends += virtualkeyboard
-settings.depends += virtualkeyboard
-styles.depends += virtualkeyboard
-plugin.depends += virtualkeyboard
-plugins.depends += virtualkeyboard
diff --git a/src/styles/CMakeLists.txt b/src/styles/CMakeLists.txt
index cff82c77..48c39017 100644
--- a/src/styles/CMakeLists.txt
+++ b/src/styles/CMakeLists.txt
@@ -1,60 +1,53 @@
-# Generated from styles.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+set(styles_imports)
+if(NOT QT_FEATURE_vkb_no_builtin_style)
+ add_subdirectory(builtin)
+ list(APPEND styles_imports QtQuick.VirtualKeyboard.Styles.Builtin/auto)
+endif()
#####################################################################
-## qtquickvirtualkeyboardstylesplugin Plugin:
+## QtQuick.VirtualKeyboard.Styles
#####################################################################
-qt_add_qml_module(qtquickvirtualkeyboardstylesplugin
+qt_internal_add_qml_module(qtvkbstylesplugin
URI "QtQuick.VirtualKeyboard.Styles"
- VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}"
- CLASSNAME QtQuickVirtualKeyboardStylesPlugin
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2 1
+ PLUGIN_TARGET qtvkbstylesplugin
+ CLASS_NAME "QtQuickVirtualKeyboardStylesPlugin"
+ # Note: The plugin source is defined manually because it uses an
+ # image provider. Once the image provider doesn't need an
+ # engine anymore, we can auto-generate the plugin.
+ NO_GENERATE_PLUGIN_SOURCE
+ NO_PLUGIN_OPTIONAL
DEPENDENCIES
- QtQuick/2.0
- SKIP_TYPE_REGISTRATION
+ QtQuick/auto
+ IMPORTS
+ ${styles_imports}
SOURCES
qtquickvirtualkeyboardstylesplugin.cpp qtquickvirtualkeyboardstylesplugin.h
svgimageprovider.cpp svgimageprovider.h
+ QML_FILES
+ KeyboardStyle.qml
+ KeyIcon.qml
+ KeyPanel.qml
+ SelectionListItem.qml
+ TraceInputKeyPanel.qml
+ TraceCanvas.qml
+ TraceUtils.js
DEFINES
QT_ASCII_CAST_WARNINGS
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_FROM_BYTEARRAY
QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
Qt::Svg
- Qt::VirtualKeyboardPrivate
-)
-
-# Resources:
-set(styles_resource_files
- "KeyIcon.qml"
- "KeyPanel.qml"
- "KeyboardStyle.qml"
- "SelectionListItem.qml"
- "TraceCanvas.qml"
- "TraceInputKeyPanel.qml"
- "TraceUtils.js"
-)
-
-qt_add_resource(qtquickvirtualkeyboardstylesplugin "styles"
- PREFIX
- "/QtQuick/VirtualKeyboard/Styles/content"
- FILES
- ${styles_resource_files}
+ Qt::VirtualKeyboard
+ NO_GENERATE_CPP_EXPORTS
)
-
-
-#### Keys ignored in scope 1:.:.:styles.pro:<TRUE>:
-# IMPORT_VERSION = "2.$$QT_MINOR_VERSION"
-# OTHER_FILES = "plugins.qmltypes" "qmldir"
-# TARGETPATH = "QtQuick/VirtualKeyboard/Styles"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:styles.pro:WIN32:
-# QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-# QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
diff --git a/src/styles/KeyIcon.qml b/src/styles/KeyIcon.qml
index 645fe11e..5ee413e6 100644
--- a/src/styles/KeyIcon.qml
+++ b/src/styles/KeyIcon.qml
@@ -1,38 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
+import QtQuick
/*!
\qmltype KeyIcon
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief Key icon with adjustable color.
+ \ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
The KeyIcon item displays an icon with adjustable color.
diff --git a/src/styles/KeyPanel.qml b/src/styles/KeyPanel.qml
index 4e12b9a8..a85f0305 100644
--- a/src/styles/KeyPanel.qml
+++ b/src/styles/KeyPanel.qml
@@ -1,38 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
+import QtQuick
/*!
\qmltype KeyPanel
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A base type of the styled keys.
+ \ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
All the key delegates provided by the style should be based on this type.
@@ -82,7 +57,8 @@ Item {
implicitHeight: keyPanelInfoText.height + 4
Text {
id: keyPanelInfoText
- text: root.parent.width + "x" + root.parent.height
+ property point pos: keyboard.keyboardLayoutLoader.item.mapFromItem(root.parent, 0, 0)
+ text: "(%1,%2)\n%3x%4\nweight: %5".arg(pos.x).arg(pos.y).arg(root.parent.width).arg(root.parent.height).arg(root.parent.control.weight)
font.pixelSize: 12
color: "white"
anchors.centerIn: parent
diff --git a/src/styles/KeyboardStyle.qml b/src/styles/KeyboardStyle.qml
index c3a6f4dd..459a885e 100644
--- a/src/styles/KeyboardStyle.qml
+++ b/src/styles/KeyboardStyle.qml
@@ -1,38 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
/*!
\qmltype KeyboardStyle
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief Provides a styling interface for the Virtual Keyboard.
+ \ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
The style type provides the style definitions that are used by
@@ -527,4 +502,31 @@ QtObject {
The default color is set to \c fullScreenInputColor.
*/
property color fullScreenInputSelectedTextColor: fullScreenInputColor
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 6.2
+
+ Template for the function list item.
+
+ \note The delegate is used in a \l ListView.
+
+ The following properties are available to the item:
+ \list
+ \li \c keyboardFunction - Keyboard function of the current item.
+ \endlist
+ */
+ property Component functionPopupListDelegate: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 6.2
+
+ Template for the function popup list highlight.
+
+ \note The delegate is used as \c ListView.highlight.
+ */
+ property Component functionPopupListHighlight: null
+
+ /*! \since QtQuick.VirtualKeyboard.Styles 6.2
+
+ Template for the function popup list background.
+ */
+ property Component functionPopupListBackground: null
}
diff --git a/src/styles/SelectionListItem.qml b/src/styles/SelectionListItem.qml
index bea759ed..d6790f44 100644
--- a/src/styles/SelectionListItem.qml
+++ b/src/styles/SelectionListItem.qml
@@ -1,38 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
+import QtQuick
/*!
\qmltype SelectionListItem
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A base type for selection list item delegates.
+ \ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
The SelectionListItem enables mouse handling for the selection list item
diff --git a/src/styles/TraceCanvas.qml b/src/styles/TraceCanvas.qml
index ce8f03a7..9d17ad7f 100644
--- a/src/styles/TraceCanvas.qml
+++ b/src/styles/TraceCanvas.qml
@@ -1,39 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
import "TraceUtils.js" as TraceUtils
+import QtQuick.VirtualKeyboard
/*!
\qmltype TraceCanvas
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A specialized Canvas type for rendering Trace objects.
+ \ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
\inherits Canvas
\since QtQuick.VirtualKeyboard 2.0
@@ -96,19 +72,20 @@ Canvas {
/*! Provides access to \l Trace object.
*/
- property var trace
+ property Trace trace
/*! Enables auto destruction mode.
If enabled, this item will be destroyed when the \c trace object is
destroyed.
- The default value is false.
+ The default value is false. In this case the canvas can be reused after
+ onRecycle signal is triggered.
*/
property bool autoDestroy
/*! Specifies the approximate delay in milliseconds, counted from the beginning of the
- auto destruction, before the object is to be destroyed.
+ auto destruction, before the object is to be destroyed or recycled.
This delay makes it possible, for example, to animate the item before destruction.
@@ -136,7 +113,61 @@ Canvas {
__renderPos = TraceUtils.renderSmoothedLine(getContext("2d"), trace, __renderPos)
}
- onTraceChanged: if (trace === null && autoDestroy) destroy(autoDestroyDelay)
+ /*! Clears screen and resets the rendering.
+
+ \since QtQuick.VirtualKeyboard.Styles 6.1
+ */
+ function renderClear() {
+ var ctx = getContext("2d")
+ ctx.clearRect(0, 0, width, height)
+ __renderPos = 0
+ }
+
+ /*! Recycles trace canvas by clearing all drawings and resetting the variables.
+
+ The function triggers onRecycle signal after completed (before the return).
+
+ The function returns true when recycling is successful.
+
+ \since QtQuick.VirtualKeyboard.Styles 6.1
+ */
+ function recycle() {
+ if (!available) {
+ destroy()
+ return false
+ }
+
+ trace = null
+ recycleTimer.stop()
+ opacity = Qt.binding(function() {
+ return trace ? trace.opacity : 1.0
+ })
+ requestAnimationFrame(renderClear)
+ onRecycle(canvas)
+
+ return true
+ }
+
+ /*! Emitted when the \a traceCanvas is recycled.
+
+ \since QtQuick.VirtualKeyboard.Styles 6.1
+ */
+ signal onRecycle(var traceCanvas)
+
+ Timer {
+ id: recycleTimer
+ interval: canvas.autoDestroyDelay
+ onTriggered: canvas.recycle()
+ }
+
+ onTraceChanged: {
+ if (trace === null) {
+ if (autoDestroy || !available)
+ destroy(autoDestroyDelay)
+ else
+ recycleTimer.restart()
+ }
+ }
onAvailableChanged: {
__renderingEnabled = available
@@ -146,8 +177,8 @@ Canvas {
Connections {
target: canvas.__renderingEnabled && trace ? trace : null
- onLengthChanged: if (renderFunction) canvas.requestAnimationFrame(renderFunction)
- onFinalChanged: if (renderFunction) canvas.requestAnimationFrame(renderFunction)
+ function onLengthChanged() { if (renderFunction) canvas.requestAnimationFrame(renderFunction) }
+ function onFinalChanged() { if (renderFunction) canvas.requestAnimationFrame(renderFunction) }
}
opacity: trace ? trace.opacity : 1.0
diff --git a/src/styles/TraceInputKeyPanel.qml b/src/styles/TraceInputKeyPanel.qml
index d128a12b..d023103a 100644
--- a/src/styles/TraceInputKeyPanel.qml
+++ b/src/styles/TraceInputKeyPanel.qml
@@ -1,38 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
+import QtQuick
/*!
\qmltype TraceInputKeyPanel
\inqmlmodule QtQuick.VirtualKeyboard.Styles
\brief A base type of the trace input key.
+ \ingroup qmlclass
\ingroup qtvirtualkeyboard-styles-qml
\since QtQuick.VirtualKeyboard 2.0
diff --git a/src/styles/TraceUtils.js b/src/styles/TraceUtils.js
index c02ce5e9..d11970c3 100644
--- a/src/styles/TraceUtils.js
+++ b/src/styles/TraceUtils.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
.pragma library
diff --git a/src/styles/builtin/CMakeLists.txt b/src/styles/builtin/CMakeLists.txt
new file mode 100644
index 00000000..ac3a2491
--- /dev/null
+++ b/src/styles/builtin/CMakeLists.txt
@@ -0,0 +1,95 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_qml_module(qtvkbbuiltinstylesplugin
+ URI "QtQuick.VirtualKeyboard.Styles.Builtin"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2 1
+ PLUGIN_TARGET qtvkbbuiltinstylesplugin
+ CLASS_NAME "QtQuickVirtualKeyboardStylesBuiltinPlugin"
+ NO_PLUGIN_OPTIONAL
+ NO_GENERATE_PLUGIN_SOURCE
+ SOURCES
+ qtquickvirtualkeyboardbstylesbuiltinplugin.cpp qtquickvirtualkeyboardbstylesbuiltinplugin.h
+ NO_GENERATE_CPP_EXPORTS
+)
+
+# Resources:
+set(virtualkeyboard_default_style_resource_files
+ "default/images/backspace-fff.svg"
+ "default/images/check-fff.svg"
+ "default/images/enter-fff.svg"
+ "default/images/globe-fff.svg"
+ "default/images/handwriting-fff.svg"
+ "default/images/hidekeyboard-fff.svg"
+ "default/images/search-fff.svg"
+ "default/images/selectionhandle-bottom.svg"
+ "default/images/shift-80c342.svg"
+ "default/images/shift-fff.svg"
+ "default/images/shift-c5d6b6.svg"
+ "default/images/textmode-fff.svg"
+ "default/images/settings-fff.svg"
+ "default/style.qml"
+)
+
+qt_internal_add_resource(qtvkbbuiltinstylesplugin "virtualkeyboard_default_style"
+ PREFIX
+ "/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/default"
+ BASE
+ "default"
+ FILES
+ ${virtualkeyboard_default_style_resource_files}
+)
+set(virtualkeyboard_retro_style_resource_files
+ "retro/images/backspace-c5a96f.svg"
+ "retro/images/check-c5a96f.svg"
+ "retro/images/enter-c5a96f.svg"
+ "retro/images/globe-110b05.svg"
+ "retro/images/globe-c5a96f.svg"
+ "retro/images/globe-fff.svg"
+ "retro/images/handwriting-110b05.svg"
+ "retro/images/handwriting-c5a96f.svg"
+ "retro/images/handwriting-fff.svg"
+ "retro/images/hidekeyboard-110b05.svg"
+ "retro/images/hidekeyboard-c5a96f.svg"
+ "retro/images/hidekeyboard-fff.svg"
+ "retro/images/key154px_black.png"
+ "retro/images/key154px_black.svg"
+ "retro/images/key154px_black_long.png"
+ "retro/images/key154px_capslock.png"
+ "retro/images/key154px_capslock_long.png"
+ "retro/images/key154px_colorA.png"
+ "retro/images/key154px_colorA.svg"
+ "retro/images/key154px_colorA_long.png"
+ "retro/images/key154px_colorB.png"
+ "retro/images/key154px_shiftcase.png"
+ "retro/images/key154px_shiftcase_long.png"
+ "retro/images/key156px_black_long.png"
+ "retro/images/key156px_black_medium_long.png"
+ "retro/images/key156px_colorA.png"
+ "retro/images/key156px_colorB.png"
+ "retro/images/key160px_black.png"
+ "retro/images/key160px_colorA.png"
+ "retro/images/key160px_colorB.png"
+ "retro/images/key_preview.png"
+ "retro/images/search-c5a96f.svg"
+ "retro/images/selectionhandle-bottom.svg"
+ "retro/images/shift-c5a96f.svg"
+ "retro/images/shift-cd8865.svg"
+ "retro/images/shift-dc4f28.svg"
+ "retro/images/textmode-110b05.svg"
+ "retro/images/textmode-c5a96f.svg"
+ "retro/images/textmode-fff.svg"
+ "retro/images/triangle_black.png"
+ "retro/images/triangle_highlight.png"
+ "retro/style.qml"
+)
+
+qt_internal_add_resource(qtvkbbuiltinstylesplugin "virtualkeyboard_retro_style"
+ PREFIX
+ "/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/retro"
+ BASE
+ "retro"
+ FILES
+ ${virtualkeyboard_retro_style_resource_files}
+)
diff --git a/src/styles/builtin/default/images/backspace-fff.svg b/src/styles/builtin/default/images/backspace-fff.svg
new file mode 100644
index 00000000..e3dac14a
--- /dev/null
+++ b/src/styles/builtin/default/images/backspace-fff.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="159px" height="88px" viewBox="0 0 159 88" enable-background="new 0 0 159 88" xml:space="preserve">
+<g>
+ <rect fill="none" width="159" height="88"/>
+ <g>
+ <g>
+ <path fill="#fff" d="M158.8,88H44L0,44L44,0h114.8V88z M48.7,76.7h98.8V11.3H48.7L16,44L48.7,76.7z"/>
+ </g>
+ <g>
+ <g>
+
+ <rect x="87.3" y="16.2" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 127.5895 140.8497)" fill="#fff" width="11.3" height="55.7"/>
+ </g>
+ <g>
+
+ <rect x="65.1" y="38.4" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 127.5954 140.8499)" fill="#fff" width="55.7" height="11.3"/>
+ </g>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/default/images/check-fff.svg b/src/styles/builtin/default/images/check-fff.svg
new file mode 100644
index 00000000..9e5ebb00
--- /dev/null
+++ b/src/styles/builtin/default/images/check-fff.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="170px" height="119px" viewBox="0 0 170 119" enable-background="new 0 0 170 119" xml:space="preserve">
+<g>
+ <polygon fill="#fff" points="62.3,119 0,56.7 11.3,45.3 62.3,96.3 158.7,0 170,11.3 "/>
+</g>
+</svg>
diff --git a/src/styles/builtin/default/images/enter-fff.svg b/src/styles/builtin/default/images/enter-fff.svg
new file mode 100644
index 00000000..3a400341
--- /dev/null
+++ b/src/styles/builtin/default/images/enter-fff.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="211px" height="80px" viewBox="0 0 211 80" enable-background="new 0 0 211 80" xml:space="preserve">
+<g>
+ <rect fill="none" width="211" height="80"/>
+ <g>
+ <rect x="9.2" y="33.8" fill="#fff" width="201.8" height="12.3"/>
+ <rect x="198.7" y="10.7" fill="#fff" width="12.3" height="35.3"/>
+ <polygon fill="#fff" points="44.5,0 44.5,79.8 0,40.7 "/>
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/default/images/globe-fff.svg b/src/styles/builtin/default/images/globe-fff.svg
new file mode 100644
index 00000000..e865b9fd
--- /dev/null
+++ b/src/styles/builtin/default/images/globe-fff.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="144px" height="144px" viewBox="0 0 144 144" enable-background="new 0 0 144 144" xml:space="preserve">
+<g>
+ <rect fill="none" width="144" height="144"/>
+ <g>
+ <path fill="#fff" d="M72,144c-39.5,0-71.8-32.1-72-71.6C-0.2,32.7,31.9,0.2,71.6,0h0.7c19.1,0.1,37.1,7.6,50.6,21.1
+ s21,31.5,21.1,50.5c0.1,19.2-7.3,37.4-20.8,51c-13.5,13.7-31.6,21.3-50.8,21.4C72.2,144,72.1,144,72,144z M76.3,101.3v32.3
+ c9-8.1,16-17.9,20.6-28.7C90.2,102.9,83.3,101.7,76.3,101.3z M47,104.9c3.2,7.4,7.5,14.3,12.8,20.6c2.4,2.9,5.1,5.6,7.9,8.1v-32.3
+ C60.7,101.7,53.8,102.9,47,104.9z M105.2,107.9c-3.9,9.2-9.2,17.6-15.9,25.1c10.4-2.9,19.9-8.5,27.8-16.4c0.5-0.5,1-1.1,1.6-1.6
+ C114.3,112.1,109.8,109.8,105.2,107.9z M25.5,114.9c7.8,8.5,17.9,14.8,29.3,18c-0.5-0.6-1.1-1.2-1.6-1.8
+ c-6-7.1-10.8-14.9-14.3-23.3C34.2,109.8,29.8,112.1,25.5,114.9z M108.1,99.7c5.5,2.3,10.8,5.1,15.9,8.4
+ c6.5-9.4,10.4-20.3,11.2-31.8h-22.9c-0.1,1.2-0.1,2.4-0.2,3.7C111.4,86.8,110.1,93.4,108.1,99.7z M8.8,76.3
+ C9.6,88.1,13.6,99,20,108.1c5.1-3.3,10.4-6.1,15.8-8.4c-2.4-7.5-3.7-15.4-4.1-23.4L8.8,76.3L8.8,76.3z M40.4,76.3
+ c0.3,7,1.5,13.8,3.6,20.4c7.7-2.4,15.7-3.8,23.7-4.1V76.3H40.4z M76.3,92.6c8,0.4,15.9,1.7,23.6,4.1c1.7-5.6,2.9-11.5,3.4-17.5
+ c0.1-1,0.1-2,0.2-2.9H76.3V92.6z M112.2,67.7h23c-0.8-11.5-4.6-22.4-11.2-31.8c-5.1,3.4-10.5,6.2-16.1,8.5
+ C110.4,51.9,111.8,59.7,112.2,67.7z M76.3,67.7h27.2c-0.4-7-1.6-13.8-3.7-20.4c-7.7,2.4-15.5,3.7-23.5,4.1V67.7z M40.5,67.7h27.2
+ V51.4c-7.9-0.4-15.8-1.7-23.4-4.1c-1.8,5.8-3,11.9-3.6,18.1C40.6,66.2,40.5,66.9,40.5,67.7z M8.8,67.7h23c0.1-1,0.1-2,0.2-3
+ c0.6-7,2-13.8,4-20.3c-5.5-2.3-10.9-5.1-16-8.5C13.6,45,9.6,55.9,8.8,67.7z M76.3,11.1v31.6c6.9-0.3,13.7-1.5,20.4-3.5
+ c-3.1-7.1-7.3-13.9-12.5-20C81.8,16.3,79.1,13.6,76.3,11.1z M47.3,39.2c6.7,2,13.5,3.2,20.4,3.5V11.1C58.8,19,51.9,28.6,47.3,39.2
+ z M88.4,10.8c0.8,0.9,1.6,1.8,2.4,2.8c5.9,6.9,10.6,14.6,14.1,22.7c4.7-2,9.3-4.3,13.7-7.2c-0.6-0.6-1.2-1.2-1.8-1.9
+ C108.8,19.2,99,13.6,88.4,10.8z M25.5,29.1c4.4,2.8,8.9,5.2,13.6,7.1c4-9.3,9.5-17.9,16.5-25.4C43.8,14,33.5,20.4,25.5,29.1z"/>
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/default/images/handwriting-fff.svg b/src/styles/builtin/default/images/handwriting-fff.svg
new file mode 100644
index 00000000..cc74e1d5
--- /dev/null
+++ b/src/styles/builtin/default/images/handwriting-fff.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="156"
+ height="156"
+ viewBox="0 0 156 156"
+ enable-background="new 0 0 156 104"
+ xml:space="preserve"
+ sodipodi:docname="handwriting-868482.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="6.6858974"
+ inkscape:cx="78"
+ inkscape:cy="52"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g8"
+ transform="translate(0,26.023835)">
+ <rect
+ fill="none"
+ width="156"
+ height="104"
+ id="rect2"
+ x="0"
+ y="0" />
+ <g
+ id="g6">
+ <path
+ fill="#ffffff"
+ d="M 37.6,103.3 C 27.5,103.3 18.7,98.3 14.5,89.7 4.4,68.7 19.9,52.3 36.2,35 37.4,33.8 38.6,32.5 39.8,31.2 45.1,25.5 45,19.7 43.3,16.4 41.5,13 37.8,11.5 33.1,12.2 16.6,14.8 11.9,38.6 11.9,38.8 L 0,36.6 C 0.3,35.3 6.4,4.3 31.2,0.3 41,-1.3 49.7,2.7 53.9,10.7 c 4.7,8.9 2.6,20.1 -5.3,28.6 -1.2,1.3 -2.4,2.6 -3.6,3.8 -16.7,17.8 -25.9,28.5 -19.6,41.4 3.3,6.8 11.1,7.6 16.9,6.3 C 51.5,88.7 62.1,79.7 62,61.3 61.8,33.2 78.2,19.5 92.2,16.4 c 14.5,-3.2 28.4,3.6 34.7,17 1.3,2.8 2.3,5.4 3.1,8.1 13.3,0.7 25.5,4.3 26,4.4 l -3.4,11.5 c -0.1,0 -9.7,-2.8 -20.6,-3.8 0.5,16.5 -8.6,28.9 -20.1,34.7 -11.9,6 -24,3.8 -28.9,-5.2 -3.1,-5.6 -1.9,-14.7 2.9,-22.5 7.9,-13 21.3,-17.4 31.5,-18.8 C 117,40.6 116.5,39.4 116,38.4 112.1,30.1 103.8,26 94.9,28 c -9.7,2.2 -21,12.1 -20.8,33.1 0.2,25.5 -15.6,38.1 -29,41.3 -2.6,0.6 -5.1,0.9 -7.5,0.9 z m 82.2,-49.6 c -14,1.5 -20.6,8.5 -23.4,12.9 -3.3,5.2 -3.4,9.8 -2.9,10.9 1.6,2.9 7.3,3 13,0.2 10.8,-5.5 13.8,-15.1 13.3,-24 z"
+ id="path4" />
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/default/images/hidekeyboard-fff.svg b/src/styles/builtin/default/images/hidekeyboard-fff.svg
new file mode 100644
index 00000000..a4f0b9b3
--- /dev/null
+++ b/src/styles/builtin/default/images/hidekeyboard-fff.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="144px" height="127px" viewBox="0 0 144 127" enable-background="new 0 0 144 127" xml:space="preserve">
+<g>
+ <rect fill="none" width="144" height="127"/>
+ <g>
+ <g>
+ <path fill="#fff" d="M144,90.3H0V0h144V90.3z M10.9,79.4h122.2V10.9H10.9V79.4z"/>
+ </g>
+ <g>
+ <rect x="19.5" y="20.2" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="20.2" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="56.8" y="20.2" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="75.5" y="20.2" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="94.2" y="20.2" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="112.9" y="20.2" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="19.5" y="39.7" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="39.7" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="56.8" y="39.7" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="75.5" y="39.7" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="94.2" y="39.7" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="112.9" y="39.7" fill="#fff" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="59.2" fill="#fff" width="67.7" height="11.7"/>
+ </g>
+ <g>
+ <polygon fill="#fff" points="72,115.2 62.2,108.2 45.9,108.2 72,126.9 98.1,108.2 81.8,108.2 "/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/default/images/search-fff.svg b/src/styles/builtin/default/images/search-fff.svg
new file mode 100644
index 00000000..9c21e291
--- /dev/null
+++ b/src/styles/builtin/default/images/search-fff.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="148px" height="148px" viewBox="0 0 148 148" enable-background="new 0 0 148 148" xml:space="preserve">
+<g>
+ <rect fill="none" width="148" height="148"/>
+ <g>
+ <path fill="#fff" d="M146.8,132.7c1.6,1.6,1.6,4.1,0,5.7l-8.5,8.5c-1.6,1.6-4.1,1.6-5.7,0l-44.6-44.6c-1.6-1.6-1.6-4.1,0-5.7
+ l8.5-8.5c1.6-1.6,4.1-1.6,5.7,0L146.8,132.7z"/>
+ <path fill="#fff" d="M58,12c25.4,0,46,20.6,46,46s-20.6,46-46,46c-25.4,0-46-20.6-46-46S32.6,12,58,12 M58,0C26,0,0,26,0,58
+ s26,58,58,58c32,0,58-26,58-58S90,0,58,0L58,0z"/>
+ </g>
+</g>
+</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/selectionhandle-bottom.svg b/src/styles/builtin/default/images/selectionhandle-bottom.svg
index 312e3ab5..312e3ab5 100644
--- a/src/virtualkeyboard/content/styles/default/images/selectionhandle-bottom.svg
+++ b/src/styles/builtin/default/images/selectionhandle-bottom.svg
diff --git a/src/styles/builtin/default/images/settings-fff.svg b/src/styles/builtin/default/images/settings-fff.svg
new file mode 100644
index 00000000..fdda82fa
--- /dev/null
+++ b/src/styles/builtin/default/images/settings-fff.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ width="16.303936mm"
+ height="16.548409mm"
+ viewBox="0 0 16.303937 16.548409"
+ version="1.1"
+ id="svg5"
+ inkscape:version="1.1-alpha (b0f32e08fc, 2021-03-07)"
+ sodipodi:docname="settings.svg"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview7"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ objecttolerance="10.0"
+ gridtolerance="10.0"
+ guidetolerance="10.0"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:document-units="mm"
+ showgrid="false"
+ inkscape:zoom="4.2532751"
+ inkscape:cx="-41.732546"
+ inkscape:cy="41.967659"
+ inkscape:window-width="1848"
+ inkscape:window-height="1016"
+ inkscape:window-x="72"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="layer1"
+ inkscape:snap-others="false"
+ fit-margin-top="0.1"
+ fit-margin-right="0.1"
+ fit-margin-bottom="0.1"
+ fit-margin-left="0.1" />
+ <defs
+ id="defs2" />
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="display:inline"
+ transform="translate(-86.699353,-53.971583)">
+ <path
+ id="path914"
+ style="fill:#fff;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ inkscape:transform-center-y="-7.0565799"
+ d="M 93.952921,54.071633 93.755,55.875142 a 6.4693593,6.4693593 0 0 0 -1.75028,0.583427 l -1.230934,-1.354439 -1.454174,1.056783 0.904854,1.584399 a 6.4693593,6.4693593 0 0 0 -1.094507,1.488797 l -1.775084,-0.368969 -0.555522,1.708941 1.647444,0.743106 a 6.4693593,6.4693593 0 0 0 -0.08165,0.932243 6.4693593,6.4693593 0 0 0 0.08113,0.925523 l -1.646928,0.742075 0.555522,1.709457 1.771467,-0.367938 a 6.4693593,6.4693593 0 0 0 1.095539,1.492933 l -0.902269,1.579231 1.454174,1.056267 1.225764,-1.348237 a 6.4693593,6.4693593 0 0 0 1.755966,0.58601 l 0.197405,1.79524 h 1.797304 l 0.197406,-1.798341 a 6.4693593,6.4693593 0 0 0 1.731161,-0.58756 l 0.0186,-0.0021 1.231966,1.355471 1.453666,-1.056783 -0.907963,-1.590082 0.01447,-0.03152 A 6.4693593,6.4693593 0 0 0 100.537,65.270404 l 0.0181,-0.01654 1.79317,0.372586 0.55501,-1.708941 -1.66967,-0.752925 -0.007,-0.03359 a 6.4693593,6.4693593 0 0 0 0.077,-0.8816 6.4693593,6.4693593 0 0 0 -0.0692,-0.922941 l 1.66864,-0.751893 -0.55501,-1.709457 -1.7911,0.372071 a 6.4693593,6.4693593 0 0 0 -1.080039,-1.489832 l 0.906399,-1.586466 -1.454168,-1.056266 -1.225765,1.347721 a 6.4693593,6.4693593 0 0 0 -1.754933,-0.575159 l -0.198438,-1.805575 z m 0.8816,3.507798 a 4.6701392,4.6701392 0 0 1 4.669999,4.669999 4.6701392,4.6701392 0 0 1 -4.669999,4.670515 4.6701392,4.6701392 0 0 1 -4.669999,-4.670515 4.6701392,4.6701392 0 0 1 4.669999,-4.669999 z" />
+ <circle
+ style="display:inline;fill:#fff;fill-opacity:1;stroke:none;stroke-width:0.529167;stroke-linejoin:round;stroke-opacity:1"
+ id="circle12597"
+ cx="94.834518"
+ cy="62.249687"
+ r="1.7568086" />
+ </g>
+</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/shift-80c342.svg b/src/styles/builtin/default/images/shift-80c342.svg
index d39a2230..d39a2230 100644
--- a/src/virtualkeyboard/content/styles/default/images/shift-80c342.svg
+++ b/src/styles/builtin/default/images/shift-80c342.svg
diff --git a/src/virtualkeyboard/content/styles/default/images/shift-c5d6b6.svg b/src/styles/builtin/default/images/shift-c5d6b6.svg
index 22f9d5de..22f9d5de 100644
--- a/src/virtualkeyboard/content/styles/default/images/shift-c5d6b6.svg
+++ b/src/styles/builtin/default/images/shift-c5d6b6.svg
diff --git a/src/styles/builtin/default/images/shift-fff.svg b/src/styles/builtin/default/images/shift-fff.svg
new file mode 100644
index 00000000..ff65317b
--- /dev/null
+++ b/src/styles/builtin/default/images/shift-fff.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="144px" height="134px" viewBox="0 0 144 134" enable-background="new 0 0 144 134" xml:space="preserve">
+<g>
+ <rect fill="none" width="144" height="134"/>
+ <g>
+ <path fill="#fff" d="M103.6,134H40.2V77.5H0L71.9,0l71.9,77.5h-40.2V134L103.6,134z M51.7,122.5h40.5V66.1h25.4L71.9,16.8
+ L26.2,66.1h25.4L51.7,122.5L51.7,122.5z"/>
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/default/images/textmode-fff.svg b/src/styles/builtin/default/images/textmode-fff.svg
new file mode 100644
index 00000000..bdb144cd
--- /dev/null
+++ b/src/styles/builtin/default/images/textmode-fff.svg
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="124"
+ height="124"
+ viewBox="0 0 124 124"
+ enable-background="new 0 0 124 96"
+ xml:space="preserve"
+ sodipodi:docname="textmode-868482.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs23" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview21"
+ showgrid="false"
+ inkscape:zoom="8.4112903"
+ inkscape:cx="62"
+ inkscape:cy="48"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g18"
+ transform="translate(0,14)">
+ <g
+ id="g14">
+ <g
+ id="g6">
+ <path
+ fill="#ffffff"
+ d="M 55.4,70.8 46.9,49 H 19.4 L 11,70.8 H 2.9 L 30,2 h 6.7 l 27,68.8 z m -11,-29 -8,-21.2 c -1,-2.7 -2.1,-6 -3.2,-9.9 -0.7,3 -1.7,6.3 -3,9.9 l -8.1,21.2 z"
+ id="path2" />
+ <path
+ fill="#ffffff"
+ d="M 66.6,72.8 H 54.1 L 45.5,51 H 20.8 L 12.4,72.8 H 0 L 28.7,0 h 9.4 z m -9.8,-4 h 4 L 35.4,4 h -1.9 l 1.7,6.2 c 1.1,3.8 2.1,7.1 3.1,9.7 l 9,24 h -28 L 28.4,20 c 1.2,-3.5 2.2,-6.7 2.9,-9.6 L 32.8,4 H 31.4 L 5.9,68.8 H 9.7 L 18.1,47 h 30.2 z m -31.7,-29 h 16.4 l -7,-18.5 c -0.4,-1.1 -0.8,-2.2 -1.2,-3.4 -0.4,1.1 -0.7,2.2 -1.2,3.4 z"
+ id="path4" />
+ </g>
+ <g
+ id="g12">
+ <path
+ fill="#ffffff"
+ d="m 116.2,70.8 -1.5,-7.3 h -0.4 c -2.6,3.2 -5.1,5.4 -7.7,6.5 -2.6,1.1 -5.7,1.7 -9.5,1.7 -5.1,0 -9.1,-1.3 -12,-3.9 -2.9,-2.6 -4.3,-6.4 -4.3,-11.2 0,-10.4 8.3,-15.8 24.9,-16.3 l 8.7,-0.3 v -3.2 c 0,-4 -0.9,-7 -2.6,-8.9 C 110.1,26 107.3,25 103.5,25 99.2,25 94.4,26.3 89,28.9 l -2.4,-6 c 2.5,-1.4 5.3,-2.5 8.3,-3.2 3,-0.7 6,-1.2 9.1,-1.2 6.1,0 10.7,1.4 13.6,4.1 2.9,2.7 4.4,7.1 4.4,13.1 V 70.8 Z M 98.7,65.3 c 4.8,0 8.6,-1.3 11.4,-4 2.8,-2.7 4.1,-6.4 4.1,-11.2 v -4.6 l -7.8,0.3 C 100.2,46 95.8,47 93,48.7 c -2.8,1.7 -4,4.4 -4,8 0,2.8 0.9,5 2.6,6.4 1.7,1.4 4,2.2 7.1,2.2 z"
+ id="path8" />
+ <path
+ fill="#ffffff"
+ d="m 97.1,73.8 c -5.6,0 -10.1,-1.5 -13.3,-4.5 -3.3,-3 -5,-7.3 -5,-12.7 0,-11.6 9,-17.8 26.8,-18.3 l 6.8,-0.2 v -1.3 c 0,-3.5 -0.7,-6.1 -2.1,-7.6 -1.3,-1.5 -3.6,-2.2 -6.8,-2.2 -4,0 -8.6,1.3 -13.7,3.7 l -1.9,0.9 -3.9,-9.5 1.6,-0.8 c 2.7,-1.4 5.6,-2.6 8.8,-3.4 3.2,-0.8 6.4,-1.2 9.6,-1.2 6.6,0 11.7,1.6 15,4.6 3.4,3.1 5.1,8 5.1,14.5 v 37.1 h -9.4 l -1.1,-5.3 c -2,2 -4,3.5 -6,4.4 -2.9,1.1 -6.4,1.8 -10.5,1.8 z M 103.5,23 c 4.4,0 7.7,1.2 9.8,3.5 2.1,2.3 3.1,5.7 3.1,10.3 V 42 l -10.7,0.3 c -23,0.7 -23,10.9 -23,14.3 0,4.3 1.2,7.5 3.7,9.7 2.5,2.3 6.1,3.4 10.6,3.4 3.5,0 6.4,-0.5 8.7,-1.5 2.2,-1 4.6,-3 6.9,-6 l 0.6,-0.8 h 2.6 l 0.7,1.6 1.2,5.7 h 2.1 V 35.8 c 0,-5.4 -1.3,-9.3 -3.8,-11.6 -2.6,-2.4 -6.7,-3.5 -12.3,-3.5 -2.8,0 -5.7,0.4 -8.6,1.1 -2.2,0.6 -4.3,1.3 -6.3,2.3 l 0.9,2.3 C 94.9,24.1 99.4,23 103.5,23 Z m -4.8,44.3 c -3.5,0 -6.4,-0.9 -8.5,-2.7 C 88,62.8 87,60.1 87,56.7 c 0,-4.3 1.7,-7.6 5,-9.6 3.1,-1.9 7.8,-3 14.4,-3.2 l 9.9,-0.4 v 6.7 c 0,5.3 -1.6,9.6 -4.8,12.6 -3.2,3 -7.5,4.5 -12.8,4.5 z m 13.5,-19.7 -5.7,0.2 c -5.8,0.2 -10,1.1 -12.4,2.6 -2.1,1.4 -3.1,3.4 -3.1,6.3 0,2.2 0.6,3.8 1.9,4.9 1.3,1.1 3.3,1.7 5.8,1.7 4.3,0 7.6,-1.1 10,-3.4 2.4,-2.3 3.5,-5.5 3.5,-9.7 z"
+ id="path10" />
+ </g>
+ </g>
+ <rect
+ y="88"
+ fill="#ffffff"
+ width="124"
+ height="8"
+ id="rect16"
+ x="0" />
+</g>
+</svg>
diff --git a/src/styles/builtin/default/style.qml b/src/styles/builtin/default/style.qml
new file mode 100644
index 00000000..0681ef43
--- /dev/null
+++ b/src/styles/builtin/default/style.qml
@@ -0,0 +1,1215 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Styles
+
+KeyboardStyle {
+ id: currentStyle
+ readonly property bool compactSelectionList: [InputEngine.InputMode.Pinyin, InputEngine.InputMode.Cangjie, InputEngine.InputMode.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1
+ readonly property string fontFamily: "Sans"
+ readonly property real keyBackgroundMargin: Math.round(8 * scaleHint)
+ readonly property real keyContentMargin: Math.round(40 * scaleHint)
+ readonly property real keyIconScale: scaleHint * 0.8
+ readonly property string resourcePrefix: "qrc:/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/default/"
+
+ readonly property string inputLocale: InputContext.locale
+ property color primaryColor: "#263238"
+ property color primaryLightColor: "#4f5b62"
+ property color primaryDarkColor: "#000a12"
+ property color textOnPrimaryColor: "#ffffff"
+ property color secondaryColor: "#01579b"
+ property color secondaryLightColor: "#4f83cc"
+ property color secondaryDarkColor: "#002f6c"
+ property color textOnSecondaryColor: "#ffffff"
+
+ property color keyboardBackgroundColor: primaryColor
+ property color normalKeyBackgroundColor: primaryDarkColor
+ property color highlightedKeyBackgroundColor: primaryLightColor
+ property color capsLockKeyAccentColor: secondaryColor
+ property color modeKeyAccentColor: textOnPrimaryColor
+ property color keyTextColor: textOnPrimaryColor
+ property color keySmallTextColor: textOnPrimaryColor
+ property color popupBackgroundColor: secondaryColor
+ property color popupBorderColor: secondaryLightColor
+ property color popupTextColor: textOnSecondaryColor
+ property color popupHighlightColor: secondaryLightColor
+ property color selectionListTextColor: textOnPrimaryColor
+ property color selectionListSeparatorColor: primaryLightColor
+ property color selectionListBackgroundColor: primaryColor
+ property color navigationHighlightColor: "yellow"
+
+ property real inputLocaleIndicatorOpacity: 1.0
+ property Timer inputLocaleIndicatorHighlightTimer: Timer {
+ interval: 1000
+ onTriggered: inputLocaleIndicatorOpacity = 0.5
+ }
+ onInputLocaleChanged: {
+ inputLocaleIndicatorOpacity = 1.0
+ inputLocaleIndicatorHighlightTimer.restart()
+ }
+
+ property Component component_settingsIcon: Component {
+ Image {
+ sourceSize.width: 80 * keyIconScale
+ sourceSize.height: 80 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/settings-fff.svg"
+ }
+ }
+
+ keyboardDesignWidth: 2560
+ keyboardDesignHeight: 800
+ keyboardRelativeLeftMargin: 6 / keyboardDesignWidth
+ keyboardRelativeRightMargin: 6 / keyboardDesignWidth
+ keyboardRelativeTopMargin: 6 / keyboardDesignHeight
+ keyboardRelativeBottomMargin: 6 / keyboardDesignHeight
+
+ keyboardBackground: Rectangle {
+ color: keyboardBackgroundColor
+ }
+
+ keyPanel: KeyPanel {
+ id: keyPanel
+ Rectangle {
+ id: keyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: keyPanel
+ anchors.margins: keyBackgroundMargin
+ Text {
+ id: keySmallText
+ text: control.smallText
+ visible: control.smallTextVisible
+ color: keySmallTextColor
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: keyContentMargin / 3
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 60 * scaleHint
+ capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
+ }
+ }
+ Loader {
+ id: loader_settingsIcon
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: keyContentMargin / 3
+ }
+ Text {
+ id: keyText
+ text: control.displayText
+ color: keyTextColor
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: control.displayText.length > 1 ? Text.AlignVCenter : Text.AlignBottom
+ anchors.fill: parent
+ anchors.leftMargin: keyContentMargin
+ anchors.topMargin: keyContentMargin
+ anchors.rightMargin: keyContentMargin
+ anchors.bottomMargin: keyContentMargin
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 60 * scaleHint
+ capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
+ }
+ }
+ states: [
+ State {
+ when: control.smallText === "\u2699" && control.smallTextVisible
+ PropertyChanges {
+ target: keySmallText
+ visible: false
+ }
+ PropertyChanges {
+ target: loader_settingsIcon
+ sourceComponent: component_settingsIcon
+ }
+ }
+ ]
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: keyBackground
+ opacity: 0.75
+ }
+ PropertyChanges {
+ target: keyText
+ opacity: 0.5
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: keyBackground
+ opacity: 0.75
+ }
+ PropertyChanges {
+ target: keyText
+ opacity: 0.05
+ }
+ }
+ ]
+ }
+
+ backspaceKeyPanel: KeyPanel {
+ id: backspaceKeyPanel
+ Rectangle {
+ id: backspaceKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: backspaceKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Image {
+ id: backspaceKeyIcon
+ anchors.centerIn: parent
+ sourceSize.height: 88 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/backspace-fff.svg"
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: backspaceKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: backspaceKeyIcon
+ opacity: 0.6
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: backspaceKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: backspaceKeyIcon
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ languageKeyPanel: KeyPanel {
+ id: languageKeyPanel
+ Rectangle {
+ id: languageKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: languageKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Image {
+ id: languageKeyIcon
+ anchors.centerIn: parent
+ sourceSize.height: 127 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/globe-fff.svg"
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: languageKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: languageKeyIcon
+ opacity: 0.75
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: languageKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: languageKeyIcon
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ enterKeyPanel: KeyPanel {
+ id: enterKeyPanel
+ Rectangle {
+ id: enterKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: enterKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Image {
+ id: enterKeyIcon
+ visible: enterKeyText.text.length === 0
+ anchors.centerIn: parent
+ readonly property size enterKeyIconSize: {
+ switch (control.actionId) {
+ case EnterKeyAction.Go:
+ case EnterKeyAction.Send:
+ case EnterKeyAction.Next:
+ case EnterKeyAction.Done:
+ return Qt.size(170, 119)
+ case EnterKeyAction.Search:
+ return Qt.size(148, 148)
+ default:
+ return Qt.size(211, 80)
+ }
+ }
+ sourceSize.height: enterKeyIconSize.height * keyIconScale
+ smooth: false
+ source: {
+ switch (control.actionId) {
+ case EnterKeyAction.Go:
+ case EnterKeyAction.Send:
+ case EnterKeyAction.Next:
+ case EnterKeyAction.Done:
+ return resourcePrefix + "images/check-fff.svg"
+ case EnterKeyAction.Search:
+ return resourcePrefix + "images/search-fff.svg"
+ default:
+ return resourcePrefix + "images/enter-fff.svg"
+ }
+ }
+ }
+ Text {
+ id: enterKeyText
+ visible: text.length !== 0
+ text: control.actionId !== EnterKeyAction.None ? control.displayText : ""
+ clip: true
+ fontSizeMode: Text.HorizontalFit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: keyTextColor
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 50 * scaleHint
+ capitalization: Font.AllUppercase
+ }
+ anchors.fill: parent
+ anchors.margins: Math.round(42 * scaleHint)
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: enterKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: enterKeyIcon
+ opacity: 0.6
+ }
+ PropertyChanges {
+ target: enterKeyText
+ opacity: 0.6
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: enterKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: enterKeyIcon
+ opacity: 0.2
+ }
+ PropertyChanges {
+ target: enterKeyText
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ hideKeyPanel: KeyPanel {
+ id: hideKeyPanel
+ Rectangle {
+ id: hideKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: hideKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Image {
+ id: hideKeyIcon
+ anchors.centerIn: parent
+ sourceSize.height: 127 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/hidekeyboard-fff.svg"
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: hideKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: hideKeyIcon
+ opacity: 0.6
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: hideKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: hideKeyIcon
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ shiftKeyPanel: KeyPanel {
+ id: shiftKeyPanel
+ Rectangle {
+ id: shiftKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: shiftKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Image {
+ id: shiftKeyIcon
+ anchors.centerIn: parent
+ sourceSize.height: 134 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/shift-fff.svg"
+ }
+ states: [
+ State {
+ name: "capsLockActive"
+ when: InputContext.capsLockActive
+ PropertyChanges {
+ target: shiftKeyBackground
+ color: capsLockKeyAccentColor
+ }
+ PropertyChanges {
+ target: shiftKeyIcon
+ source: resourcePrefix + "images/shift-c5d6b6.svg"
+ }
+ },
+ State {
+ name: "shiftActive"
+ when: InputContext.shiftActive
+ PropertyChanges {
+ target: shiftKeyIcon
+ source: resourcePrefix + "images/shift-80c342.svg"
+ }
+ }
+ ]
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: shiftKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: shiftKeyIcon
+ opacity: 0.6
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: shiftKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: shiftKeyIcon
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ spaceKeyPanel: KeyPanel {
+ id: spaceKeyPanel
+ Rectangle {
+ id: spaceKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: spaceKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Text {
+ id: spaceKeyText
+ text: Qt.locale(InputContext.locale).nativeLanguageName
+ color: keyTextColor
+ opacity: inputLocaleIndicatorOpacity
+ Behavior on opacity { PropertyAnimation { duration: 250 } }
+ anchors.centerIn: parent
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 60 * scaleHint
+ }
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: spaceKeyBackground
+ opacity: 0.80
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: spaceKeyBackground
+ opacity: 0.8
+ }
+ }
+ ]
+ }
+
+ symbolKeyPanel: KeyPanel {
+ id: symbolKeyPanel
+ Rectangle {
+ id: symbolKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: symbolKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Text {
+ id: symbolKeyText
+ text: control.displayText
+ color: keyTextColor
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.fill: parent
+ anchors.margins: keyContentMargin
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 60 * scaleHint
+ capitalization: Font.AllUppercase
+ }
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: symbolKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: symbolKeyText
+ opacity: 0.6
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: symbolKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: symbolKeyText
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ modeKeyPanel: KeyPanel {
+ id: modeKeyPanel
+ Rectangle {
+ id: modeKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: modeKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Text {
+ id: modeKeyText
+ text: control.displayText
+ color: keyTextColor
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.fill: parent
+ anchors.margins: keyContentMargin
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 60 * scaleHint
+ capitalization: Font.AllUppercase
+ }
+ }
+ Rectangle {
+ id: modeKeyIndicator
+ implicitHeight: parent.height * 0.1
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.leftMargin: parent.width * 0.4
+ anchors.rightMargin: parent.width * 0.4
+ anchors.bottomMargin: parent.height * 0.12
+ color: modeKeyAccentColor
+ radius: 3
+ visible: control.mode
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: modeKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: modeKeyText
+ opacity: 0.6
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: modeKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: modeKeyText
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ handwritingKeyPanel: KeyPanel {
+ id: handwritingKeyPanel
+ Rectangle {
+ id: hwrKeyBackground
+ radius: 5
+ color: control && control.highlighted ? highlightedKeyBackgroundColor : normalKeyBackgroundColor
+ anchors.fill: handwritingKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Image {
+ id: hwrKeyIcon
+ anchors.centerIn: parent
+ sourceSize.height: 127 * keyIconScale
+ smooth: false
+ source: resourcePrefix + (keyboard.handwritingMode ? "images/textmode-fff.svg" : "images/handwriting-fff.svg")
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: hwrKeyBackground
+ opacity: 0.80
+ }
+ PropertyChanges {
+ target: hwrKeyIcon
+ opacity: 0.6
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: hwrKeyBackground
+ opacity: 0.8
+ }
+ PropertyChanges {
+ target: hwrKeyIcon
+ opacity: 0.2
+ }
+ }
+ ]
+ }
+
+ characterPreviewMargin: 0
+ characterPreviewDelegate: Item {
+ property string text
+ property string flickLeft
+ property string flickTop
+ property string flickRight
+ property string flickBottom
+ readonly property bool flickKeysSet: flickLeft || flickTop || flickRight || flickBottom
+ readonly property bool flickKeysVisible: text && flickKeysSet &&
+ text !== flickLeft && text !== flickTop && text !== flickRight && text !== flickBottom
+ id: characterPreview
+ Rectangle {
+ id: characterPreviewBackground
+ anchors.fill: parent
+ color: popupBackgroundColor
+ radius: 5
+ readonly property int largeTextHeight: Math.round(height / 3 * 2)
+ readonly property int smallTextHeight: Math.round(height / 3)
+ readonly property int smallTextMargin: Math.round(3 * scaleHint)
+ Text {
+ id: characterPreviewText
+ color: popupTextColor
+ text: characterPreview.text
+ fontSizeMode: Text.VerticalFit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ height: characterPreviewBackground.largeTextHeight
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 82 * scaleHint
+ }
+ }
+ Text {
+ color: popupTextColor
+ text: characterPreview.flickLeft
+ visible: characterPreview.flickKeysVisible
+ opacity: 0.8
+ fontSizeMode: Text.VerticalFit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.left: parent.left
+ anchors.leftMargin: characterPreviewBackground.smallTextMargin
+ anchors.verticalCenter: parent.verticalCenter
+ height: characterPreviewBackground.smallTextHeight
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 62 * scaleHint
+ }
+ }
+ Text {
+ color: popupTextColor
+ text: characterPreview.flickTop
+ visible: characterPreview.flickKeysVisible
+ opacity: 0.8
+ fontSizeMode: Text.VerticalFit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.top: parent.top
+ anchors.topMargin: characterPreviewBackground.smallTextMargin
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: characterPreviewBackground.smallTextHeight
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 62 * scaleHint
+ }
+ }
+ Text {
+ color: popupTextColor
+ text: characterPreview.flickRight
+ visible: characterPreview.flickKeysVisible
+ opacity: 0.8
+ fontSizeMode: Text.VerticalFit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.right: parent.right
+ anchors.rightMargin: characterPreviewBackground.smallTextMargin
+ anchors.verticalCenter: parent.verticalCenter
+ height: characterPreviewBackground.smallTextHeight
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 62 * scaleHint
+ }
+ }
+ Text {
+ color: popupTextColor
+ text: characterPreview.flickBottom
+ visible: characterPreview.flickKeysVisible
+ opacity: 0.8
+ fontSizeMode: Text.VerticalFit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: characterPreviewBackground.smallTextMargin
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: characterPreviewBackground.smallTextHeight
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 62 * scaleHint
+ }
+ }
+ states: State {
+ name: "flickKeysVisible"
+ when: characterPreview.flickKeysVisible
+ PropertyChanges {
+ target: characterPreviewText
+ height: characterPreviewBackground.smallTextHeight
+ }
+ }
+ }
+ }
+
+ alternateKeysListItemWidth: 120 * scaleHint
+ alternateKeysListItemHeight: 170 * scaleHint
+ alternateKeysListDelegate: Item {
+ id: alternateKeysListItem
+ width: alternateKeysListItemWidth
+ height: alternateKeysListItemHeight
+ Text {
+ id: listItemText
+ text: model.text
+ color: popupTextColor
+ opacity: 0.8
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 60 * scaleHint
+ }
+ anchors.centerIn: parent
+ }
+ states: State {
+ name: "current"
+ when: alternateKeysListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: listItemText
+ opacity: 1
+ }
+ }
+ }
+ alternateKeysListHighlight: Rectangle {
+ color: popupHighlightColor
+ radius: 5
+ }
+ alternateKeysListBackground: Item {
+ Rectangle {
+ readonly property real margin: 20 * scaleHint
+ x: -margin
+ y: -margin
+ width: parent.width + 2 * margin
+ height: parent.height + 2 * margin
+ radius: 5
+ color: popupBackgroundColor
+ border {
+ width: 1
+ color: popupBorderColor
+ }
+ }
+ }
+
+ selectionListHeight: 85 * scaleHint
+ selectionListDelegate: SelectionListItem {
+ id: selectionListItem
+ width: Math.round(selectionListLabel.width + selectionListLabel.anchors.leftMargin * 2)
+ Text {
+ id: selectionListLabel
+ anchors.left: parent.left
+ anchors.leftMargin: Math.round((compactSelectionList ? 50 : 140) * scaleHint)
+ anchors.verticalCenter: parent.verticalCenter
+ text: decorateText(display, wordCompletionLength)
+ color: selectionListTextColor
+ opacity: 0.9
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ }
+ function decorateText(text, wordCompletionLength) {
+ if (wordCompletionLength > 0) {
+ return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
+ }
+ return text
+ }
+ }
+ Rectangle {
+ id: selectionListSeparator
+ width: 4 * scaleHint
+ height: 36 * scaleHint
+ radius: 2
+ color: selectionListSeparatorColor
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.left
+ }
+ states: State {
+ name: "current"
+ when: selectionListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: selectionListLabel
+ opacity: 1
+ }
+ }
+ }
+ selectionListBackground: Rectangle {
+ color: selectionListBackgroundColor
+ }
+ selectionListAdd: Transition {
+ NumberAnimation { property: "y"; from: wordCandidateView.height; duration: 200 }
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 }
+ }
+ selectionListRemove: Transition {
+ NumberAnimation { property: "y"; to: -wordCandidateView.height; duration: 200 }
+ NumberAnimation { property: "opacity"; to: 0; duration: 200 }
+ }
+
+ navigationHighlight: Rectangle {
+ color: "transparent"
+ border.color: navigationHighlightColor
+ border.width: 5
+ }
+
+ traceInputKeyPanelDelegate: TraceInputKeyPanel {
+ id: traceInputKeyPanel
+ traceMargins: keyBackgroundMargin
+ Rectangle {
+ id: traceInputKeyPanelBackground
+ radius: 5
+ color: normalKeyBackgroundColor
+ anchors.fill: traceInputKeyPanel
+ anchors.margins: keyBackgroundMargin
+ Text {
+ id: hwrInputModeIndicator
+ visible: control.patternRecognitionMode === InputEngine.PatternRecognitionMode.Handwriting
+ text: {
+ switch (InputContext.inputEngine.inputMode) {
+ case InputEngine.InputMode.Numeric:
+ if (["ar", "fa"].indexOf(InputContext.locale.substring(0, 2)) !== -1)
+ return "\u0660\u0661\u0662"
+ // Fallthrough
+ case InputEngine.InputMode.Dialable:
+ return "123"
+ case InputEngine.InputMode.Greek:
+ return "ΑΒΓ"
+ case InputEngine.InputMode.Cyrillic:
+ return "АБВ"
+ case InputEngine.InputMode.Arabic:
+ if (InputContext.locale.substring(0, 2) === "fa")
+ return "\u0627\u200C\u0628\u200C\u067E"
+ return "\u0623\u200C\u0628\u200C\u062C"
+ case InputEngine.InputMode.Hebrew:
+ return "\u05D0\u05D1\u05D2"
+ case InputEngine.InputMode.ChineseHandwriting:
+ return "中文"
+ case InputEngine.InputMode.JapaneseHandwriting:
+ return "日本語"
+ case InputEngine.InputMode.KoreanHandwriting:
+ return "한국어"
+ case InputEngine.InputMode.Thai:
+ return "กขค"
+ default:
+ return "Abc"
+ }
+ }
+ color: keyTextColor
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.margins: keyContentMargin
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ capitalization: {
+ if (InputContext.capsLockActive)
+ return Font.AllUppercase
+ if (InputContext.shiftActive)
+ return Font.MixedCase
+ return Font.AllLowercase
+ }
+ }
+ }
+ }
+ Canvas {
+ id: traceInputKeyGuideLines
+ anchors.fill: traceInputKeyPanelBackground
+ opacity: 0.1
+ onPaint: {
+ var ctx = getContext("2d")
+ ctx.lineWidth = 1
+ ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
+ ctx.clearRect(0, 0, width, height)
+ var i
+ var margin = Math.round(30 * scaleHint)
+ if (control.horizontalRulers) {
+ for (i = 0; i < control.horizontalRulers.length; i++) {
+ ctx.beginPath()
+ var y = Math.round(control.horizontalRulers[i])
+ var rightMargin = Math.round(width - margin)
+ if (i + 1 === control.horizontalRulers.length) {
+ ctx.moveTo(margin, y)
+ ctx.lineTo(rightMargin, y)
+ } else {
+ var dashLen = Math.round(20 * scaleHint)
+ for (var dash = margin, dashCount = 0;
+ dash < rightMargin; dash += dashLen, dashCount++) {
+ if ((dashCount & 1) === 0) {
+ ctx.moveTo(dash, y)
+ ctx.lineTo(Math.min(dash + dashLen, rightMargin), y)
+ }
+ }
+ }
+ ctx.stroke()
+ }
+ }
+ if (control.verticalRulers) {
+ for (i = 0; i < control.verticalRulers.length; i++) {
+ ctx.beginPath()
+ ctx.moveTo(control.verticalRulers[i], margin)
+ ctx.lineTo(control.verticalRulers[i], Math.round(height - margin))
+ ctx.stroke()
+ }
+ }
+ }
+ Connections {
+ target: control
+ function onHorizontalRulersChanged() { traceInputKeyGuideLines.requestPaint() }
+ function onVerticalRulersChanged() { traceInputKeyGuideLines.requestPaint() }
+ }
+ }
+ }
+
+ traceCanvasDelegate: TraceCanvas {
+ id: traceCanvas
+ onAvailableChanged: {
+ if (!available)
+ return
+ var ctx = getContext("2d")
+ if (parent.canvasType === "fullscreen") {
+ ctx.lineWidth = 10
+ ctx.strokeStyle = Qt.rgba(0, 0, 0)
+ } else {
+ ctx.lineWidth = 10 * scaleHint
+ ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
+ }
+ ctx.lineCap = "round"
+ ctx.fillStyle = ctx.strokeStyle
+ }
+ autoDestroyDelay: 800
+ onTraceChanged: if (trace === null) opacity = 0
+ Behavior on opacity { PropertyAnimation { easing.type: Easing.OutCubic; duration: 150 } }
+ }
+
+ popupListDelegate: SelectionListItem {
+ property real cursorAnchor: popupListLabel.x + popupListLabel.width
+ id: popupListItem
+ width: popupListLabel.width + popupListLabel.anchors.leftMargin * 2
+ height: popupListLabel.height + popupListLabel.anchors.topMargin * 2
+ Text {
+ id: popupListLabel
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.leftMargin: popupListLabel.height / 2
+ anchors.topMargin: popupListLabel.height / 3
+ text: decorateText(display, wordCompletionLength)
+ color: popupTextColor
+ opacity: 0.8
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: Qt.inputMethod.cursorRectangle.height * 0.8
+ }
+ function decorateText(text, wordCompletionLength) {
+ if (wordCompletionLength > 0) {
+ return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
+ }
+ return text
+ }
+ }
+ states: State {
+ name: "current"
+ when: popupListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: popupListLabel
+ opacity: 1.0
+ }
+ }
+ }
+
+ popupListBackground: Item {
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ color: popupBackgroundColor
+ border {
+ width: 1
+ color: popupBorderColor
+ }
+ }
+ }
+
+ popupListAdd: Transition {
+ NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
+ }
+
+ popupListRemove: Transition {
+ NumberAnimation { property: "opacity"; to: 0; duration: 200 }
+ }
+
+ languagePopupListEnabled: true
+
+ languageListDelegate: SelectionListItem {
+ id: languageListItem
+ width: languageNameTextMetrics.width * 17
+ height: languageNameTextMetrics.height + languageListLabel.anchors.topMargin + languageListLabel.anchors.bottomMargin
+ Text {
+ id: languageListLabel
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.leftMargin: languageNameTextMetrics.height / 2
+ anchors.rightMargin: anchors.leftMargin
+ anchors.topMargin: languageNameTextMetrics.height / 3
+ anchors.bottomMargin: anchors.topMargin
+ text: languageNameFormatter.elidedText
+ color: popupTextColor
+ opacity: 0.8
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ }
+ }
+ TextMetrics {
+ id: languageNameTextMetrics
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ }
+ text: "X"
+ }
+ TextMetrics {
+ id: languageNameFormatter
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ }
+ elide: Text.ElideRight
+ elideWidth: languageListItem.width - languageListLabel.anchors.leftMargin - languageListLabel.anchors.rightMargin
+ text: displayName
+ }
+ states: State {
+ name: "current"
+ when: languageListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: languageListLabel
+ opacity: 1
+ }
+ }
+ }
+
+ languageListHighlight: Rectangle {
+ color: popupHighlightColor
+ radius: 5
+ }
+
+ languageListBackground: Rectangle {
+ color: popupBackgroundColor
+ border {
+ width: 1
+ color: popupBorderColor
+ }
+ }
+
+ languageListAdd: Transition {
+ NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
+ }
+
+ languageListRemove: Transition {
+ NumberAnimation { property: "opacity"; to: 0; duration: 200 }
+ }
+
+ selectionHandle: Image {
+ sourceSize.width: 20
+ source: resourcePrefix + "images/selectionhandle-bottom.svg"
+ }
+
+ fullScreenInputContainerBackground: Rectangle {
+ color: "#FFF"
+ }
+
+ fullScreenInputBackground: Rectangle {
+ color: "#FFF"
+ }
+
+ fullScreenInputMargins: Math.round(15 * scaleHint)
+
+ fullScreenInputPadding: Math.round(30 * scaleHint)
+
+ fullScreenInputCursor: Rectangle {
+ width: 1
+ color: "#000"
+ visible: parent.blinkStatus
+ }
+
+ fullScreenInputFont.pixelSize: 58 * scaleHint
+
+ functionPopupListDelegate: Item {
+ id: functionPopupListItem
+ readonly property real iconMargin: 40 * scaleHint
+ readonly property real iconWidth: 144 * keyIconScale
+ readonly property real iconHeight: 144 * keyIconScale
+ width: iconWidth + 2 * iconMargin
+ height: iconHeight + 2 * iconMargin
+ Image {
+ id: functionIcon
+ anchors.centerIn: parent
+ sourceSize.height: iconHeight
+ smooth: false
+ source: {
+ switch (keyboardFunction) {
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
+ return resourcePrefix + "images/hidekeyboard-fff.svg"
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
+ return resourcePrefix + "images/globe-fff.svg"
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
+ return resourcePrefix + (keyboard.handwritingMode ? "images/textmode-fff.svg" : "images/handwriting-fff.svg")
+ }
+ }
+ }
+ }
+
+ functionPopupListBackground: Item {
+ Rectangle {
+ readonly property real backgroundMargin: 20 * scaleHint
+ x: -backgroundMargin
+ y: -backgroundMargin
+ width: parent.width + 2 * backgroundMargin
+ height: parent.height + 2 * backgroundMargin
+ radius: 5
+ color: popupBackgroundColor
+ border {
+ width: 1
+ color: popupBorderColor
+ }
+ }
+ }
+
+ functionPopupListHighlight: Rectangle {
+ color: popupHighlightColor
+ radius: 5
+ }
+}
diff --git a/src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.cpp b/src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.cpp
new file mode 100644
index 00000000..57dfe813
--- /dev/null
+++ b/src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.cpp
@@ -0,0 +1,22 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qtquickvirtualkeyboardbstylesbuiltinplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+extern void qml_register_types_QtQuick_VirtualKeyboard_Styles_Builtin();
+Q_GHS_KEEP_REFERENCE(qml_register_types_QtQuick_VirtualKeyboard_Styles_Builtin);
+
+QtQuickVirtualKeyboardStylesBuiltinPlugin::QtQuickVirtualKeyboardStylesBuiltinPlugin(QObject *parent) :
+ QQmlEngineExtensionPlugin(parent)
+{
+ volatile auto registration = &qml_register_types_QtQuick_VirtualKeyboard_Styles_Builtin;
+ Q_UNUSED(registration);
+#if defined(QT_STATICPLUGIN)
+ Q_INIT_RESOURCE(virtualkeyboard_default_style);
+ Q_INIT_RESOURCE(virtualkeyboard_retro_style);
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.h b/src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.h
new file mode 100644
index 00000000..4658b454
--- /dev/null
+++ b/src/styles/builtin/qtquickvirtualkeyboardbstylesbuiltinplugin.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QTQUICKVIRTUALKEYBOARDSTYLESBUILTINPLUGIN_H
+#define QTQUICKVIRTUALKEYBOARDSTYLESBUILTINPLUGIN_H
+
+#include <QQmlEngineExtensionPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickVirtualKeyboardStylesBuiltinPlugin : public QQmlEngineExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ QtQuickVirtualKeyboardStylesBuiltinPlugin(QObject *parent = nullptr);
+};
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKVIRTUALKEYBOARDSTYLESBUILTINPLUGIN_H
+
diff --git a/src/virtualkeyboard/content/styles/retro/images/backspace-c5a96f.svg b/src/styles/builtin/retro/images/backspace-c5a96f.svg
index a242531a..a242531a 100644
--- a/src/virtualkeyboard/content/styles/retro/images/backspace-c5a96f.svg
+++ b/src/styles/builtin/retro/images/backspace-c5a96f.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/check-c5a96f.svg b/src/styles/builtin/retro/images/check-c5a96f.svg
index e45b41ab..e45b41ab 100644
--- a/src/virtualkeyboard/content/styles/retro/images/check-c5a96f.svg
+++ b/src/styles/builtin/retro/images/check-c5a96f.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/enter-c5a96f.svg b/src/styles/builtin/retro/images/enter-c5a96f.svg
index ddbd86e8..ddbd86e8 100644
--- a/src/virtualkeyboard/content/styles/retro/images/enter-c5a96f.svg
+++ b/src/styles/builtin/retro/images/enter-c5a96f.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/globe-110b05.svg b/src/styles/builtin/retro/images/globe-110b05.svg
index 591ab50f..591ab50f 100644
--- a/src/virtualkeyboard/content/styles/retro/images/globe-110b05.svg
+++ b/src/styles/builtin/retro/images/globe-110b05.svg
diff --git a/src/styles/builtin/retro/images/globe-c5a96f.svg b/src/styles/builtin/retro/images/globe-c5a96f.svg
new file mode 100644
index 00000000..68025577
--- /dev/null
+++ b/src/styles/builtin/retro/images/globe-c5a96f.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="144px" height="144px" viewBox="0 0 144 144" enable-background="new 0 0 144 144" xml:space="preserve">
+<g>
+ <rect fill="none" width="144" height="144"/>
+ <g>
+ <path fill="#C5A96F" d="M72,144c-39.5,0-71.8-32.1-72-71.6C-0.2,32.7,31.9,0.2,71.6,0h0.7c19.1,0.1,37.1,7.6,50.6,21.1
+ s21,31.5,21.1,50.5c0.1,19.2-7.3,37.4-20.8,51c-13.5,13.7-31.6,21.3-50.8,21.4C72.2,144,72.1,144,72,144z M76.3,101.3v32.3
+ c9-8.1,16-17.9,20.6-28.7C90.2,102.9,83.3,101.7,76.3,101.3z M47,104.9c3.2,7.4,7.5,14.3,12.8,20.6c2.4,2.9,5.1,5.6,7.9,8.1v-32.3
+ C60.7,101.7,53.8,102.9,47,104.9z M105.2,107.9c-3.9,9.2-9.2,17.6-15.9,25.1c10.4-2.9,19.9-8.5,27.8-16.4c0.5-0.5,1-1.1,1.6-1.6
+ C114.3,112.1,109.8,109.8,105.2,107.9z M25.5,114.9c7.8,8.5,17.9,14.8,29.3,18c-0.5-0.6-1.1-1.2-1.6-1.8
+ c-6-7.1-10.8-14.9-14.3-23.3C34.2,109.8,29.8,112.1,25.5,114.9z M108.1,99.7c5.5,2.3,10.8,5.1,15.9,8.4
+ c6.5-9.4,10.4-20.3,11.2-31.8h-22.9c-0.1,1.2-0.1,2.4-0.2,3.7C111.4,86.8,110.1,93.4,108.1,99.7z M8.8,76.3
+ C9.6,88.1,13.6,99,20,108.1c5.1-3.3,10.4-6.1,15.8-8.4c-2.4-7.5-3.7-15.4-4.1-23.4L8.8,76.3L8.8,76.3z M40.4,76.3
+ c0.3,7,1.5,13.8,3.6,20.4c7.7-2.4,15.7-3.8,23.7-4.1V76.3H40.4z M76.3,92.6c8,0.4,15.9,1.7,23.6,4.1c1.7-5.6,2.9-11.5,3.4-17.5
+ c0.1-1,0.1-2,0.2-2.9H76.3V92.6z M112.2,67.7h23c-0.8-11.5-4.6-22.4-11.2-31.8c-5.1,3.4-10.5,6.2-16.1,8.5
+ C110.4,51.9,111.8,59.7,112.2,67.7z M76.3,67.7h27.2c-0.4-7-1.6-13.8-3.7-20.4c-7.7,2.4-15.5,3.7-23.5,4.1V67.7z M40.5,67.7h27.2
+ V51.4c-7.9-0.4-15.8-1.7-23.4-4.1c-1.8,5.8-3,11.9-3.6,18.1C40.6,66.2,40.5,66.9,40.5,67.7z M8.8,67.7h23c0.1-1,0.1-2,0.2-3
+ c0.6-7,2-13.8,4-20.3c-5.5-2.3-10.9-5.1-16-8.5C13.6,45,9.6,55.9,8.8,67.7z M76.3,11.1v31.6c6.9-0.3,13.7-1.5,20.4-3.5
+ c-3.1-7.1-7.3-13.9-12.5-20C81.8,16.3,79.1,13.6,76.3,11.1z M47.3,39.2c6.7,2,13.5,3.2,20.4,3.5V11.1C58.8,19,51.9,28.6,47.3,39.2
+ z M88.4,10.8c0.8,0.9,1.6,1.8,2.4,2.8c5.9,6.9,10.6,14.6,14.1,22.7c4.7-2,9.3-4.3,13.7-7.2c-0.6-0.6-1.2-1.2-1.8-1.9
+ C108.8,19.2,99,13.6,88.4,10.8z M25.5,29.1c4.4,2.8,8.9,5.2,13.6,7.1c4-9.3,9.5-17.9,16.5-25.4C43.8,14,33.5,20.4,25.5,29.1z"/>
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/retro/images/globe-fff.svg b/src/styles/builtin/retro/images/globe-fff.svg
new file mode 100644
index 00000000..f45af34a
--- /dev/null
+++ b/src/styles/builtin/retro/images/globe-fff.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="144px" height="144px" viewBox="0 0 144 144" enable-background="new 0 0 144 144" xml:space="preserve">
+<g>
+ <rect fill="none" width="144" height="144"/>
+ <g>
+ <path fill="#FFF" d="M72,144c-39.5,0-71.8-32.1-72-71.6C-0.2,32.7,31.9,0.2,71.6,0h0.7c19.1,0.1,37.1,7.6,50.6,21.1
+ s21,31.5,21.1,50.5c0.1,19.2-7.3,37.4-20.8,51c-13.5,13.7-31.6,21.3-50.8,21.4C72.2,144,72.1,144,72,144z M76.3,101.3v32.3
+ c9-8.1,16-17.9,20.6-28.7C90.2,102.9,83.3,101.7,76.3,101.3z M47,104.9c3.2,7.4,7.5,14.3,12.8,20.6c2.4,2.9,5.1,5.6,7.9,8.1v-32.3
+ C60.7,101.7,53.8,102.9,47,104.9z M105.2,107.9c-3.9,9.2-9.2,17.6-15.9,25.1c10.4-2.9,19.9-8.5,27.8-16.4c0.5-0.5,1-1.1,1.6-1.6
+ C114.3,112.1,109.8,109.8,105.2,107.9z M25.5,114.9c7.8,8.5,17.9,14.8,29.3,18c-0.5-0.6-1.1-1.2-1.6-1.8
+ c-6-7.1-10.8-14.9-14.3-23.3C34.2,109.8,29.8,112.1,25.5,114.9z M108.1,99.7c5.5,2.3,10.8,5.1,15.9,8.4
+ c6.5-9.4,10.4-20.3,11.2-31.8h-22.9c-0.1,1.2-0.1,2.4-0.2,3.7C111.4,86.8,110.1,93.4,108.1,99.7z M8.8,76.3
+ C9.6,88.1,13.6,99,20,108.1c5.1-3.3,10.4-6.1,15.8-8.4c-2.4-7.5-3.7-15.4-4.1-23.4L8.8,76.3L8.8,76.3z M40.4,76.3
+ c0.3,7,1.5,13.8,3.6,20.4c7.7-2.4,15.7-3.8,23.7-4.1V76.3H40.4z M76.3,92.6c8,0.4,15.9,1.7,23.6,4.1c1.7-5.6,2.9-11.5,3.4-17.5
+ c0.1-1,0.1-2,0.2-2.9H76.3V92.6z M112.2,67.7h23c-0.8-11.5-4.6-22.4-11.2-31.8c-5.1,3.4-10.5,6.2-16.1,8.5
+ C110.4,51.9,111.8,59.7,112.2,67.7z M76.3,67.7h27.2c-0.4-7-1.6-13.8-3.7-20.4c-7.7,2.4-15.5,3.7-23.5,4.1V67.7z M40.5,67.7h27.2
+ V51.4c-7.9-0.4-15.8-1.7-23.4-4.1c-1.8,5.8-3,11.9-3.6,18.1C40.6,66.2,40.5,66.9,40.5,67.7z M8.8,67.7h23c0.1-1,0.1-2,0.2-3
+ c0.6-7,2-13.8,4-20.3c-5.5-2.3-10.9-5.1-16-8.5C13.6,45,9.6,55.9,8.8,67.7z M76.3,11.1v31.6c6.9-0.3,13.7-1.5,20.4-3.5
+ c-3.1-7.1-7.3-13.9-12.5-20C81.8,16.3,79.1,13.6,76.3,11.1z M47.3,39.2c6.7,2,13.5,3.2,20.4,3.5V11.1C58.8,19,51.9,28.6,47.3,39.2
+ z M88.4,10.8c0.8,0.9,1.6,1.8,2.4,2.8c5.9,6.9,10.6,14.6,14.1,22.7c4.7-2,9.3-4.3,13.7-7.2c-0.6-0.6-1.2-1.2-1.8-1.9
+ C108.8,19.2,99,13.6,88.4,10.8z M25.5,29.1c4.4,2.8,8.9,5.2,13.6,7.1c4-9.3,9.5-17.9,16.5-25.4C43.8,14,33.5,20.4,25.5,29.1z"/>
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/retro/images/handwriting-110b05.svg b/src/styles/builtin/retro/images/handwriting-110b05.svg
new file mode 100644
index 00000000..2093bb6d
--- /dev/null
+++ b/src/styles/builtin/retro/images/handwriting-110b05.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="156"
+ height="156"
+ viewBox="0 0 156 156"
+ enable-background="new 0 0 156 104"
+ xml:space="preserve"
+ sodipodi:docname="handwriting-110b05.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="6.6858974"
+ inkscape:cx="78"
+ inkscape:cy="69.948226"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g8"
+ transform="translate(0,26.023835)">
+ <rect
+ fill="none"
+ width="156"
+ height="104"
+ id="rect2"
+ x="0"
+ y="0" />
+ <g
+ id="g6">
+ <path
+ fill="#110b05"
+ d="M 37.6,103.3 C 27.5,103.3 18.7,98.3 14.5,89.7 4.4,68.7 19.9,52.3 36.2,35 37.4,33.8 38.6,32.5 39.8,31.2 45.1,25.5 45,19.7 43.3,16.4 41.5,13 37.8,11.5 33.1,12.2 16.6,14.8 11.9,38.6 11.9,38.8 L 0,36.6 C 0.3,35.3 6.4,4.3 31.2,0.3 41,-1.3 49.7,2.7 53.9,10.7 c 4.7,8.9 2.6,20.1 -5.3,28.6 -1.2,1.3 -2.4,2.6 -3.6,3.8 -16.7,17.8 -25.9,28.5 -19.6,41.4 3.3,6.8 11.1,7.6 16.9,6.3 C 51.5,88.7 62.1,79.7 62,61.3 61.8,33.2 78.2,19.5 92.2,16.4 c 14.5,-3.2 28.4,3.6 34.7,17 1.3,2.8 2.3,5.4 3.1,8.1 13.3,0.7 25.5,4.3 26,4.4 l -3.4,11.5 c -0.1,0 -9.7,-2.8 -20.6,-3.8 0.5,16.5 -8.6,28.9 -20.1,34.7 -11.9,6 -24,3.8 -28.9,-5.2 -3.1,-5.6 -1.9,-14.7 2.9,-22.5 7.9,-13 21.3,-17.4 31.5,-18.8 C 117,40.6 116.5,39.4 116,38.4 112.1,30.1 103.8,26 94.9,28 c -9.7,2.2 -21,12.1 -20.8,33.1 0.2,25.5 -15.6,38.1 -29,41.3 -2.6,0.6 -5.1,0.9 -7.5,0.9 z m 82.2,-49.6 c -14,1.5 -20.6,8.5 -23.4,12.9 -3.3,5.2 -3.4,9.8 -2.9,10.9 1.6,2.9 7.3,3 13,0.2 10.8,-5.5 13.8,-15.1 13.3,-24 z"
+ id="path4" />
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/retro/images/handwriting-c5a96f.svg b/src/styles/builtin/retro/images/handwriting-c5a96f.svg
new file mode 100644
index 00000000..f23fe5e0
--- /dev/null
+++ b/src/styles/builtin/retro/images/handwriting-c5a96f.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="156"
+ height="156"
+ viewBox="0 0 156 156"
+ enable-background="new 0 0 156 104"
+ xml:space="preserve"
+ sodipodi:docname="handwriting-c5a96f.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="6.6858974"
+ inkscape:cx="78"
+ inkscape:cy="52"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g8"
+ transform="translate(0,26.023835)">
+ <rect
+ fill="none"
+ width="156"
+ height="104"
+ id="rect2"
+ x="0"
+ y="0" />
+ <g
+ id="g6">
+ <path
+ fill="#c5a96f"
+ d="M 37.6,103.3 C 27.5,103.3 18.7,98.3 14.5,89.7 4.4,68.7 19.9,52.3 36.2,35 37.4,33.8 38.6,32.5 39.8,31.2 45.1,25.5 45,19.7 43.3,16.4 41.5,13 37.8,11.5 33.1,12.2 16.6,14.8 11.9,38.6 11.9,38.8 L 0,36.6 C 0.3,35.3 6.4,4.3 31.2,0.3 41,-1.3 49.7,2.7 53.9,10.7 c 4.7,8.9 2.6,20.1 -5.3,28.6 -1.2,1.3 -2.4,2.6 -3.6,3.8 -16.7,17.8 -25.9,28.5 -19.6,41.4 3.3,6.8 11.1,7.6 16.9,6.3 C 51.5,88.7 62.1,79.7 62,61.3 61.8,33.2 78.2,19.5 92.2,16.4 c 14.5,-3.2 28.4,3.6 34.7,17 1.3,2.8 2.3,5.4 3.1,8.1 13.3,0.7 25.5,4.3 26,4.4 l -3.4,11.5 c -0.1,0 -9.7,-2.8 -20.6,-3.8 0.5,16.5 -8.6,28.9 -20.1,34.7 -11.9,6 -24,3.8 -28.9,-5.2 -3.1,-5.6 -1.9,-14.7 2.9,-22.5 7.9,-13 21.3,-17.4 31.5,-18.8 C 117,40.6 116.5,39.4 116,38.4 112.1,30.1 103.8,26 94.9,28 c -9.7,2.2 -21,12.1 -20.8,33.1 0.2,25.5 -15.6,38.1 -29,41.3 -2.6,0.6 -5.1,0.9 -7.5,0.9 z m 82.2,-49.6 c -14,1.5 -20.6,8.5 -23.4,12.9 -3.3,5.2 -3.4,9.8 -2.9,10.9 1.6,2.9 7.3,3 13,0.2 10.8,-5.5 13.8,-15.1 13.3,-24 z"
+ id="path4" />
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/retro/images/handwriting-fff.svg b/src/styles/builtin/retro/images/handwriting-fff.svg
new file mode 100644
index 00000000..8c169421
--- /dev/null
+++ b/src/styles/builtin/retro/images/handwriting-fff.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="156"
+ height="156"
+ viewBox="0 0 156 156"
+ enable-background="new 0 0 156 104"
+ xml:space="preserve"
+ sodipodi:docname="handwriting-fff.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="6.6858974"
+ inkscape:cx="78"
+ inkscape:cy="52"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g8"
+ transform="translate(0,26.023835)">
+ <rect
+ fill="none"
+ width="156"
+ height="104"
+ id="rect2"
+ x="0"
+ y="0" />
+ <g
+ id="g6">
+ <path
+ fill="#ffffff"
+ d="M 37.6,103.3 C 27.5,103.3 18.7,98.3 14.5,89.7 4.4,68.7 19.9,52.3 36.2,35 37.4,33.8 38.6,32.5 39.8,31.2 45.1,25.5 45,19.7 43.3,16.4 41.5,13 37.8,11.5 33.1,12.2 16.6,14.8 11.9,38.6 11.9,38.8 L 0,36.6 C 0.3,35.3 6.4,4.3 31.2,0.3 41,-1.3 49.7,2.7 53.9,10.7 c 4.7,8.9 2.6,20.1 -5.3,28.6 -1.2,1.3 -2.4,2.6 -3.6,3.8 -16.7,17.8 -25.9,28.5 -19.6,41.4 3.3,6.8 11.1,7.6 16.9,6.3 C 51.5,88.7 62.1,79.7 62,61.3 61.8,33.2 78.2,19.5 92.2,16.4 c 14.5,-3.2 28.4,3.6 34.7,17 1.3,2.8 2.3,5.4 3.1,8.1 13.3,0.7 25.5,4.3 26,4.4 l -3.4,11.5 c -0.1,0 -9.7,-2.8 -20.6,-3.8 0.5,16.5 -8.6,28.9 -20.1,34.7 -11.9,6 -24,3.8 -28.9,-5.2 -3.1,-5.6 -1.9,-14.7 2.9,-22.5 7.9,-13 21.3,-17.4 31.5,-18.8 C 117,40.6 116.5,39.4 116,38.4 112.1,30.1 103.8,26 94.9,28 c -9.7,2.2 -21,12.1 -20.8,33.1 0.2,25.5 -15.6,38.1 -29,41.3 -2.6,0.6 -5.1,0.9 -7.5,0.9 z m 82.2,-49.6 c -14,1.5 -20.6,8.5 -23.4,12.9 -3.3,5.2 -3.4,9.8 -2.9,10.9 1.6,2.9 7.3,3 13,0.2 10.8,-5.5 13.8,-15.1 13.3,-24 z"
+ id="path4" />
+ </g>
+</g>
+</svg>
diff --git a/src/styles/builtin/retro/images/hidekeyboard-110b05.svg b/src/styles/builtin/retro/images/hidekeyboard-110b05.svg
new file mode 100644
index 00000000..9debcac6
--- /dev/null
+++ b/src/styles/builtin/retro/images/hidekeyboard-110b05.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="144px" height="127px" viewBox="0 0 144 127" enable-background="new 0 0 144 127" xml:space="preserve">
+<g>
+ <rect fill="none" width="144" height="127"/>
+ <g>
+ <g>
+ <path fill="#110b05" d="M144,90.3H0V0h144V90.3z M10.9,79.4h122.2V10.9H10.9V79.4z"/>
+ </g>
+ <g>
+ <rect x="19.5" y="20.2" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="20.2" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="56.8" y="20.2" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="75.5" y="20.2" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="94.2" y="20.2" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="112.9" y="20.2" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="19.5" y="39.7" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="39.7" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="56.8" y="39.7" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="75.5" y="39.7" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="94.2" y="39.7" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="112.9" y="39.7" fill="#110b05" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="59.2" fill="#110b05" width="67.7" height="11.7"/>
+ </g>
+ <g>
+ <polygon fill="#110b05" points="72,115.2 62.2,108.2 45.9,108.2 72,126.9 98.1,108.2 81.8,108.2 "/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/src/virtualkeyboard/content/styles/retro/images/hidekeyboard-c5a96f.svg b/src/styles/builtin/retro/images/hidekeyboard-c5a96f.svg
index a4019bf3..a4019bf3 100644
--- a/src/virtualkeyboard/content/styles/retro/images/hidekeyboard-c5a96f.svg
+++ b/src/styles/builtin/retro/images/hidekeyboard-c5a96f.svg
diff --git a/src/styles/builtin/retro/images/hidekeyboard-fff.svg b/src/styles/builtin/retro/images/hidekeyboard-fff.svg
new file mode 100644
index 00000000..eb81f0b9
--- /dev/null
+++ b/src/styles/builtin/retro/images/hidekeyboard-fff.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="144px" height="127px" viewBox="0 0 144 127" enable-background="new 0 0 144 127" xml:space="preserve">
+<g>
+ <rect fill="none" width="144" height="127"/>
+ <g>
+ <g>
+ <path fill="#FFF" d="M144,90.3H0V0h144V90.3z M10.9,79.4h122.2V10.9H10.9V79.4z"/>
+ </g>
+ <g>
+ <rect x="19.5" y="20.2" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="20.2" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="56.8" y="20.2" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="75.5" y="20.2" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="94.2" y="20.2" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="112.9" y="20.2" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="19.5" y="39.7" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="39.7" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="56.8" y="39.7" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="75.5" y="39.7" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="94.2" y="39.7" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="112.9" y="39.7" fill="#FFF" width="11.7" height="11.7"/>
+ </g>
+ <g>
+ <rect x="38.1" y="59.2" fill="#FFF" width="67.7" height="11.7"/>
+ </g>
+ <g>
+ <polygon fill="#FFF" points="72,115.2 62.2,108.2 45.9,108.2 72,126.9 98.1,108.2 81.8,108.2 "/>
+ </g>
+ </g>
+</g>
+</svg>
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_black.png b/src/styles/builtin/retro/images/key154px_black.png
index d9bf8e72..d9bf8e72 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_black.png
+++ b/src/styles/builtin/retro/images/key154px_black.png
Binary files differ
diff --git a/src/styles/builtin/retro/images/key154px_black.svg b/src/styles/builtin/retro/images/key154px_black.svg
new file mode 100644
index 00000000..635dd9a3
--- /dev/null
+++ b/src/styles/builtin/retro/images/key154px_black.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 154 154" enable-background="new 0 0 154 154" xml:space="preserve">
+<g>
+ <radialGradient id="SVGID_1_" cx="77" cy="77" r="73" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#0C0C0B"/>
+ <stop offset="1" style="stop-color:#2C2C2C"/>
+ </radialGradient>
+ <path fill="url(#SVGID_1_)" d="M77,150c-40.3,0-73-32.7-73-73C4,36.7,36.7,4,77,4c40.3,0,73,32.7,73,73C150,117.3,117.3,150,77,150
+ z"/>
+ <path fill="#C2B49B" d="M77,8c38,0,69,31,69,69s-31,69-69,69S8,115,8,77S39,8,77,8 M77,0C34.5,0,0,34.5,0,77s34.5,77,77,77
+ s77-34.5,77-77S119.5,0,77,0L77,0z"/>
+</g>
+<g opacity="8.000000e-02">
+ <path d="M77,16c33.6,0,61,27.4,61,61s-27.4,61-61,61s-61-27.4-61-61S43.4,16,77,16 M77,8C38.9,8,8,38.9,8,77s30.9,69,69,69
+ s69-30.9,69-69S115.1,8,77,8L77,8z"/>
+</g>
+</svg>
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_black_long.png b/src/styles/builtin/retro/images/key154px_black_long.png
index 492c718a..492c718a 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_black_long.png
+++ b/src/styles/builtin/retro/images/key154px_black_long.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_capslock.png b/src/styles/builtin/retro/images/key154px_capslock.png
index 7cb0bd4a..7cb0bd4a 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_capslock.png
+++ b/src/styles/builtin/retro/images/key154px_capslock.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_capslock_long.png b/src/styles/builtin/retro/images/key154px_capslock_long.png
index 429d4bb5..429d4bb5 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_capslock_long.png
+++ b/src/styles/builtin/retro/images/key154px_capslock_long.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_colorA.png b/src/styles/builtin/retro/images/key154px_colorA.png
index 778384cd..778384cd 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_colorA.png
+++ b/src/styles/builtin/retro/images/key154px_colorA.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_colorA.svg b/src/styles/builtin/retro/images/key154px_colorA.svg
index 13af8a63..13af8a63 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_colorA.svg
+++ b/src/styles/builtin/retro/images/key154px_colorA.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_colorA_long.png b/src/styles/builtin/retro/images/key154px_colorA_long.png
index e1b6e5b8..e1b6e5b8 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_colorA_long.png
+++ b/src/styles/builtin/retro/images/key154px_colorA_long.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_colorB.png b/src/styles/builtin/retro/images/key154px_colorB.png
index cef9fd29..cef9fd29 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_colorB.png
+++ b/src/styles/builtin/retro/images/key154px_colorB.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_shiftcase.png b/src/styles/builtin/retro/images/key154px_shiftcase.png
index 58bf8282..58bf8282 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_shiftcase.png
+++ b/src/styles/builtin/retro/images/key154px_shiftcase.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key154px_shiftcase_long.png b/src/styles/builtin/retro/images/key154px_shiftcase_long.png
index bfcba5fd..bfcba5fd 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key154px_shiftcase_long.png
+++ b/src/styles/builtin/retro/images/key154px_shiftcase_long.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key156px_black_long.png b/src/styles/builtin/retro/images/key156px_black_long.png
index a22109bd..a22109bd 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key156px_black_long.png
+++ b/src/styles/builtin/retro/images/key156px_black_long.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key156px_black_medium_long.png b/src/styles/builtin/retro/images/key156px_black_medium_long.png
index 8c92d3b1..8c92d3b1 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key156px_black_medium_long.png
+++ b/src/styles/builtin/retro/images/key156px_black_medium_long.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key156px_colorA.png b/src/styles/builtin/retro/images/key156px_colorA.png
index 6da57d60..6da57d60 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key156px_colorA.png
+++ b/src/styles/builtin/retro/images/key156px_colorA.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key156px_colorB.png b/src/styles/builtin/retro/images/key156px_colorB.png
index af0912e3..af0912e3 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key156px_colorB.png
+++ b/src/styles/builtin/retro/images/key156px_colorB.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key160px_black.png b/src/styles/builtin/retro/images/key160px_black.png
index 565c4bf7..565c4bf7 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key160px_black.png
+++ b/src/styles/builtin/retro/images/key160px_black.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key160px_colorA.png b/src/styles/builtin/retro/images/key160px_colorA.png
index e2125cf8..e2125cf8 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key160px_colorA.png
+++ b/src/styles/builtin/retro/images/key160px_colorA.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key160px_colorB.png b/src/styles/builtin/retro/images/key160px_colorB.png
index 9b543b05..9b543b05 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key160px_colorB.png
+++ b/src/styles/builtin/retro/images/key160px_colorB.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/key_preview.png b/src/styles/builtin/retro/images/key_preview.png
index 3e9e9557..3e9e9557 100644
--- a/src/virtualkeyboard/content/styles/retro/images/key_preview.png
+++ b/src/styles/builtin/retro/images/key_preview.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/search-c5a96f.svg b/src/styles/builtin/retro/images/search-c5a96f.svg
index a1f7c903..a1f7c903 100644
--- a/src/virtualkeyboard/content/styles/retro/images/search-c5a96f.svg
+++ b/src/styles/builtin/retro/images/search-c5a96f.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/selectionhandle-bottom.svg b/src/styles/builtin/retro/images/selectionhandle-bottom.svg
index 1a45a736..1a45a736 100644
--- a/src/virtualkeyboard/content/styles/retro/images/selectionhandle-bottom.svg
+++ b/src/styles/builtin/retro/images/selectionhandle-bottom.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/shift-c5a96f.svg b/src/styles/builtin/retro/images/shift-c5a96f.svg
index 3da185d2..3da185d2 100644
--- a/src/virtualkeyboard/content/styles/retro/images/shift-c5a96f.svg
+++ b/src/styles/builtin/retro/images/shift-c5a96f.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/shift-cd8865.svg b/src/styles/builtin/retro/images/shift-cd8865.svg
index 09eba7cd..09eba7cd 100644
--- a/src/virtualkeyboard/content/styles/retro/images/shift-cd8865.svg
+++ b/src/styles/builtin/retro/images/shift-cd8865.svg
diff --git a/src/virtualkeyboard/content/styles/retro/images/shift-dc4f28.svg b/src/styles/builtin/retro/images/shift-dc4f28.svg
index d1a5d5ee..d1a5d5ee 100644
--- a/src/virtualkeyboard/content/styles/retro/images/shift-dc4f28.svg
+++ b/src/styles/builtin/retro/images/shift-dc4f28.svg
diff --git a/src/styles/builtin/retro/images/textmode-110b05.svg b/src/styles/builtin/retro/images/textmode-110b05.svg
new file mode 100644
index 00000000..c5bfd98d
--- /dev/null
+++ b/src/styles/builtin/retro/images/textmode-110b05.svg
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="124"
+ height="124"
+ viewBox="0 0 124 124"
+ enable-background="new 0 0 124 96"
+ xml:space="preserve"
+ sodipodi:docname="textmode-110b05.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs23" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview21"
+ showgrid="false"
+ inkscape:zoom="8.4112903"
+ inkscape:cx="62"
+ inkscape:cy="48"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g18"
+ transform="translate(-0.05,14)">
+ <g
+ id="g14">
+ <g
+ id="g6">
+ <path
+ fill="#110b05"
+ d="M 55.4,70.8 46.9,49 H 19.4 L 11,70.8 H 2.9 L 30,2 h 6.7 l 27,68.8 z m -11,-29 -8,-21.2 c -1,-2.7 -2.1,-6 -3.2,-9.9 -0.7,3 -1.7,6.3 -3,9.9 l -8.1,21.2 z"
+ id="path2" />
+ <path
+ fill="#110b05"
+ d="M 66.6,72.8 H 54.1 L 45.5,51 H 20.8 L 12.4,72.8 H 0 L 28.7,0 h 9.4 z m -9.8,-4 h 4 L 35.4,4 h -1.9 l 1.7,6.2 c 1.1,3.8 2.1,7.1 3.1,9.7 l 9,24 h -28 L 28.4,20 c 1.2,-3.5 2.2,-6.7 2.9,-9.6 L 32.8,4 H 31.4 L 5.9,68.8 H 9.7 L 18.1,47 h 30.2 z m -31.7,-29 h 16.4 l -7,-18.5 c -0.4,-1.1 -0.8,-2.2 -1.2,-3.4 -0.4,1.1 -0.7,2.2 -1.2,3.4 z"
+ id="path4" />
+ </g>
+ <g
+ id="g12">
+ <path
+ fill="#110b05"
+ d="m 116.2,70.8 -1.5,-7.3 h -0.4 c -2.6,3.2 -5.1,5.4 -7.7,6.5 -2.6,1.1 -5.7,1.7 -9.5,1.7 -5.1,0 -9.1,-1.3 -12,-3.9 -2.9,-2.6 -4.3,-6.4 -4.3,-11.2 0,-10.4 8.3,-15.8 24.9,-16.3 l 8.7,-0.3 v -3.2 c 0,-4 -0.9,-7 -2.6,-8.9 C 110.1,26 107.3,25 103.5,25 99.2,25 94.4,26.3 89,28.9 l -2.4,-6 c 2.5,-1.4 5.3,-2.5 8.3,-3.2 3,-0.7 6,-1.2 9.1,-1.2 6.1,0 10.7,1.4 13.6,4.1 2.9,2.7 4.4,7.1 4.4,13.1 V 70.8 Z M 98.7,65.3 c 4.8,0 8.6,-1.3 11.4,-4 2.8,-2.7 4.1,-6.4 4.1,-11.2 v -4.6 l -7.8,0.3 C 100.2,46 95.8,47 93,48.7 c -2.8,1.7 -4,4.4 -4,8 0,2.8 0.9,5 2.6,6.4 1.7,1.4 4,2.2 7.1,2.2 z"
+ id="path8" />
+ <path
+ fill="#110b05"
+ d="m 97.1,73.8 c -5.6,0 -10.1,-1.5 -13.3,-4.5 -3.3,-3 -5,-7.3 -5,-12.7 0,-11.6 9,-17.8 26.8,-18.3 l 6.8,-0.2 v -1.3 c 0,-3.5 -0.7,-6.1 -2.1,-7.6 -1.3,-1.5 -3.6,-2.2 -6.8,-2.2 -4,0 -8.6,1.3 -13.7,3.7 l -1.9,0.9 -3.9,-9.5 1.6,-0.8 c 2.7,-1.4 5.6,-2.6 8.8,-3.4 3.2,-0.8 6.4,-1.2 9.6,-1.2 6.6,0 11.7,1.6 15,4.6 3.4,3.1 5.1,8 5.1,14.5 v 37.1 h -9.4 l -1.1,-5.3 c -2,2 -4,3.5 -6,4.4 -2.9,1.1 -6.4,1.8 -10.5,1.8 z M 103.5,23 c 4.4,0 7.7,1.2 9.8,3.5 2.1,2.3 3.1,5.7 3.1,10.3 V 42 l -10.7,0.3 c -23,0.7 -23,10.9 -23,14.3 0,4.3 1.2,7.5 3.7,9.7 2.5,2.3 6.1,3.4 10.6,3.4 3.5,0 6.4,-0.5 8.7,-1.5 2.2,-1 4.6,-3 6.9,-6 l 0.6,-0.8 h 2.6 l 0.7,1.6 1.2,5.7 h 2.1 V 35.8 c 0,-5.4 -1.3,-9.3 -3.8,-11.6 -2.6,-2.4 -6.7,-3.5 -12.3,-3.5 -2.8,0 -5.7,0.4 -8.6,1.1 -2.2,0.6 -4.3,1.3 -6.3,2.3 l 0.9,2.3 C 94.9,24.1 99.4,23 103.5,23 Z m -4.8,44.3 c -3.5,0 -6.4,-0.9 -8.5,-2.7 C 88,62.8 87,60.1 87,56.7 c 0,-4.3 1.7,-7.6 5,-9.6 3.1,-1.9 7.8,-3 14.4,-3.2 l 9.9,-0.4 v 6.7 c 0,5.3 -1.6,9.6 -4.8,12.6 -3.2,3 -7.5,4.5 -12.8,4.5 z m 13.5,-19.7 -5.7,0.2 c -5.8,0.2 -10,1.1 -12.4,2.6 -2.1,1.4 -3.1,3.4 -3.1,6.3 0,2.2 0.6,3.8 1.9,4.9 1.3,1.1 3.3,1.7 5.8,1.7 4.3,0 7.6,-1.1 10,-3.4 2.4,-2.3 3.5,-5.5 3.5,-9.7 z"
+ id="path10" />
+ </g>
+ </g>
+ <rect
+ y="88"
+ fill="#110b05"
+ width="124"
+ height="8"
+ id="rect16"
+ x="0" />
+</g>
+</svg>
diff --git a/src/styles/builtin/retro/images/textmode-c5a96f.svg b/src/styles/builtin/retro/images/textmode-c5a96f.svg
new file mode 100644
index 00000000..e6340558
--- /dev/null
+++ b/src/styles/builtin/retro/images/textmode-c5a96f.svg
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="124"
+ height="124"
+ viewBox="0 0 124 124"
+ enable-background="new 0 0 124 96"
+ xml:space="preserve"
+ sodipodi:docname="textmode-c5a96f.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs23" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview21"
+ showgrid="false"
+ inkscape:zoom="8.4112903"
+ inkscape:cx="62"
+ inkscape:cy="48"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g18"
+ transform="translate(-0.05,14)">
+ <g
+ id="g14">
+ <g
+ id="g6">
+ <path
+ fill="#c5a96f"
+ d="M 55.4,70.8 46.9,49 H 19.4 L 11,70.8 H 2.9 L 30,2 h 6.7 l 27,68.8 z m -11,-29 -8,-21.2 c -1,-2.7 -2.1,-6 -3.2,-9.9 -0.7,3 -1.7,6.3 -3,9.9 l -8.1,21.2 z"
+ id="path2" />
+ <path
+ fill="#c5a96f"
+ d="M 66.6,72.8 H 54.1 L 45.5,51 H 20.8 L 12.4,72.8 H 0 L 28.7,0 h 9.4 z m -9.8,-4 h 4 L 35.4,4 h -1.9 l 1.7,6.2 c 1.1,3.8 2.1,7.1 3.1,9.7 l 9,24 h -28 L 28.4,20 c 1.2,-3.5 2.2,-6.7 2.9,-9.6 L 32.8,4 H 31.4 L 5.9,68.8 H 9.7 L 18.1,47 h 30.2 z m -31.7,-29 h 16.4 l -7,-18.5 c -0.4,-1.1 -0.8,-2.2 -1.2,-3.4 -0.4,1.1 -0.7,2.2 -1.2,3.4 z"
+ id="path4" />
+ </g>
+ <g
+ id="g12">
+ <path
+ fill="#c5a96f"
+ d="m 116.2,70.8 -1.5,-7.3 h -0.4 c -2.6,3.2 -5.1,5.4 -7.7,6.5 -2.6,1.1 -5.7,1.7 -9.5,1.7 -5.1,0 -9.1,-1.3 -12,-3.9 -2.9,-2.6 -4.3,-6.4 -4.3,-11.2 0,-10.4 8.3,-15.8 24.9,-16.3 l 8.7,-0.3 v -3.2 c 0,-4 -0.9,-7 -2.6,-8.9 C 110.1,26 107.3,25 103.5,25 99.2,25 94.4,26.3 89,28.9 l -2.4,-6 c 2.5,-1.4 5.3,-2.5 8.3,-3.2 3,-0.7 6,-1.2 9.1,-1.2 6.1,0 10.7,1.4 13.6,4.1 2.9,2.7 4.4,7.1 4.4,13.1 V 70.8 Z M 98.7,65.3 c 4.8,0 8.6,-1.3 11.4,-4 2.8,-2.7 4.1,-6.4 4.1,-11.2 v -4.6 l -7.8,0.3 C 100.2,46 95.8,47 93,48.7 c -2.8,1.7 -4,4.4 -4,8 0,2.8 0.9,5 2.6,6.4 1.7,1.4 4,2.2 7.1,2.2 z"
+ id="path8" />
+ <path
+ fill="#c5a96f"
+ d="m 97.1,73.8 c -5.6,0 -10.1,-1.5 -13.3,-4.5 -3.3,-3 -5,-7.3 -5,-12.7 0,-11.6 9,-17.8 26.8,-18.3 l 6.8,-0.2 v -1.3 c 0,-3.5 -0.7,-6.1 -2.1,-7.6 -1.3,-1.5 -3.6,-2.2 -6.8,-2.2 -4,0 -8.6,1.3 -13.7,3.7 l -1.9,0.9 -3.9,-9.5 1.6,-0.8 c 2.7,-1.4 5.6,-2.6 8.8,-3.4 3.2,-0.8 6.4,-1.2 9.6,-1.2 6.6,0 11.7,1.6 15,4.6 3.4,3.1 5.1,8 5.1,14.5 v 37.1 h -9.4 l -1.1,-5.3 c -2,2 -4,3.5 -6,4.4 -2.9,1.1 -6.4,1.8 -10.5,1.8 z M 103.5,23 c 4.4,0 7.7,1.2 9.8,3.5 2.1,2.3 3.1,5.7 3.1,10.3 V 42 l -10.7,0.3 c -23,0.7 -23,10.9 -23,14.3 0,4.3 1.2,7.5 3.7,9.7 2.5,2.3 6.1,3.4 10.6,3.4 3.5,0 6.4,-0.5 8.7,-1.5 2.2,-1 4.6,-3 6.9,-6 l 0.6,-0.8 h 2.6 l 0.7,1.6 1.2,5.7 h 2.1 V 35.8 c 0,-5.4 -1.3,-9.3 -3.8,-11.6 -2.6,-2.4 -6.7,-3.5 -12.3,-3.5 -2.8,0 -5.7,0.4 -8.6,1.1 -2.2,0.6 -4.3,1.3 -6.3,2.3 l 0.9,2.3 C 94.9,24.1 99.4,23 103.5,23 Z m -4.8,44.3 c -3.5,0 -6.4,-0.9 -8.5,-2.7 C 88,62.8 87,60.1 87,56.7 c 0,-4.3 1.7,-7.6 5,-9.6 3.1,-1.9 7.8,-3 14.4,-3.2 l 9.9,-0.4 v 6.7 c 0,5.3 -1.6,9.6 -4.8,12.6 -3.2,3 -7.5,4.5 -12.8,4.5 z m 13.5,-19.7 -5.7,0.2 c -5.8,0.2 -10,1.1 -12.4,2.6 -2.1,1.4 -3.1,3.4 -3.1,6.3 0,2.2 0.6,3.8 1.9,4.9 1.3,1.1 3.3,1.7 5.8,1.7 4.3,0 7.6,-1.1 10,-3.4 2.4,-2.3 3.5,-5.5 3.5,-9.7 z"
+ id="path10" />
+ </g>
+ </g>
+ <rect
+ y="88"
+ fill="#c5a96f"
+ width="124"
+ height="8"
+ id="rect16"
+ x="0" />
+</g>
+</svg>
diff --git a/src/styles/builtin/retro/images/textmode-fff.svg b/src/styles/builtin/retro/images/textmode-fff.svg
new file mode 100644
index 00000000..e14961dc
--- /dev/null
+++ b/src/styles/builtin/retro/images/textmode-fff.svg
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="124"
+ height="124"
+ viewBox="0 0 124 124"
+ enable-background="new 0 0 124 96"
+ xml:space="preserve"
+ sodipodi:docname="textmode-fff.svg"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
+ id="metadata25"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs23" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1055"
+ id="namedview21"
+ showgrid="false"
+ inkscape:zoom="8.4112903"
+ inkscape:cx="62"
+ inkscape:cy="48"
+ inkscape:window-x="-7"
+ inkscape:window-y="-7"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g18"
+ transform="translate(-0.05,14)">
+ <g
+ id="g14">
+ <g
+ id="g6">
+ <path
+ fill="#ffffff"
+ d="M 55.4,70.8 46.9,49 H 19.4 L 11,70.8 H 2.9 L 30,2 h 6.7 l 27,68.8 z m -11,-29 -8,-21.2 c -1,-2.7 -2.1,-6 -3.2,-9.9 -0.7,3 -1.7,6.3 -3,9.9 l -8.1,21.2 z"
+ id="path2" />
+ <path
+ fill="#ffffff"
+ d="M 66.6,72.8 H 54.1 L 45.5,51 H 20.8 L 12.4,72.8 H 0 L 28.7,0 h 9.4 z m -9.8,-4 h 4 L 35.4,4 h -1.9 l 1.7,6.2 c 1.1,3.8 2.1,7.1 3.1,9.7 l 9,24 h -28 L 28.4,20 c 1.2,-3.5 2.2,-6.7 2.9,-9.6 L 32.8,4 H 31.4 L 5.9,68.8 H 9.7 L 18.1,47 h 30.2 z m -31.7,-29 h 16.4 l -7,-18.5 c -0.4,-1.1 -0.8,-2.2 -1.2,-3.4 -0.4,1.1 -0.7,2.2 -1.2,3.4 z"
+ id="path4" />
+ </g>
+ <g
+ id="g12">
+ <path
+ fill="#ffffff"
+ d="m 116.2,70.8 -1.5,-7.3 h -0.4 c -2.6,3.2 -5.1,5.4 -7.7,6.5 -2.6,1.1 -5.7,1.7 -9.5,1.7 -5.1,0 -9.1,-1.3 -12,-3.9 -2.9,-2.6 -4.3,-6.4 -4.3,-11.2 0,-10.4 8.3,-15.8 24.9,-16.3 l 8.7,-0.3 v -3.2 c 0,-4 -0.9,-7 -2.6,-8.9 C 110.1,26 107.3,25 103.5,25 99.2,25 94.4,26.3 89,28.9 l -2.4,-6 c 2.5,-1.4 5.3,-2.5 8.3,-3.2 3,-0.7 6,-1.2 9.1,-1.2 6.1,0 10.7,1.4 13.6,4.1 2.9,2.7 4.4,7.1 4.4,13.1 V 70.8 Z M 98.7,65.3 c 4.8,0 8.6,-1.3 11.4,-4 2.8,-2.7 4.1,-6.4 4.1,-11.2 v -4.6 l -7.8,0.3 C 100.2,46 95.8,47 93,48.7 c -2.8,1.7 -4,4.4 -4,8 0,2.8 0.9,5 2.6,6.4 1.7,1.4 4,2.2 7.1,2.2 z"
+ id="path8" />
+ <path
+ fill="#ffffff"
+ d="m 97.1,73.8 c -5.6,0 -10.1,-1.5 -13.3,-4.5 -3.3,-3 -5,-7.3 -5,-12.7 0,-11.6 9,-17.8 26.8,-18.3 l 6.8,-0.2 v -1.3 c 0,-3.5 -0.7,-6.1 -2.1,-7.6 -1.3,-1.5 -3.6,-2.2 -6.8,-2.2 -4,0 -8.6,1.3 -13.7,3.7 l -1.9,0.9 -3.9,-9.5 1.6,-0.8 c 2.7,-1.4 5.6,-2.6 8.8,-3.4 3.2,-0.8 6.4,-1.2 9.6,-1.2 6.6,0 11.7,1.6 15,4.6 3.4,3.1 5.1,8 5.1,14.5 v 37.1 h -9.4 l -1.1,-5.3 c -2,2 -4,3.5 -6,4.4 -2.9,1.1 -6.4,1.8 -10.5,1.8 z M 103.5,23 c 4.4,0 7.7,1.2 9.8,3.5 2.1,2.3 3.1,5.7 3.1,10.3 V 42 l -10.7,0.3 c -23,0.7 -23,10.9 -23,14.3 0,4.3 1.2,7.5 3.7,9.7 2.5,2.3 6.1,3.4 10.6,3.4 3.5,0 6.4,-0.5 8.7,-1.5 2.2,-1 4.6,-3 6.9,-6 l 0.6,-0.8 h 2.6 l 0.7,1.6 1.2,5.7 h 2.1 V 35.8 c 0,-5.4 -1.3,-9.3 -3.8,-11.6 -2.6,-2.4 -6.7,-3.5 -12.3,-3.5 -2.8,0 -5.7,0.4 -8.6,1.1 -2.2,0.6 -4.3,1.3 -6.3,2.3 l 0.9,2.3 C 94.9,24.1 99.4,23 103.5,23 Z m -4.8,44.3 c -3.5,0 -6.4,-0.9 -8.5,-2.7 C 88,62.8 87,60.1 87,56.7 c 0,-4.3 1.7,-7.6 5,-9.6 3.1,-1.9 7.8,-3 14.4,-3.2 l 9.9,-0.4 v 6.7 c 0,5.3 -1.6,9.6 -4.8,12.6 -3.2,3 -7.5,4.5 -12.8,4.5 z m 13.5,-19.7 -5.7,0.2 c -5.8,0.2 -10,1.1 -12.4,2.6 -2.1,1.4 -3.1,3.4 -3.1,6.3 0,2.2 0.6,3.8 1.9,4.9 1.3,1.1 3.3,1.7 5.8,1.7 4.3,0 7.6,-1.1 10,-3.4 2.4,-2.3 3.5,-5.5 3.5,-9.7 z"
+ id="path10" />
+ </g>
+ </g>
+ <rect
+ y="88"
+ fill="#ffffff"
+ width="124"
+ height="8"
+ id="rect16"
+ x="0" />
+</g>
+</svg>
diff --git a/src/virtualkeyboard/content/styles/retro/images/triangle_black.png b/src/styles/builtin/retro/images/triangle_black.png
index a45e733b..a45e733b 100644
--- a/src/virtualkeyboard/content/styles/retro/images/triangle_black.png
+++ b/src/styles/builtin/retro/images/triangle_black.png
Binary files differ
diff --git a/src/virtualkeyboard/content/styles/retro/images/triangle_highlight.png b/src/styles/builtin/retro/images/triangle_highlight.png
index 34853263..34853263 100644
--- a/src/virtualkeyboard/content/styles/retro/images/triangle_highlight.png
+++ b/src/styles/builtin/retro/images/triangle_highlight.png
Binary files differ
diff --git a/src/styles/builtin/retro/style.qml b/src/styles/builtin/retro/style.qml
new file mode 100644
index 00000000..dd295446
--- /dev/null
+++ b/src/styles/builtin/retro/style.qml
@@ -0,0 +1,1248 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Styles
+
+KeyboardStyle {
+ id: currentStyle
+ readonly property bool compactSelectionList: [InputEngine.InputMode.Pinyin, InputEngine.InputMode.Cangjie, InputEngine.InputMode.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1
+ readonly property string fontFamily: "Courier"
+ readonly property real keyBackgroundMargin: Math.round(9 * scaleHint)
+ readonly property real keyContentMargin: Math.round(30 * scaleHint)
+ readonly property real keyIconScale: scaleHint * 0.6
+ readonly property string resourcePath: "qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/retro/"
+ readonly property string resourcePrefix: "qrc:/" + resourcePath
+
+ readonly property string inputLocale: InputContext.locale
+ property real inputLocaleIndicatorOpacity: 1.0
+ property Timer inputLocaleIndicatorHighlightTimer: Timer {
+ interval: 1000
+ onTriggered: inputLocaleIndicatorOpacity = 0.8
+ }
+ onInputLocaleChanged: {
+ inputLocaleIndicatorOpacity = 1.0
+ inputLocaleIndicatorHighlightTimer.restart()
+ }
+
+ keyboardDesignWidth: 2560
+ keyboardDesignHeight: 800
+ keyboardRelativeLeftMargin: 114 / keyboardDesignWidth
+ keyboardRelativeRightMargin: 114 / keyboardDesignWidth
+ keyboardRelativeTopMargin: 9 / keyboardDesignHeight
+ keyboardRelativeBottomMargin: 88 / keyboardDesignHeight
+
+ keyboardBackground: Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#272727" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+ }
+
+ keyPanel: KeyPanel {
+ id: keyPanel
+ Image {
+ id: keyBackground
+ source: resourcePrefix + "images/key154px_colorA.png"
+ fillMode: Image.PreserveAspectFit
+ anchors.fill: keyPanel
+ anchors.margins: keyBackgroundMargin
+ states: [
+ State {
+ name: "key154px_colorB"
+ when: ['q', 'r', 'y', 'p', 's', 'd', 'j', 'l', 'v', 'b', '\'',
+ '1', '4', '6', '0', '#', '%', '+', ')', '>',
+ '~', '·', '÷', '}', '€', '£', '§', ']', '«', '»'].indexOf(control.displayText.toLowerCase()) >= 0
+ PropertyChanges {
+ target: keyBackground
+ source: resourcePrefix + "images/key154px_colorB.png"
+ }
+ },
+ State {
+ name: "key154px_black"
+ when: control.highlighted
+ PropertyChanges {
+ target: keyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ }
+ }
+ ]
+ }
+ Text {
+ id: keyText
+ text: control.displayText
+ color: "#110b05"
+ anchors.fill: keyPanel
+ anchors.margins: keyContentMargin
+ fontSizeMode: Text.Fit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font {
+ family: fontFamily
+ weight: Font.Bold
+ pixelSize: 82 * scaleHint
+ capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
+ }
+ states: [
+ State {
+ name: "fontB"
+ when: control.highlighted
+ PropertyChanges {
+ target: keyText
+ color: "#c5a96f"
+ font.pixelSize: 74 * scaleHint
+ font.letterSpacing: -5 * scaleHint
+ }
+ }
+ ]
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: keyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: keyText
+ opacity: 0.75
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: keyBackground
+ opacity: 0.30
+ }
+ PropertyChanges {
+ target: keyText
+ opacity: 0.50
+ }
+ }
+ ]
+ }
+
+ backspaceKeyPanel: KeyPanel {
+ id: backspaceKeyPanel
+ BorderImage {
+ id: backspaceKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * keyBackgroundMargin) / scale
+ height: sourceSize.height
+ anchors.centerIn: backspaceKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ }
+ Image {
+ id: backspaceKeyIcon
+ anchors.centerIn: backspaceKeyPanel
+ sourceSize.width: 159 * keyIconScale
+ sourceSize.height: 88 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/backspace-c5a96f.svg"
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: backspaceKeyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: backspaceKeyIcon
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: backspaceKeyBackground
+ opacity: 0.20
+ }
+ PropertyChanges {
+ target: backspaceKeyIcon
+ opacity: 0.20
+ }
+ }
+ ]
+ }
+
+ languageKeyPanel: KeyPanel {
+ id: languageKeyPanel
+ Image {
+ id: languageKeyBackground
+ source: resourcePrefix + "images/key154px_colorB.png"
+ fillMode: Image.PreserveAspectFit
+ anchors.fill: languageKeyPanel
+ anchors.margins: keyBackgroundMargin
+ }
+ Image {
+ id: languageKeyIcon
+ anchors.centerIn: languageKeyPanel
+ sourceSize.width: 127 * keyIconScale
+ sourceSize.height: 127 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/globe-110b05.svg"
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: languageKeyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: languageKeyIcon
+ opacity: 0.30
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: languageKeyBackground
+ opacity: 0.75
+ }
+ PropertyChanges {
+ target: languageKeyIcon
+ opacity: 0.50
+ }
+ }
+ ]
+ }
+
+ enterKeyPanel: KeyPanel {
+ id: enterKeyPanel
+ BorderImage {
+ id: enterKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * keyBackgroundMargin) / scale
+ height: sourceSize.height
+ anchors.centerIn: enterKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ }
+ Image {
+ id: enterKeyIcon
+ visible: enterKeyText.text.length === 0
+ anchors.centerIn: enterKeyPanel
+ readonly property size enterKeyIconSize: {
+ switch (control.actionId) {
+ case EnterKeyAction.Go:
+ case EnterKeyAction.Send:
+ case EnterKeyAction.Next:
+ case EnterKeyAction.Done:
+ return Qt.size(170, 119)
+ case EnterKeyAction.Search:
+ return Qt.size(148, 148)
+ default:
+ return Qt.size(211, 80)
+ }
+ }
+ sourceSize.width: enterKeyIconSize.width * keyIconScale
+ sourceSize.height: enterKeyIconSize.height * keyIconScale
+ smooth: false
+ source: {
+ switch (control.actionId) {
+ case EnterKeyAction.Go:
+ case EnterKeyAction.Send:
+ case EnterKeyAction.Next:
+ case EnterKeyAction.Done:
+ return resourcePrefix + "images/check-c5a96f.svg"
+ case EnterKeyAction.Search:
+ return resourcePrefix + "images/search-c5a96f.svg"
+ default:
+ return resourcePrefix + "images/enter-c5a96f.svg"
+ }
+ }
+ }
+ Text {
+ id: enterKeyText
+ visible: text.length !== 0
+ text: control.actionId !== EnterKeyAction.None ? control.displayText : ""
+ clip: true
+ fontSizeMode: Text.HorizontalFit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ anchors.fill: enterKeyPanel
+ anchors.leftMargin: keyContentMargin
+ anchors.topMargin: Math.round(50 * scaleHint)
+ anchors.rightMargin: keyContentMargin
+ anchors.bottomMargin: Math.round(30 * scaleHint)
+ color: "#c5a96f"
+ font {
+ family: fontFamily
+ weight: Font.Bold
+ pixelSize: 74 * scaleHint
+ capitalization: Font.AllUppercase
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: enterKeyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: enterKeyIcon
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: enterKeyText
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: enterKeyBackground
+ opacity: 0.20
+ }
+ PropertyChanges {
+ target: enterKeyIcon
+ opacity: 0.20
+ }
+ PropertyChanges {
+ target: enterKeyText
+ opacity: 0.20
+ }
+ }
+ ]
+ }
+
+ hideKeyPanel: KeyPanel {
+ id: hideKeyPanel
+ BorderImage {
+ id: hideKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * keyBackgroundMargin) / scale
+ height: sourceSize.height
+ anchors.centerIn: hideKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ }
+ Image {
+ id: hideKeyIcon
+ anchors.centerIn: hideKeyPanel
+ sourceSize.width: 127 * keyIconScale
+ sourceSize.height: 127 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/hidekeyboard-c5a96f.svg"
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: hideKeyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: hideKeyIcon
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: hideKeyBackground
+ opacity: 0.20
+ }
+ PropertyChanges {
+ target: hideKeyIcon
+ opacity: 0.20
+ }
+ }
+ ]
+ }
+
+ shiftKeyPanel: KeyPanel {
+ id: shiftKeyPanel
+ BorderImage {
+ id: shiftKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * keyBackgroundMargin) / scale
+ height: sourceSize.height
+ anchors.centerIn: shiftKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ states: [
+ State {
+ name: "capsLockActive"
+ when: InputContext.capsLockActive
+ PropertyChanges {
+ target: shiftKeyBackground
+ source: resourcePrefix + "images/key154px_capslock.png"
+ }
+ PropertyChanges {
+ target: shiftKeyIcon
+ source: resourcePrefix + "images/shift-cd8865.svg"
+ }
+ },
+ State {
+ name: "shiftActive"
+ when: InputContext.shiftActive
+ PropertyChanges {
+ target: shiftKeyBackground
+ source: resourcePrefix + "images/key154px_shiftcase.png"
+ }
+ PropertyChanges {
+ target: shiftKeyIcon
+ source: resourcePrefix + "images/shift-dc4f28.svg"
+ }
+ }
+ ]
+ }
+ Image {
+ id: shiftKeyIcon
+ anchors.centerIn: shiftKeyPanel
+ sourceSize.width: 144 * keyIconScale
+ sourceSize.height: 134 * keyIconScale
+ smooth: false
+ source: resourcePrefix + "images/shift-c5a96f.svg"
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: shiftKeyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: shiftKeyIcon
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: shiftKeyBackground
+ opacity: 0.20
+ }
+ PropertyChanges {
+ target: shiftKeyIcon
+ opacity: 0.20
+ }
+ }
+ ]
+ }
+
+ spaceKeyPanel: KeyPanel {
+ id: spaceKeyPanel
+ BorderImage {
+ id: spaceKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * keyBackgroundMargin) / scale
+ height: sourceSize.height
+ anchors.centerIn: spaceKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ }
+ Text {
+ id: spaceKeyText
+ text: Qt.locale(InputContext.locale).nativeLanguageName
+ color: "#c5a96f"
+ opacity: inputLocaleIndicatorOpacity
+ Behavior on opacity { PropertyAnimation { duration: 250 } }
+ anchors.centerIn: spaceKeyPanel
+ font {
+ family: fontFamily
+ weight: Font.Bold
+ pixelSize: 72 * scaleHint
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: spaceKeyBackground
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: spaceKeyBackground
+ opacity: 0.30
+ }
+ }
+ ]
+ }
+
+ symbolKeyPanel: KeyPanel {
+ id: symbolKeyPanel
+ BorderImage {
+ id: symbolKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * keyBackgroundMargin) / scale
+ height: sourceSize.height
+ anchors.centerIn: symbolKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ }
+ Text {
+ id: symbolKeyText
+ text: control.displayText
+ color: "#c5a96f"
+ anchors.centerIn: symbolKeyPanel
+ font {
+ family: fontFamily
+ weight: Font.DemiBold
+ pixelSize: 74 * scaleHint
+ letterSpacing: -5 * scaleHint
+ capitalization: Font.AllUppercase
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: symbolKeyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: symbolKeyText
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: symbolKeyBackground
+ opacity: 0.20
+ }
+ PropertyChanges {
+ target: symbolKeyText
+ opacity: 0.20
+ }
+ }
+ ]
+ }
+
+ modeKeyPanel: KeyPanel {
+ id: modeKeyPanel
+ BorderImage {
+ id: modeKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * keyBackgroundMargin) / scale
+ height: sourceSize.height
+ anchors.centerIn: modeKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ states: [
+ State {
+ name: "mode"
+ when: control.mode
+ PropertyChanges {
+ target: modeKeyBackground
+ source: resourcePrefix + "images/key154px_capslock.png"
+ }
+ }
+ ]
+ }
+ Text {
+ id: modeKeyText
+ text: control.displayText
+ color: "#c5a96f"
+ anchors.fill: modeKeyPanel
+ anchors.margins: keyContentMargin
+ fontSizeMode: Text.Fit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font {
+ family: fontFamily
+ weight: Font.DemiBold
+ pixelSize: 74 * scaleHint
+ letterSpacing: -5 * scaleHint
+ capitalization: Font.AllUppercase
+ }
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: modeKeyBackground
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: modeKeyBackground
+ opacity: 0.20
+ }
+ }
+ ]
+ }
+
+ handwritingKeyPanel: KeyPanel {
+ id: handwritingKeyPanel
+ BorderImage {
+ id: hwrKeyBackground
+ source: resourcePrefix + "images/key154px_black.png"
+ width: (parent.width - 2 * hwrKeyBackground) / scale
+ height: sourceSize.height
+ anchors.centerIn: handwritingKeyPanel
+ border.left: 76
+ border.top: 76
+ border.right: 76
+ border.bottom: 76
+ horizontalTileMode: BorderImage.Stretch
+ scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
+ }
+ Image {
+ id: hwrKeyIcon
+ anchors.centerIn: handwritingKeyPanel
+ sourceSize.width: 127 * keyIconScale
+ sourceSize.height: 127 * keyIconScale
+ smooth: false
+ source: resourcePrefix + (keyboard.handwritingMode ? "images/textmode-c5a96f.svg" : "images/handwriting-c5a96f.svg")
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: control.pressed
+ PropertyChanges {
+ target: hwrKeyBackground
+ opacity: 0.70
+ }
+ PropertyChanges {
+ target: hwrKeyIcon
+ opacity: 0.70
+ }
+ },
+ State {
+ name: "disabled"
+ when: !control.enabled
+ PropertyChanges {
+ target: hwrKeyBackground
+ opacity: 0.20
+ }
+ PropertyChanges {
+ target: hwrKeyIcon
+ opacity: 0.20
+ }
+ }
+ ]
+ }
+
+ characterPreviewMargin: Math.round(20 * scaleHint)
+ characterPreviewDelegate: Item {
+ property string text
+ id: characterPreview
+ Image {
+ id: characterPreviewBackground
+ source: resourcePrefix + "images/key_preview.png"
+ fillMode: Image.PreserveAspectFit
+ anchors.fill: parent
+ }
+ Text {
+ id: characterPreviewText
+ color: "#c5a96f"
+ text: characterPreview.text
+ anchors.centerIn: characterPreviewBackground
+ font {
+ family: fontFamily
+ weight: Font.Bold
+ pixelSize: 85 * scaleHint
+ }
+ states: [
+ State {
+ name: "fit"
+ when: text.length > 1
+ PropertyChanges {
+ target: characterPreviewText
+ font.letterSpacing: -5 * scaleHint
+ }
+ }
+ ]
+ }
+ }
+
+ alternateKeysListItemWidth: Math.round(111 * scaleHint)
+ alternateKeysListItemHeight: Math.round(154 * scaleHint)
+ alternateKeysListBottomMargin: Math.round(15 * scaleHint)
+ alternateKeysListLeftMargin: Math.round(79 * scaleHint)
+ alternateKeysListRightMargin: Math.round(79 * scaleHint)
+ alternateKeysListDelegate: Item {
+ id: alternateKeysListItem
+ width: alternateKeysListItemWidth
+ height: alternateKeysListItemHeight
+ Text {
+ id: listItemText
+ text: model.text
+ color: "#868482"
+ font {
+ family: fontFamily
+ weight: Font.DemiBold
+ pixelSize: 52 * scaleHint
+ letterSpacing: -6 * scaleHint
+ }
+ anchors.centerIn: parent
+ }
+ states: State {
+ name: "current"
+ when: alternateKeysListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: listItemText
+ color: "white"
+ }
+ }
+ }
+ alternateKeysListHighlight: Item {
+ Rectangle {
+ anchors.fill: parent
+ anchors.topMargin: Math.round(8 * scaleHint)
+ anchors.bottomMargin: Math.round(8 * scaleHint)
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#64462a" }
+ GradientStop { position: 0.18; color: "#a37648" }
+ GradientStop { position: 0.5; color: "#c4a47c" }
+ GradientStop { position: 0.82; color: "#a37648" }
+ GradientStop { position: 1.0; color: "#64462a" }
+ }
+ }
+ }
+ alternateKeysListBackground: Item {
+ property real currentItemOffset
+ property bool currentItemHighlight: false
+ BorderImage {
+ cache: false
+ source: resourcePrefix + "images/key160px_black.png"
+ width: sourceSize.width + parent.width / scale
+ height: sourceSize.height
+ anchors.centerIn: parent
+ border.left: 79
+ border.top: 79
+ border.right: 79
+ border.bottom: 79
+ horizontalTileMode: BorderImage.Stretch
+ scale: parent.height / sourceSize.height
+ }
+ Image {
+ visible: currentItemOffset !== undefined
+ source: currentItemHighlight ? resourcePrefix + "images/triangle_highlight.png" : resourcePrefix + "images/triangle_black.png"
+ fillMode: Image.PreserveAspectFit
+ width: sourceSize.width * scaleHint
+ height: sourceSize.height * scaleHint
+ anchors.top: parent.bottom
+ anchors.topMargin: Math.round(-8 * scaleHint)
+ anchors.left: parent.left
+ anchors.leftMargin: Math.round(currentItemOffset - width / 2)
+ }
+ }
+
+ selectionListHeight: 85 * scaleHint
+ selectionListDelegate: SelectionListItem {
+ id: selectionListItem
+ width: Math.round(selectionListLabel.width + selectionListLabel.anchors.leftMargin * 2)
+ Text {
+ id: selectionListLabel
+ anchors.left: parent.left
+ anchors.leftMargin: Math.round((compactSelectionList ? 50 : 140) * scaleHint)
+ anchors.verticalCenter: parent.verticalCenter
+ text: decorateText(display, wordCompletionLength)
+ color: "white"
+ font {
+ family: fontFamily
+ weight: Font.Bold
+ pixelSize: 44 * scaleHint
+ }
+ function decorateText(text, wordCompletionLength) {
+ if (wordCompletionLength > 0) {
+ return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
+ }
+ return text
+ }
+ }
+ Rectangle {
+ id: selectionListSeparator
+ width: 4 * scaleHint
+ height: 36 * scaleHint
+ color: "#35322f"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.left
+ }
+ states: State {
+ name: "current"
+ when: selectionListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: selectionListLabel
+ color: "#c5a96f"
+ }
+ }
+ }
+ selectionListBackground: Rectangle {
+ color: "#222222"
+ }
+ selectionListAdd: Transition {
+ NumberAnimation { property: "y"; from: wordCandidateView.height; duration: 200 }
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 }
+ }
+ selectionListRemove: Transition {
+ NumberAnimation { property: "y"; to: -wordCandidateView.height; duration: 200 }
+ NumberAnimation { property: "opacity"; to: 0; duration: 200 }
+ }
+
+ navigationHighlight: Rectangle {
+ color: "transparent"
+ border.color: "yellow"
+ border.width: 5
+ }
+
+ traceInputKeyPanelDelegate: TraceInputKeyPanel {
+ traceMargins: keyBackgroundMargin
+ BorderImage {
+ id: traceInputKeyPanelBackground
+ readonly property int traceInputKeyPanelSvgImageHeight: Math.round(height / 12)
+ readonly property real traceInputKeyPanelSvgImageScale: traceInputKeyPanelSvgImageHeight / 154
+ source: "image://qtvkbsvg/%1/images/key154px_colorA.svg?height=%2".arg(resourcePath).arg(traceInputKeyPanelSvgImageHeight)
+ anchors.fill: parent
+ anchors.margins: keyBackgroundMargin
+ border.left: 76 * traceInputKeyPanelSvgImageScale
+ border.top: 76 * traceInputKeyPanelSvgImageScale
+ border.right: 78 * traceInputKeyPanelSvgImageScale
+ border.bottom: 78 * traceInputKeyPanelSvgImageScale
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ }
+ Text {
+ id: hwrInputModeIndicator
+ visible: control.patternRecognitionMode === InputEngine.PatternRecognitionMode.Handwriting
+ text: {
+ switch (InputContext.inputEngine.inputMode) {
+ case InputEngine.InputMode.Numeric:
+ if (["ar", "fa"].indexOf(InputContext.locale.substring(0, 2)) !== -1)
+ return "\u0660\u0661\u0662"
+ // Fallthrough
+ case InputEngine.InputMode.Dialable:
+ return "123"
+ case InputEngine.InputMode.Greek:
+ return "ΑΒΓ"
+ case InputEngine.InputMode.Cyrillic:
+ return "АБВ"
+ case InputEngine.InputMode.Arabic:
+ if (InputContext.locale.substring(0, 2) === "fa")
+ return "\u0627\u200C\u0628\u200C\u067E"
+ return "\u0623\u200C\u0628\u200C\u062C"
+ case InputEngine.InputMode.Hebrew:
+ return "\u05D0\u05D1\u05D2"
+ case InputEngine.InputMode.ChineseHandwriting:
+ return "中文"
+ case InputEngine.InputMode.JapaneseHandwriting:
+ return "日本語"
+ case InputEngine.InputMode.KoreanHandwriting:
+ return "한국어"
+ case InputEngine.InputMode.Thai:
+ return "กขค"
+ default:
+ return "Abc"
+ }
+ }
+ color: "black"
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.margins: keyContentMargin * 1.5
+ font {
+ family: fontFamily
+ weight: Font.Bold
+ pixelSize: 72 * scaleHint
+ capitalization: {
+ if (InputContext.capsLockActive)
+ return Font.AllUppercase
+ if (InputContext.shiftActive)
+ return Font.MixedCase
+ return Font.AllLowercase
+ }
+ }
+ }
+ Canvas {
+ id: traceInputKeyGuideLines
+ anchors.fill: traceInputKeyPanelBackground
+ opacity: 0.4
+ onPaint: {
+ var ctx = getContext("2d")
+ ctx.lineWidth = 1
+ ctx.strokeStyle = Qt.rgba(0, 0, 0)
+ ctx.clearRect(0, 0, width, height)
+ var i
+ var margin = Math.round(30 * scaleHint)
+ if (control.horizontalRulers) {
+ for (i = 0; i < control.horizontalRulers.length; i++) {
+ ctx.beginPath()
+ var y = Math.round(control.horizontalRulers[i])
+ var rightMargin = Math.round(width - margin)
+ if (i + 1 === control.horizontalRulers.length) {
+ ctx.moveTo(margin, y)
+ ctx.lineTo(rightMargin, y)
+ } else {
+ var dashLen = Math.round(20 * scaleHint)
+ for (var dash = margin, dashCount = 0;
+ dash < rightMargin; dash += dashLen, dashCount++) {
+ if ((dashCount & 1) === 0) {
+ ctx.moveTo(dash, y)
+ ctx.lineTo(Math.min(dash + dashLen, rightMargin), y)
+ }
+ }
+ }
+ ctx.stroke()
+ }
+ }
+ if (control.verticalRulers) {
+ for (i = 0; i < control.verticalRulers.length; i++) {
+ ctx.beginPath()
+ ctx.moveTo(control.verticalRulers[i], 0)
+ ctx.lineTo(control.verticalRulers[i], height)
+ ctx.stroke()
+ }
+ }
+ }
+ Connections {
+ target: control
+ function onHorizontalRulersChanged() { traceInputKeyGuideLines.requestPaint() }
+ function onVerticalRulersChanged() { traceInputKeyGuideLines.requestPaint() }
+ }
+ }
+ }
+
+ traceCanvasDelegate: TraceCanvas {
+ id: traceCanvas
+ onAvailableChanged: {
+ if (!available)
+ return
+ var ctx = getContext("2d")
+ ctx.lineWidth = parent.canvasType === "fullscreen" ? 10 : 10 * scaleHint
+ ctx.lineCap = "round"
+ ctx.strokeStyle = Qt.rgba(0, 0, 0)
+ ctx.fillStyle = ctx.strokeStyle
+ }
+ autoDestroyDelay: 800
+ onTraceChanged: if (trace === null) opacity = 0
+ Behavior on opacity { PropertyAnimation { easing.type: Easing.OutCubic; duration: 150 } }
+ }
+
+ popupListDelegate: SelectionListItem {
+ property real cursorAnchor: popupListLabel.x + popupListLabel.width
+ id: popupListItem
+ width: popupListLabel.width + popupListLabel.anchors.leftMargin * 2
+ height: popupListLabel.height + popupListLabel.anchors.topMargin * 2
+ Text {
+ id: popupListLabel
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.leftMargin: popupListLabel.height / 2
+ anchors.topMargin: popupListLabel.height / 3
+ text: decorateText(display, wordCompletionLength)
+ color: "#110b05"
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: Qt.inputMethod.cursorRectangle.height * 0.8
+ }
+ function decorateText(text, wordCompletionLength) {
+ if (wordCompletionLength > 0) {
+ return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
+ }
+ return text
+ }
+ }
+ states: State {
+ name: "current"
+ when: popupListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: popupListLabel
+ color: "black"
+ }
+ }
+ }
+
+ popupListBackground: Item {
+ BorderImage {
+ readonly property int popupListBackgroundSvgImageHeight: Math.round(height / 8)
+ readonly property real popupListBackgroundSvgImageScale: popupListBackgroundSvgImageHeight / 154
+ readonly property real backgroundMargin: 0 * scaleHint
+ x: -backgroundMargin
+ y: -backgroundMargin
+ width: parent.width + 2 * backgroundMargin
+ height: parent.height + 2 * backgroundMargin
+ source: "image://qtvkbsvg/%1/images/key154px_colorA.svg?height=%2".arg(resourcePath).arg(popupListBackgroundSvgImageHeight)
+ border.left: 76 * popupListBackgroundSvgImageScale
+ border.top: 76 * popupListBackgroundSvgImageScale
+ border.right: 76 * popupListBackgroundSvgImageScale
+ border.bottom: 76 * popupListBackgroundSvgImageScale
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ }
+ }
+
+ popupListAdd: Transition {
+ NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
+ }
+
+ popupListRemove: Transition {
+ NumberAnimation { property: "opacity"; to: 0; duration: 200 }
+ }
+
+ languagePopupListEnabled: true
+
+ languageListDelegate: SelectionListItem {
+ id: languageListItem
+ width: languageNameTextMetrics.width * 20
+ height: languageNameTextMetrics.height + languageListLabel.anchors.topMargin + languageListLabel.anchors.bottomMargin
+ Text {
+ id: languageListLabel
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.leftMargin: languageNameTextMetrics.height / 2
+ anchors.rightMargin: anchors.leftMargin
+ anchors.topMargin: languageNameTextMetrics.height / 3
+ anchors.bottomMargin: anchors.topMargin
+ text: languageNameFormatter.elidedText
+ color: "#c5a96f"
+ opacity: 0.8
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ }
+ }
+ TextMetrics {
+ id: languageNameTextMetrics
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ }
+ text: "X"
+ }
+ TextMetrics {
+ id: languageNameFormatter
+ font {
+ family: fontFamily
+ weight: Font.Normal
+ pixelSize: 44 * scaleHint
+ }
+ elide: Text.ElideRight
+ elideWidth: languageListItem.width - languageListLabel.anchors.leftMargin - languageListLabel.anchors.rightMargin
+ text: displayName
+ }
+ states: State {
+ name: "current"
+ when: languageListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: languageListLabel
+ color: "white"
+ }
+ }
+ }
+
+ languageListHighlight: Item {
+ Rectangle {
+ anchors.fill: parent
+ anchors.topMargin: Math.round(8 * scaleHint)
+ anchors.bottomMargin: Math.round(8 * scaleHint)
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#64462a" }
+ GradientStop { position: 0.18; color: "#a37648" }
+ GradientStop { position: 0.5; color: "#c4a47c" }
+ GradientStop { position: 0.82; color: "#a37648" }
+ GradientStop { position: 1.0; color: "#64462a" }
+ }
+ }
+ }
+
+ languageListBackground: Item {
+ BorderImage {
+ readonly property int languageListBackgroundSvgImageHeight: Math.round(height / 3)
+ readonly property real languageListBackgroundSvgImageScale: languageListBackgroundSvgImageHeight / 154
+ readonly property real backgroundMargin: 40 * scaleHint
+ x: -backgroundMargin
+ y: -backgroundMargin
+ width: parent.width + 2 * backgroundMargin
+ height: parent.height + 2 * backgroundMargin
+ source: "image://qtvkbsvg/%1/images/key154px_black.svg?height=%2".arg(resourcePath).arg(languageListBackgroundSvgImageHeight)
+ border.left: 76 * languageListBackgroundSvgImageScale
+ border.top: 76 * languageListBackgroundSvgImageScale
+ border.right: 78 * languageListBackgroundSvgImageScale
+ border.bottom: 78 * languageListBackgroundSvgImageScale
+ horizontalTileMode: BorderImage.Stretch
+ verticalTileMode: BorderImage.Stretch
+ }
+ }
+
+ languageListAdd: Transition {
+ NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
+ }
+
+ languageListRemove: Transition {
+ NumberAnimation { property: "opacity"; to: 0; duration: 200 }
+ }
+
+ selectionHandle: Image {
+ sourceSize.width: 20
+ source: resourcePrefix + "images/selectionhandle-bottom.svg"
+ }
+
+ fullScreenInputContainerBackground: Rectangle {
+ color: "#FFF"
+ }
+
+ fullScreenInputBackground: Rectangle {
+ color: "#FFF"
+ }
+
+ fullScreenInputMargins: Math.round(15 * scaleHint)
+
+ fullScreenInputPadding: Math.round(30 * scaleHint)
+
+ fullScreenInputCursor: Rectangle {
+ width: 1
+ color: "#000"
+ visible: parent.blinkStatus
+ }
+
+ fullScreenInputFont.pixelSize: 58 * scaleHint
+
+ fullScreenInputPasswordCharacter: "*"
+
+ fullScreenInputSelectionColor: "#B57C47"
+
+ functionPopupListDelegate: Item {
+ id: functionPopupListItem
+ readonly property real iconMargin: 40 * scaleHint
+ readonly property real iconWidth: 144 * keyIconScale
+ readonly property real iconHeight: 144 * keyIconScale
+ width: iconWidth + 2 * iconMargin
+ height: iconHeight + 2 * iconMargin
+ Image {
+ id: functionIcon
+ anchors.centerIn: parent
+ sourceSize.width: iconWidth
+ sourceSize.height: iconHeight
+ smooth: false
+ source: {
+ switch (keyboardFunction) {
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
+ return resourcePrefix + "images/hidekeyboard-c5a96f.svg"
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
+ return resourcePrefix + "images/globe-c5a96f.svg"
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
+ return resourcePrefix + (keyboard.handwritingMode ? "images/textmode-c5a96f.svg" : "images/handwriting-c5a96f.svg")
+ }
+ }
+ states: State {
+ when: functionPopupListItem.ListView.isCurrentItem
+ PropertyChanges {
+ target: functionIcon
+ source: {
+ switch (keyboardFunction) {
+ case QtVirtualKeyboard.KeyboardFunction.HideInputPanel:
+ return resourcePrefix + "images/hidekeyboard-fff.svg"
+ case QtVirtualKeyboard.KeyboardFunction.ChangeLanguage:
+ return resourcePrefix + "images/globe-fff.svg"
+ case QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode:
+ return resourcePrefix + (keyboard.handwritingMode ? "images/textmode-fff.svg" : "images/handwriting-fff.svg")
+ }
+ }
+ }
+ }
+ }
+ }
+
+ functionPopupListBackground: Item {
+ property ListView view
+ property real currentItemOffset: {
+ if (view.count > 0) {
+ var highlightItem = view.itemAtIndex(0)
+ return view.mapFromItem(highlightItem, highlightItem.width / 2, 0).x
+ }
+ return 0
+ }
+ property bool currentItemHighlight: view.currentIndex === 0
+ BorderImage {
+ cache: false
+ source: resourcePrefix + "images/key160px_black.png"
+ width: sourceSize.width + parent.width / scale
+ height: sourceSize.height
+ anchors.centerIn: parent
+ border.left: 79
+ border.top: 79
+ border.right: 79
+ border.bottom: 79
+ horizontalTileMode: BorderImage.Stretch
+ scale: parent.height / sourceSize.height
+ }
+ Image {
+ visible: currentItemOffset !== undefined
+ source: currentItemHighlight ? resourcePrefix + "images/triangle_highlight.png" : resourcePrefix + "images/triangle_black.png"
+ fillMode: Image.PreserveAspectFit
+ width: sourceSize.width * scaleHint
+ height: sourceSize.height * scaleHint
+ anchors.top: parent.bottom
+ anchors.topMargin: Math.round(-8 * scaleHint)
+ anchors.left: parent.left
+ anchors.leftMargin: Math.round(currentItemOffset - width / 2)
+ }
+ }
+
+ functionPopupListHighlight: Item {
+ Rectangle {
+ anchors.fill: parent
+ anchors.topMargin: Math.round(8 * scaleHint)
+ anchors.bottomMargin: Math.round(8 * scaleHint)
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#64462a" }
+ GradientStop { position: 0.18; color: "#a37648" }
+ GradientStop { position: 0.5; color: "#c4a47c" }
+ GradientStop { position: 0.82; color: "#a37648" }
+ GradientStop { position: 1.0; color: "#64462a" }
+ }
+ }
+ }
+}
diff --git a/src/styles/plugins.qmltypes b/src/styles/plugins.qmltypes
deleted file mode 100644
index 2aecdcb7..00000000
--- a/src/styles/plugins.qmltypes
+++ /dev/null
@@ -1,570 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.VirtualKeyboard.Styles 2.14'
-
-Module {
- dependencies: ["QtQuick 2.0"]
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard.Styles/KeyIcon 1.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyIcon 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "color"; type: "QColor" }
- Property { name: "source"; type: "QUrl" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard.Styles/KeyIcon 2.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyIcon 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "color"; type: "QColor" }
- Property { name: "source"; type: "QUrl" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard.Styles/KeyPanel 1.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyPanel 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "control"; type: "QQuickItem"; isPointer: true }
- Property { name: "soundEffect"; type: "QUrl" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard.Styles/KeyPanel 2.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyPanel 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "control"; type: "QQuickItem"; isPointer: true }
- Property { name: "soundEffect"; type: "QUrl" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- Property { name: "keyboardHeight"; type: "double" }
- Property { name: "keyboardDesignWidth"; type: "double" }
- Property { name: "keyboardDesignHeight"; type: "double" }
- Property { name: "scaleHint"; type: "double"; isReadonly: true }
- Property { name: "keyboardRelativeLeftMargin"; type: "double" }
- Property { name: "keyboardRelativeRightMargin"; type: "double" }
- Property { name: "keyboardRelativeTopMargin"; type: "double" }
- Property { name: "keyboardRelativeBottomMargin"; type: "double" }
- Property { name: "keyboardBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "keyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "backspaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "enterKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "hideKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "shiftKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "spaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "symbolKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "modeKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "handwritingKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "characterPreviewMargin"; type: "double" }
- Property { name: "characterPreviewDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListItemWidth"; type: "double" }
- Property { name: "alternateKeysListItemHeight"; type: "double" }
- Property { name: "alternateKeysListTopMargin"; type: "double" }
- Property { name: "alternateKeysListBottomMargin"; type: "double" }
- Property { name: "alternateKeysListLeftMargin"; type: "double" }
- Property { name: "alternateKeysListRightMargin"; type: "double" }
- Property { name: "alternateKeysListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHeight"; type: "double" }
- Property { name: "selectionListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "navigationHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceInputKeyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceCanvasDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "popupListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languagePopupListEnabled"; type: "bool" }
- Property { name: "languageListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languageListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputContainerBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputMargins"; type: "double" }
- Property { name: "fullScreenInputPadding"; type: "double" }
- Property { name: "fullScreenInputCursor"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputFont"; type: "QFont" }
- Property { name: "fullScreenInputPasswordCharacter"; type: "string" }
- Property { name: "fullScreenInputColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectionColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectedTextColor"; type: "QColor" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.1"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- Property { name: "keyboardHeight"; type: "double" }
- Property { name: "keyboardDesignWidth"; type: "double" }
- Property { name: "keyboardDesignHeight"; type: "double" }
- Property { name: "scaleHint"; type: "double"; isReadonly: true }
- Property { name: "keyboardRelativeLeftMargin"; type: "double" }
- Property { name: "keyboardRelativeRightMargin"; type: "double" }
- Property { name: "keyboardRelativeTopMargin"; type: "double" }
- Property { name: "keyboardRelativeBottomMargin"; type: "double" }
- Property { name: "keyboardBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "keyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "backspaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "enterKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "hideKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "shiftKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "spaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "symbolKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "modeKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "handwritingKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "characterPreviewMargin"; type: "double" }
- Property { name: "characterPreviewDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListItemWidth"; type: "double" }
- Property { name: "alternateKeysListItemHeight"; type: "double" }
- Property { name: "alternateKeysListTopMargin"; type: "double" }
- Property { name: "alternateKeysListBottomMargin"; type: "double" }
- Property { name: "alternateKeysListLeftMargin"; type: "double" }
- Property { name: "alternateKeysListRightMargin"; type: "double" }
- Property { name: "alternateKeysListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHeight"; type: "double" }
- Property { name: "selectionListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "navigationHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceInputKeyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceCanvasDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "popupListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languagePopupListEnabled"; type: "bool" }
- Property { name: "languageListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languageListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputContainerBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputMargins"; type: "double" }
- Property { name: "fullScreenInputPadding"; type: "double" }
- Property { name: "fullScreenInputCursor"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputFont"; type: "QFont" }
- Property { name: "fullScreenInputPasswordCharacter"; type: "string" }
- Property { name: "fullScreenInputColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectionColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectedTextColor"; type: "QColor" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.2"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.2"]
- exportMetaObjectRevisions: [2]
- isComposite: true
- Property { name: "keyboardHeight"; type: "double" }
- Property { name: "keyboardDesignWidth"; type: "double" }
- Property { name: "keyboardDesignHeight"; type: "double" }
- Property { name: "scaleHint"; type: "double"; isReadonly: true }
- Property { name: "keyboardRelativeLeftMargin"; type: "double" }
- Property { name: "keyboardRelativeRightMargin"; type: "double" }
- Property { name: "keyboardRelativeTopMargin"; type: "double" }
- Property { name: "keyboardRelativeBottomMargin"; type: "double" }
- Property { name: "keyboardBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "keyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "backspaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "enterKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "hideKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "shiftKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "spaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "symbolKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "modeKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "handwritingKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "characterPreviewMargin"; type: "double" }
- Property { name: "characterPreviewDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListItemWidth"; type: "double" }
- Property { name: "alternateKeysListItemHeight"; type: "double" }
- Property { name: "alternateKeysListTopMargin"; type: "double" }
- Property { name: "alternateKeysListBottomMargin"; type: "double" }
- Property { name: "alternateKeysListLeftMargin"; type: "double" }
- Property { name: "alternateKeysListRightMargin"; type: "double" }
- Property { name: "alternateKeysListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHeight"; type: "double" }
- Property { name: "selectionListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "navigationHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceInputKeyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceCanvasDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "popupListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languagePopupListEnabled"; type: "bool" }
- Property { name: "languageListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languageListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputContainerBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputMargins"; type: "double" }
- Property { name: "fullScreenInputPadding"; type: "double" }
- Property { name: "fullScreenInputCursor"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputFont"; type: "QFont" }
- Property { name: "fullScreenInputPasswordCharacter"; type: "string" }
- Property { name: "fullScreenInputColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectionColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectedTextColor"; type: "QColor" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.3"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyboardStyle 1.3"]
- exportMetaObjectRevisions: [3]
- isComposite: true
- Property { name: "keyboardHeight"; type: "double" }
- Property { name: "keyboardDesignWidth"; type: "double" }
- Property { name: "keyboardDesignHeight"; type: "double" }
- Property { name: "scaleHint"; type: "double"; isReadonly: true }
- Property { name: "keyboardRelativeLeftMargin"; type: "double" }
- Property { name: "keyboardRelativeRightMargin"; type: "double" }
- Property { name: "keyboardRelativeTopMargin"; type: "double" }
- Property { name: "keyboardRelativeBottomMargin"; type: "double" }
- Property { name: "keyboardBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "keyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "backspaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "enterKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "hideKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "shiftKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "spaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "symbolKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "modeKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "handwritingKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "characterPreviewMargin"; type: "double" }
- Property { name: "characterPreviewDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListItemWidth"; type: "double" }
- Property { name: "alternateKeysListItemHeight"; type: "double" }
- Property { name: "alternateKeysListTopMargin"; type: "double" }
- Property { name: "alternateKeysListBottomMargin"; type: "double" }
- Property { name: "alternateKeysListLeftMargin"; type: "double" }
- Property { name: "alternateKeysListRightMargin"; type: "double" }
- Property { name: "alternateKeysListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHeight"; type: "double" }
- Property { name: "selectionListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "navigationHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceInputKeyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceCanvasDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "popupListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languagePopupListEnabled"; type: "bool" }
- Property { name: "languageListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languageListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputContainerBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputMargins"; type: "double" }
- Property { name: "fullScreenInputPadding"; type: "double" }
- Property { name: "fullScreenInputCursor"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputFont"; type: "QFont" }
- Property { name: "fullScreenInputPasswordCharacter"; type: "string" }
- Property { name: "fullScreenInputColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectionColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectedTextColor"; type: "QColor" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard.Styles/KeyboardStyle 2.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyboardStyle 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- Property { name: "keyboardHeight"; type: "double" }
- Property { name: "keyboardDesignWidth"; type: "double" }
- Property { name: "keyboardDesignHeight"; type: "double" }
- Property { name: "scaleHint"; type: "double"; isReadonly: true }
- Property { name: "keyboardRelativeLeftMargin"; type: "double" }
- Property { name: "keyboardRelativeRightMargin"; type: "double" }
- Property { name: "keyboardRelativeTopMargin"; type: "double" }
- Property { name: "keyboardRelativeBottomMargin"; type: "double" }
- Property { name: "keyboardBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "keyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "backspaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "enterKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "hideKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "shiftKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "spaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "symbolKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "modeKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "handwritingKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "characterPreviewMargin"; type: "double" }
- Property { name: "characterPreviewDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListItemWidth"; type: "double" }
- Property { name: "alternateKeysListItemHeight"; type: "double" }
- Property { name: "alternateKeysListTopMargin"; type: "double" }
- Property { name: "alternateKeysListBottomMargin"; type: "double" }
- Property { name: "alternateKeysListLeftMargin"; type: "double" }
- Property { name: "alternateKeysListRightMargin"; type: "double" }
- Property { name: "alternateKeysListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHeight"; type: "double" }
- Property { name: "selectionListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "navigationHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceInputKeyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceCanvasDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "popupListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languagePopupListEnabled"; type: "bool" }
- Property { name: "languageListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languageListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputContainerBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputMargins"; type: "double" }
- Property { name: "fullScreenInputPadding"; type: "double" }
- Property { name: "fullScreenInputCursor"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputFont"; type: "QFont" }
- Property { name: "fullScreenInputPasswordCharacter"; type: "string" }
- Property { name: "fullScreenInputColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectionColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectedTextColor"; type: "QColor" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard.Styles/KeyboardStyle 2.1"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyboardStyle 2.1"]
- exportMetaObjectRevisions: [1]
- isComposite: true
- Property { name: "keyboardHeight"; type: "double" }
- Property { name: "keyboardDesignWidth"; type: "double" }
- Property { name: "keyboardDesignHeight"; type: "double" }
- Property { name: "scaleHint"; type: "double"; isReadonly: true }
- Property { name: "keyboardRelativeLeftMargin"; type: "double" }
- Property { name: "keyboardRelativeRightMargin"; type: "double" }
- Property { name: "keyboardRelativeTopMargin"; type: "double" }
- Property { name: "keyboardRelativeBottomMargin"; type: "double" }
- Property { name: "keyboardBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "keyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "backspaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "enterKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "hideKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "shiftKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "spaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "symbolKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "modeKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "handwritingKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "characterPreviewMargin"; type: "double" }
- Property { name: "characterPreviewDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListItemWidth"; type: "double" }
- Property { name: "alternateKeysListItemHeight"; type: "double" }
- Property { name: "alternateKeysListTopMargin"; type: "double" }
- Property { name: "alternateKeysListBottomMargin"; type: "double" }
- Property { name: "alternateKeysListLeftMargin"; type: "double" }
- Property { name: "alternateKeysListRightMargin"; type: "double" }
- Property { name: "alternateKeysListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHeight"; type: "double" }
- Property { name: "selectionListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "navigationHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceInputKeyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceCanvasDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "popupListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languagePopupListEnabled"; type: "bool" }
- Property { name: "languageListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languageListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputContainerBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputMargins"; type: "double" }
- Property { name: "fullScreenInputPadding"; type: "double" }
- Property { name: "fullScreenInputCursor"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputFont"; type: "QFont" }
- Property { name: "fullScreenInputPasswordCharacter"; type: "string" }
- Property { name: "fullScreenInputColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectionColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectedTextColor"; type: "QColor" }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.VirtualKeyboard.Styles/KeyboardStyle 2.2"
- exports: ["QtQuick.VirtualKeyboard.Styles/KeyboardStyle 2.2"]
- exportMetaObjectRevisions: [2]
- isComposite: true
- Property { name: "keyboardHeight"; type: "double" }
- Property { name: "keyboardDesignWidth"; type: "double" }
- Property { name: "keyboardDesignHeight"; type: "double" }
- Property { name: "scaleHint"; type: "double"; isReadonly: true }
- Property { name: "keyboardRelativeLeftMargin"; type: "double" }
- Property { name: "keyboardRelativeRightMargin"; type: "double" }
- Property { name: "keyboardRelativeTopMargin"; type: "double" }
- Property { name: "keyboardRelativeBottomMargin"; type: "double" }
- Property { name: "keyboardBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "keyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "backspaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "enterKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "hideKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "shiftKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "spaceKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "symbolKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "modeKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "handwritingKeyPanel"; type: "QQmlComponent"; isPointer: true }
- Property { name: "characterPreviewMargin"; type: "double" }
- Property { name: "characterPreviewDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListItemWidth"; type: "double" }
- Property { name: "alternateKeysListItemHeight"; type: "double" }
- Property { name: "alternateKeysListTopMargin"; type: "double" }
- Property { name: "alternateKeysListBottomMargin"; type: "double" }
- Property { name: "alternateKeysListLeftMargin"; type: "double" }
- Property { name: "alternateKeysListRightMargin"; type: "double" }
- Property { name: "alternateKeysListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "alternateKeysListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHeight"; type: "double" }
- Property { name: "selectionListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "navigationHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceInputKeyPanelDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "traceCanvasDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "popupListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "popupListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languagePopupListEnabled"; type: "bool" }
- Property { name: "languageListDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListHighlight"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "languageListAdd"; type: "QQuickTransition"; isPointer: true }
- Property { name: "languageListRemove"; type: "QQuickTransition"; isPointer: true }
- Property { name: "selectionHandle"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputContainerBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputBackground"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputMargins"; type: "double" }
- Property { name: "fullScreenInputPadding"; type: "double" }
- Property { name: "fullScreenInputCursor"; type: "QQmlComponent"; isPointer: true }
- Property { name: "fullScreenInputFont"; type: "QFont" }
- Property { name: "fullScreenInputPasswordCharacter"; type: "string" }
- Property { name: "fullScreenInputColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectionColor"; type: "QColor" }
- Property { name: "fullScreenInputSelectedTextColor"; type: "QColor" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard.Styles/SelectionListItem 1.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/SelectionListItem 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "soundEffect"; type: "QUrl" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard.Styles/SelectionListItem 2.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/SelectionListItem 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "soundEffect"; type: "QUrl" }
- }
- Component {
- prototype: "QQuickCanvasItem"
- name: "QtQuick.VirtualKeyboard.Styles/TraceCanvas 2.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/TraceCanvas 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "trace"; type: "QVariant" }
- Property { name: "autoDestroy"; type: "bool" }
- Property { name: "autoDestroyDelay"; type: "int" }
- Property { name: "renderFunction"; type: "QVariant" }
- Property { name: "__renderPos"; type: "int" }
- Property { name: "__renderingEnabled"; type: "bool" }
- Method { name: "renderSmoothedLine"; type: "QVariant" }
- }
- Component {
- prototype: "QQuickItem"
- name: "QtQuick.VirtualKeyboard.Styles/TraceInputKeyPanel 2.0"
- exports: ["QtQuick.VirtualKeyboard.Styles/TraceInputKeyPanel 2.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- Property { name: "control"; type: "QQuickItem"; isPointer: true }
- Property { name: "traceMargins"; type: "double" }
- }
-}
diff --git a/src/styles/qmldir b/src/styles/qmldir
deleted file mode 100644
index 6f4705fc..00000000
--- a/src/styles/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module QtQuick.VirtualKeyboard.Styles
-plugin qtquickvirtualkeyboardstylesplugin
-classname QtQuickVirtualKeyboardStylesPlugin
-typeinfo plugins.qmltypes
-depends QtQuick 2.0
diff --git a/src/styles/qtquickvirtualkeyboardstylesplugin.cpp b/src/styles/qtquickvirtualkeyboardstylesplugin.cpp
index 4a1316a2..6c984219 100644
--- a/src/styles/qtquickvirtualkeyboardstylesplugin.cpp
+++ b/src/styles/qtquickvirtualkeyboardstylesplugin.cpp
@@ -1,43 +1,19 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "qtquickvirtualkeyboardstylesplugin.h"
#include "svgimageprovider.h"
-#include <qqml.h>
+#include <QtQml/qqml.h>
#include <QtCore/QLibraryInfo>
-#include <QtVirtualKeyboard/private/qvirtualkeyboard_staticplugin_p.h>
QT_BEGIN_NAMESPACE
+extern void qml_register_types_QtQuick_VirtualKeyboard_Styles();
+Q_GHS_KEEP_REFERENCE(qml_register_types_QtQuick_VirtualKeyboard_Styles);
+
/*!
- \qmlmodule QtQuick.VirtualKeyboard.Styles 2.\QtMinorVersion
+ \qmlmodule QtQuick.VirtualKeyboard.Styles
\title Qt Quick Virtual Keyboard Styles QML Types
\ingroup qmlmodules
@@ -46,37 +22,21 @@ QT_BEGIN_NAMESPACE
The QML types can be imported into your application using the following
import statements in your .qml file:
- \qml \QtMinorVersion
- import QtQuick.VirtualKeyboard.Styles 2.\1
+ \qml
+ import QtQuick.VirtualKeyboard.Styles
\endqml
*/
-void QtQuickVirtualKeyboardStylesPlugin::registerTypes(const char *uri)
+QtQuickVirtualKeyboardStylesPlugin::QtQuickVirtualKeyboardStylesPlugin(QObject *parent) :
+ QQmlExtensionPlugin(parent)
{
-#if defined(QT_STATICPLUGIN)
- Q_VKB_IMPORT_PLUGIN(QtQuick2Plugin)
-#endif
-
- const QString path(QStringLiteral("qrc:///QtQuick/VirtualKeyboard/Styles/content/"));
- qmlRegisterType(QUrl(path + QLatin1String("KeyboardStyle.qml")), uri, 1, 0, "KeyboardStyle");
- qmlRegisterType(QUrl(path + QLatin1String("KeyboardStyle.qml")), uri, 1, 1, "KeyboardStyle");
- qmlRegisterType(QUrl(path + QLatin1String("KeyboardStyle.qml")), uri, 1, 2, "KeyboardStyle");
- qmlRegisterType(QUrl(path + QLatin1String("KeyboardStyle.qml")), uri, 1, 3, "KeyboardStyle");
- qmlRegisterType(QUrl(path + QLatin1String("KeyboardStyle.qml")), uri, 2, 0, "KeyboardStyle");
- qmlRegisterType(QUrl(path + QLatin1String("KeyboardStyle.qml")), uri, 2, 1, "KeyboardStyle");
- qmlRegisterType(QUrl(path + QLatin1String("KeyboardStyle.qml")), uri, 2, 2, "KeyboardStyle");
- qmlRegisterType(QUrl(path + QLatin1String("KeyIcon.qml")), uri, 1, 0, "KeyIcon");
- qmlRegisterType(QUrl(path + QLatin1String("KeyIcon.qml")), uri, 2, 0, "KeyIcon");
- qmlRegisterType(QUrl(path + QLatin1String("KeyPanel.qml")), uri, 1, 0, "KeyPanel");
- qmlRegisterType(QUrl(path + QLatin1String("KeyPanel.qml")), uri, 2, 0, "KeyPanel");
- qmlRegisterType(QUrl(path + QLatin1String("SelectionListItem.qml")), uri, 1, 0, "SelectionListItem");
- qmlRegisterType(QUrl(path + QLatin1String("SelectionListItem.qml")), uri, 2, 0, "SelectionListItem");
- qmlRegisterType(QUrl(path + QLatin1String("TraceInputKeyPanel.qml")), uri, 2, 0, "TraceInputKeyPanel");
- qmlRegisterType(QUrl(path + QLatin1String("TraceCanvas.qml")), uri, 2, 0, "TraceCanvas");
+ volatile auto registration = &qml_register_types_QtQuick_VirtualKeyboard_Styles;
+ Q_UNUSED(registration);
+}
- // The minor version used to be the current Qt 5 minor. For compatibility it is the last
- // Qt 5 release.
- qmlRegisterModule(uri, 2, 15);
+void QtQuickVirtualKeyboardStylesPlugin::registerTypes(const char *uri)
+{
+ Q_UNUSED(uri);
}
void QtQuickVirtualKeyboardStylesPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
diff --git a/src/styles/qtquickvirtualkeyboardstylesplugin.h b/src/styles/qtquickvirtualkeyboardstylesplugin.h
index 1d467332..f01a8f7b 100644
--- a/src/styles/qtquickvirtualkeyboardstylesplugin.h
+++ b/src/styles/qtquickvirtualkeyboardstylesplugin.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QTQUICKVIRTUALKEYBOARDSTYLESPLUGIN_H
#define QTQUICKVIRTUALKEYBOARDSTYLESPLUGIN_H
@@ -40,7 +14,7 @@ class QtQuickVirtualKeyboardStylesPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQuickVirtualKeyboardStylesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ QtQuickVirtualKeyboardStylesPlugin(QObject *parent = nullptr);
void registerTypes(const char *uri) override;
void initializeEngine(QQmlEngine *engine, const char *uri) override;
};
diff --git a/src/styles/styles.pro b/src/styles/styles.pro
deleted file mode 100644
index 5d79fd9e..00000000
--- a/src/styles/styles.pro
+++ /dev/null
@@ -1,34 +0,0 @@
-TARGET = qtquickvirtualkeyboardstylesplugin
-TARGETPATH = QtQuick/VirtualKeyboard/Styles
-IMPORT_VERSION = 2.$$QT_MINOR_VERSION
-QT += qml quick svg virtualkeyboard-private
-
-CONFIG += no_cxx_module
-
-SOURCES += \
- svgimageprovider.cpp \
- qtquickvirtualkeyboardstylesplugin.cpp
-
-HEADERS += \
- svgimageprovider.h \
- qtquickvirtualkeyboardstylesplugin.h
-
-RESOURCES += \
- styles.qrc
-
-OTHER_FILES += \
- plugins.qmltypes \
- qmldir
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-win32 {
- QMAKE_TARGET_PRODUCT = "Qt Virtual Keyboard (Qt $$QT_VERSION)"
- QMAKE_TARGET_DESCRIPTION = "Virtual Keyboard for Qt."
-}
-
-load(qml_plugin)
diff --git a/src/styles/styles.qrc b/src/styles/styles.qrc
deleted file mode 100644
index 819d4771..00000000
--- a/src/styles/styles.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
- <qresource prefix="/QtQuick/VirtualKeyboard/Styles/content">
- <file>KeyboardStyle.qml</file>
- <file>KeyIcon.qml</file>
- <file>KeyPanel.qml</file>
- <file>SelectionListItem.qml</file>
- <file>TraceInputKeyPanel.qml</file>
- <file>TraceCanvas.qml</file>
- <file>TraceUtils.js</file>
- </qresource>
-</RCC>
diff --git a/src/styles/svgimageprovider.cpp b/src/styles/svgimageprovider.cpp
index 29d320a4..fa8345ba 100644
--- a/src/styles/svgimageprovider.cpp
+++ b/src/styles/svgimageprovider.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "svgimageprovider.h"
#include <QImage>
@@ -53,7 +27,7 @@ QPixmap SvgImageProvider::requestPixmap(const QString &id, QSize *size, const QS
QVariantMap params;
for (const QString &param : paramList) {
QStringList keyValue = param.split(QLatin1Char('='), Qt::SkipEmptyParts);
- if (keyValue.length() == 2)
+ if (keyValue.size() == 2)
params[keyValue[0]] = keyValue[1];
}
const auto widthIt = params.constFind(QLatin1String("width"));
diff --git a/src/styles/svgimageprovider.h b/src/styles/svgimageprovider.h
index 3d89a278..851ab606 100644
--- a/src/styles/svgimageprovider.h
+++ b/src/styles/svgimageprovider.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SVGIMAGEPROVIDER_H
#define SVGIMAGEPROVIDER_H
diff --git a/src/virtualkeyboard/.prev_CMakeLists.txt b/src/virtualkeyboard/.prev_CMakeLists.txt
deleted file mode 100644
index ce750e90..00000000
--- a/src/virtualkeyboard/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,357 +0,0 @@
-# Generated from virtualkeyboard.pro.
-
-#####################################################################
-## VirtualKeyboard Module:
-#####################################################################
-
-qt_add_module(VirtualKeyboard
- PLUGIN_TYPES virtualkeyboard
- SOURCES
- abstractinputpanel.cpp abstractinputpanel_p.h
- appinputpanel.cpp appinputpanel_p.h
- appinputpanel_p_p.h
- desktopinputselectioncontrol.cpp desktopinputselectioncontrol_p.h
- enterkeyaction.cpp enterkeyaction_p.h
- enterkeyactionattachedtype.cpp enterkeyactionattachedtype_p.h
- fallbackinputmethod.cpp fallbackinputmethod_p.h
- gesturerecognizer.cpp gesturerecognizer_p.h
- handwritinggesturerecognizer.cpp handwritinggesturerecognizer_p.h
- inputmethod.cpp inputmethod_p.h
- inputselectionhandle.cpp inputselectionhandle_p.h
- plaininputmethod.cpp plaininputmethod_p.h
- platforminputcontext.cpp platforminputcontext_p.h
- qvirtualkeyboard_global.h qvirtualkeyboard_global_p.h
- qvirtualkeyboard_staticplugin_p.h
- qvirtualkeyboardabstractinputmethod.cpp qvirtualkeyboardabstractinputmethod.h
- qvirtualkeyboardextensionplugin.cpp qvirtualkeyboardextensionplugin.h
- qvirtualkeyboardinputcontext.cpp qvirtualkeyboardinputcontext.h qvirtualkeyboardinputcontext_p.cpp qvirtualkeyboardinputcontext_p.h
- qvirtualkeyboardinputengine.cpp qvirtualkeyboardinputengine.h
- qvirtualkeyboardselectionlistmodel.cpp qvirtualkeyboardselectionlistmodel.h
- qvirtualkeyboardtrace.cpp qvirtualkeyboardtrace.h
- settings.cpp settings_p.h
- shadowinputcontext.cpp shadowinputcontext_p.h
- shifthandler.cpp shifthandler_p.h
- virtualkeyboarddebug_p.h
- virtualkeyboardsettings.cpp virtualkeyboardsettings_p.h
- DEFINES
- QT_ASCII_CAST_WARNINGS
- QT_NO_CAST_FROM_ASCII
- QT_NO_CAST_FROM_BYTEARRAY
- QT_NO_CAST_TO_ASCII
- QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR=\\\"qrc:/QtQuick/VirtualKeyboard/content/layouts\\\"
- QVIRTUALKEYBOARD_LIBRARY
- LIBRARIES
- Qt::CorePrivate
- Qt::GuiPrivate
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
- PRIVATE_MODULE_INTERFACE
- Qt::CorePrivate
- Qt::GuiPrivate
-)
-
-# Resources:
-set(virtualkeyboard_content_resource_files
- "HandwritingInputPanel.qml"
- "InputPanel.qml"
- "components/AlternativeKeys.qml"
- "components/BackspaceKey.qml"
- "components/BaseKey.qml"
- "components/ChangeLanguageKey.qml"
- "components/CharacterPreviewBubble.qml"
- "components/EnterKey.qml"
- "components/FillerKey.qml"
- "components/HandwritingModeKey.qml"
- "components/HideKeyboardKey.qml"
- "components/InputModeKey.qml"
- "components/Key.qml"
- "components/Keyboard.qml"
- "components/KeyboardColumn.qml"
- "components/KeyboardLayout.qml"
- "components/KeyboardLayoutLoader.qml"
- "components/KeyboardRow.qml"
- "components/ModeKey.qml"
- "components/MultiSoundEffect.qml"
- "components/MultitapInputMethod.qml"
- "components/NumberKey.qml"
- "components/PopupList.qml"
- "components/SelectionControl.qml"
- "components/ShadowInputControl.qml"
- "components/ShiftKey.qml"
- "components/SpaceKey.qml"
- "components/SymbolModeKey.qml"
- "components/TraceInputArea.qml"
- "components/TraceInputKey.qml"
- "components/WordCandidatePopupList.qml"
-)
-
-qt_add_resource(VirtualKeyboard "virtualkeyboard_content"
- PREFIX
- "/QtQuick/VirtualKeyboard/content"
- BASE
- "content"
- FILES
- ${virtualkeyboard_content_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:virtualkeyboard.pro:<TRUE>:
-# LAYOUT_FILES = "content/layouts/fallback/dialpad.qml" "content/layouts/fallback/digits.qml" "content/layouts/fallback/numbers.qml" "content/layouts/fallback/main.qml" "content/layouts/fallback/symbols.qml"
-# MODULE = "virtualkeyboard"
-# OTHER_FILES = "$$PWD/qtvirtualkeyboard.qdocconf" "$$PWD/src/qtvirtualkeyboard-index.qdoc" "$$PWD/src/deployment-guide.qdoc" "$$PWD/src/technical-guide.qdoc" "$$PWD/src/user-guide.qdoc" "$$PWD/src/build.qdoc" "$$PWD/src/snippets/CustomInputMethod.qml" "content/styles/default/*.qml" "content/styles/retro/*.qml" "content/*.qml" "content/components/*.qml" "qtvirtualkeyboard.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_sensitive_debug
- PUBLIC_DEFINES
- SENSITIVE_DEBUG
-)
-
-if(NOT no-builtin-style)
- # Resources:
- set(virtualkeyboard_default_style_resource_files
- "images/backspace-868482.svg"
- "images/check-868482.svg"
- "images/enter-868482.svg"
- "images/globe-868482.svg"
- "images/handwriting-868482.svg"
- "images/hidekeyboard-868482.svg"
- "images/search-868482.svg"
- "images/selectionhandle-bottom.svg"
- "images/shift-80c342.svg"
- "images/shift-868482.svg"
- "images/shift-c5d6b6.svg"
- "images/textmode-868482.svg"
- "style.qml"
- )
-
- qt_add_resource(VirtualKeyboard "virtualkeyboard_default_style"
- PREFIX
- "/QtQuick/VirtualKeyboard/content/styles/default"
- BASE
- "content/styles/default"
- FILES
- ${virtualkeyboard_default_style_resource_files}
- )
- set(virtualkeyboard_retro_style_resource_files
- "images/backspace-c5a96f.svg"
- "images/check-c5a96f.svg"
- "images/enter-c5a96f.svg"
- "images/globe-110b05.svg"
- "images/handwriting-110b05.svg"
- "images/hidekeyboard-c5a96f.svg"
- "images/key154px_black.png"
- "images/key154px_black_long.png"
- "images/key154px_capslock.png"
- "images/key154px_capslock_long.png"
- "images/key154px_colorA.png"
- "images/key154px_colorA.svg"
- "images/key154px_colorA_long.png"
- "images/key154px_colorB.png"
- "images/key154px_shiftcase.png"
- "images/key154px_shiftcase_long.png"
- "images/key156px_black_long.png"
- "images/key156px_black_medium_long.png"
- "images/key156px_colorA.png"
- "images/key156px_colorB.png"
- "images/key160px_black.png"
- "images/key160px_colorA.png"
- "images/key160px_colorB.png"
- "images/key_preview.png"
- "images/search-c5a96f.svg"
- "images/selectionhandle-bottom.svg"
- "images/shift-c5a96f.svg"
- "images/shift-cd8865.svg"
- "images/shift-dc4f28.svg"
- "images/textmode-110b05.svg"
- "images/triangle_black.png"
- "images/triangle_highlight.png"
- "style.qml"
- )
-
- qt_add_resource(VirtualKeyboard "virtualkeyboard_retro_style"
- PREFIX
- "/QtQuick/VirtualKeyboard/content/styles/retro"
- BASE
- "content/styles/retro"
- FILES
- ${virtualkeyboard_retro_style_resource_files}
- )
-endif()
-
-#### Keys ignored in scope 4:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_en_GB:
-# LAYOUT_FILES = "content/layouts/en_GB/dialpad.fallback" "content/layouts/en_GB/digits.fallback" "content/layouts/en_GB/main.fallback" "content/layouts/en_GB/numbers.fallback" "content/layouts/en_GB/symbols.fallback"
-
-#### Keys ignored in scope 5:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_en_US:
-# LAYOUT_FILES = "content/layouts/en_US/dialpad.fallback" "content/layouts/en_US/digits.fallback" "content/layouts/en_US/main.fallback" "content/layouts/en_US/numbers.fallback" "content/layouts/en_US/symbols.fallback"
-
-#### Keys ignored in scope 6:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ar_AR:
-# LAYOUT_FILES = "content/layouts/ar_AR/dialpad.fallback" "content/layouts/ar_AR/digits.qml" "content/layouts/ar_AR/main.qml" "content/layouts/ar_AR/numbers.qml" "content/layouts/ar_AR/symbols.qml"
-
-#### Keys ignored in scope 7:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_bg_BG:
-# LAYOUT_FILES = "content/layouts/bg_BG/dialpad.fallback" "content/layouts/bg_BG/digits.fallback" "content/layouts/bg_BG/main.qml" "content/layouts/bg_BG/numbers.fallback" "content/layouts/bg_BG/symbols.fallback"
-
-#### Keys ignored in scope 8:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_cs_CZ:
-# LAYOUT_FILES = "content/layouts/cs_CZ/dialpad.fallback" "content/layouts/cs_CZ/digits.fallback" "content/layouts/cs_CZ/main.qml" "content/layouts/cs_CZ/numbers.fallback" "content/layouts/cs_CZ/symbols.fallback"
-
-#### Keys ignored in scope 9:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_da_DK:
-# LAYOUT_FILES = "content/layouts/da_DK/dialpad.fallback" "content/layouts/da_DK/digits.fallback" "content/layouts/da_DK/main.qml" "content/layouts/da_DK/numbers.fallback" "content/layouts/da_DK/symbols.fallback"
-
-#### Keys ignored in scope 10:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_de_DE:
-# LAYOUT_FILES = "content/layouts/de_DE/dialpad.fallback" "content/layouts/de_DE/digits.fallback" "content/layouts/de_DE/main.qml" "content/layouts/de_DE/numbers.fallback" "content/layouts/de_DE/symbols.fallback"
-
-#### Keys ignored in scope 11:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_el_GR:
-# LAYOUT_FILES = "content/layouts/el_GR/dialpad.fallback" "content/layouts/el_GR/digits.fallback" "content/layouts/el_GR/main.qml" "content/layouts/el_GR/numbers.fallback" "content/layouts/el_GR/symbols.fallback"
-
-#### Keys ignored in scope 12:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_es_ES:
-# LAYOUT_FILES = "content/layouts/es_ES/dialpad.fallback" "content/layouts/es_ES/digits.fallback" "content/layouts/es_ES/main.qml" "content/layouts/es_ES/numbers.fallback" "content/layouts/es_ES/symbols.qml"
-
-#### Keys ignored in scope 13:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_es_MX:
-# LAYOUT_FILES = "content/layouts/es_MX/dialpad.fallback" "content/layouts/es_MX/digits.fallback" "content/layouts/es_MX/main.qml" "content/layouts/es_MX/numbers.fallback" "content/layouts/es_MX/symbols.qml"
-
-#### Keys ignored in scope 14:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_et_EE:
-# LAYOUT_FILES = "content/layouts/et_EE/dialpad.fallback" "content/layouts/et_EE/digits.fallback" "content/layouts/et_EE/main.qml" "content/layouts/et_EE/numbers.fallback" "content/layouts/et_EE/symbols.fallback"
-
-#### Keys ignored in scope 15:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fa_FA:
-# LAYOUT_FILES = "content/layouts/fa_FA/dialpad.fallback" "content/layouts/fa_FA/digits.qml" "content/layouts/fa_FA/main.qml" "content/layouts/fa_FA/numbers.qml" "content/layouts/fa_FA/symbols.qml"
-
-#### Keys ignored in scope 16:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fi_FI:
-# LAYOUT_FILES = "content/layouts/fi_FI/dialpad.fallback" "content/layouts/fi_FI/digits.fallback" "content/layouts/fi_FI/main.qml" "content/layouts/fi_FI/numbers.fallback" "content/layouts/fi_FI/symbols.fallback"
-
-#### Keys ignored in scope 17:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fr_CA:
-# LAYOUT_FILES = "content/layouts/fr_CA/dialpad.fallback" "content/layouts/fr_CA/digits.fallback" "content/layouts/fr_CA/main.qml" "content/layouts/fr_CA/numbers.fallback" "content/layouts/fr_CA/symbols.fallback"
-
-#### Keys ignored in scope 18:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fr_FR:
-# LAYOUT_FILES = "content/layouts/fr_FR/dialpad.fallback" "content/layouts/fr_FR/digits.fallback" "content/layouts/fr_FR/main.qml" "content/layouts/fr_FR/numbers.fallback" "content/layouts/fr_FR/symbols.fallback"
-
-#### Keys ignored in scope 19:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_he_IL:
-# LAYOUT_FILES = "content/layouts/he_IL/dialpad.fallback" "content/layouts/he_IL/digits.fallback" "content/layouts/he_IL/main.qml" "content/layouts/he_IL/numbers.fallback" "content/layouts/he_IL/symbols.qml"
-
-#### Keys ignored in scope 20:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_hi_IN:
-# LAYOUT_FILES = "content/layouts/hi_IN/dialpad.fallback" "content/layouts/hi_IN/digits.fallback" "content/layouts/hi_IN/main.qml" "content/layouts/hi_IN/numbers.fallback" "content/layouts/hi_IN/symbols.qml"
-
-#### Keys ignored in scope 21:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_hr_HR:
-# LAYOUT_FILES = "content/layouts/hr_HR/dialpad.fallback" "content/layouts/hr_HR/digits.fallback" "content/layouts/hr_HR/main.qml" "content/layouts/hr_HR/numbers.fallback" "content/layouts/hr_HR/symbols.fallback"
-
-#### Keys ignored in scope 22:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_hu_HU:
-# LAYOUT_FILES = "content/layouts/hu_HU/dialpad.fallback" "content/layouts/hu_HU/digits.fallback" "content/layouts/hu_HU/main.qml" "content/layouts/hu_HU/numbers.fallback" "content/layouts/hu_HU/symbols.fallback"
-
-#### Keys ignored in scope 23:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_id_ID:
-# LAYOUT_FILES = "content/layouts/id_ID/dialpad.fallback" "content/layouts/id_ID/digits.fallback" "content/layouts/id_ID/main.fallback" "content/layouts/id_ID/numbers.fallback" "content/layouts/id_ID/symbols.fallback"
-
-#### Keys ignored in scope 24:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_it_IT:
-# LAYOUT_FILES = "content/layouts/it_IT/dialpad.fallback" "content/layouts/it_IT/digits.fallback" "content/layouts/it_IT/main.qml" "content/layouts/it_IT/numbers.fallback" "content/layouts/it_IT/symbols.fallback"
-
-#### Keys ignored in scope 25:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_nb_NO:
-# LAYOUT_FILES = "content/layouts/nb_NO/dialpad.fallback" "content/layouts/nb_NO/digits.fallback" "content/layouts/nb_NO/main.qml" "content/layouts/nb_NO/numbers.fallback" "content/layouts/nb_NO/symbols.fallback"
-
-#### Keys ignored in scope 26:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ms_MY:
-# LAYOUT_FILES = "content/layouts/ms_MY/dialpad.fallback" "content/layouts/ms_MY/digits.fallback" "content/layouts/ms_MY/main.fallback" "content/layouts/ms_MY/numbers.fallback" "content/layouts/ms_MY/symbols.fallback"
-
-#### Keys ignored in scope 27:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_nl_NL:
-# LAYOUT_FILES = "content/layouts/nl_NL/dialpad.fallback" "content/layouts/nl_NL/digits.fallback" "content/layouts/nl_NL/main.fallback" "content/layouts/nl_NL/numbers.fallback" "content/layouts/nl_NL/symbols.fallback"
-
-#### Keys ignored in scope 28:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_pl_PL:
-# LAYOUT_FILES = "content/layouts/pl_PL/dialpad.fallback" "content/layouts/pl_PL/digits.fallback" "content/layouts/pl_PL/main.qml" "content/layouts/pl_PL/numbers.fallback" "content/layouts/pl_PL/symbols.fallback"
-
-#### Keys ignored in scope 29:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_pt_BR:
-# LAYOUT_FILES = "content/layouts/pt_BR/dialpad.fallback" "content/layouts/pt_BR/digits.fallback" "content/layouts/pt_BR/main.qml" "content/layouts/pt_BR/numbers.fallback" "content/layouts/pt_BR/symbols.fallback"
-
-#### Keys ignored in scope 30:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_pt_PT:
-# LAYOUT_FILES = "content/layouts/pt_PT/dialpad.fallback" "content/layouts/pt_PT/digits.fallback" "content/layouts/pt_PT/main.qml" "content/layouts/pt_PT/numbers.fallback" "content/layouts/pt_PT/symbols.fallback"
-
-#### Keys ignored in scope 31:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ro_RO:
-# LAYOUT_FILES = "content/layouts/ro_RO/dialpad.fallback" "content/layouts/ro_RO/digits.fallback" "content/layouts/ro_RO/main.qml" "content/layouts/ro_RO/numbers.fallback" "content/layouts/ro_RO/symbols.fallback"
-
-#### Keys ignored in scope 32:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ru_RU:
-# LAYOUT_FILES = "content/layouts/ru_RU/dialpad.fallback" "content/layouts/ru_RU/digits.fallback" "content/layouts/ru_RU/main.qml" "content/layouts/ru_RU/numbers.fallback" "content/layouts/ru_RU/symbols.fallback"
-
-#### Keys ignored in scope 33:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sk_SK:
-# LAYOUT_FILES = "content/layouts/sk_SK/dialpad.fallback" "content/layouts/sk_SK/digits.fallback" "content/layouts/sk_SK/main.qml" "content/layouts/sk_SK/numbers.fallback" "content/layouts/sk_SK/symbols.fallback"
-
-#### Keys ignored in scope 34:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sl_SI:
-# LAYOUT_FILES = "content/layouts/sl_SI/dialpad.fallback" "content/layouts/sl_SI/digits.fallback" "content/layouts/sl_SI/main.qml" "content/layouts/sl_SI/numbers.fallback" "content/layouts/sl_SI/symbols.fallback"
-
-#### Keys ignored in scope 35:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sq_AL:
-# LAYOUT_FILES = "content/layouts/sq_AL/dialpad.fallback" "content/layouts/sq_AL/digits.fallback" "content/layouts/sq_AL/main.qml" "content/layouts/sq_AL/numbers.fallback" "content/layouts/sq_AL/symbols.fallback"
-
-#### Keys ignored in scope 36:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sr_SP:
-# LAYOUT_FILES = "content/layouts/sr_SP/dialpad.fallback" "content/layouts/sr_SP/digits.fallback" "content/layouts/sr_SP/main.qml" "content/layouts/sr_SP/numbers.fallback" "content/layouts/sr_SP/symbols.fallback"
-
-#### Keys ignored in scope 37:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sv_SE:
-# LAYOUT_FILES = "content/layouts/sv_SE/dialpad.fallback" "content/layouts/sv_SE/digits.fallback" "content/layouts/sv_SE/main.qml" "content/layouts/sv_SE/numbers.fallback" "content/layouts/sv_SE/symbols.fallback"
-
-#### Keys ignored in scope 38:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_tr_TR:
-# LAYOUT_FILES = "content/layouts/tr_TR/dialpad.fallback" "content/layouts/tr_TR/digits.fallback" "content/layouts/tr_TR/main.qml" "content/layouts/tr_TR/numbers.fallback" "content/layouts/tr_TR/symbols.fallback"
-
-#### Keys ignored in scope 39:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_uk_UA:
-# LAYOUT_FILES = "content/layouts/uk_UA/dialpad.fallback" "content/layouts/uk_UA/digits.fallback" "content/layouts/uk_UA/main.qml" "content/layouts/uk_UA/numbers.fallback" "content/layouts/uk_UA/symbols.fallback"
-
-#### Keys ignored in scope 40:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_vi_VN:
-# LAYOUT_FILES = "content/layouts/vi_VN/dialpad.fallback" "content/layouts/vi_VN/digits.fallback" "content/layouts/vi_VN/main.qml" "content/layouts/vi_VN/numbers.fallback" "content/layouts/vi_VN/symbols.qml"
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_no_builtin_style
- DEFINES
- QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"\\\"
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_retro_style AND NOT QT_FEATURE_vkb_no_builtin_style
- DEFINES
- QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"retro\\\"
-)
-
-qt_extend_target(VirtualKeyboard CONDITION NOT QT_FEATURE_vkb_no_builtin_style AND NOT QT_FEATURE_vkb_retro_style
- DEFINES
- QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"default\\\"
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_desktop
- SOURCES
- desktopinputpanel.cpp desktopinputpanel_p.h
- inputview.cpp inputview_p.h
- DEFINES
- QT_VIRTUALKEYBOARD_DESKTOP
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_desktop AND QT_FEATURE_vkb_xcb
- PUBLIC_LIBRARIES
- XCB::XFIXES
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_record_trace_input
- SOURCES
- unipentrace.cpp unipentrace_p.h
- PUBLIC_DEFINES
- QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_arrow_keynavigation
- DEFINES
- QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
-)
-
-if(QT_FEATURE_vkb_layouts)
- # Resources:
- set(qmake_virtualkeyboard_layouts_resource_files
- "content/layouts/fallback/dialpad.qml"
- "content/layouts/fallback/digits.qml"
- "content/layouts/fallback/main.qml"
- "content/layouts/fallback/numbers.qml"
- "content/layouts/fallback/symbols.qml"
- )
-
- qt_add_resource(VirtualKeyboard "qmake_virtualkeyboard_layouts"
- PREFIX
- "$$LAYOUTS_PREFIX"
- FILES
- ${qmake_virtualkeyboard_layouts_resource_files}
- )
-endif()
-qt_add_docs(VirtualKeyboard
- doc/qtvirtualkeyboard.qdocconf
-)
-
diff --git a/src/virtualkeyboard/.prev_configure.cmake b/src/virtualkeyboard/.prev_configure.cmake
deleted file mode 100644
index 33c2be77..00000000
--- a/src/virtualkeyboard/.prev_configure.cmake
+++ /dev/null
@@ -1,373 +0,0 @@
-
-
-#### Inputs
-
-# input vkb-hunspell
-set(INPUT_vkb_hunspell "undefined" CACHE STRING "")
-set_property(CACHE INPUT_vkb_hunspell PROPERTY STRINGS undefined no 3rdparty system)
-
-
-
-#### Libraries
-
-qt_find_package(Hunspell PROVIDED_TARGETS Hunspell::Hunspell)
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
- qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)
-endif()
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
- qt_find_package(XCB COMPONENTS XFIXES PROVIDED_TARGETS XCB::XFIXES)
-endif()
-
-
-#### Tests
-
-
-
-#### Features
-
-qt_feature("vkb-record-trace-input" PUBLIC
- LABEL "Input trace recording"
- AUTODETECT false
-)
-qt_feature("vkb-arrow-keynavigation" PUBLIC
- LABEL "Key navigation"
- AUTODETECT false
-)
-qt_feature("vkb-desktop" PUBLIC
- LABEL "Desktop integration"
- CONDITION NOT cross_compile
-)
-qt_feature("vkb-xcb" PUBLIC
- LABEL "XCB integration"
- CONDITION TARGET XCB::XCB AND XCB_XFIXES_FOUND
-)
-qt_feature("vkb-layouts" PUBLIC
- LABEL "Built-in layouts"
-)
-qt_feature("vkb-no-builtin-style" PUBLIC
- LABEL "Disable builtin styles"
- AUTODETECT OFF
- ENABLE INPUT_vkb_style STREQUAL 'none'
-)
-qt_feature("vkb-retro-style" PUBLIC
- LABEL "Retro style as default"
- AUTODETECT OFF
- ENABLE INPUT_vkb_style STREQUAL 'retro'
-)
-qt_feature("vkb-default-style" PUBLIC
- LABEL "Default style"
- AUTODETECT ON
- CONDITION NOT QT_FEATURE_vkb_retro_style AND NOT QT_FEATURE_vkb_no_builtin_style
- ENABLE INPUT_vkb_style STREQUAL 'default'
-)
-qt_feature("vkb-sensitive-debug" PRIVATE
- LABEL "Sensitive Debug"
- AUTODETECT OFF
-)
-qt_feature("t9write-alphabetic" PRIVATE
- LABEL " Alphabetic"
- CONDITION VKB_HAVE_T9WRITE_ALPHA
-)
-qt_feature("t9write-cjk" PRIVATE
- LABEL " CJK"
- CONDITION VKB_HAVE_T9WRITE_CJK
-)
-qt_feature("t9write" PRIVATE
- LABEL "T9Write handwriting"
- CONDITION QT_FEATURE_t9write_alphabetic OR QT_FEATURE_t9write_cjk
- ENABLE INPUT_vkb_handwriting STREQUAL 't9write'
- DISABLE INPUT_vkb_handwriting STREQUAL 'no' OR INPUT_vkb_handwriting STREQUAL 'lipi'
-)
-qt_feature("lipi-toolkit" PRIVATE
- LABEL "Lipi handwriting"
- AUTODETECT OFF
- ENABLE INPUT_vkb_handwriting STREQUAL 'lipi'
- DISABLE INPUT_vkb_handwriting STREQUAL 'no' OR INPUT_vkb_handwriting STREQUAL 't9write'
-)
-qt_feature("system-hunspell" PRIVATE
- LABEL "System Hunspell"
- CONDITION Hunspell_FOUND
-)
-qt_feature("3rdparty-hunspell" PRIVATE
- LABEL " Using Hunspell copy from 3rdparty/"
- CONDITION VKB_HAVE_3RDPARTY_HUNSPELL
- DISABLE INPUT_vkb_hunspell STREQUAL 'no' OR INPUT_vkb_hunspell STREQUAL 'system'
-)
-qt_feature("hunspell" PRIVATE
- LABEL "Hunspell"
- CONDITION QT_FEATURE_3rdparty_hunspell OR QT_FEATURE_system_hunspell
-)
-qt_feature("openwnn" PRIVATE
- LABEL "OpenWnn"
- AUTODETECT ( NOT INPUT_lang_ja_JP STREQUAL 'no' )
-)
-qt_feature("vkb-myscript" PRIVATE
- LABEL "MyScript"
- AUTODETECT OFF
-)
-qt_feature("pinyin" PRIVATE
- LABEL "libpinyin"
- AUTODETECT ( NOT INPUT_lang_ch_CN STREQUAL 'no' )
-)
-qt_feature("tcime" PRIVATE
- LABEL "Traditional Chinese IME (tcime)"
- AUTODETECT ( NOT INPUT_lang_ch_TW STREQUAL 'no' )
- CONDITION QT_FEATURE_zhuyin OR QT_FEATURE_cangjie
-)
-qt_feature("zhuyin" PRIVATE
- LABEL "Zhuyin"
- AUTODETECT ( NOT INPUT_lang_zh_TW STREQUAL 'no' )
-)
-qt_feature("cangjie" PRIVATE
- LABEL "Cangjie"
- AUTODETECT ( NOT INPUT_lang_zh_TW STREQUAL 'no' )
-)
-qt_feature("hangul" PRIVATE
- LABEL "Hangul"
-)
-qt_feature("thai" PRIVATE
- LABEL "Thai"
-)
-qt_feature("vkb-lang-ar_AR" PRIVATE
- LABEL "Arabic"
- AUTODETECT ( NOT INPUT_lang_ar_AR STREQUAL 'no' )
-)
-qt_feature("vkb-lang-bg_BG" PRIVATE
- LABEL "Bulgarian"
- AUTODETECT ( NOT INPUT_lang_bg_BG STREQUAL 'no' )
-)
-qt_feature("vkb-lang-cs_CZ" PRIVATE
- LABEL "Czech"
- AUTODETECT ( NOT INPUT_lang_cs_CZ STREQUAL 'no' )
-)
-qt_feature("vkb-lang-da_DK" PRIVATE
- LABEL "Danish"
- AUTODETECT ( NOT INPUT_lang_da_DK STREQUAL 'no' )
-)
-qt_feature("vkb-lang-de_DE" PRIVATE
- LABEL "German"
- AUTODETECT ( NOT INPUT_lang_de_DE STREQUAL 'no' )
-)
-qt_feature("vkb-lang-el_GR" PRIVATE
- LABEL "Greek"
- AUTODETECT ( NOT INPUT_lang_el_GR STREQUAL 'no' )
-)
-qt_feature("vkb-lang-en_GB" PRIVATE
- LABEL "English GB"
- AUTODETECT ( NOT INPUT_lang_en_GB STREQUAL 'no' )
-)
-qt_feature("vkb-lang-en_US" PRIVATE
- LABEL "English US"
- AUTODETECT ( NOT INPUT_lang_en_US STREQUAL 'no' )
-)
-qt_feature("vkb-lang-es_ES" PRIVATE
- LABEL "Spanish"
- AUTODETECT ( NOT INPUT_lang_es_ES STREQUAL 'no' )
-)
-qt_feature("vkb-lang-es_MX" PRIVATE
- LABEL "Spanish Mexico"
- AUTODETECT ( NOT INPUT_lang_es_MX STREQUAL 'no' )
-)
-qt_feature("vkb-lang-et_EE" PRIVATE
- LABEL "Estonian"
- AUTODETECT ( NOT INPUT_lang_et_EE STREQUAL 'no' )
-)
-qt_feature("vkb-lang-fa_FA" PRIVATE
- LABEL "Farsi"
- AUTODETECT ( NOT INPUT_lang_fa_FA STREQUAL 'no' )
-)
-qt_feature("vkb-lang-fi_FI" PRIVATE
- LABEL "Finnish"
- AUTODETECT ( NOT INPUT_lang_fi_FI STREQUAL 'no' )
-)
-qt_feature("vkb-lang-fr_CA" PRIVATE
- LABEL "French Canada"
- AUTODETECT ( NOT INPUT_lang_fr_CA STREQUAL 'no' )
-)
-qt_feature("vkb-lang-fr_FR" PRIVATE
- LABEL "French France"
- AUTODETECT ( NOT INPUT_lang_fr_FR STREQUAL 'no' )
-)
-qt_feature("vkb-lang-he_IL" PRIVATE
- LABEL "Hebrew"
- AUTODETECT ( NOT INPUT_lang_he_IL STREQUAL 'no' )
-)
-qt_feature("vkb-lang-hi_IN" PRIVATE
- LABEL "Hindi"
- AUTODETECT ( NOT INPUT_lang_hi_IN STREQUAL 'no' )
-)
-qt_feature("vkb-lang-hr_HR" PRIVATE
- LABEL "Croatian"
- AUTODETECT ( NOT INPUT_lang_hr_HR STREQUAL 'no' )
-)
-qt_feature("vkb-lang-hu_HU" PRIVATE
- LABEL "Hungarian"
- AUTODETECT ( NOT INPUT_lang_hu_HU STREQUAL 'no' )
-)
-qt_feature("vkb-lang-id_ID" PRIVATE
- LABEL "Indonesian"
- AUTODETECT ( NOT INPUT_lang_id_ID STREQUAL 'no' )
-)
-qt_feature("vkb-lang-it_IT" PRIVATE
- LABEL "Italian"
- AUTODETECT ( NOT INPUT_lang_it_IT STREQUAL 'no' )
-)
-qt_feature("vkb-lang-ja_JP" PRIVATE
- LABEL "Japanese"
- CONDITION QT_FEATURE_openwnn
-)
-qt_feature("vkb-lang-ko_KR" PRIVATE
- LABEL "Korean"
- AUTODETECT ( NOT INPUT_lang_ko_KR STREQUAL 'no' )
-)
-qt_feature("vkb-lang-ms_MY" PRIVATE
- LABEL "Malay"
- AUTODETECT ( NOT INPUT_lang_ms_MY STREQUAL 'no' )
-)
-qt_feature("vkb-lang-nb_NO" PRIVATE
- LABEL "Norwegian"
- AUTODETECT ( NOT INPUT_lang_nb_NO STREQUAL 'no' )
-)
-qt_feature("vkb-lang-nl_NL" PRIVATE
- LABEL "Dutch"
- AUTODETECT ( NOT INPUT_lang_nl_NL STREQUAL 'no' )
-)
-qt_feature("vkb-lang-pl_PL" PRIVATE
- LABEL "Polish"
- AUTODETECT ( NOT INPUT_lang_pl_PL STREQUAL 'no' )
-)
-qt_feature("vkb-lang-pt_BR" PRIVATE
- LABEL "Portuguese Brazil"
- AUTODETECT ( NOT INPUT_lang_pt_BR STREQUAL 'no' )
-)
-qt_feature("vkb-lang-pt_PT" PRIVATE
- LABEL "Portuguese Portugal"
- AUTODETECT ( NOT INPUT_lang_pt_PT STREQUAL 'no' )
-)
-qt_feature("vkb-lang-ro_RO" PRIVATE
- LABEL "Romanian"
- AUTODETECT ( NOT INPUT_lang_ro_RO STREQUAL 'no' )
-)
-qt_feature("vkb-lang-ru_RU" PRIVATE
- LABEL "Russian"
- AUTODETECT ( NOT INPUT_lang_ru_RU STREQUAL 'no' )
-)
-qt_feature("vkb-lang-sk_SK" PRIVATE
- LABEL "Slovak"
- AUTODETECT ( NOT INPUT_lang_sk_SK STREQUAL 'no' )
-)
-qt_feature("vkb-lang-sl_SI" PRIVATE
- LABEL "Slovenian"
- AUTODETECT ( NOT INPUT_lang_sl_SI STREQUAL 'no' )
-)
-qt_feature("vkb-lang-sq_AL" PRIVATE
- LABEL "Albanian"
- AUTODETECT ( NOT INPUT_lang_sq_AL STREQUAL 'no' )
-)
-qt_feature("vkb-lang-sr_SP" PRIVATE
- LABEL "Serbian"
- AUTODETECT ( NOT INPUT_lang_sr_SP STREQUAL 'no' )
-)
-qt_feature("vkb-lang-sv_SE" PRIVATE
- LABEL "Swedish"
- AUTODETECT ( NOT INPUT_lang_sv_SE STREQUAL 'no' )
-)
-qt_feature("vkb-lang-th_TH" PRIVATE
- LABEL "Thai"
- CONDITION QT_FEATURE_thai
-)
-qt_feature("vkb-lang-tr_TR" PRIVATE
- LABEL "Turkish"
- AUTODETECT ( NOT INPUT_lang_tr_TR STREQUAL 'no' )
-)
-qt_feature("vkb-lang-uk_UA" PRIVATE
- LABEL "Ukrainian"
- AUTODETECT ( NOT INPUT_lang_uk_UA STREQUAL 'no' )
-)
-qt_feature("vkb-lang-vi_VN" PRIVATE
- LABEL "Vietnamese"
- AUTODETECT ( NOT INPUT_lang_vi_VN STREQUAL 'no' )
-)
-qt_feature("vkb-lang-zh_CN" PRIVATE
- LABEL "Simplified Chinese"
- AUTODETECT ( NOT INPUT_lang_zh_CN STREQUAL 'no' )
- CONDITION QT_FEATURE_pinyin
-)
-qt_feature("vkb-lang-zh_TW" PRIVATE
- LABEL "Traditional Chinese"
- AUTODETECT ( NOT INPUT_lang_zh_TW STREQUAL 'no' )
- CONDITION QT_FEATURE_tcime OR QT_FEATURE_zhuyin OR QT_FEATURE_cangjie
-)
-qt_configure_add_summary_section(NAME "Qt Virtualkeyboard")
-qt_configure_add_summary_entry(ARGS "vkb-desktop")
-qt_configure_add_summary_entry(ARGS "vkb-layouts")
-qt_configure_add_summary_entry(ARGS "vkb-arrow-keynavigation")
-qt_configure_add_summary_entry(ARGS "vkb-retro-style")
-qt_configure_add_summary_entry(ARGS "vkb-sensitive-debug")
-qt_configure_add_summary_entry(ARGS "t9write")
-qt_configure_add_summary_entry(ARGS "t9write-alphabetic")
-qt_configure_add_summary_entry(ARGS "t9write-cjk")
-qt_configure_add_summary_entry(ARGS "lipi-toolkit")
-qt_configure_add_summary_entry(ARGS "hunspell")
-qt_configure_add_summary_entry(ARGS "3rdparty-hunspell")
-qt_configure_add_summary_entry(ARGS "openwnn")
-qt_configure_add_summary_entry(ARGS "vkb-myscript")
-qt_configure_add_summary_section(NAME "Language support enabled for")
-qt_configure_add_summary_entry(ARGS "vkb-lang-ar_AR")
-qt_configure_add_summary_entry(ARGS "vkb-lang-bg_BG")
-qt_configure_add_summary_entry(ARGS "vkb-lang-cs_CZ")
-qt_configure_add_summary_entry(ARGS "vkb-lang-da_DK")
-qt_configure_add_summary_entry(ARGS "vkb-lang-de_DE")
-qt_configure_add_summary_entry(ARGS "vkb-lang-el_GR")
-qt_configure_add_summary_entry(ARGS "vkb-lang-en_GB")
-qt_configure_add_summary_entry(ARGS "vkb-lang-en_US")
-qt_configure_add_summary_entry(ARGS "vkb-lang-es_ES")
-qt_configure_add_summary_entry(ARGS "vkb-lang-es_MX")
-qt_configure_add_summary_entry(ARGS "vkb-lang-et_EE")
-qt_configure_add_summary_entry(ARGS "vkb-lang-fa_FA")
-qt_configure_add_summary_entry(ARGS "vkb-lang-fi_FI")
-qt_configure_add_summary_entry(ARGS "vkb-lang-fr_CA")
-qt_configure_add_summary_entry(ARGS "vkb-lang-fr_FR")
-qt_configure_add_summary_entry(ARGS "vkb-lang-he_IL")
-qt_configure_add_summary_entry(ARGS "vkb-lang-hi_IN")
-qt_configure_add_summary_entry(ARGS "vkb-lang-hr_HR")
-qt_configure_add_summary_entry(ARGS "vkb-lang-hu_HU")
-qt_configure_add_summary_entry(ARGS "vkb-lang-id_ID")
-qt_configure_add_summary_entry(ARGS "vkb-lang-it_IT")
-qt_configure_add_summary_entry(ARGS "vkb-lang-ja_JP")
-qt_configure_add_summary_entry(ARGS "vkb-lang-ko_KR")
-qt_configure_add_summary_entry(ARGS "vkb-lang-ms_MY")
-qt_configure_add_summary_entry(ARGS "vkb-lang-nb_NO")
-qt_configure_add_summary_entry(ARGS "vkb-lang-nl_NL")
-qt_configure_add_summary_entry(ARGS "vkb-lang-pl_PL")
-qt_configure_add_summary_entry(ARGS "vkb-lang-pt_BR")
-qt_configure_add_summary_entry(ARGS "vkb-lang-pt_PT")
-qt_configure_add_summary_entry(ARGS "vkb-lang-ro_RO")
-qt_configure_add_summary_entry(ARGS "vkb-lang-ru_RU")
-qt_configure_add_summary_entry(ARGS "vkb-lang-sk_SK")
-qt_configure_add_summary_entry(ARGS "vkb-lang-sl_SI")
-qt_configure_add_summary_entry(ARGS "vkb-lang-sq_AL")
-qt_configure_add_summary_entry(ARGS "vkb-lang-sr_SP")
-qt_configure_add_summary_entry(ARGS "vkb-lang-sv_SE")
-qt_configure_add_summary_entry(ARGS "vkb-lang-th_TH")
-qt_configure_add_summary_entry(ARGS "vkb-lang-tr_TR")
-qt_configure_add_summary_entry(ARGS "vkb-lang-uk_UA")
-qt_configure_add_summary_entry(ARGS "vkb-lang-vi_VN")
-qt_configure_add_summary_entry(ARGS "vkb-lang-zh_CN")
-qt_configure_add_summary_entry(ARGS "vkb-lang-zh_TW")
-qt_configure_end_summary_section() # end of "Language support enabled for" section
-qt_configure_add_summary_section(NAME "Traditional chinese input methods")
-qt_configure_add_summary_entry(ARGS "zhuyin")
-qt_configure_add_summary_entry(ARGS "cangjie")
-qt_configure_end_summary_section() # end of "Traditional chinese input methods" section
-qt_configure_end_summary_section() # end of "Qt Virtualkeyboard" section
-qt_configure_add_report_entry(
- TYPE ERROR
- MESSAGE "T9Write SDK could not be found. For more information, see the documentation in 'Building Qt Virtual Keyboard'."
- CONDITION INPUT_vkb_handwriting STREQUAL 't9write' AND NOT QT_FEATURE_t9write
-)
-qt_configure_add_report_entry(
- TYPE NOTE
- MESSAGE "Hunspell disabled. Spelling correction will not be available."
- CONDITION NOT QT_FEATURE_hunspell
-)
diff --git a/src/virtualkeyboard/CMakeLists.txt b/src/virtualkeyboard/CMakeLists.txt
index f8202119..a7ad047a 100644
--- a/src/virtualkeyboard/CMakeLists.txt
+++ b/src/virtualkeyboard/CMakeLists.txt
@@ -1,17 +1,34 @@
-# Generated from virtualkeyboard.pro.
-
-# special case begin
-set(VKB_LAYOUTS_BASE "${CMAKE_CURRENT_SOURCE_DIR}/.." CACHE STRING "" FORCE)
-set(VKB_LAYOUTS_PREFIX "/QtQuick/VirtualKeyboard" CACHE STRING "" FORCE)
-set(VKB_INSTALL_DATA = "${INSTALL_DATA}/qtvirtualkeyboard" CACHE STRING "" FORCE)
-# special case end
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## VirtualKeyboard Module:
+## QtQuick.VirtualKeyboard
#####################################################################
-qt_add_module(VirtualKeyboard
- PLUGIN_TYPES virtualkeyboard
+set(VKB_INSTALL_DATA "${QT_INSTALL_DIR}/qtvirtualkeyboard" CACHE STRING "" FORCE)
+
+set(qml_files
+ HandwritingInputPanel.qml
+ InputPanel.qml
+ EnterKey.qml ### Qt7: Remove, see QTBUG-102227
+)
+
+qt_internal_add_qml_module(VirtualKeyboard
+ URI "QtQuick.VirtualKeyboard"
+ VERSION "${PROJECT_VERSION}"
+ PAST_MAJOR_VERSIONS 2 1
+ PLUGIN_TARGET qtvkbplugin
+ DEPENDENCIES
+ QtQuick/auto
+ QtQuick.Window/auto
+ QtQuick.Layouts/auto
+ Qt.labs.folderlistmodel/auto
+ QtQuick.VirtualKeyboard.Settings/auto
+ QtQuick.VirtualKeyboard.Styles/auto
+ QtQuick.VirtualKeyboard.Plugins/auto
+ IMPORTS
+ QtQuick.VirtualKeyboard.Layouts/auto
+ QtQuick.VirtualKeyboard.Components/auto ### Qt7: Move to dependencies, see QTBUG-102227
SOURCES
abstractinputpanel.cpp abstractinputpanel_p.h
appinputpanel.cpp appinputpanel_p.h
@@ -24,27 +41,34 @@ qt_add_module(VirtualKeyboard
handwritinggesturerecognizer.cpp handwritinggesturerecognizer_p.h
inputmethod.cpp inputmethod_p.h
inputselectionhandle.cpp inputselectionhandle_p.h
+ virtualkeyboard.cpp virtualkeyboard_p.h
+ virtualkeyboardattachedtype.cpp virtualkeyboardattachedtype_p.h
plaininputmethod.cpp plaininputmethod_p.h
platforminputcontext.cpp platforminputcontext_p.h
qvirtualkeyboard_global.h qvirtualkeyboard_global_p.h
- qvirtualkeyboard_staticplugin_p.h
+ qvirtualkeyboard_namespace.h
qvirtualkeyboardabstractinputmethod.cpp qvirtualkeyboardabstractinputmethod.h
- qvirtualkeyboardextensionplugin.cpp qvirtualkeyboardextensionplugin.h
+ qvirtualkeyboardabstractinputmethod_p.cpp qvirtualkeyboardabstractinputmethod_p.h
+ qvirtualkeyboarddictionary.cpp qvirtualkeyboarddictionary.h
+ qvirtualkeyboarddictionarymanager.cpp qvirtualkeyboarddictionarymanager.h
+ qvirtualkeyboardfeatures_namespace_p.h
qvirtualkeyboardinputcontext.cpp qvirtualkeyboardinputcontext.h qvirtualkeyboardinputcontext_p.cpp qvirtualkeyboardinputcontext_p.h
qvirtualkeyboardinputengine.cpp qvirtualkeyboardinputengine.h
+ qvirtualkeyboardnamespace_p.h
+ qvirtualkeyboardobserver.cpp qvirtualkeyboardobserver.h
qvirtualkeyboardselectionlistmodel.cpp qvirtualkeyboardselectionlistmodel.h
qvirtualkeyboardtrace.cpp qvirtualkeyboardtrace.h
settings.cpp settings_p.h
shadowinputcontext.cpp shadowinputcontext_p.h
shifthandler.cpp shifthandler_p.h
virtualkeyboarddebug_p.h
- virtualkeyboardsettings.cpp virtualkeyboardsettings_p.h
+ QML_FILES
+ ${qml_files}
DEFINES
QT_ASCII_CAST_WARNINGS
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_FROM_BYTEARRAY
QT_NO_CAST_TO_ASCII
- QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR=\\\"qrc:/QtQuick/VirtualKeyboard/content/layouts\\\"
QVIRTUALKEYBOARD_LIBRARY
LIBRARIES
Qt::CorePrivate
@@ -59,602 +83,7 @@ qt_add_module(VirtualKeyboard
Qt::GuiPrivate
)
-# Resources:
-set(virtualkeyboard_content_resource_files
- "HandwritingInputPanel.qml"
- "InputPanel.qml"
- "components/AlternativeKeys.qml"
- "components/BackspaceKey.qml"
- "components/BaseKey.qml"
- "components/ChangeLanguageKey.qml"
- "components/CharacterPreviewBubble.qml"
- "components/EnterKey.qml"
- "components/FillerKey.qml"
- "components/HandwritingModeKey.qml"
- "components/HideKeyboardKey.qml"
- "components/InputModeKey.qml"
- "components/Key.qml"
- "components/Keyboard.qml"
- "components/KeyboardColumn.qml"
- "components/KeyboardLayout.qml"
- "components/KeyboardLayoutLoader.qml"
- "components/KeyboardRow.qml"
- "components/ModeKey.qml"
- "components/MultiSoundEffect.qml"
- "components/MultitapInputMethod.qml"
- "components/NumberKey.qml"
- "components/PopupList.qml"
- "components/SelectionControl.qml"
- "components/ShadowInputControl.qml"
- "components/ShiftKey.qml"
- "components/SpaceKey.qml"
- "components/SymbolModeKey.qml"
- "components/TraceInputArea.qml"
- "components/TraceInputKey.qml"
- "components/WordCandidatePopupList.qml"
-)
-
-qt_add_resource(VirtualKeyboard "virtualkeyboard_content"
- PREFIX
- "/QtQuick/VirtualKeyboard/content"
- BASE
- "content"
- FILES
- ${virtualkeyboard_content_resource_files}
-)
-
-
-#### Keys ignored in scope 1:.:.:virtualkeyboard.pro:<TRUE>:
-# LAYOUT_FILES = "content/layouts/fallback/dialpad.qml" "content/layouts/fallback/digits.qml" "content/layouts/fallback/numbers.qml" "content/layouts/fallback/main.qml" "content/layouts/fallback/symbols.qml"
-# MODULE = "virtualkeyboard"
-# OTHER_FILES = "$$PWD/qtvirtualkeyboard.qdocconf" "$$PWD/src/qtvirtualkeyboard-index.qdoc" "$$PWD/src/deployment-guide.qdoc" "$$PWD/src/technical-guide.qdoc" "$$PWD/src/user-guide.qdoc" "$$PWD/src/build.qdoc" "$$PWD/src/snippets/CustomInputMethod.qml" "content/styles/default/*.qml" "content/styles/retro/*.qml" "content/*.qml" "content/components/*.qml" "qtvirtualkeyboard.json" "$$LAYOUT_FILES"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_sensitive_debug
- PUBLIC_DEFINES
- SENSITIVE_DEBUG
-)
-
-if(NOT no-builtin-style)
- # Resources:
- set(virtualkeyboard_default_style_resource_files
- "images/backspace-868482.svg"
- "images/check-868482.svg"
- "images/enter-868482.svg"
- "images/globe-868482.svg"
- "images/handwriting-868482.svg"
- "images/hidekeyboard-868482.svg"
- "images/search-868482.svg"
- "images/selectionhandle-bottom.svg"
- "images/shift-80c342.svg"
- "images/shift-868482.svg"
- "images/shift-c5d6b6.svg"
- "images/textmode-868482.svg"
- "style.qml"
- )
-
- qt_add_resource(VirtualKeyboard "virtualkeyboard_default_style"
- PREFIX
- "/QtQuick/VirtualKeyboard/content/styles/default"
- BASE
- "content/styles/default"
- FILES
- ${virtualkeyboard_default_style_resource_files}
- )
- set(virtualkeyboard_retro_style_resource_files
- "images/backspace-c5a96f.svg"
- "images/check-c5a96f.svg"
- "images/enter-c5a96f.svg"
- "images/globe-110b05.svg"
- "images/handwriting-110b05.svg"
- "images/hidekeyboard-c5a96f.svg"
- "images/key154px_black.png"
- "images/key154px_black_long.png"
- "images/key154px_capslock.png"
- "images/key154px_capslock_long.png"
- "images/key154px_colorA.png"
- "images/key154px_colorA.svg"
- "images/key154px_colorA_long.png"
- "images/key154px_colorB.png"
- "images/key154px_shiftcase.png"
- "images/key154px_shiftcase_long.png"
- "images/key156px_black_long.png"
- "images/key156px_black_medium_long.png"
- "images/key156px_colorA.png"
- "images/key156px_colorB.png"
- "images/key160px_black.png"
- "images/key160px_colorA.png"
- "images/key160px_colorB.png"
- "images/key_preview.png"
- "images/search-c5a96f.svg"
- "images/selectionhandle-bottom.svg"
- "images/shift-c5a96f.svg"
- "images/shift-cd8865.svg"
- "images/shift-dc4f28.svg"
- "images/textmode-110b05.svg"
- "images/triangle_black.png"
- "images/triangle_highlight.png"
- "style.qml"
- )
-
- qt_add_resource(VirtualKeyboard "virtualkeyboard_retro_style"
- PREFIX
- "/QtQuick/VirtualKeyboard/content/styles/retro"
- BASE
- "content/styles/retro"
- FILES
- ${virtualkeyboard_retro_style_resource_files}
- )
-endif()
-
-# special case begin
-
-set(LAYOUT_FILES)
-if (FEATURE_vkb_lang_en_GB)
- list(APPEND LAYOUT_FILES
- content/layouts/en_GB/dialpad.fallback
- content/layouts/en_GB/digits.fallback
- content/layouts/en_GB/main.fallback
- content/layouts/en_GB/numbers.fallback
- content/layouts/en_GB/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_en_US)
- list(APPEND LAYOUT_FILES
- content/layouts/en_US/dialpad.fallback
- content/layouts/en_US/digits.fallback
- content/layouts/en_US/main.fallback
- content/layouts/en_US/numbers.fallback
- content/layouts/en_US/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_ar_AR)
- list(APPEND LAYOUT_FILES
- content/layouts/ar_AR/dialpad.fallback
- content/layouts/ar_AR/digits.qml
- content/layouts/ar_AR/main.qml
- content/layouts/ar_AR/numbers.qml
- content/layouts/ar_AR/symbols.qml
- )
-endif()
-if(FEATURE_vkb_lang_bg_BG)
- list(APPEND LAYOUT_FILES
- content/layouts/bg_BG/dialpad.fallback
- content/layouts/bg_BG/digits.fallback
- content/layouts/bg_BG/main.qml
- content/layouts/bg_BG/numbers.fallback
- content/layouts/bg_BG/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_cs_CZ)
- list(APPEND LAYOUT_FILES
- content/layouts/cs_CZ/dialpad.fallback
- content/layouts/cs_CZ/digits.fallback
- content/layouts/cs_CZ/main.qml
- content/layouts/cs_CZ/numbers.fallback
- content/layouts/cs_CZ/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_da_DK)
- list(APPEND LAYOUT_FILES
- content/layouts/da_DK/dialpad.fallback
- content/layouts/da_DK/digits.fallback
- content/layouts/da_DK/main.qml
- content/layouts/da_DK/numbers.fallback
- content/layouts/da_DK/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_de_DE)
- list(APPEND LAYOUT_FILES
- content/layouts/de_DE/dialpad.fallback
- content/layouts/de_DE/digits.fallback
- content/layouts/de_DE/main.qml
- content/layouts/de_DE/numbers.fallback
- content/layouts/de_DE/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_el_GR)
- list(APPEND LAYOUT_FILES
- content/layouts/el_GR/dialpad.fallback
- content/layouts/el_GR/digits.fallback
- content/layouts/el_GR/main.qml
- content/layouts/el_GR/numbers.fallback
- content/layouts/el_GR/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_es_ES)
- list(APPEND LAYOUT_FILES
- content/layouts/es_ES/dialpad.fallback
- content/layouts/es_ES/digits.fallback
- content/layouts/es_ES/main.qml
- content/layouts/es_ES/numbers.fallback
- content/layouts/es_ES/symbols.qml
- )
-endif()
-if(FEATURE_vkb_lang_es_MX)
- list(APPEND LAYOUT_FILES
- content/layouts/es_MX/dialpad.fallback
- content/layouts/es_MX/digits.fallback
- content/layouts/es_MX/main.qml
- content/layouts/es_MX/numbers.fallback
- content/layouts/es_MX/symbols.qml
- )
-endif()
-if(FEATURE_vkb_lang_et_EE)
- list(APPEND LAYOUT_FILES
- content/layouts/et_EE/dialpad.fallback
- content/layouts/et_EE/digits.fallback
- content/layouts/et_EE/main.qml
- content/layouts/et_EE/numbers.fallback
- content/layouts/et_EE/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_fa_FA)
- list(APPEND LAYOUT_FILES
- content/layouts/fa_FA/dialpad.fallback
- content/layouts/fa_FA/digits.qml
- content/layouts/fa_FA/main.qml
- content/layouts/fa_FA/numbers.qml
- content/layouts/fa_FA/symbols.qml
- )
-endif()
-if(FEATURE_vkb_lang_fi_FI)
- list(APPEND LAYOUT_FILES
- content/layouts/fi_FI/dialpad.fallback
- content/layouts/fi_FI/digits.fallback
- content/layouts/fi_FI/main.qml
- content/layouts/fi_FI/numbers.fallback
- content/layouts/fi_FI/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_fr_CA)
- list(APPEND LAYOUT_FILES
- content/layouts/fr_CA/dialpad.fallback
- content/layouts/fr_CA/digits.fallback
- content/layouts/fr_CA/main.qml
- content/layouts/fr_CA/numbers.fallback
- content/layouts/fr_CA/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_fr_FR)
- list(APPEND LAYOUT_FILES
- content/layouts/fr_FR/dialpad.fallback
- content/layouts/fr_FR/digits.fallback
- content/layouts/fr_FR/main.qml
- content/layouts/fr_FR/numbers.fallback
- content/layouts/fr_FR/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_he_IL)
- list(APPEND LAYOUT_FILES
- content/layouts/he_IL/dialpad.fallback
- content/layouts/he_IL/digits.fallback
- content/layouts/he_IL/main.qml
- content/layouts/he_IL/numbers.fallback
- content/layouts/he_IL/symbols.qml
- )
-endif()
-if(FEATURE_vkb_lang_hi_IN)
- list(APPEND LAYOUT_FILES
- content/layouts/hi_IN/dialpad.fallback
- content/layouts/hi_IN/digits.fallback
- content/layouts/hi_IN/main.qml
- content/layouts/hi_IN/numbers.fallback
- content/layouts/hi_IN/symbols.qml
- )
-endif()
-if(FEATURE_vkb_lang_hr_HR)
- list(APPEND LAYOUT_FILES
- content/layouts/hr_HR/dialpad.fallback
- content/layouts/hr_HR/digits.fallback
- content/layouts/hr_HR/main.qml
- content/layouts/hr_HR/numbers.fallback
- content/layouts/hr_HR/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_hu_HU)
- list(APPEND LAYOUT_FILES
- content/layouts/hu_HU/dialpad.fallback
- content/layouts/hu_HU/digits.fallback
- content/layouts/hu_HU/main.qml
- content/layouts/hu_HU/numbers.fallback
- content/layouts/hu_HU/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_id_ID)
- list(APPEND LAYOUT_FILES
- content/layouts/id_ID/dialpad.fallback
- content/layouts/id_ID/digits.fallback
- content/layouts/id_ID/main.fallback
- content/layouts/id_ID/numbers.fallback
- content/layouts/id_ID/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_it_IT)
- list(APPEND LAYOUT_FILES
- content/layouts/it_IT/dialpad.fallback
- content/layouts/it_IT/digits.fallback
- content/layouts/it_IT/main.qml
- content/layouts/it_IT/numbers.fallback
- content/layouts/it_IT/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_nb_NO)
- list(APPEND LAYOUT_FILES
- content/layouts/nb_NO/dialpad.fallback
- content/layouts/nb_NO/digits.fallback
- content/layouts/nb_NO/main.qml
- content/layouts/nb_NO/numbers.fallback
- content/layouts/nb_NO/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_ms_MY)
- list(APPEND LAYOUT_FILES
- content/layouts/ms_MY/dialpad.fallback
- content/layouts/ms_MY/digits.fallback
- content/layouts/ms_MY/main.fallback
- content/layouts/ms_MY/numbers.fallback
- content/layouts/ms_MY/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_nl_NL)
- list(APPEND LAYOUT_FILES
- content/layouts/nl_NL/dialpad.fallback
- content/layouts/nl_NL/digits.fallback
- content/layouts/nl_NL/main.fallback
- content/layouts/nl_NL/numbers.fallback
- content/layouts/nl_NL/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_pl_PL)
- list(APPEND LAYOUT_FILES
- content/layouts/pl_PL/dialpad.fallback
- content/layouts/pl_PL/digits.fallback
- content/layouts/pl_PL/main.qml
- content/layouts/pl_PL/numbers.fallback
- content/layouts/pl_PL/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_pt_BR)
- list(APPEND LAYOUT_FILES
- content/layouts/pt_BR/dialpad.fallback
- content/layouts/pt_BR/digits.fallback
- content/layouts/pt_BR/main.qml
- content/layouts/pt_BR/numbers.fallback
- content/layouts/pt_BR/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_pt_PT)
- list(APPEND LAYOUT_FILES
- content/layouts/pt_PT/dialpad.fallback
- content/layouts/pt_PT/digits.fallback
- content/layouts/pt_PT/main.qml
- content/layouts/pt_PT/numbers.fallback
- content/layouts/pt_PT/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_ro_RO)
- list(APPEND LAYOUT_FILES
- content/layouts/ro_RO/dialpad.fallback
- content/layouts/ro_RO/digits.fallback
- content/layouts/ro_RO/main.qml
- content/layouts/ro_RO/numbers.fallback
- content/layouts/ro_RO/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_ru_RU)
- list(APPEND LAYOUT_FILES
- content/layouts/ru_RU/dialpad.fallback
- content/layouts/ru_RU/digits.fallback
- content/layouts/ru_RU/main.qml
- content/layouts/ru_RU/numbers.fallback
- content/layouts/ru_RU/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_sk_SK)
- list(APPEND LAYOUT_FILES
- content/layouts/sk_SK/dialpad.fallback
- content/layouts/sk_SK/digits.fallback
- content/layouts/sk_SK/main.qml
- content/layouts/sk_SK/numbers.fallback
- content/layouts/sk_SK/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_sl_SI)
- list(APPEND LAYOUT_FILES
- content/layouts/sl_SI/dialpad.fallback
- content/layouts/sl_SI/digits.fallback
- content/layouts/sl_SI/main.qml
- content/layouts/sl_SI/numbers.fallback
- content/layouts/sl_SI/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_sq_AL)
- list(APPEND LAYOUT_FILES
- content/layouts/sq_AL/dialpad.fallback
- content/layouts/sq_AL/digits.fallback
- content/layouts/sq_AL/main.qml
- content/layouts/sq_AL/numbers.fallback
- content/layouts/sq_AL/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_sr_SP)
- list(APPEND LAYOUT_FILES
- content/layouts/sr_SP/dialpad.fallback
- content/layouts/sr_SP/digits.fallback
- content/layouts/sr_SP/main.qml
- content/layouts/sr_SP/numbers.fallback
- content/layouts/sr_SP/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_sv_SE)
- list(APPEND LAYOUT_FILES
- content/layouts/sv_SE/dialpad.fallback
- content/layouts/sv_SE/digits.fallback
- content/layouts/sv_SE/main.qml
- content/layouts/sv_SE/numbers.fallback
- content/layouts/sv_SE/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_tr_TR)
- list(APPEND LAYOUT_FILES
- content/layouts/tr_TR/dialpad.fallback
- content/layouts/tr_TR/digits.fallback
- content/layouts/tr_TR/main.qml
- content/layouts/tr_TR/numbers.fallback
- content/layouts/tr_TR/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_uk_UA)
- list(APPEND LAYOUT_FILES
- content/layouts/uk_UA/dialpad.fallback
- content/layouts/uk_UA/digits.fallback
- content/layouts/uk_UA/main.qml
- content/layouts/uk_UA/numbers.fallback
- content/layouts/uk_UA/symbols.fallback
- )
-endif()
-if(FEATURE_vkb_lang_vi_VN)
- list(APPEND LAYOUT_FILES
- content/layouts/vi_VN/dialpad.fallback
- content/layouts/vi_VN/digits.fallback
- content/layouts/vi_VN/main.qml
- content/layouts/vi_VN/numbers.fallback
- content/layouts/vi_VN/symbols.qml
- )
-endif()
-
-# special case end
-
-#### Keys ignored in scope 4:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_en_GB:
-# LAYOUT_FILES = "content/layouts/en_GB/dialpad.fallback" "content/layouts/en_GB/digits.fallback" "content/layouts/en_GB/main.fallback" "content/layouts/en_GB/numbers.fallback" "content/layouts/en_GB/symbols.fallback"
-
-#### Keys ignored in scope 5:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_en_US:
-# LAYOUT_FILES = "content/layouts/en_US/dialpad.fallback" "content/layouts/en_US/digits.fallback" "content/layouts/en_US/main.fallback" "content/layouts/en_US/numbers.fallback" "content/layouts/en_US/symbols.fallback"
-
-#### Keys ignored in scope 6:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ar_AR:
-# LAYOUT_FILES = "content/layouts/ar_AR/dialpad.fallback" "content/layouts/ar_AR/digits.qml" "content/layouts/ar_AR/main.qml" "content/layouts/ar_AR/numbers.qml" "content/layouts/ar_AR/symbols.qml"
-
-#### Keys ignored in scope 7:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_bg_BG:
-# LAYOUT_FILES = "content/layouts/bg_BG/dialpad.fallback" "content/layouts/bg_BG/digits.fallback" "content/layouts/bg_BG/main.qml" "content/layouts/bg_BG/numbers.fallback" "content/layouts/bg_BG/symbols.fallback"
-
-#### Keys ignored in scope 8:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_cs_CZ:
-# LAYOUT_FILES = "content/layouts/cs_CZ/dialpad.fallback" "content/layouts/cs_CZ/digits.fallback" "content/layouts/cs_CZ/main.qml" "content/layouts/cs_CZ/numbers.fallback" "content/layouts/cs_CZ/symbols.fallback"
-
-#### Keys ignored in scope 9:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_da_DK:
-# LAYOUT_FILES = "content/layouts/da_DK/dialpad.fallback" "content/layouts/da_DK/digits.fallback" "content/layouts/da_DK/main.qml" "content/layouts/da_DK/numbers.fallback" "content/layouts/da_DK/symbols.fallback"
-
-#### Keys ignored in scope 10:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_de_DE:
-# LAYOUT_FILES = "content/layouts/de_DE/dialpad.fallback" "content/layouts/de_DE/digits.fallback" "content/layouts/de_DE/main.qml" "content/layouts/de_DE/numbers.fallback" "content/layouts/de_DE/symbols.fallback"
-
-#### Keys ignored in scope 11:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_el_GR:
-# LAYOUT_FILES = "content/layouts/el_GR/dialpad.fallback" "content/layouts/el_GR/digits.fallback" "content/layouts/el_GR/main.qml" "content/layouts/el_GR/numbers.fallback" "content/layouts/el_GR/symbols.fallback"
-
-#### Keys ignored in scope 12:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_es_ES:
-# LAYOUT_FILES = "content/layouts/es_ES/dialpad.fallback" "content/layouts/es_ES/digits.fallback" "content/layouts/es_ES/main.qml" "content/layouts/es_ES/numbers.fallback" "content/layouts/es_ES/symbols.qml"
-
-#### Keys ignored in scope 13:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_es_MX:
-# LAYOUT_FILES = "content/layouts/es_MX/dialpad.fallback" "content/layouts/es_MX/digits.fallback" "content/layouts/es_MX/main.qml" "content/layouts/es_MX/numbers.fallback" "content/layouts/es_MX/symbols.qml"
-
-#### Keys ignored in scope 14:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_et_EE:
-# LAYOUT_FILES = "content/layouts/et_EE/dialpad.fallback" "content/layouts/et_EE/digits.fallback" "content/layouts/et_EE/main.qml" "content/layouts/et_EE/numbers.fallback" "content/layouts/et_EE/symbols.fallback"
-
-#### Keys ignored in scope 15:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fa_FA:
-# LAYOUT_FILES = "content/layouts/fa_FA/dialpad.fallback" "content/layouts/fa_FA/digits.qml" "content/layouts/fa_FA/main.qml" "content/layouts/fa_FA/numbers.qml" "content/layouts/fa_FA/symbols.qml"
-
-#### Keys ignored in scope 16:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fi_FI:
-# LAYOUT_FILES = "content/layouts/fi_FI/dialpad.fallback" "content/layouts/fi_FI/digits.fallback" "content/layouts/fi_FI/main.qml" "content/layouts/fi_FI/numbers.fallback" "content/layouts/fi_FI/symbols.fallback"
-
-#### Keys ignored in scope 17:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fr_CA:
-# LAYOUT_FILES = "content/layouts/fr_CA/dialpad.fallback" "content/layouts/fr_CA/digits.fallback" "content/layouts/fr_CA/main.qml" "content/layouts/fr_CA/numbers.fallback" "content/layouts/fr_CA/symbols.fallback"
-
-#### Keys ignored in scope 18:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_fr_FR:
-# LAYOUT_FILES = "content/layouts/fr_FR/dialpad.fallback" "content/layouts/fr_FR/digits.fallback" "content/layouts/fr_FR/main.qml" "content/layouts/fr_FR/numbers.fallback" "content/layouts/fr_FR/symbols.fallback"
-
-#### Keys ignored in scope 19:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_he_IL:
-# LAYOUT_FILES = "content/layouts/he_IL/dialpad.fallback" "content/layouts/he_IL/digits.fallback" "content/layouts/he_IL/main.qml" "content/layouts/he_IL/numbers.fallback" "content/layouts/he_IL/symbols.qml"
-
-#### Keys ignored in scope 20:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_hi_IN:
-# LAYOUT_FILES = "content/layouts/hi_IN/dialpad.fallback" "content/layouts/hi_IN/digits.fallback" "content/layouts/hi_IN/main.qml" "content/layouts/hi_IN/numbers.fallback" "content/layouts/hi_IN/symbols.qml"
-
-#### Keys ignored in scope 21:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_hr_HR:
-# LAYOUT_FILES = "content/layouts/hr_HR/dialpad.fallback" "content/layouts/hr_HR/digits.fallback" "content/layouts/hr_HR/main.qml" "content/layouts/hr_HR/numbers.fallback" "content/layouts/hr_HR/symbols.fallback"
-
-#### Keys ignored in scope 22:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_hu_HU:
-# LAYOUT_FILES = "content/layouts/hu_HU/dialpad.fallback" "content/layouts/hu_HU/digits.fallback" "content/layouts/hu_HU/main.qml" "content/layouts/hu_HU/numbers.fallback" "content/layouts/hu_HU/symbols.fallback"
-
-#### Keys ignored in scope 23:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_id_ID:
-# LAYOUT_FILES = "content/layouts/id_ID/dialpad.fallback" "content/layouts/id_ID/digits.fallback" "content/layouts/id_ID/main.fallback" "content/layouts/id_ID/numbers.fallback" "content/layouts/id_ID/symbols.fallback"
-
-#### Keys ignored in scope 24:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_it_IT:
-# LAYOUT_FILES = "content/layouts/it_IT/dialpad.fallback" "content/layouts/it_IT/digits.fallback" "content/layouts/it_IT/main.qml" "content/layouts/it_IT/numbers.fallback" "content/layouts/it_IT/symbols.fallback"
-
-#### Keys ignored in scope 25:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_nb_NO:
-# LAYOUT_FILES = "content/layouts/nb_NO/dialpad.fallback" "content/layouts/nb_NO/digits.fallback" "content/layouts/nb_NO/main.qml" "content/layouts/nb_NO/numbers.fallback" "content/layouts/nb_NO/symbols.fallback"
-
-#### Keys ignored in scope 26:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ms_MY:
-# LAYOUT_FILES = "content/layouts/ms_MY/dialpad.fallback" "content/layouts/ms_MY/digits.fallback" "content/layouts/ms_MY/main.fallback" "content/layouts/ms_MY/numbers.fallback" "content/layouts/ms_MY/symbols.fallback"
-
-#### Keys ignored in scope 27:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_nl_NL:
-# LAYOUT_FILES = "content/layouts/nl_NL/dialpad.fallback" "content/layouts/nl_NL/digits.fallback" "content/layouts/nl_NL/main.fallback" "content/layouts/nl_NL/numbers.fallback" "content/layouts/nl_NL/symbols.fallback"
-
-#### Keys ignored in scope 28:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_pl_PL:
-# LAYOUT_FILES = "content/layouts/pl_PL/dialpad.fallback" "content/layouts/pl_PL/digits.fallback" "content/layouts/pl_PL/main.qml" "content/layouts/pl_PL/numbers.fallback" "content/layouts/pl_PL/symbols.fallback"
-
-#### Keys ignored in scope 29:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_pt_BR:
-# LAYOUT_FILES = "content/layouts/pt_BR/dialpad.fallback" "content/layouts/pt_BR/digits.fallback" "content/layouts/pt_BR/main.qml" "content/layouts/pt_BR/numbers.fallback" "content/layouts/pt_BR/symbols.fallback"
-
-#### Keys ignored in scope 30:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_pt_PT:
-# LAYOUT_FILES = "content/layouts/pt_PT/dialpad.fallback" "content/layouts/pt_PT/digits.fallback" "content/layouts/pt_PT/main.qml" "content/layouts/pt_PT/numbers.fallback" "content/layouts/pt_PT/symbols.fallback"
-
-#### Keys ignored in scope 31:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ro_RO:
-# LAYOUT_FILES = "content/layouts/ro_RO/dialpad.fallback" "content/layouts/ro_RO/digits.fallback" "content/layouts/ro_RO/main.qml" "content/layouts/ro_RO/numbers.fallback" "content/layouts/ro_RO/symbols.fallback"
-
-#### Keys ignored in scope 32:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_ru_RU:
-# LAYOUT_FILES = "content/layouts/ru_RU/dialpad.fallback" "content/layouts/ru_RU/digits.fallback" "content/layouts/ru_RU/main.qml" "content/layouts/ru_RU/numbers.fallback" "content/layouts/ru_RU/symbols.fallback"
-
-#### Keys ignored in scope 33:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sk_SK:
-# LAYOUT_FILES = "content/layouts/sk_SK/dialpad.fallback" "content/layouts/sk_SK/digits.fallback" "content/layouts/sk_SK/main.qml" "content/layouts/sk_SK/numbers.fallback" "content/layouts/sk_SK/symbols.fallback"
-
-#### Keys ignored in scope 34:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sl_SI:
-# LAYOUT_FILES = "content/layouts/sl_SI/dialpad.fallback" "content/layouts/sl_SI/digits.fallback" "content/layouts/sl_SI/main.qml" "content/layouts/sl_SI/numbers.fallback" "content/layouts/sl_SI/symbols.fallback"
-
-#### Keys ignored in scope 35:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sq_AL:
-# LAYOUT_FILES = "content/layouts/sq_AL/dialpad.fallback" "content/layouts/sq_AL/digits.fallback" "content/layouts/sq_AL/main.qml" "content/layouts/sq_AL/numbers.fallback" "content/layouts/sq_AL/symbols.fallback"
-
-#### Keys ignored in scope 36:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sr_SP:
-# LAYOUT_FILES = "content/layouts/sr_SP/dialpad.fallback" "content/layouts/sr_SP/digits.fallback" "content/layouts/sr_SP/main.qml" "content/layouts/sr_SP/numbers.fallback" "content/layouts/sr_SP/symbols.fallback"
-
-#### Keys ignored in scope 37:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_sv_SE:
-# LAYOUT_FILES = "content/layouts/sv_SE/dialpad.fallback" "content/layouts/sv_SE/digits.fallback" "content/layouts/sv_SE/main.qml" "content/layouts/sv_SE/numbers.fallback" "content/layouts/sv_SE/symbols.fallback"
-
-#### Keys ignored in scope 38:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_tr_TR:
-# LAYOUT_FILES = "content/layouts/tr_TR/dialpad.fallback" "content/layouts/tr_TR/digits.fallback" "content/layouts/tr_TR/main.qml" "content/layouts/tr_TR/numbers.fallback" "content/layouts/tr_TR/symbols.fallback"
-
-#### Keys ignored in scope 39:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_uk_UA:
-# LAYOUT_FILES = "content/layouts/uk_UA/dialpad.fallback" "content/layouts/uk_UA/digits.fallback" "content/layouts/uk_UA/main.qml" "content/layouts/uk_UA/numbers.fallback" "content/layouts/uk_UA/symbols.fallback"
-
-#### Keys ignored in scope 40:.:.:virtualkeyboard.pro:QT_FEATURE_vkb_lang_vi_VN:
-# LAYOUT_FILES = "content/layouts/vi_VN/dialpad.fallback" "content/layouts/vi_VN/digits.fallback" "content/layouts/vi_VN/main.qml" "content/layouts/vi_VN/numbers.fallback" "content/layouts/vi_VN/symbols.qml"
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_no_builtin_style
- DEFINES
- QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"\\\"
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_retro_style AND NOT QT_FEATURE_vkb_no_builtin_style
- DEFINES
- QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"retro\\\"
-)
-
-qt_extend_target(VirtualKeyboard CONDITION NOT QT_FEATURE_vkb_no_builtin_style AND NOT QT_FEATURE_vkb_retro_style
- DEFINES
- QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"default\\\"
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_desktop
+qt_internal_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_desktop
SOURCES
desktopinputpanel.cpp desktopinputpanel_p.h
inputview.cpp inputview_p.h
@@ -662,42 +91,18 @@ qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_desktop
QT_VIRTUALKEYBOARD_DESKTOP
)
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_desktop AND QT_FEATURE_vkb_xcb
- PUBLIC_LIBRARIES
- XCB::XFIXES
-)
-
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_record_trace_input
+qt_internal_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_record_trace_input
SOURCES
unipentrace.cpp unipentrace_p.h
PUBLIC_DEFINES
QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
)
-qt_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_arrow_keynavigation
+qt_internal_extend_target(VirtualKeyboard CONDITION QT_FEATURE_vkb_arrow_keynavigation
DEFINES
QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
)
-if(QT_FEATURE_vkb_layouts)
- # Resources:
- set(qmake_virtualkeyboard_layouts_resource_files
- "content/layouts/fallback/dialpad.qml"
- "content/layouts/fallback/digits.qml"
- "content/layouts/fallback/main.qml"
- "content/layouts/fallback/numbers.qml"
- "content/layouts/fallback/symbols.qml"
- )
-
- qt_add_resource(VirtualKeyboard "qmake_virtualkeyboard_layouts"
- PREFIX
- "${VKB_LAYOUTS_PREFIX}" #special case
- FILES
- ${qmake_virtualkeyboard_layouts_resource_files}
- ${LAYOUT_FILES} # special case
- )
-endif()
-qt_add_docs(VirtualKeyboard
+qt_internal_add_docs(VirtualKeyboard
doc/qtvirtualkeyboard.qdocconf
)
-
diff --git a/src/virtualkeyboard/EnterKey.qml b/src/virtualkeyboard/EnterKey.qml
new file mode 100644
index 00000000..94da4e28
--- /dev/null
+++ b/src/virtualkeyboard/EnterKey.qml
@@ -0,0 +1,8 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick.VirtualKeyboard.Components as C
+
+// Qt7: Remove, see QTBUG-102227
+
+C.EnterKey {}
diff --git a/src/virtualkeyboard/HandwritingInputPanel.qml b/src/virtualkeyboard/HandwritingInputPanel.qml
new file mode 100644
index 00000000..8cfb6703
--- /dev/null
+++ b/src/virtualkeyboard/HandwritingInputPanel.qml
@@ -0,0 +1,122 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
+import QtQml
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+/*!
+ \qmltype HandwritingInputPanel
+ \inqmlmodule QtQuick.VirtualKeyboard
+ \since QtQuick.VirtualKeyboard 2.0
+
+ \brief Provides a handwriting panel add-on for the virtual keyboard UI.
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-qml
+
+ The HandwritingInputPanel is an add-on component for the InputPanel, which
+ enables full-screen handwriting input for the application.
+
+ HandwritingInputPanel is designed to be anchored full screen alongside
+ the InputPanel. The operating principle is that when the handwriting panel
+ is "available", the InputPanel is invisible. This functionality is built-in,
+ and requires no more than a reference to the InputPanel instance.
+
+ The panel is set into operation by setting the \l {HandwritingInputPanel::}{available}
+ property to \c true. When the panel is in operation, the keyboard remains hidden
+ when the input focus is set. When \c available is \c true, handwriting input is
+ activated by setting the \l {HandwritingInputPanel::}{active} property to \c true.
+
+ The user interface, which provides controls for handwriting mode and the
+ visibility of the keyboard, is application-specific. One suggested implementation
+ is to use a floating button on the handwriting panel, where single click toggles
+ the handwriting mode (changes the \l {HandwritingInputPanel::}{active} property), and double-click toggles
+ the visibility of the keyboard (changes the \l {HandwritingInputPanel::}{available} property).
+
+ HandwritingInputPanel also provides a word candidate popup which allows the user
+ to select an alternative word candidate from the list of suggestions generated
+ by the handwriting input method.
+*/
+
+Item {
+ id: handwritingInputPanel
+
+ /*! A reference to the input panel instance.
+
+ This property must be set to the existing input panel instance.
+ */
+ property var inputPanel
+
+ /*! This property controls the availability status of the handwriting input method.
+
+ Setting the property to \c true prepares the handwriting input method and inhibits
+ the display of keyboard.
+ */
+ property bool available
+
+ /*! This property controls the active status of the handwriting input method.
+
+ Setting the property to \c true activates the handwriting input method. When the
+ handwriting input method is active, all touch input is captured by the
+ handwriting input panel and redirected to input engine for processing.
+ */
+ property bool active
+
+ state: enabled && available ? (active ? "active" : "available") : "unavailable"
+ enabled: inputPanel.keyboard.isHandwritingAvailable()
+ visible: enabled && available && active && Qt.inputMethod.visible
+
+ LayoutMirroring.enabled: false
+ LayoutMirroring.childrenInherit: true
+
+ Item {
+ id: keyboard
+ property var style: inputPanel && inputPanel.hasOwnProperty ? inputPanel.keyboard.style : null
+ property var soundEffect: inputPanel && inputPanel.hasOwnProperty ? inputPanel.keyboard.soundEffect : null
+ }
+
+ onEnabledChanged: inputPanel.keyboard.fullScreenHandwritingMode = enabled && available
+ onAvailableChanged: inputPanel.keyboard.fullScreenHandwritingMode = enabled && available
+
+ TraceInputArea {
+ id: hwrInputArea
+ enabled: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
+ objectName: "hwrInputArea"
+ anchors.fill: parent
+ patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
+ canvasType: "fullscreen"
+ }
+
+ Binding {
+ target: InputContext.priv
+ property: "keyboardRectangle"
+ value: Qt.rect(hwrInputArea.x, hwrInputArea.y, hwrInputArea.width, hwrInputArea.height)
+ when: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
+ restoreMode: Binding.RestoreBinding
+ }
+
+ Binding {
+ target: inputPanel ? inputPanel.keyboard : null
+ property: "active"
+ value: false
+ when: handwritingInputPanel.enabled && handwritingInputPanel.available
+ restoreMode: Binding.RestoreBinding
+ }
+
+ WordCandidatePopupList {
+ id: wordCandidatePopupList
+ z: 1
+ objectName: "wordCandidatePopupList"
+ enabled: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
+ }
+
+ Loader {
+ sourceComponent: keyboard.style.popupListBackground
+ anchors.fill: wordCandidatePopupList
+ z: -1
+ visible: wordCandidatePopupList.visible
+ }
+}
diff --git a/src/virtualkeyboard/InputPanel.qml b/src/virtualkeyboard/InputPanel.qml
new file mode 100644
index 00000000..676cee67
--- /dev/null
+++ b/src/virtualkeyboard/InputPanel.qml
@@ -0,0 +1,141 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
+import QtQml
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
+
+/*!
+ \qmltype InputPanel
+ \inqmlmodule QtQuick.VirtualKeyboard
+
+ \brief Provides the virtual keyboard UI.
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-qml
+
+ The keyboard size is automatically calculated from the available
+ width; that is, the keyboard maintains the aspect ratio specified by the current
+ style. Therefore the application should only set the \l {Item::}{width} and \l {Item::}{y}
+ coordinates of the InputPanel, and not the \l {Item::}{height}.
+
+ As with \l {Qt Virtual Keyboard QML Types}{all other QML types} provided by
+ the module, the \c QT_IM_MODULE environment variable must be set to
+ \c qtvirtualkeyboard before using InputPanel. For more information, see
+ \l {Loading the Plugin}.
+
+ \note You can have only one InputPanel instance in your application. The panel
+ will not be blocked by modal dialogs, but it can be obscured by items with a higher
+ \l {Item::}{z} value.
+*/
+
+Item {
+ id: inputPanel
+
+ /*!
+ \qmlproperty bool InputPanel::active
+ \since QtQuick.VirtualKeyboard 2.0
+
+ This property reflects the active status of the input panel.
+ The keyboard should be made visible to the user when this property is
+ \c true.
+ */
+ property alias active: keyboard.active
+
+ /*!
+ \qmlproperty bool InputPanel::externalLanguageSwitchEnabled
+ \since QtQuick.VirtualKeyboard 2.4
+
+ This property enables the external language switch mechanism.
+ When this property is \c true, the virtual keyboard will not show
+ the built-in language popup, but will emit the \l externalLanguageSwitch
+ signal instead. The application can handle this signal and show a
+ custom language selection dialog instead.
+ */
+ property bool externalLanguageSwitchEnabled
+
+ /*!
+ \qmlsignal InputPanel::externalLanguageSwitch(var localeList, int currentIndex)
+ \since QtQuick.VirtualKeyboard 2.4
+
+ This signal is emitted when \l externalLanguageSwitchEnabled is \c true
+ and the \l {user-guide-language}{language switch key} is pressed by the user.
+
+ It serves as a hook to display a custom language dialog instead of
+ the built-in language popup in the virtual keyboard.
+
+ The \a localeList parameter contains a list of locale names to choose
+ from. To get more information about a particular language, use the
+ \l[QtQml]{Qt::locale()}{Qt.locale()} function. The \a currentIndex
+ is the index of current locale in the \a localeList. This item should
+ be highlighted as the current item in the UI.
+
+ To select a new language, use the \l {VirtualKeyboardSettings::locale}
+ {VirtualKeyboardSettings.locale} property.
+
+ Below is an example that demonstrates a custom language dialog implementation:
+
+ \snippet qtvirtualkeyboard-custom-language-popup.qml popup
+
+ The dialog would then be declared:
+
+ \snippet qtvirtualkeyboard-custom-language-popup.qml declaring
+
+ In the application's InputPanel, add the following code:
+
+ \snippet qtvirtualkeyboard-custom-language-popup.qml using
+
+ The custom dialog will now be shown when the language switch key is pressed.
+ */
+ signal externalLanguageSwitch(var localeList, int currentIndex)
+
+ /*! \internal */
+ property alias keyboard: keyboard
+
+ /*! \internal */
+ property bool desktopPanel: false
+
+ /*! \internal */
+ property point screenPos: desktopPanel ? Qt.point(keyboard.x, keyboard.y) : Qt.point(x, y)
+
+ SelectionControl {
+ objectName: "selectionControl"
+ x: -parent.x
+ y: -parent.y
+ enabled: active && !keyboard.fullScreenMode && !desktopPanel
+ }
+
+ implicitHeight: keyboard.height - keyboard.wordCandidateView.currentYOffset
+ Keyboard {
+ id: keyboard
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+ MouseArea {
+ z: -1
+ anchors.fill: keyboard
+ enabled: active
+ }
+
+ Binding {
+ target: InputContext.priv
+ property: "keyboardRectangle"
+ value: keyboardRectangle()
+ when: !InputContext.animating
+ restoreMode: Binding.RestoreBinding
+ }
+
+ /*! \internal */
+ function keyboardRectangle() {
+ var rect = Qt.rect(0, 0, keyboard.width, keyboard.height)
+ const screenPosX = screenPos.x
+ const screenPosY = screenPos.y
+ if (desktopPanel) {
+ rect.x += screenPosX
+ rect.y += screenPosY
+ }
+ return mapToItem(null, rect)
+ }
+}
diff --git a/src/virtualkeyboard/abstractinputpanel.cpp b/src/virtualkeyboard/abstractinputpanel.cpp
index 79b17edc..53614547 100644
--- a/src/virtualkeyboard/abstractinputpanel.cpp
+++ b/src/virtualkeyboard/abstractinputpanel.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/abstractinputpanel_p.h>
#include <QtCore/QRect>
diff --git a/src/virtualkeyboard/abstractinputpanel_p.h b/src/virtualkeyboard/abstractinputpanel_p.h
index 08a19fc6..439b6bad 100644
--- a/src/virtualkeyboard/abstractinputpanel_p.h
+++ b/src/virtualkeyboard/abstractinputpanel_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ABSTRACTINPUTPANEL_P_H
#define ABSTRACTINPUTPANEL_P_H
@@ -43,11 +17,12 @@
#include <QObject>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT AbstractInputPanel : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT AbstractInputPanel : public QObject
{
Q_OBJECT
protected:
diff --git a/src/virtualkeyboard/appinputpanel.cpp b/src/virtualkeyboard/appinputpanel.cpp
index 95987fb2..78f7fed7 100644
--- a/src/virtualkeyboard/appinputpanel.cpp
+++ b/src/virtualkeyboard/appinputpanel.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/appinputpanel_p.h>
#include <QtVirtualKeyboard/private/appinputpanel_p_p.h>
diff --git a/src/virtualkeyboard/appinputpanel_p.h b/src/virtualkeyboard/appinputpanel_p.h
index 8ff0e659..62adc5a0 100644
--- a/src/virtualkeyboard/appinputpanel_p.h
+++ b/src/virtualkeyboard/appinputpanel_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef APPINPUTPANEL_P_H
#define APPINPUTPANEL_P_H
@@ -53,7 +27,7 @@ class AppInputPanelPrivate;
\internal
*/
-class QVIRTUALKEYBOARD_EXPORT AppInputPanel : public AbstractInputPanel
+class Q_VIRTUALKEYBOARD_EXPORT AppInputPanel : public AbstractInputPanel
{
Q_OBJECT
Q_DECLARE_PRIVATE(AppInputPanel)
diff --git a/src/virtualkeyboard/appinputpanel_p_p.h b/src/virtualkeyboard/appinputpanel_p_p.h
index f41c9b72..c96eb520 100644
--- a/src/virtualkeyboard/appinputpanel_p_p.h
+++ b/src/virtualkeyboard/appinputpanel_p_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef APPINPUTPANEL_P_P_H
#define APPINPUTPANEL_P_P_H
@@ -52,7 +26,7 @@ namespace QtVirtualKeyboard {
\internal
*/
-class QVIRTUALKEYBOARD_EXPORT AppInputPanelPrivate : public QObjectPrivate
+class Q_VIRTUALKEYBOARD_EXPORT AppInputPanelPrivate : public QObjectPrivate
{
public:
AppInputPanelPrivate() :
diff --git a/src/virtualkeyboard/configure.cmake b/src/virtualkeyboard/configure.cmake
index 6b26718c..35ee23de 100644
--- a/src/virtualkeyboard/configure.cmake
+++ b/src/virtualkeyboard/configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#### Inputs
@@ -6,23 +9,21 @@
set(INPUT_vkb_hunspell "undefined" CACHE STRING "")
set_property(CACHE INPUT_vkb_hunspell PROPERTY STRINGS undefined no 3rdparty system)
+# input vkb-cerence-sdk
+set(INPUT_vkb_cerence_sdk "" CACHE PATH "")
#### Libraries
-qt_find_package(Hunspell PROVIDED_TARGETS Hunspell::Hunspell)
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS AND NOT TARGET XCB::XCB) # special case
- qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)
-endif()
-if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS AND NOT TARGET XCB::XFIXES) # special case
- qt_find_package(XCB COMPONENTS XFIXES PROVIDED_TARGETS XCB::XFIXES)
-endif()
-
+qt_find_package(Hunspell PROVIDED_TARGETS Hunspell::Hunspell MODULE_NAME virtualkeyboard QMAKE_LIB hunspell)
+qt_find_package(CerenceHwrAlphabetic PROVIDED_TARGETS Cerence::HWR::Alphabetic MODULE_NAME virtualkeyboard QMAKE_LIB t9write-ucr)
+qt_find_package(CerenceHwrCjk PROVIDED_TARGETS Cerence::HWR::CJK MODULE_NAME virtualkeyboard QMAKE_LIB t9write-cjk)
+qt_find_package(CerenceXt9 PROVIDED_TARGETS Cerence::XT9 MODULE_NAME virtualkeyboard QMAKE_LIB xt9-acktn)
+qt_find_package(MyScript PROVIDED_TARGETS MyScript::VOIM MODULE_NAME virtualkeyboard QMAKE_LIB voim)
#### Tests
-
#### Features
qt_feature("vkb-record-trace-input" PUBLIC
@@ -35,11 +36,7 @@ qt_feature("vkb-arrow-keynavigation" PUBLIC
)
qt_feature("vkb-desktop" PUBLIC
LABEL "Desktop integration"
- CONDITION NOT cross_compile
-)
-qt_feature("vkb-xcb" PUBLIC
- LABEL "XCB integration"
- CONDITION TARGET XCB::XCB AND XCB_XFIXES_FOUND
+ CONDITION NOT ANDROID
)
qt_feature("vkb-layouts" PUBLIC
LABEL "Built-in layouts"
@@ -64,25 +61,59 @@ qt_feature("vkb-sensitive-debug" PRIVATE
LABEL "Sensitive Debug"
AUTODETECT OFF
)
-qt_feature("t9write-alphabetic" PRIVATE
- LABEL " Alphabetic"
- CONDITION VKB_HAVE_T9WRITE_ALPHA
+qt_feature("cerence-sdk" PRIVATE
+ LABEL "Cerence"
+ AUTODETECT CERENCE_HWR_ALPHABETIC_FOUND OR CERENCE_XT9_FOUND
+)
+qt_feature("cerence-hwr" PRIVATE
+ LABEL " Handwriting"
+ CONDITION QT_FEATURE_cerence_hwr_alphabetic OR QT_FEATURE_cerence_hwr_cjk
+ ENABLE INPUT_vkb_handwriting STREQUAL 'cerence-hwr'
+ DISABLE NOT INPUT_vkb_handwriting STREQUAL '' AND NOT INPUT_vkb_handwriting STREQUAL 'cerence-hwr'
+)
+qt_feature("cerence-hwr-alphabetic" PRIVATE
+ LABEL " Alphabetic"
+ CONDITION QT_FEATURE_cerence_sdk
+ ENABLE INPUT_vkb_handwriting STREQUAL 'cerence-hwr'
+ DISABLE NOT INPUT_vkb_handwriting STREQUAL '' AND NOT INPUT_vkb_handwriting STREQUAL 'cerence-hwr'
+ AUTODETECT CERENCE_HWR_ALPHABETIC_FOUND
+)
+qt_feature("cerence-hwr-cjk" PRIVATE
+ LABEL " CJK"
+ CONDITION QT_FEATURE_cerence_sdk
+ ENABLE INPUT_vkb_handwriting STREQUAL 'cerence-hwr'
+ DISABLE NOT INPUT_vkb_handwriting STREQUAL '' AND NOT INPUT_vkb_handwriting STREQUAL 'cerence-hwr'
+ AUTODETECT CERENCE_HWR_CJK_FOUND
+)
+qt_feature("vkb-bundle-cerence" PUBLIC
+ LABEL " Bundle resources"
+ AUTODETECT OFF
+)
+qt_feature("vkb-bundle-cerence-hwr" PUBLIC
+ LABEL " Handwriting"
+ AUTODETECT OFF
+ ENABLE FEATURE_vkb_bundle_cerence
+)
+qt_feature("vkb-bundle-cerence-xt9" PUBLIC
+ LABEL " XT9"
+ AUTODETECT OFF
+ ENABLE FEATURE_vkb_bundle_cerence
)
-qt_feature("t9write-cjk" PRIVATE
- LABEL " CJK"
- CONDITION VKB_HAVE_T9WRITE_CJK
+qt_feature("cerence-xt9" PRIVATE
+ LABEL " XT9"
+ CONDITION CERENCE_XT9_FOUND
)
-qt_feature("t9write" PRIVATE
- LABEL "T9Write handwriting"
- CONDITION QT_FEATURE_t9write_alphabetic OR QT_FEATURE_t9write_cjk
- ENABLE INPUT_vkb_handwriting STREQUAL 't9write'
- DISABLE INPUT_vkb_handwriting STREQUAL 'no' OR INPUT_vkb_handwriting STREQUAL 'lipi'
+qt_feature("vkb-cerence-xt9-debug" PUBLIC
+ LABEL " XT9 Debug"
+ AUTODETECT OFF
+)
+qt_feature("vkb-cerence-xt9-9key-layouts" PUBLIC
+ LABEL " XT9 9-key layouts"
+ AUTODETECT OFF
)
-qt_feature("lipi-toolkit" PRIVATE
- LABEL "Lipi handwriting"
+qt_feature("vkb-cerence-static" PUBLIC
+ LABEL " Static Linking"
AUTODETECT OFF
- ENABLE INPUT_vkb_handwriting STREQUAL 'lipi'
- DISABLE INPUT_vkb_handwriting STREQUAL 'no' OR INPUT_vkb_handwriting STREQUAL 't9write'
)
qt_feature("system-hunspell" PRIVATE
LABEL "System Hunspell"
@@ -96,37 +127,65 @@ qt_feature("3rdparty-hunspell" PRIVATE
qt_feature("hunspell" PRIVATE
LABEL "Hunspell"
CONDITION QT_FEATURE_3rdparty_hunspell OR QT_FEATURE_system_hunspell
+ DISABLE QT_FEATURE_cerence_xt9
)
qt_feature("openwnn" PRIVATE
LABEL "OpenWnn"
AUTODETECT ( NOT INPUT_lang_ja_JP STREQUAL 'no' )
+ DISABLE QT_FEATURE_cerence_xt9
)
-qt_feature("vkb-myscript" PRIVATE
+qt_feature("myscript" PRIVATE
LABEL "MyScript"
- AUTODETECT OFF
+ CONDITION MyScript_FOUND
+ ENABLE INPUT_vkb_handwriting STREQUAL 'myscript-hwr'
+ DISABLE NOT INPUT_vkb_handwriting STREQUAL '' AND NOT INPUT_vkb_handwriting STREQUAL 'myscript-hwr'
)
qt_feature("pinyin" PRIVATE
LABEL "libpinyin"
AUTODETECT ( NOT INPUT_lang_ch_CN STREQUAL 'no' )
+ CONDITION QT_FEATURE_thread
+ DISABLE QT_FEATURE_cerence_xt9
+)
+qt_feature("vkb-no-bundle-pinyin" PRIVATE
+ LABEL "Disable resource bundle for the pinyin"
+ AUTODETECT OFF
)
qt_feature("tcime" PRIVATE
LABEL "Traditional Chinese IME (tcime)"
AUTODETECT ( NOT INPUT_lang_ch_TW STREQUAL 'no' )
CONDITION QT_FEATURE_zhuyin OR QT_FEATURE_cangjie
+ DISABLE QT_FEATURE_cerence_xt9
+)
+qt_feature("vkb-no-bundle-tcime" PRIVATE
+ LABEL "Disable resource bundle for the tcime"
+ AUTODETECT OFF
)
qt_feature("zhuyin" PRIVATE
LABEL "Zhuyin"
AUTODETECT ( NOT INPUT_lang_zh_TW STREQUAL 'no' )
+ DISABLE QT_FEATURE_cerence_xt9
)
qt_feature("cangjie" PRIVATE
LABEL "Cangjie"
AUTODETECT ( NOT INPUT_lang_zh_TW STREQUAL 'no' )
+ DISABLE QT_FEATURE_cerence_xt9
)
qt_feature("hangul" PRIVATE
LABEL "Hangul"
+ AUTODETECT ( NOT INPUT_lang_ko_KR STREQUAL 'no' )
+ DISABLE QT_FEATURE_cerence_xt9
)
qt_feature("thai" PRIVATE
LABEL "Thai"
+ AUTODETECT ( NOT INPUT_lang_th_TH STREQUAL 'no' )
+ DISABLE QT_FEATURE_cerence_xt9
+)
+qt_feature("example-hwr" PRIVATE
+ LABEL "Example HWR"
+ ENABLE INPUT_vkb_handwriting STREQUAL 'example-hwr'
+ AUTODETECT ( FALSE )
+ DISABLE NOT INPUT_vkb_handwriting STREQUAL '' AND NOT INPUT_vkb_handwriting STREQUAL 'example-hwr'
+ PURPOSE "Generates random characters in response to handwriting input. For development and demonstration purposes only."
)
qt_feature("vkb-lang-ar_AR" PRIVATE
LABEL "Arabic"
@@ -214,7 +273,7 @@ qt_feature("vkb-lang-it_IT" PRIVATE
)
qt_feature("vkb-lang-ja_JP" PRIVATE
LABEL "Japanese"
- CONDITION QT_FEATURE_openwnn
+ CONDITION QT_FEATURE_openwnn OR QT_FEATURE_cerence_xt9
)
qt_feature("vkb-lang-ko_KR" PRIVATE
LABEL "Korean"
@@ -274,7 +333,7 @@ qt_feature("vkb-lang-sv_SE" PRIVATE
)
qt_feature("vkb-lang-th_TH" PRIVATE
LABEL "Thai"
- CONDITION QT_FEATURE_thai
+ CONDITION QT_FEATURE_thai OR QT_FEATURE_cerence_xt9
)
qt_feature("vkb-lang-tr_TR" PRIVATE
LABEL "Turkish"
@@ -291,12 +350,17 @@ qt_feature("vkb-lang-vi_VN" PRIVATE
qt_feature("vkb-lang-zh_CN" PRIVATE
LABEL "Simplified Chinese"
AUTODETECT ( NOT INPUT_lang_zh_CN STREQUAL 'no' )
- CONDITION QT_FEATURE_pinyin
+ CONDITION QT_FEATURE_pinyin OR QT_FEATURE_cerence_xt9
)
qt_feature("vkb-lang-zh_TW" PRIVATE
LABEL "Traditional Chinese"
AUTODETECT ( NOT INPUT_lang_zh_TW STREQUAL 'no' )
- CONDITION QT_FEATURE_tcime OR QT_FEATURE_zhuyin OR QT_FEATURE_cangjie
+ CONDITION QT_FEATURE_tcime OR QT_FEATURE_zhuyin OR QT_FEATURE_cangjie OR QT_FEATURE_cerence_xt9
+)
+qt_feature("vkb-lang-zh_HK" PRIVATE
+ LABEL "HongKong Chinese"
+ AUTODETECT ( NOT INPUT_lang_zh_HK STREQUAL 'no' )
+ CONDITION QT_FEATURE_cerence_xt9
)
qt_configure_add_summary_section(NAME "Qt Virtualkeyboard")
qt_configure_add_summary_entry(ARGS "vkb-desktop")
@@ -304,14 +368,22 @@ qt_configure_add_summary_entry(ARGS "vkb-layouts")
qt_configure_add_summary_entry(ARGS "vkb-arrow-keynavigation")
qt_configure_add_summary_entry(ARGS "vkb-retro-style")
qt_configure_add_summary_entry(ARGS "vkb-sensitive-debug")
-qt_configure_add_summary_entry(ARGS "t9write")
-qt_configure_add_summary_entry(ARGS "t9write-alphabetic")
-qt_configure_add_summary_entry(ARGS "t9write-cjk")
-qt_configure_add_summary_entry(ARGS "lipi-toolkit")
+qt_configure_add_summary_entry(ARGS "cerence-sdk")
+qt_configure_add_summary_entry(ARGS "vkb-cerence-static")
+qt_configure_add_summary_entry(ARGS "cerence-hwr")
+qt_configure_add_summary_entry(ARGS "cerence-hwr-alphabetic")
+qt_configure_add_summary_entry(ARGS "cerence-hwr-cjk")
+qt_configure_add_summary_entry(ARGS "cerence-xt9")
+qt_configure_add_summary_entry(ARGS "vkb-cerence-xt9-debug")
+qt_configure_add_summary_entry(ARGS "vkb-cerence-xt9-9key-layouts")
+qt_configure_add_summary_entry(ARGS "vkb-bundle-cerence")
+qt_configure_add_summary_entry(ARGS "vkb-bundle-cerence-hwr")
+qt_configure_add_summary_entry(ARGS "vkb-bundle-cerence-xt9")
qt_configure_add_summary_entry(ARGS "hunspell")
qt_configure_add_summary_entry(ARGS "3rdparty-hunspell")
qt_configure_add_summary_entry(ARGS "openwnn")
-qt_configure_add_summary_entry(ARGS "vkb-myscript")
+qt_configure_add_summary_entry(ARGS "myscript")
+qt_configure_add_summary_entry(ARGS "example-hwr")
qt_configure_add_summary_section(NAME "Language support enabled for")
qt_configure_add_summary_entry(ARGS "vkb-lang-ar_AR")
qt_configure_add_summary_entry(ARGS "vkb-lang-bg_BG")
@@ -355,6 +427,7 @@ qt_configure_add_summary_entry(ARGS "vkb-lang-uk_UA")
qt_configure_add_summary_entry(ARGS "vkb-lang-vi_VN")
qt_configure_add_summary_entry(ARGS "vkb-lang-zh_CN")
qt_configure_add_summary_entry(ARGS "vkb-lang-zh_TW")
+qt_configure_add_summary_entry(ARGS "vkb-lang-zh_HK")
qt_configure_end_summary_section() # end of "Language support enabled for" section
qt_configure_add_summary_section(NAME "Traditional chinese input methods")
qt_configure_add_summary_entry(ARGS "zhuyin")
@@ -363,11 +436,16 @@ qt_configure_end_summary_section() # end of "Traditional chinese input methods"
qt_configure_end_summary_section() # end of "Qt Virtualkeyboard" section
qt_configure_add_report_entry(
TYPE ERROR
- MESSAGE "T9Write SDK could not be found. For more information, see the documentation in 'Building Qt Virtual Keyboard'."
- CONDITION INPUT_vkb_handwriting STREQUAL 't9write' AND NOT QT_FEATURE_t9write
+ MESSAGE "MyScript SDK could not be found. For more information, see the documentation in 'Building Qt Virtual Keyboard'."
+ CONDITION INPUT_vkb_handwriting STREQUAL 'myscript-hwr' AND NOT QT_FEATURE_myscript
+)
+qt_configure_add_report_entry(
+ TYPE ERROR
+ MESSAGE "Cerence HWR SDK could not be found. For more information, see the documentation in 'Building Qt Virtual Keyboard'."
+ CONDITION INPUT_vkb_handwriting STREQUAL 'cerence-hwr' AND NOT QT_FEATURE_cerence_hwr
)
qt_configure_add_report_entry(
TYPE NOTE
- MESSAGE "Hunspell disabled. Spelling correction will not be available."
+ MESSAGE "Hunspell in Qt Virtual Keyboard is not enabled. Spelling correction will not be available."
CONDITION NOT QT_FEATURE_hunspell
)
diff --git a/src/virtualkeyboard/configure.json b/src/virtualkeyboard/configure.json
deleted file mode 100644
index cdaed556..00000000
--- a/src/virtualkeyboard/configure.json
+++ /dev/null
@@ -1,497 +0,0 @@
-{
- "module": "virtualkeyboard",
- "testDir": "../../config.tests",
-
- "commandline": {
- "options": {
- "vkb-sensitive-debug": "boolean",
- "vkb-arrow-keynavigation": "boolean",
- "vkb-enable": { "type": "enableLang" },
- "vkb-disable": { "type": "disableLang" },
- "vkb-desktop": "boolean",
- "vkb-cangjie": { "type": "boolean", "value": "cangjie" },
- "vkb-zhuyin": { "type": "boolean", "value": "zhuyin" },
- "vkb-hunspell": { "type": "enum", "values": [ "no", "3rdparty", "system" ] },
- "vkb-handwriting": { "type": "optionalString", "values": [ "yes", "no", "t9write", "lipi" ] },
- "vkb-style": { "type": "string", "values": [ "standard", "retro" , "none"] }
- }
- },
-
- "libraries": {
- "hunspell": {
- "label": "Hunspell",
- "test": "hunspell",
- "sources": [
- { "type": "pkgConfig", "args": "hunspell" },
- { "includedir": "/usr/include/hunspell", "libs": "-lhunspell-1.3" }
- ]
- },
- "xcb": {
- "label": "XCB",
- "headers": "xcb/xcb.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb" },
- "-lxcb"
- ]
- },
- "xcb-xfixes": {
- "label": "XCB Xfixes",
- "headers": "xcb/xfixes.h",
- "sources": [
- { "type": "pkgConfig", "args": "xcb-xfixes" },
- "-lxcb-xfixes"
- ],
- "use": "xcb"
- }
- },
-
- "tests": {
- "3rdparty-hunspell": {
- "label": "Hunspell copy under 3rdparty/",
- "type": "3rdpartyHunspell"
- },
- "t9write-alphabetic": {
- "label" : "T9Write Alphabetic Support",
- "type" : "t9write-alphabetic"
- },
- "t9write-cjk": {
- "label" : "T9Write CJK Support",
- "type" : "t9write-cjk"
- }
- },
-
- "features": {
- "vkb-record-trace-input": {
- "label": "Input trace recording",
- "autoDetect": "false",
- "output": [ "publicFeature" ]
- },
- "vkb-arrow-keynavigation": {
- "label": "Key navigation",
- "autoDetect": "false",
- "output": [ "publicFeature" ]
- },
- "vkb-desktop": {
- "label": "Desktop integration",
- "condition": "!config.cross_compile",
- "output": [ "publicFeature" ]
- },
- "vkb-xcb": {
- "label": "XCB integration",
- "condition": "libs.xcb && libs.xcb-xfixes",
- "output": [ "publicFeature" ]
- },
- "vkb-layouts": {
- "label": "Built-in layouts",
- "output": [ "publicFeature" ]
- },
- "vkb-no-builtin-style": {
- "label": "Disable builtin styles",
- "autoDetect": false,
- "enable": "input.vkb-style == 'none'",
- "output": [ "publicFeature" ]
- },
- "vkb-retro-style": {
- "label": "Retro style as default",
- "autoDetect": false,
- "enable": "input.vkb-style == 'retro'",
- "output": [ "publicFeature" ]
- },
- "vkb-default-style": {
- "label": "Default style",
- "autoDetect": true,
- "condition": "!features.vkb-retro-style && !features.vkb-no-builtin-style",
- "enable": "input.vkb-style == 'default'",
- "output": [ "publicFeature" ]
- },
- "vkb-sensitive-debug": {
- "label": "Sensitive Debug",
- "autoDetect": false,
- "output": [ "privateFeature" ]
- },
-
- "t9write-alphabetic": {
- "label": " Alphabetic",
- "condition": "tests.t9write-alphabetic",
- "output": [ "privateFeature" ]
- },
- "t9write-cjk": {
- "label": " CJK",
- "condition": "tests.t9write-cjk",
- "output": [ "privateFeature" ]
- },
- "t9write": {
- "label": "T9Write handwriting",
- "enable": "input.vkb-handwriting == 't9write'",
- "disable": "input.vkb-handwriting == 'no' || input.vkb-handwriting == 'lipi'",
- "condition": "features.t9write-alphabetic || features.t9write-cjk",
- "output": [ "privateFeature" ]
- },
- "lipi-toolkit": {
- "label": "Lipi handwriting",
- "autoDetect": false,
- "enable": "input.vkb-handwriting == 'lipi'",
- "disable": "input.vkb-handwriting == 'no' || input.vkb-handwriting == 't9write'",
- "output": [ "privateFeature" ]
- },
- "system-hunspell": {
- "label": "System Hunspell",
- "condition": "libs.hunspell",
- "output": [ "privateFeature" ]
- },
- "3rdparty-hunspell": {
- "label": " Using Hunspell copy from 3rdparty/",
- "disable": "input.vkb-hunspell == 'no' || input.vkb-hunspell == 'system'",
- "condition": "tests.3rdparty-hunspell",
- "output": [ "privateFeature" ]
- },
- "hunspell": {
- "label": "Hunspell",
- "condition": "features.3rdparty-hunspell || features.system-hunspell",
- "output": [ "privateFeature" ]
- },
- "openwnn": {
- "label": "OpenWnn",
- "autoDetect": "input.lang-ja_JP != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-myscript": {
- "label": "MyScript",
- "autoDetect": false,
- "output": [ "privateFeature" ]
- },
- "pinyin": {
- "label": "libpinyin",
- "autoDetect": "input.lang-ch_CN != 'no'",
- "output": [ "privateFeature" ]
- },
- "tcime": {
- "label": "Traditional Chinese IME (tcime)",
- "autoDetect": "input.lang-ch_TW != 'no'",
- "condition": "features.zhuyin || features.cangjie",
- "output": [ "privateFeature" ]
- },
- "zhuyin": {
- "label": "Zhuyin",
- "autoDetect": "input.lang-zh_TW != 'no'",
- "output": [ "privateFeature" ]
- },
- "cangjie": {
- "label": "Cangjie",
- "autoDetect": "input.lang-zh_TW != 'no'",
- "output": [ "privateFeature" ]
- },
- "hangul": {
- "label": "Hangul",
- "autoDectect": "input.lang-ko_KR != 'no'",
- "output": [ "privateFeature" ]
- },
- "thai": {
- "label": "Thai",
- "autoDectect": "input.lang-th_TH != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-ar_AR": {
- "label": "Arabic",
- "autoDetect": "input.lang-ar_AR != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-bg_BG": {
- "label": "Bulgarian",
- "autoDetect": "input.lang-bg_BG != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-cs_CZ": {
- "label": "Czech",
- "autoDetect": "input.lang-cs_CZ != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-da_DK": {
- "label": "Danish",
- "autoDetect": "input.lang-da_DK != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-de_DE": {
- "label": "German",
- "autoDetect": "input.lang-de_DE != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-el_GR": {
- "label": "Greek",
- "autoDetect": "input.lang-el_GR != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-en_GB": {
- "label": "English GB",
- "autoDetect": "input.lang-en_GB != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-en_US": {
- "label": "English US",
- "autoDetect": "input.lang-en_US != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-es_ES": {
- "label": "Spanish",
- "autoDetect": "input.lang-es_ES != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-es_MX": {
- "label": "Spanish Mexico",
- "autoDetect": "input.lang-es_MX != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-et_EE": {
- "label": "Estonian",
- "autoDetect": "input.lang-et_EE != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-fa_FA": {
- "label": "Farsi",
- "autoDetect": "input.lang-fa_FA != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-fi_FI": {
- "label": "Finnish",
- "autoDetect": "input.lang-fi_FI != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-fr_CA": {
- "label": "French Canada",
- "autoDetect": "input.lang-fr_CA != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-fr_FR": {
- "label": "French France",
- "autoDetect": "input.lang-fr_FR != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-he_IL": {
- "label": "Hebrew",
- "autoDetect": "input.lang-he_IL != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-hi_IN": {
- "label": "Hindi",
- "autoDetect": "input.lang-hi_IN != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-hr_HR": {
- "label": "Croatian",
- "autoDetect": "input.lang-hr_HR != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-hu_HU": {
- "label": "Hungarian",
- "autoDetect": "input.lang-hu_HU != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-id_ID": {
- "label": "Indonesian",
- "autoDetect": "input.lang-id_ID != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-it_IT": {
- "label": "Italian",
- "autoDetect": "input.lang-it_IT != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-ja_JP": {
- "label": "Japanese",
- "condition": "features.openwnn",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-ko_KR": {
- "label": "Korean",
- "autoDetect": "input.lang-ko_KR != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-ms_MY": {
- "label": "Malay",
- "autoDetect": "input.lang-ms_MY != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-nb_NO": {
- "label": "Norwegian",
- "autoDetect": "input.lang-nb_NO != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-nl_NL": {
- "label": "Dutch",
- "autoDetect": "input.lang-nl_NL != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-pl_PL": {
- "label": "Polish",
- "autoDetect": "input.lang-pl_PL != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-pt_BR": {
- "label": "Portuguese Brazil",
- "autoDetect": "input.lang-pt_BR != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-pt_PT": {
- "label": "Portuguese Portugal",
- "autoDetect": "input.lang-pt_PT != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-ro_RO": {
- "label": "Romanian",
- "autoDetect": "input.lang-ro_RO != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-ru_RU": {
- "label": "Russian",
- "autoDetect": "input.lang-ru_RU != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-sk_SK": {
- "label": "Slovak",
- "autoDetect": "input.lang-sk_SK != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-sl_SI": {
- "label": "Slovenian",
- "autoDetect": "input.lang-sl_SI != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-sq_AL": {
- "label": "Albanian",
- "autoDetect": "input.lang-sq_AL != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-sr_SP": {
- "label": "Serbian",
- "autoDetect": "input.lang-sr_SP != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-sv_SE": {
- "label": "Swedish",
- "autoDetect": "input.lang-sv_SE != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-th_TH": {
- "label": "Thai",
- "condition": "features.thai",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-tr_TR": {
- "label": "Turkish",
- "autoDetect": "input.lang-tr_TR != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-uk_UA": {
- "label": "Ukrainian",
- "autoDetect": "input.lang-uk_UA != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-vi_VN": {
- "label": "Vietnamese",
- "autoDetect": "input.lang-vi_VN != 'no'",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-zh_CN": {
- "label": "Simplified Chinese",
- "autoDetect": "input.lang-zh_CN != 'no'",
- "condition": "features.pinyin",
- "output": [ "privateFeature" ]
- },
- "vkb-lang-zh_TW": {
- "label": "Traditional Chinese",
- "autoDetect": "input.lang-zh_TW != 'no'",
- "condition": "features.tcime || features.zhuyin || features.cangjie",
- "output": [ "privateFeature" ]
- }
- },
-
- "report": [
- {
- "type": "error",
- "condition": "input.vkb-handwriting == 't9write' && !features.t9write",
- "message": "T9Write SDK could not be found. For more information,
-see the documentation in 'Building Qt Virtual Keyboard'."
- },
- {
- "type": "note",
- "condition": "!features.hunspell",
- "message": "Hunspell disabled. Spelling correction will not be available."
- }
- ],
-
- "summary": [
- {
- "section": "Qt Virtualkeyboard",
- "entries": [
- "vkb-desktop",
- "vkb-layouts",
- "vkb-arrow-keynavigation",
- "vkb-retro-style",
- "vkb-sensitive-debug",
- "t9write",
- "t9write-alphabetic",
- "t9write-cjk",
- "lipi-toolkit",
- "hunspell",
- "3rdparty-hunspell",
- "openwnn",
- "vkb-myscript",
- {
- "section": "Language support enabled for",
- "entries": [
- "vkb-lang-ar_AR",
- "vkb-lang-bg_BG",
- "vkb-lang-cs_CZ",
- "vkb-lang-da_DK",
- "vkb-lang-de_DE",
- "vkb-lang-el_GR",
- "vkb-lang-en_GB",
- "vkb-lang-en_US",
- "vkb-lang-es_ES",
- "vkb-lang-es_MX",
- "vkb-lang-et_EE",
- "vkb-lang-fa_FA",
- "vkb-lang-fi_FI",
- "vkb-lang-fr_CA",
- "vkb-lang-fr_FR",
- "vkb-lang-he_IL",
- "vkb-lang-hi_IN",
- "vkb-lang-hr_HR",
- "vkb-lang-hu_HU",
- "vkb-lang-id_ID",
- "vkb-lang-it_IT",
- "vkb-lang-ja_JP",
- "vkb-lang-ko_KR",
- "vkb-lang-ms_MY",
- "vkb-lang-nb_NO",
- "vkb-lang-nl_NL",
- "vkb-lang-pl_PL",
- "vkb-lang-pt_BR",
- "vkb-lang-pt_PT",
- "vkb-lang-ro_RO",
- "vkb-lang-ru_RU",
- "vkb-lang-sk_SK",
- "vkb-lang-sl_SI",
- "vkb-lang-sq_AL",
- "vkb-lang-sr_SP",
- "vkb-lang-sv_SE",
- "vkb-lang-th_TH",
- "vkb-lang-tr_TR",
- "vkb-lang-uk_UA",
- "vkb-lang-vi_VN",
- "vkb-lang-zh_CN",
- "vkb-lang-zh_TW"
- ]
- },
- {
- "section": "Traditional chinese input methods",
- "condition": "features.vkb-lang-zh_TW",
- "entries": [
- "zhuyin",
- "cangjie"
- ]
- }
- ]
- }
- ]
-}
diff --git a/src/virtualkeyboard/configure.pri b/src/virtualkeyboard/configure.pri
deleted file mode 100644
index 883619d8..00000000
--- a/src/virtualkeyboard/configure.pri
+++ /dev/null
@@ -1,181 +0,0 @@
-VKB_SOURCE_TREE = $$PWD
-VALID_LANGUAGES = \
- ar_AR \
- bg_BG \
- cs_CZ \
- da_DK \
- de_DE \
- el_GR \
- en_GB \
- en_US \
- es_ES \
- es_MX \
- et_EE \
- fa_FA \
- fi_FI \
- fr_CA \
- fr_FR \
- he_IL \
- hi_IN \
- hr_HR \
- hu_HU \
- id_ID \
- it_IT \
- ja_JP \
- ko_KR \
- ms_MY \
- nb_NO \
- nl_NL \
- pl_PL \
- pt_BR \
- pt_PT \
- ro_RO \
- ru_RU \
- sk_SK \
- sl_SI \
- sq_AL \
- sr_SP \
- sv_SE \
- th_TH \
- tr_TR \
- uk_UA \
- vi_VN \
- zh_CN \
- zh_TW
-
-defineReplace(qtConfGetLanguageList) {
- val = $${2}
- isEmpty(val): val = $$qtConfGetNextCommandlineArg()
- contains(val, "^-.*|[A-Z_]+=.*")|isEmpty(val) {
- qtConfAddError("No value supplied to command line option '$$1'.")
- return()
- }
- vals = $$split(val, ',')
- for (l, vals) {
- languages += $$l
- equals(val, "all"): \
- return($$VALID_LANGUAGES)
-
- !contains(VALID_LANGUAGES, $$l) {
- qtConfAddError("Language '$$l' is not supported by the Qt Virtual Keyboard." \
- "The list of valid languages is:" \
- "$$VALID_LANGUAGES");
- return()
- }
- }
- return($$languages)
-}
-
-defineTest(qtConfCommandline_enableLang) {
- languages = $$qtConfGetLanguageList($$1, $$2)
-
- # explicitly disable all languages that are currently not explicitly set
- for (l, VALID_LANGUAGES) {
- isEmpty(config.input.lang-$${l}) {
- config.input.lang-$${l} = "no"
- export(config.input.lang-$${l})
- }
- }
-
- for (l, languages) {
- config.input.lang-$${l} = "yes"
- export(config.input.lang-$${l})
- }
-}
-
-defineTest(qtConfCommandline_disableLang) {
- languages = $$qtConfGetLanguageList($$1, $$2)
-
- for (l, languages) {
- config.input.lang-$${l} = "no"
- export(config.input.lang-$${l})
- }
-}
-
-
-# T9Write tests
-
-T9WRITE_BASE_DIR = $$VKB_SOURCE_TREE/src/plugins/t9write/3rdparty/t9write/
-
-defineTest(t9writeFindSharedLibrary) {
- contains(QT_ARCH, arm) {
- LIB_DIR = $$T9WRITE_BASE_DIR/lib/arm/shared
- } else: linux {
- LIB_DIR = $$T9WRITE_BASE_DIR/lib/linux-x86/shared
- } else: win32 {
- LIB_DIR = $$T9WRITE_BASE_DIR/lib/win32/shared
- } else {
- return(false)
- }
- win32 {
- result = $$files($$LIB_DIR/$$1/*.obj)
- isEmpty(result): result = $$files($$LIB_DIR/$$1/*.lib)
- isEmpty(result) {
- return(false)
- }
- } else {
- result = $$files($$LIB_DIR/$$1/*.o)
- isEmpty(result): result = $$files($$LIB_DIR/$$1/*.so)
- isEmpty(result) {
- return(false)
- }
- }
- return(true)
-}
-
-defineTest(t9writeFindStaticLibrary) {
- contains(QT_ARCH, arm) {
- LIB_DIR = $$T9WRITE_BASE_DIR/lib/arm/shared
- } else: linux {
- LIB_DIR = $$T9WRITE_BASE_DIR/lib/linux-x86/shared
- } else: win32 {
- LIB_DIR = $$T9WRITE_BASE_DIR/lib/win32/shared
- } else {
- return(false)
- }
- win32 {
- result = $$files($$LIB_DIR/$$1/*.obj)
- isEmpty(result): result = $$files($$LIB_DIR/$$1/*.lib)
- isEmpty(result) {
- return(false)
- }
- } else {
- result = $$files($$LIB_DIR/$$1/*.o)
- isEmpty(result): result = $$files($$LIB_DIR/$$1/*.a)
- isEmpty(result) {
- return(false)
- }
- }
- return(true)
-}
-
-defineTest(qtConfTest_t9write-alphabetic) {
- !exists($${T9WRITE_BASE_DIR}/api/decuma_hwr.h) {
- return (false)
- }
- !t9writeFindStaticLibrary(alphabetic)|!t9writeFindSharedLibrary(alphabetic) {
- return (false)
- }
- return(true)
-}
-
-defineTest(qtConfTest_t9write-cjk) {
- !exists($${T9WRITE_BASE_DIR}/api/decuma_hwr_cjk.h) {
- return (false)
- }
- !t9writeFindStaticLibrary(cjk)|!t9writeFindSharedLibrary(cjk) {
- return (false)
- }
- return(true)
-}
-
-
-# 3rdpary hunspell support
-
-defineTest(qtConfTest_3rdpartyHunspell) {
- !exists($$VKB_SOURCE_TREE/src/plugins/hunspell/3rdparty/hunspell/hunspell.h): \
- return(false)
- !exists($$VKB_SOURCE_TREE/src/plugins/hunspell/3rdparty/hunspell/data): \
- return(false)
- return(true)
-}
diff --git a/src/virtualkeyboard/content/HandwritingInputPanel.qml b/src/virtualkeyboard/content/HandwritingInputPanel.qml
deleted file mode 100644
index 4fe4fbc3..00000000
--- a/src/virtualkeyboard/content/HandwritingInputPanel.qml
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
-import QtQml 2.14
-import QtQuick.Window 2.2
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype HandwritingInputPanel
- \inqmlmodule QtQuick.VirtualKeyboard
- \since QtQuick.VirtualKeyboard 2.0
-
- \brief Provides a handwriting panel add-on for the virtual keyboard UI.
- \ingroup qtvirtualkeyboard-qml
-
- The HandwritingInputPanel is an add-on component for the InputPanel, which
- enables full-screen handwriting input for the application.
-
- HandwritingInputPanel is designed to be anchored full screen alongside
- the InputPanel. The operating principle is that when the handwriting panel
- is "available", the InputPanel is invisible. This functionality is built-in,
- and requires no more than a reference to the InputPanel instance.
-
- The panel is set into operation by setting the \l {HandwritingInputPanel::}{available}
- property to \c true. When the panel is in operation, the keyboard remains hidden
- when the input focus is set. When \c available is \c true, handwriting input is
- activated by setting the \l {HandwritingInputPanel::}{active} property to \c true.
-
- The user interface, which provides controls for handwriting mode and the
- visibility of the keyboard, is application-specific. One suggested implementation
- is to use a floating button on the handwriting panel, where single click toggles
- the handwriting mode (changes the \l {HandwritingInputPanel::}{active} property), and double-click toggles
- the visibility of the keyboard (changes the \l {HandwritingInputPanel::}{available} property).
-
- HandwritingInputPanel also provides a word candidate popup which allows the user
- to select an alternative word candidate from the list of suggestions generated
- by the handwriting input method.
-*/
-
-Item {
- id: handwritingInputPanel
-
- /*! A reference to the input panel instance.
-
- This property must be set to the existing input panel instance.
- */
- property var inputPanel
-
- /*! This property controls the availability status of the handwriting input method.
-
- Setting the property to \c true prepares the handwriting input method and inhibits
- the display of keyboard.
- */
- property bool available
-
- /*! This property controls the active status of the handwriting input method.
-
- Setting the property to \c true activates the handwriting input method. When the
- handwriting input method is active, all touch input is captured by the
- handwriting input panel and redirected to input engine for processing.
- */
- property bool active
-
- state: enabled && available ? (active ? "active" : "available") : "unavailable"
- enabled: inputPanel.keyboard.isHandwritingAvailable()
- visible: enabled && available && active && Qt.inputMethod.visible
-
- LayoutMirroring.enabled: false
- LayoutMirroring.childrenInherit: true
-
- Item {
- id: keyboard
- property var style: inputPanel && inputPanel.hasOwnProperty ? inputPanel.keyboard.style : null
- property var soundEffect: inputPanel && inputPanel.hasOwnProperty ? inputPanel.keyboard.soundEffect : null
- }
-
- onEnabledChanged: inputPanel.keyboard.fullScreenHandwritingMode = enabled && available
- onAvailableChanged: inputPanel.keyboard.fullScreenHandwritingMode = enabled && available
-
- TraceInputArea {
- id: hwrInputArea
- enabled: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
- objectName: "hwrInputArea"
- anchors.fill: parent
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- canvasType: "fullscreen"
- }
-
- Binding {
- target: InputContext.priv
- property: "keyboardRectangle"
- value: Qt.rect(hwrInputArea.x, hwrInputArea.y, hwrInputArea.width, hwrInputArea.height)
- when: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
- restoreMode: Binding.RestoreBinding
- }
-
- Binding {
- target: inputPanel ? inputPanel.keyboard : null
- property: "active"
- value: false
- when: handwritingInputPanel.enabled && handwritingInputPanel.available
- restoreMode: Binding.RestoreBinding
- }
-
- WordCandidatePopupList {
- z: 1
- objectName: "wordCandidatePopupList"
- enabled: handwritingInputPanel.enabled && handwritingInputPanel.available && handwritingInputPanel.active
- }
-}
diff --git a/src/virtualkeyboard/content/InputPanel.qml b/src/virtualkeyboard/content/InputPanel.qml
deleted file mode 100644
index f511eab2..00000000
--- a/src/virtualkeyboard/content/InputPanel.qml
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
-import QtQml 2.14
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype InputPanel
- \inqmlmodule QtQuick.VirtualKeyboard
-
- \brief Provides the virtual keyboard UI.
- \ingroup qtvirtualkeyboard-qml
-
- The keyboard size is automatically calculated from the available
- width; that is, the keyboard maintains the aspect ratio specified by the current
- style. Therefore the application should only set the \l {Item::}{width} and \l {Item::}{y}
- coordinates of the InputPanel, and not the \l {Item::}{height}.
-
- As with \l {Qt Virtual Keyboard QML Types}{all other QML types} provided by
- the module, the \c QT_IM_MODULE environment variable must be set to
- \c qtvirtualkeyboard before using InputPanel. For more information, see
- \l {Loading the Plugin}.
-*/
-
-Item {
- id: inputPanel
-
- /*!
- \qmlproperty bool InputPanel::active
- \since QtQuick.VirtualKeyboard 2.0
-
- This property reflects the active status of the input panel.
- The keyboard should be made visible to the user when this property is
- \c true.
- */
- property alias active: keyboard.active
-
- /*!
- \qmlproperty bool InputPanel::externalLanguageSwitchEnabled
- \since QtQuick.VirtualKeyboard 2.4
-
- This property enables the external language switch mechanism.
- When this property is \c true, the virtual keyboard will not show
- the built-in language popup, but will emit the \l externalLanguageSwitch
- signal instead. The application can handle this signal and show a
- custom language selection dialog instead.
- */
- property bool externalLanguageSwitchEnabled
-
- /*!
- \qmlsignal InputPanel::externalLanguageSwitch(var localeList, int currentIndex)
- \since QtQuick.VirtualKeyboard 2.4
-
- This signal is emitted when \l externalLanguageSwitchEnabled is \c true
- and the \l {user-guide-language}{language switch key} is pressed by the user.
-
- It serves as a hook to display a custom language dialog instead of
- the built-in language popup in the virtual keyboard.
-
- The \e localeList parameter contains a list of locale names to choose
- from. To get more information about a particular language, use the
- \l {QtQml::Qt::locale()}{Qt.locale()} function. The \e currentIndex
- is the index of current locale in the \e localeList. This item should
- be highlighted as the current item in the UI.
-
- To select a new language, use the \l {VirtualKeyboardSettings::locale}
- {VirtualKeyboardSettings.locale} property.
-
- Below is an example that demonstrates a custom language dialog implementation:
-
- \snippet qtvirtualkeyboard-custom-language-popup.qml popup
-
- The dialog would then be declared:
-
- \snippet qtvirtualkeyboard-custom-language-popup.qml declaring
-
- In the application's InputPanel, add the following code:
-
- \snippet qtvirtualkeyboard-custom-language-popup.qml using
-
- The custom dialog will now be shown when the language switch key is pressed.
- */
- signal externalLanguageSwitch(var localeList, int currentIndex)
-
- /*! \internal */
- property alias keyboard: keyboard
-
- /*! \internal */
- property bool desktopPanel: false
-
- SelectionControl {
- objectName: "selectionControl"
- x: -parent.x
- y: -parent.y
- enabled: active && !keyboard.fullScreenMode && !desktopPanel
- }
-
- implicitHeight: keyboard.height
- Keyboard {
- id: keyboard
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- }
- MouseArea {
- z: -1
- anchors.fill: keyboard
- enabled: active
- }
-
- Binding {
- target: InputContext.priv
- property: "keyboardRectangle"
- value: mapToItem(null,
- desktopPanel ? keyboard.x : x,
- (desktopPanel ? keyboard.y : y) + keyboard.wordCandidateView.currentYOffset - (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0),
- keyboard.width,
- keyboard.height - keyboard.wordCandidateView.currentYOffset + (keyboard.shadowInputControl.visible ? keyboard.shadowInputControl.height : 0))
- when: !InputContext.animating
- restoreMode: Binding.RestoreBinding
- }
-}
diff --git a/src/virtualkeyboard/content/components/AlternativeKeys.qml b/src/virtualkeyboard/content/components/AlternativeKeys.qml
deleted file mode 100644
index 7879f006..00000000
--- a/src/virtualkeyboard/content/components/AlternativeKeys.qml
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-Item {
- property bool active: listView.currentIndex != -1
- property int highlightIndex: -1
- property alias listView: listView
- property int keyCode
- property point origin
- signal clicked
- LayoutMirroring.enabled: false
- LayoutMirroring.childrenInherit: true
-
- z: 1
- visible: active
- anchors.fill: parent
-
- ListModel {
- id: listModel
- }
-
- ListView {
- id: listView
- spacing: 0
- model: listModel
- delegate: keyboard.style.alternateKeysListDelegate
- highlight: keyboard.style.alternateKeysListHighlight ? keyboard.style.alternateKeysListHighlight : defaultHighlight
- highlightMoveDuration: 0
- highlightResizeDuration: 0
- keyNavigationWraps: true
- orientation: ListView.Horizontal
- height: keyboard.style.alternateKeysListItemHeight
- x: origin.x
- y: origin.y - height - keyboard.style.alternateKeysListBottomMargin
- Component {
- id: defaultHighlight
- Item {}
- }
- }
-
- Loader {
- id: backgroundLoader
- sourceComponent: keyboard.style.alternateKeysListBackground
- anchors.fill: listView
- z: -1
- states: State {
- name: "highlighted"
- when: highlightIndex !== -1 && highlightIndex === listView.currentIndex &&
- backgroundLoader.item !== null && backgroundLoader.item.hasOwnProperty("currentItemHighlight")
- PropertyChanges {
- target: backgroundLoader.item
- currentItemHighlight: true
- }
- }
- }
-
- onClicked: {
- if (active && listView.currentIndex >= 0 && listView.currentIndex < listView.model.count) {
- var activeKey = listView.model.get(listView.currentIndex)
- InputContext.inputEngine.virtualKeyClick(keyCode, activeKey.text,
- InputContext.uppercase ? Qt.ShiftModifier : 0)
- }
- }
-
- function open(key, originX, originY) {
- keyCode = key.key
- var alternativeKeys = key.effectiveAlternativeKeys
- if (alternativeKeys.length > 0) {
- for (var i = 0; i < alternativeKeys.length; i++) {
- listModel.append({ "text": InputContext.uppercase ? alternativeKeys[i].toUpperCase() : alternativeKeys[i] })
- }
- listView.width = keyboard.style.alternateKeysListItemWidth * listModel.count
- listView.forceLayout()
- highlightIndex = key.effectiveAlternativeKeysHighlightIndex
- if (highlightIndex === -1) {
- console.log("AlternativeKeys: active key \"" + key.text + "\" not found in alternativeKeys \"" + alternativeKeys + ".\"")
- highlightIndex = 0
- }
- listView.currentIndex = highlightIndex
- var currentItemOffset = (listView.currentIndex + 0.5) * keyboard.style.alternateKeysListItemWidth
- origin = Qt.point(Math.min(Math.max(keyboard.style.alternateKeysListLeftMargin, originX - currentItemOffset), width - listView.width - keyboard.style.alternateKeysListRightMargin), originY)
- if (backgroundLoader.item && backgroundLoader.item.hasOwnProperty("currentItemOffset")) {
- backgroundLoader.item.currentItemOffset = currentItemOffset
- }
- }
- return active
- }
-
- function move(mouseX) {
- var newIndex = listView.indexAt(Math.max(1, Math.min(listView.width - 1, mapToItem(listView, mouseX, 0).x)), 1)
- if (newIndex !== listView.currentIndex) {
- listView.currentIndex = newIndex
- }
- }
-
- function close() {
- listView.currentIndex = -1
- listModel.clear()
- }
-}
diff --git a/src/virtualkeyboard/content/components/BackspaceKey.qml b/src/virtualkeyboard/content/components/BackspaceKey.qml
deleted file mode 100644
index 126f6e2c..00000000
--- a/src/virtualkeyboard/content/components/BackspaceKey.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype BackspaceKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits BaseKey
-
- \brief Backspace key for keyboard layouts.
-
- Sends a backspace key for input method processing.
- This key is repeatable.
-*/
-
-BaseKey {
- key: Qt.Key_Backspace
- repeat: true
- functionKey: true
- keyPanelDelegate: keyboard.style ? keyboard.style.backspaceKeyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/BaseKey.qml b/src/virtualkeyboard/content/components/BaseKey.qml
deleted file mode 100644
index ae3b530f..00000000
--- a/src/virtualkeyboard/content/components/BaseKey.qml
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype BaseKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Item
-
- \brief Common parent for all key types.
-
- BaseKey is a common type for all keys in keyboard layout.
-
- This type should not be used directly in the layouts. The specialized
- key types, such as Key or EnterKey should be used instead.
-*/
-
-Item {
- id: keyItem
-
- /*! Sets the key weight value which determines the relative size of the key.
-
- Use this property to change the key size in the layout.
-
- The default value is inherited from the parent element
- of the key in the layout hierarchy.
- */
- property real weight: parent.keyWeight
-
- /*! Sets the key text for input method processing.
-
- In most cases, this is the Unicode representation of the key code.
-
- The default value is an empty string.
- */
- property string text: ""
-
- /*! Sets the display text.
-
- This string is rendered in the keyboard layout.
-
- The default value is the key text.
- */
- property string displayText: text
-
- /*! \since QtQuick.VirtualKeyboard 2.0
-
- Sets the small text rendered in the corner of the key.
-
- The default value based on the default item in the effective alternative keys.
- */
- property string smallText: effectiveAlternativeKeys && effectiveAlternativeKeysHighlightIndex !== -1 ? effectiveAlternativeKeys[effectiveAlternativeKeysHighlightIndex] : ""
-
- /*! \since QtQuick.VirtualKeyboard 2.0
-
- Sets the visibility of small text.
-
- The default value is inherited from the parent.
- */
- property bool smallTextVisible: parent.smallTextVisible
-
- /*! Sets the list of alternative keys.
-
- This property can be set to a string, or a list of strings. If the value is
- a string, the alternative keys are presented as individual characters of
- that string. If the value is a list of strings, the list is used instead.
-
- The alternative keys are presented to the user by pressing and holding a key
- with this property set.
-
- \note If the alternative keys contains the key \c text, it will be filtered from
- the \c effectiveAlternativeKeys and its position will be used as an indicator
- for the highlighted item instead.
-
- The default is empty list.
- */
- property var alternativeKeys: []
-
- /*! \since QtQuick.VirtualKeyboard 2.0
-
- This property contains the effective alternative keys presented to user.
-
- The list is contains the items in the \c alternativeKeys excluding the \c text
- item.
- */
- readonly property var effectiveAlternativeKeys: {
- var textIndex = alternativeKeys.indexOf(text)
- if (textIndex == -1)
- return alternativeKeys
- return alternativeKeys.slice(0, textIndex).concat(alternativeKeys.slice(textIndex + 1))
- }
-
- /*! \since QtQuick.VirtualKeyboard 2.0
-
- This property contains the index of highlighted item in the \c effectiveAlternativeKeys.
-
- The index is calculated from the index of the key \c text in the \c alternativeKeys.
-
- For example, if the alternative keys contains "çcċčć" and the key \c text is "c",
- this index will become 1 and the effective alternative keys presented to user will
- be "ç[ċ]čć".
- */
- readonly property int effectiveAlternativeKeysHighlightIndex: {
- var index = alternativeKeys.indexOf(text)
- return index > 1 && (index + 1) == alternativeKeys.length ? alternativeKeys.length - 2 : index
- }
-
- /*! Sets the key code for input method processing.
-
- The default is Qt.Key_unknown.
- */
- property int key: Qt.Key_unknown
-
- /*! \since QtQuick.VirtualKeyboard 1.3
-
- This property controls whether the key emits key events for input
- method processing. When true, the key events are disabled.
-
- By default, the key event is emitted if the \e key is not unknown
- or the \e text is not empty.
- */
- property bool noKeyEvent: key === Qt.Key_unknown && text.length === 0
-
- /*! This property holds the active status of the key.
-
- This property is automatically set to true when the key is pressed.
- */
- property bool active: false
-
- /*! \since QtQuick.VirtualKeyboard 1.3
-
- Disables key modifiers on the emitted key.
-
- The default is false.
- */
- property bool noModifier: false
-
- /*! Sets the key repeat attribute.
-
- If the repeat is enabled, the key will repeat the input events while held down.
- The repeat should not be used if alternativeKeys is also set.
-
- The default is false.
- */
- property bool repeat: false
-
- /*! Sets the highlighted status of the key.
-
- The default is false.
- */
- property bool highlighted: false
-
- /*! Sets the function key attribute.
-
- The default is false.
- */
- property bool functionKey: false
-
- /*! Sets the show preview attribute.
-
- By default, the character preview popup is not shown for function keys.
- */
- property bool showPreview: enabled && !functionKey && !keyboard.navigationModeActive
-
- /*! This property holds the pressed status of the key.
-
- The pressed status can only be true if the key is both enabled and active.
- When the key state becomes pressed, it triggers a key down event for the
- input engine. A key up event is triggered when the key is released.
- */
- property bool pressed: enabled && active
-
- /*! This property holds the uppercase status of the key.
-
- By default, this property reflects the uppercase status of the keyboard.
- */
- property bool uppercased: InputContext.uppercase && !noModifier
-
- /*! Sets the key panel delegate for the key.
-
- This property is essential for key decoration. Without a key panel delegate,
- the key is invisible. This property should be assigned in the inherited key type.
- */
- property alias keyPanelDelegate: keyPanel.sourceComponent
-
- /*!
- \since QtQuick.VirtualKeyboard 1.1
-
- This property holds the sound effect to be played on key press.
-
- This property is read-only since the sound effects are defined in the keyboard style.
- */
- readonly property url soundEffect: keyPanel.item ? keyPanel.item.soundEffect : ""
-
- onSoundEffectChanged: keyboard.soundEffect.register(soundEffect)
-
- // QTBUG-54953, QTBUG-55773
- // Avoid a row that was hidden taking up the entire height of the
- // keyboard when it is made visible after the application has started.
- // This value is low because keys can scale vertically, and setting e.g. 40
- // pixels might be too high for a keyboard that doesn't have a lot of space.
- implicitHeight: 1
-
- Layout.minimumWidth: keyPanel.implicitWidth
- Layout.minimumHeight: keyPanel.implicitHeight
- Layout.preferredWidth: weight
- Layout.fillWidth: true
- Layout.fillHeight: true
-
- Loader {
- id: keyPanel
- anchors.fill: parent
- onStatusChanged: if (status == Loader.Ready) keyPanel.item.control = keyItem
- }
-
- /*! This signal is triggered when the key is pressed, allowing custom processing
- of key.
- */
- signal clicked
-}
diff --git a/src/virtualkeyboard/content/components/ChangeLanguageKey.qml b/src/virtualkeyboard/content/components/ChangeLanguageKey.qml
deleted file mode 100644
index 70e12fa4..00000000
--- a/src/virtualkeyboard/content/components/ChangeLanguageKey.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Styles 2.1
-
-/*!
- \qmltype ChangeLanguageKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits BaseKey
-
- \brief Change language key for keyboard layouts.
-
- This key changes the current input language in the list of supported
- languages. The key has two function modes:
-
- \list
- \li Popup mode
- \li Toggle mode
- \endlist
-
- The popup mode is enabled by the \l {KeyboardStyle::languagePopupListEnabled} property.
- If enabled, a key press will open a popup list with available languages. Otherwise
- it will cycle to the next available input language.
-*/
-
-BaseKey {
- /*! If this property is true, the input language is only
- changed between the languages providing custom layout.
-
- For example, if only the English and Arabic languages
- provide digits layout, then other locales using the
- shared default layout are ignored.
-
- The default is false.
- */
- property bool customLayoutsOnly: false
-
- id: changeLanguageKey
- objectName: "changeLanguageKey"
- functionKey: true
- displayText: keyboard.locale.split("_")[0]
- keyPanelDelegate: keyboard.style ? keyboard.style.languageKeyPanel : undefined
- onClicked: {
- if (keyboard.style.languagePopupListEnabled)
- keyboard.showLanguagePopup(changeLanguageKey, false)
- else
- keyboard.changeInputLanguage(customLayoutsOnly)
- }
- enabled: keyboard.canChangeInputLanguage(customLayoutsOnly)
-}
diff --git a/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml b/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml
deleted file mode 100644
index ee70e110..00000000
--- a/src/virtualkeyboard/content/components/CharacterPreviewBubble.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-Item {
- property bool active
- property var activeKey: keyboard.activeKey
-
- visible: active && activeKey !== undefined && activeKey !== null && activeKey.showPreview
- z: 1
-
- Loader {
- id: characterPreview
- anchors.fill: parent
- sourceComponent: keyboard.style.characterPreviewDelegate
- }
-
- onActiveKeyChanged: {
- if (activeKey && characterPreview.item !== null) {
- characterPreview.item.text = InputContext.uppercase ? activeKey.displayText.toUpperCase() : activeKey.displayText
- width = activeKey.width
- height = activeKey.height
- var position = keyboard.mapFromItem(activeKey, 0, 0)
- x = position.x
- y = position.y - height - keyboard.style.characterPreviewMargin
- }
- }
-}
diff --git a/src/virtualkeyboard/content/components/EnterKey.qml b/src/virtualkeyboard/content/components/EnterKey.qml
deleted file mode 100644
index 9f7c04da..00000000
--- a/src/virtualkeyboard/content/components/EnterKey.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype EnterKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits BaseKey
-
- \brief Enter key for keyboard layouts.
-
- Sends an enter key for input method processing.
-*/
-
-BaseKey {
- /*! This property holds the action id for the enter key.
-
- */
- readonly property int actionId: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.actionId : EnterKeyAction.None
-
- text: "\n"
- displayText: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.label : ""
- key: Qt.Key_Return
- showPreview: false
- highlighted: enabled && displayText.length > 0
- enabled: InputContext.priv.hasEnterKeyAction(InputContext.priv.inputItem) ? InputContext.priv.inputItem.EnterKeyAction.enabled : true
- keyPanelDelegate: keyboard.style ? keyboard.style.enterKeyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/FillerKey.qml b/src/virtualkeyboard/content/components/FillerKey.qml
deleted file mode 100644
index b06d4aed..00000000
--- a/src/virtualkeyboard/content/components/FillerKey.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype FillerKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits BaseKey
-
- \brief Filler key for keyboard layouts.
-
- This key can be used as a filler in the keyboard layout.
-*/
-
-BaseKey {
- showPreview: false
-}
diff --git a/src/virtualkeyboard/content/components/HandwritingModeKey.qml b/src/virtualkeyboard/content/components/HandwritingModeKey.qml
deleted file mode 100644
index 815d89db..00000000
--- a/src/virtualkeyboard/content/components/HandwritingModeKey.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype HandwritingModeKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Key
- \since QtQuick.VirtualKeyboard 2.0
-
- \brief Hand writing mode key for keyboard layouts.
-
- This key toggles between the handwriting mode layout and the main layout.
-
- The key is automatically hidden from the keyboard layout if handwriting support
- is not enabled for the virtual keyboard.
-*/
-
-Key {
- key: Qt.Key_Context2
- displayText: "HWR"
- functionKey: true
- visible: keyboard.isHandwritingAvailable()
- onClicked: keyboard.setHandwritingMode(!keyboard.handwritingMode)
- keyPanelDelegate: keyboard.style ? keyboard.style.handwritingKeyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/HideKeyboardKey.qml b/src/virtualkeyboard/content/components/HideKeyboardKey.qml
deleted file mode 100644
index ab38fbc2..00000000
--- a/src/virtualkeyboard/content/components/HideKeyboardKey.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype HideKeyboardKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits BaseKey
-
- \brief Hide keyboard key for keyboard layouts.
-
- This key hides the keyboard from the user when pressed.
-*/
-
-BaseKey {
- functionKey: true
- onClicked: InputContext.priv.hideInputPanel()
- keyPanelDelegate: keyboard.style ? keyboard.style.hideKeyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/InputModeKey.qml b/src/virtualkeyboard/content/components/InputModeKey.qml
deleted file mode 100644
index f7b31b9b..00000000
--- a/src/virtualkeyboard/content/components/InputModeKey.qml
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-/*!
- \qmltype InputModeKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Key
- \since QtQuick.VirtualKeyboard 2.3
-
- \brief Input mode key for keyboard layouts.
-
- This key toggles between available \l {QVirtualKeyboardInputEngine::inputModes} {InputEngine.inputModes}.
-*/
-
-Key {
- key: Qt.Key_Mode_switch
- noKeyEvent: true
- functionKey: true
- text: InputContext.inputEngine.inputMode < inputModeNameList.length ?
- inputModeNameList[InputContext.inputEngine.inputMode] : "ABC"
- onClicked: InputContext.inputEngine.inputMode = __nextInputMode(InputContext.inputEngine.inputMode)
- keyPanelDelegate: keyboard.style ? keyboard.style.symbolKeyPanel : undefined
- enabled: inputModeCount > 1
-
- /*!
- List of input mode names.
-
- The default list contains all known input modes for \l {QVirtualKeyboardInputEngine::inputMode} {InputEngine.inputMode}.
- */
- property var inputModeNameList: [
- "ABC", // InputEngine.InputMode.Latin
- "123", // InputEngine.InputMode.Numeric
- "123", // InputEngine.InputMode.Dialable
- "拼音", // InputEngine.InputMode.Pinyin
- "倉頡", // InputEngine.InputMode.Cangjie
- "注音", // InputEngine.InputMode.Zhuyin
- "한글", // InputEngine.InputMode.Hangul
- "あ", // InputEngine.InputMode.Hiragana
- "カ", // InputEngine.InputMode.Katakana
- "全角", // InputEngine.InputMode.FullwidthLatin
- "ΑΒΓ", // InputEngine.InputMode.Greek
- "АБВ", // InputEngine.InputMode.Cyrillic
- "\u0623\u200C\u0628\u200C\u062C", // InputEngine.InputMode.Arabic
- "\u05D0\u05D1\u05D2", // InputEngine.InputMode.Hebrew
- "中文", // InputEngine.InputMode.ChineseHandwriting
- "日本語", // InputEngine.InputMode.JapaneseHandwriting
- "한국어", // InputEngine.InputMode.KoreanHandwriting
- "กขค", // InputEngine.InputMode.Thai
- ]
-
- /*!
- List of input modes to toggle.
-
- This property allows to define a custom list of input modes to
- toggle.
-
- The default list contains all the available input modes.
- */
- property var inputModes: InputContext.inputEngine.inputModes
-
- /*!
- This read-only property reflects the actual number of input modes
- the user can cycle through this key.
- */
- readonly property int inputModeCount: __inputModes !== undefined ? __inputModes.length : 0
-
- property var __inputModes: __filterInputModes([].concat(InputContext.inputEngine.inputModes), inputModes)
-
- onInputModesChanged: {
- // Check that the current input mode is included in our list
- if (keyboard.active && InputContext.inputEngine.inputMode !== -1 &&
- __inputModes !== undefined && __inputModes.length > 0 &&
- __inputModes.indexOf(InputContext.inputEngine.inputMode) === -1)
- InputContext.inputEngine.inputMode = __inputModes[0]
- }
-
- function __nextInputMode(inputMode) {
- if (!enabled)
- return inputMode
- var inputModeIndex = __inputModes.indexOf(inputMode) + 1
- if (inputModeIndex >= __inputModes.length)
- inputModeIndex = 0
- return __inputModes[inputModeIndex]
- }
-
- function __filterInputModes(inputModes, filter) {
- for (var i = 0; i < inputModes.length; i++) {
- if (filter.indexOf(inputModes[i]) === -1)
- inputModes.splice(i, 1)
- }
- return inputModes
- }
-}
diff --git a/src/virtualkeyboard/content/components/Key.qml b/src/virtualkeyboard/content/components/Key.qml
deleted file mode 100644
index 5a376310..00000000
--- a/src/virtualkeyboard/content/components/Key.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype Key
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits BaseKey
-
- \brief Regular character key for keyboard layouts.
-
- This key emits the key code and key text for input method processing.
-*/
-
-BaseKey {
- id: keyItem
- key: !functionKey && text.length > 0 ? text.toUpperCase().charCodeAt(0) : Qt.Key_unknown
- keyPanelDelegate: keyboard.style ? keyboard.style.keyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml
deleted file mode 100644
index d6073d4e..00000000
--- a/src/virtualkeyboard/content/components/Keyboard.qml
+++ /dev/null
@@ -1,1643 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
-import QtQml 2.14
-import QtQuick.Layouts 1.0
-import QtQuick.Window 2.2
-import QtQuick.VirtualKeyboard 2.3
-import QtQuick.VirtualKeyboard.Styles 2.1
-import QtQuick.VirtualKeyboard.Settings 2.2
-import QtQuick.VirtualKeyboard.Plugins 2.3
-import Qt.labs.folderlistmodel 2.0
-
-Item {
- id: keyboard
- objectName: "keyboard"
-
- property alias style: styleLoader.item
- property alias wordCandidateView: wordCandidateView
- property alias shadowInputControl: shadowInputControl
- property var activeKey: null
- property TouchPoint activeTouchPoint
- property int localeIndex: -1
- property var availableLocaleIndices: []
- property var availableCustomLocaleIndices: []
- property string locale: localeIndex >= 0 && localeIndex < layoutsModel.count ? layoutsModel.get(localeIndex, "fileName") : ""
- property string inputLocale
- property int defaultLocaleIndex: -1
- readonly property bool latinOnly: InputContext.inputMethodHints & (Qt.ImhLatinOnly | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)
- readonly property bool preferNumbers: InputContext.inputMethodHints & Qt.ImhPreferNumbers
- readonly property bool dialableCharactersOnly: InputContext.inputMethodHints & Qt.ImhDialableCharactersOnly
- readonly property bool formattedNumbersOnly: InputContext.inputMethodHints & Qt.ImhFormattedNumbersOnly
- readonly property bool digitsOnly: InputContext.inputMethodHints & Qt.ImhDigitsOnly
- property string layout
- property string layoutType: {
- if (keyboard.handwritingMode) return "handwriting"
- if (keyboard.dialableCharactersOnly) return "dialpad"
- if (keyboard.formattedNumbersOnly) return "numbers"
- if (keyboard.digitsOnly) return "digits"
- if (keyboard.symbolMode) return "symbols"
- return "main"
- }
- property bool active: Qt.inputMethod.visible
- property bool handwritingMode
- property bool fullScreenHandwritingMode
- property bool symbolMode
- property bool fullScreenMode: VirtualKeyboardSettings.fullScreenMode
- property var defaultInputMethod: initDefaultInputMethod()
- property var plainInputMethod: PlainInputMethod {}
- property var customInputMethod: null
- property var customInputMethodSharedLayouts: []
- property int defaultInputMode: InputEngine.InputMode.Latin
- property bool inputMethodNeedsReset: true
- property bool inputModeNeedsReset: true
- property bool navigationModeActive: false
- readonly property bool languagePopupListActive: languagePopupList.enabled
- property alias soundEffect: soundEffect
-
- function initDefaultInputMethod() {
- try {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; DefaultInputMethod {}', keyboard, "defaultInputMethod")
- } catch (e) { }
- return plainInputMethod
- }
-
- Component.onCompleted: InputContext.priv.registerInputPanel(parent)
-
- width: keyboardBackground.width
- height: keyboardBackground.height + (VirtualKeyboardSettings.wordCandidateList.alwaysVisible ? wordCandidateView.height : 0)
- onActiveChanged: {
- hideLanguagePopup()
- if (active && symbolMode && !preferNumbers)
- symbolMode = false
- keyboardInputArea.reset()
- wordCandidateViewAutoHideTimer.stop()
- }
- onActiveKeyChanged: {
- if (InputContext.inputEngine.activeKey !== Qt.Key_unknown)
- InputContext.inputEngine.virtualKeyCancel()
- }
- Connections {
- target: VirtualKeyboardSettings
- function onLocaleChanged() {
- updateDefaultLocale()
- localeIndex = defaultLocaleIndex
- }
- function onActiveLocalesChanged() {
- updateDefaultLocale()
- if (!isValidLocale(localeIndex) || VirtualKeyboardSettings.locale)
- localeIndex = defaultLocaleIndex
- }
- function onFullScreenModeChanged() {
- wordCandidateView.disableAnimation = VirtualKeyboardSettings.fullScreenMode
- keyboard.fullScreenMode = VirtualKeyboardSettings.fullScreenMode
- }
- }
- onAvailableLocaleIndicesChanged: hideLanguagePopup()
- onAvailableCustomLocaleIndicesChanged: hideLanguagePopup()
- onLocaleChanged: {
- hideLanguagePopup()
- inputMethodNeedsReset = true
- inputModeNeedsReset = true
- updateLayout()
- }
- onInputLocaleChanged: {
- if (Qt.locale(inputLocale).name !== "C")
- InputContext.priv.locale = inputLocale
- }
- onLayoutChanged: hideLanguagePopup()
- onLayoutTypeChanged: {
- updateAvailableLocaleIndices()
- updateLayout()
- }
- onLatinOnlyChanged: inputModeNeedsReset = true
- onPreferNumbersChanged: {
- keyboard.symbolMode = !keyboard.handwritingMode && preferNumbers
- inputModeNeedsReset = true
- }
- onDialableCharactersOnlyChanged: inputModeNeedsReset = true
- onFormattedNumbersOnlyChanged: inputModeNeedsReset = true
- onDigitsOnlyChanged: inputModeNeedsReset = true
- onHandwritingModeChanged: if (!keyboard.handwritingMode) keyboard.fullScreenHandwritingMode = false
- onFullScreenHandwritingModeChanged: if (keyboard.fullScreenHandwritingMode) keyboard.handwritingMode = true
- onLanguagePopupListActiveChanged: {
- if (languagePopupListActive && navigationModeActive)
- keyboardInputArea.initialKey = null
- }
-
- Connections {
- target: InputContext
- function onInputMethodHintsChanged() {
- if (InputContext.priv.focus)
- updateInputMethod()
- }
- }
- Connections {
- target: InputContext.priv
- function onInputItemChanged() {
- keyboard.hideLanguagePopup()
- if (active && symbolMode && !preferNumbers)
- symbolMode = false
- }
- function onFocusChanged() {
- if (InputContext.priv.focus)
- updateInputMethod()
- }
- function onNavigationKeyPressed(key, isAutoRepeat) {
- var initialKey
- var direction = wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ? 1 : -1
- switch (key) {
- case Qt.Key_Left:
- if (keyboard.navigationModeActive && !keyboardInputArea.initialKey) {
- if (languagePopupListActive) {
- hideLanguagePopup()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- break
- }
- if (alternativeKeys.active) {
- if (alternativeKeys.listView.currentIndex > 0) {
- alternativeKeys.listView.decrementCurrentIndex()
- } else {
- alternativeKeys.close()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- break
- }
- if (wordCandidateContextMenu.active) {
- hideWordCandidateContextMenu()
- break
- }
- if (wordCandidateView.count) {
- if (wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight &&
- wordCandidateView.currentIndex > 0) {
- wordCandidateView.decrementCurrentIndex()
- } else if (wordCandidateView.effectiveLayoutDirection == Qt.RightToLeft &&
- wordCandidateView.currentIndex + 1 < wordCandidateView.count) {
- wordCandidateView.incrementCurrentIndex()
- } else {
- keyboardInputArea.navigateToNextKey(0, 0, false)
- initialKey = keyboardInputArea.initialKey
- while (keyboardInputArea.navigateToNextKey(0, 1 * direction, false))
- initialKey = keyboardInputArea.initialKey
- while (keyboardInputArea.navigateToNextKey(1, 0, false))
- initialKey = keyboardInputArea.initialKey
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- break
- }
- }
- initialKey = keyboardInputArea.initialKey
- if (!keyboardInputArea.navigateToNextKey(-1, 0, false)) {
- keyboardInputArea.initialKey = initialKey
- if (!keyboardInputArea.navigateToNextKey(0, -1 * direction, false)) {
- if (wordCandidateView.count) {
- if (wordCandidateView.count) {
- wordCandidateView.currentIndex =
- wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ?
- (wordCandidateView.count - 1) : 0
- break
- }
- break
- }
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, -1 * direction, true)
- }
- keyboardInputArea.navigateToNextKey(-1, 0, true)
- }
- break
- case Qt.Key_Up:
- if (languagePopupListActive) {
- if (languagePopupList.currentIndex > 0) {
- languagePopupList.decrementCurrentIndex()
- } else if (languagePopupList.keyNavigationWraps) {
- languagePopupList.currentIndex = languagePopupList.count - 1
- } else {
- hideLanguagePopup()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- } else if (alternativeKeys.active) {
- alternativeKeys.close()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- } else if (wordCandidateContextMenu.active) {
- if (wordCandidateContextMenuList.currentIndex > 0) {
- wordCandidateContextMenuList.decrementCurrentIndex()
- } else if (wordCandidateContextMenuList.keyNavigationWraps && wordCandidateContextMenuList.count > 1) {
- wordCandidateContextMenuList.currentIndex = wordCandidateContextMenuList.count - 1
- } else {
- hideWordCandidateContextMenu()
- }
- } else if (keyboard.navigationModeActive && !keyboardInputArea.initialKey && wordCandidateView.count) {
- keyboardInputArea.navigateToNextKey(0, 0, false)
- initialKey = keyboardInputArea.initialKey
- if (!keyboardInputArea.navigateToNextKey(0, -1, false)) {
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, -1, true)
- } else {
- keyboardInputArea.navigateToNextKey(0, 1, false)
- }
- } else if (!keyboardInputArea.navigateToNextKey(0, -1, !keyboard.navigationModeActive || !keyboardInputArea.initialKey || wordCandidateView.count == 0)) {
- if (wordCandidateView.currentIndex === -1)
- wordCandidateView.incrementCurrentIndex()
- }
- break
- case Qt.Key_Right:
- if (keyboard.navigationModeActive && !keyboardInputArea.initialKey) {
- if (languagePopupListActive) {
- hideLanguagePopup()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- break
- }
- if (alternativeKeys.active) {
- if (alternativeKeys.listView.currentIndex + 1 < alternativeKeys.listView.count) {
- alternativeKeys.listView.incrementCurrentIndex()
- } else {
- alternativeKeys.close()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- break
- }
- if (wordCandidateContextMenu.active) {
- hideWordCandidateContextMenu()
- break
- }
- if (wordCandidateView.count) {
- if (wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight &&
- wordCandidateView.currentIndex + 1 < wordCandidateView.count) {
- wordCandidateView.incrementCurrentIndex()
- } else if (wordCandidateView.effectiveLayoutDirection == Qt.RightToLeft &&
- wordCandidateView.currentIndex > 0) {
- wordCandidateView.decrementCurrentIndex()
- } else {
- keyboardInputArea.navigateToNextKey(0, 0, false)
- initialKey = keyboardInputArea.initialKey
- while (keyboardInputArea.navigateToNextKey(0, -1 * direction, false))
- initialKey = keyboardInputArea.initialKey;
- while (keyboardInputArea.navigateToNextKey(-1, 0, false))
- initialKey = keyboardInputArea.initialKey;
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- break
- }
- }
- initialKey = keyboardInputArea.initialKey
- if (!keyboardInputArea.navigateToNextKey(1, 0, false)) {
- keyboardInputArea.initialKey = initialKey
- if (!keyboardInputArea.navigateToNextKey(0, 1 * direction, false)) {
- if (wordCandidateView.count) {
- wordCandidateView.currentIndex =
- wordCandidateView.effectiveLayoutDirection == Qt.LeftToRight ?
- 0 : (wordCandidateView.count - 1)
- break
- }
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, 1 * direction, true)
- }
- keyboardInputArea.navigateToNextKey(1, 0, true)
- }
- break
- case Qt.Key_Down:
- if (languagePopupListActive) {
- if (languagePopupList.currentIndex + 1 < languagePopupList.count) {
- languagePopupList.incrementCurrentIndex()
- } else if (languagePopupList.keyNavigationWraps) {
- languagePopupList.currentIndex = 0
- } else {
- hideLanguagePopup()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- } else if (alternativeKeys.active) {
- alternativeKeys.close()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- } else if (wordCandidateContextMenu.active) {
- if (wordCandidateContextMenuList.currentIndex + 1 < wordCandidateContextMenuList.count) {
- wordCandidateContextMenuList.incrementCurrentIndex()
- } else if (wordCandidateContextMenuList.keyNavigationWraps && wordCandidateContextMenuList.count > 1) {
- wordCandidateContextMenuList.currentIndex = 0
- } else {
- hideWordCandidateContextMenu()
- keyboardInputArea.setActiveKey(null)
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- } else if (keyboard.navigationModeActive && !keyboardInputArea.initialKey && wordCandidateView.count) {
- keyboardInputArea.navigateToNextKey(0, 0, false)
- initialKey = keyboardInputArea.initialKey
- if (!keyboardInputArea.navigateToNextKey(0, 1, false)) {
- keyboardInputArea.initialKey = initialKey
- keyboardInputArea.navigateToNextKey(0, 1, true)
- } else {
- keyboardInputArea.navigateToNextKey(0, -1, false)
- }
- } else if (!keyboardInputArea.navigateToNextKey(0, 1, !keyboard.navigationModeActive || !keyboardInputArea.initialKey || wordCandidateView.count == 0)) {
- if (wordCandidateView.currentIndex === -1)
- wordCandidateView.incrementCurrentIndex()
- }
- break
- case Qt.Key_Return:
- if (!keyboard.navigationModeActive)
- break
- if (languagePopupListActive) {
- if (!isAutoRepeat) {
- languagePopupList.model.selectItem(languagePopupList.currentIndex)
- keyboardInputArea.reset()
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- } else if (keyboardInputArea.initialKey) {
- if (!isAutoRepeat) {
- pressAndHoldTimer.restart()
- keyboardInputArea.setActiveKey(keyboardInputArea.initialKey)
- keyboardInputArea.press(keyboardInputArea.initialKey, true)
- }
- } else if (!wordCandidateContextMenu.active && wordCandidateView.count > 0) {
- if (!isAutoRepeat) {
- pressAndHoldTimer.restart()
- }
- }
- break
- default:
- break
- }
- }
- function onNavigationKeyReleased(key, isAutoRepeat) {
- switch (key) {
- case Qt.Key_Return:
- if (!keyboard.navigationModeActive) {
- if (languagePopupListActive)
- languagePopupList.model.selectItem(languagePopupList.currentIndex)
- break
- }
- if (isAutoRepeat)
- break
- if (!languagePopupListActive && !alternativeKeys.active && !wordCandidateContextMenu.active && keyboard.activeKey) {
- keyboardInputArea.release(keyboard.activeKey)
- pressAndHoldTimer.stop()
- alternativeKeys.close()
- keyboardInputArea.setActiveKey(null)
- if (!languagePopupListActive && keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
- keyboardInputArea.navigateToNextKey(0, 0, false)
- } else if (wordCandidateContextMenu.active) {
- if (!wordCandidateContextMenu.openedByNavigationKeyLongPress) {
- wordCandidateContextMenu.selectCurrentItem()
- keyboardInputArea.navigateToNextKey(0, 0, false)
- } else {
- wordCandidateContextMenu.openedByNavigationKeyLongPress = false
- }
- } else if (alternativeKeys.active) {
- if (!alternativeKeys.openedByNavigationKeyLongPress) {
- alternativeKeys.clicked()
- alternativeKeys.close()
- keyboardInputArea.navigateToNextKey(0, 0, false)
- keyboardInputArea.reset()
- } else {
- alternativeKeys.openedByNavigationKeyLongPress = false
- }
- } else if (!wordCandidateContextMenu.active && wordCandidateView.count > 0) {
- wordCandidateView.model.selectItem(wordCandidateView.currentIndex)
- if (!InputContext.preeditText.length)
- keyboardInputArea.navigateToNextKey(0, 1, true)
- }
- break
- default:
- break
- }
- }
- }
- Connections {
- target: InputContext.inputEngine
- function onVirtualKeyClicked(key, text, modifiers, isAutoRepeat) {
- if (isAutoRepeat && keyboard.activeKey)
- soundEffect.play(keyboard.activeKey.soundEffect)
- if (key !== Qt.Key_unknown && keyboardInputArea.dragSymbolMode) {
- keyboardInputArea.dragSymbolMode = false
- keyboard.symbolMode = false
- } else if (key === Qt.Key_Space) {
- var surroundingText = InputContext.surroundingText.trim()
- if (InputContext.priv.shiftHandler.sentenceEndingCharacters.indexOf(surroundingText.charAt(surroundingText.length-1)) >= 0)
- keyboard.symbolMode = false
- }
- }
- }
- FolderListModel {
- id: layoutsModel
- nameFilters: ["$"]
- folder: VirtualKeyboardSettings.layoutPath
- }
- Connections {
- target: layoutsModel
- function onCountChanged() {
- updateDefaultLocale()
- localeIndex = defaultLocaleIndex
- }
- }
- AlternativeKeys {
- id: alternativeKeys
- objectName: "alternativeKeys"
- // Add some extra margin for decoration
- property real horizontalMargin: style.alternateKeysListItemWidth
- property real verticalMargin: style.alternateKeysListItemHeight
- property rect previewRect: Qt.rect(keyboard.x + alternativeKeys.listView.x - horizontalMargin,
- keyboard.y + alternativeKeys.listView.y - verticalMargin,
- alternativeKeys.listView.width + horizontalMargin * 2,
- alternativeKeys.listView.height + verticalMargin * 2)
- property bool openedByNavigationKeyLongPress
- onVisibleChanged: {
- if (visible)
- InputContext.priv.previewRectangle = Qt.binding(function() {return previewRect})
- else
- openedByNavigationKeyLongPress = false
- InputContext.priv.previewVisible = visible
- }
- }
- Timer {
- id: pressAndHoldTimer
- interval: 800
- onTriggered: {
- if (keyboard.activeKey && keyboard.activeKey === keyboardInputArea.initialKey) {
- var origin = keyboard.mapFromItem(activeKey, activeKey.width / 2, 0)
- if (alternativeKeys.open(keyboard.activeKey, origin.x, origin.y)) {
- InputContext.inputEngine.virtualKeyCancel()
- keyboardInputArea.initialKey = null
- alternativeKeys.openedByNavigationKeyLongPress = keyboard.navigationModeActive
- } else if (keyboard.activeKey.key === Qt.Key_Context1 && !keyboard.symbolMode) {
- InputContext.inputEngine.virtualKeyCancel()
- keyboardInputArea.dragSymbolMode = true
- keyboard.symbolMode = true
- keyboardInputArea.initialKey = null
- if (keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
- keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- } else if (keyboardInputArea.dragSymbolMode &&
- keyboard.activeKey &&
- keyboard.activeKey.functionKey &&
- !keyboard.activeKey.repeat) {
- InputContext.inputEngine.virtualKeyCancel()
- keyboardInputArea.click(keyboard.activeKey)
- keyboardInputArea.initialKey = null
- if (keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
- keyboardInputArea.navigateToNextKey(0, 0, false)
- } else if (!wordCandidateContextMenu.active) {
- wordCandidateContextMenu.show(wordCandidateView.currentIndex)
- wordCandidateContextMenu.openedByNavigationKeyLongPress = keyboard.navigationModeActive
- }
- }
- }
- Timer {
- id: releaseInaccuracyTimer
- interval: 500
- onTriggered: {
- if (keyboardInputArea.pressed && activeTouchPoint && !alternativeKeys.active && !keyboardInputArea.dragSymbolMode) {
- var key = keyboardInputArea.keyOnPoint(activeTouchPoint.x, activeTouchPoint.y)
- if (key !== keyboard.activeKey) {
- InputContext.inputEngine.virtualKeyCancel()
- keyboardInputArea.setActiveKey(key)
- keyboardInputArea.press(key, false)
- }
- }
- }
- }
- CharacterPreviewBubble {
- id: characterPreview
- objectName: "characterPreviewBubble"
- active: keyboardInputArea.pressed && !alternativeKeys.active
- property rect previewRect: Qt.rect(keyboard.x + characterPreview.x,
- keyboard.y + characterPreview.y,
- characterPreview.width,
- characterPreview.height)
- }
- Binding {
- target: InputContext.priv
- property: "previewRectangle"
- value: characterPreview.previewRect
- when: characterPreview.visible
- restoreMode: Binding.RestoreBinding
- }
- Binding {
- target: InputContext.priv
- property: "previewRectangle"
- value: languagePopupList.previewRect
- when: languagePopupListActive
- restoreMode: Binding.RestoreBinding
- }
- Binding {
- target: InputContext.priv
- property: "previewVisible"
- value: characterPreview.visible || languagePopupListActive
- restoreMode: Binding.RestoreBinding
- }
- Loader {
- id: styleLoader
- source: VirtualKeyboardSettings.style
- Binding {
- target: styleLoader.item
- property: "keyboardHeight"
- value: keyboardInnerContainer.height
- restoreMode: Binding.RestoreBinding
- }
- }
- Loader {
- id: naviationHighlight
- objectName: "naviationHighlight"
- property var highlightItem: {
- if (keyboard.navigationModeActive) {
- if (keyboardInputArea.initialKey) {
- return keyboardInputArea.initialKey
- } else if (languagePopupListActive) {
- return languagePopupList.highlightItem
- } else if (alternativeKeys.listView.count > 0) {
- return alternativeKeys.listView.highlightItem
- } else if (wordCandidateContextMenu.active) {
- return wordCandidateContextMenuList.highlightItem
- } else if (wordCandidateView.count > 0) {
- return wordCandidateView.highlightItem
- }
- }
- return keyboard
- }
- // Note: without "highlightItem.x - highlightItem.x" the binding does not work for alternativeKeys
- property var highlightItemOffset: highlightItem ? keyboard.mapFromItem(highlightItem, highlightItem.x - highlightItem.x, highlightItem.y - highlightItem.y) : ({x:0, y:0})
- property int moveDuration: 200
- property int resizeDuration: 200
- property alias xAnimation: xAnimation
- property alias yAnimation: yAnimation
- property alias widthAnimation: widthAnimation
- property alias heightAnimation: heightAnimation
- z: 2
- x: highlightItemOffset.x
- y: highlightItemOffset.y
- width: highlightItem ? highlightItem.width : 0
- height: highlightItem ? highlightItem.height : 0
- visible: keyboard.navigationModeActive && highlightItem !== null && highlightItem !== keyboard
- sourceComponent: keyboard.style.navigationHighlight
- Behavior on x {
- NumberAnimation { id: xAnimation; duration: naviationHighlight.moveDuration; easing.type: Easing.OutCubic }
- }
- Behavior on y {
- NumberAnimation { id: yAnimation; duration: naviationHighlight.moveDuration; easing.type: Easing.OutCubic }
- }
- Behavior on width {
- NumberAnimation { id: widthAnimation; duration: naviationHighlight.resizeDuration; easing.type: Easing.OutCubic }
- }
- Behavior on height {
- NumberAnimation { id: heightAnimation; duration: naviationHighlight.resizeDuration; easing.type: Easing.OutCubic }
- }
- }
-
- ShadowInputControl {
- id: shadowInputControl
- objectName: "shadowInputControl"
- z: -3
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: wordCandidateView.top
- height: (keyboard.parent.parent ? keyboard.parent.parent.height : Screen.height) -
- keyboard.height - (wordCandidateView.visibleCondition && !VirtualKeyboardSettings.wordCandidateList.alwaysVisible ? wordCandidateView.height : 0)
- visible: fullScreenMode && (shadowInputControlVisibleTimer.running || InputContext.animating)
-
- Connections {
- target: keyboard
- function onActiveChanged() {
- if (keyboard.active)
- shadowInputControlVisibleTimer.start()
- else
- shadowInputControlVisibleTimer.stop()
- }
- }
-
- Timer {
- id: shadowInputControlVisibleTimer
- interval: 2147483647
- repeat: true
- }
-
- MouseArea {
- onPressed: keyboard.hideLanguagePopup()
- anchors.fill: parent
- enabled: languagePopupList.enabled
- }
- }
-
- SelectionControl {
- objectName: "fullScreenModeSelectionControl"
- inputContext: InputContext.priv.shadow
- anchors.top: shadowInputControl.top
- anchors.left: shadowInputControl.left
- enabled: keyboard.enabled && fullScreenMode
- }
-
- ListView {
- id: wordCandidateView
- objectName: "wordCandidateView"
- clip: true
- z: -2
- property bool disableAnimation: VirtualKeyboardSettings.fullScreenMode
- property bool empty: true
- readonly property bool visibleCondition: (((!wordCandidateView.empty || wordCandidateViewAutoHideTimer.running || shadowInputControl.visible) &&
- InputContext.inputEngine.wordCandidateListVisibleHint) || VirtualKeyboardSettings.wordCandidateList.alwaysVisible) &&
- (keyboard.active || shadowInputControl.visible)
- readonly property real visibleYOffset: VirtualKeyboardSettings.wordCandidateList.alwaysVisible ? 0 : -height
- readonly property real currentYOffset: visibleCondition || wordCandidateViewTransition.running ? visibleYOffset : 0
- height: Math.round(style.selectionListHeight)
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: 0
- orientation: ListView.Horizontal
- snapMode: ListView.SnapToItem
- delegate: style.selectionListDelegate
- highlight: style.selectionListHighlight ? style.selectionListHighlight : defaultHighlight
- highlightMoveDuration: 0
- highlightResizeDuration: 0
- add: style.selectionListAdd
- remove: style.selectionListRemove
- keyNavigationWraps: true
- model: InputContext.inputEngine.wordCandidateListModel
- onCurrentItemChanged: if (currentItem) soundEffect.register(currentItem.soundEffect)
- Connections {
- target: wordCandidateView.model ? wordCandidateView.model : null
- function onActiveItemChanged(index) { wordCandidateView.currentIndex = index }
- function onItemSelected() { if (wordCandidateView.currentItem) soundEffect.play(wordCandidateView.currentItem.soundEffect) }
- function onCountChanged() {
- var empty = wordCandidateView.model.count === 0
- if (empty)
- wordCandidateViewAutoHideTimer.restart()
- else
- wordCandidateViewAutoHideTimer.stop()
- wordCandidateView.empty = empty
- keyboard.hideWordCandidateContextMenu()
- }
- }
- Connections {
- target: InputContext.priv
- function onInputItemChanged() { wordCandidateViewAutoHideTimer.stop() }
- }
- Connections {
- target: InputContext.inputEngine
- function onWordCandidateListVisibleHintChanged() { wordCandidateViewAutoHideTimer.stop() }
- }
- Timer {
- id: wordCandidateViewAutoHideTimer
- interval: VirtualKeyboardSettings.wordCandidateList.autoHideDelay
- }
- Loader {
- sourceComponent: style.selectionListBackground
- anchors.fill: parent
- z: -1
- }
- Component {
- id: defaultHighlight
- Item {}
- }
- states: State {
- name: "visible"
- when: wordCandidateView.visibleCondition
- PropertyChanges {
- target: wordCandidateView
- y: wordCandidateView.visibleYOffset
- }
- }
- transitions: Transition {
- id: wordCandidateViewTransition
- to: "visible"
- enabled: !InputContext.animating && !VirtualKeyboardSettings.wordCandidateList.alwaysVisible && !wordCandidateView.disableAnimation
- reversible: true
- ParallelAnimation {
- NumberAnimation {
- properties: "y"
- duration: 250
- easing.type: Easing.InOutQuad
- }
- }
- }
-
- function longPressItem(index) {
- return keyboard.showWordCandidateContextMenu(index)
- }
- }
-
- Item {
- id: soundEffect
- property var __sounds: ({})
- property bool available: false
-
- signal playingChanged(url source, bool playing)
-
- Connections {
- target: VirtualKeyboardSettings
- function onStyleNameChanged() {
- soundEffect.__sounds = {}
- soundEffect.available = false
- }
- }
-
- function play(sound) {
- if (enabled && sound != Qt.resolvedUrl("")) {
- var soundId = Qt.md5(sound)
- var multiSoundEffect = __sounds[soundId]
- if (!multiSoundEffect)
- multiSoundEffect = register(sound)
- if (multiSoundEffect)
- multiSoundEffect.play()
- }
- }
-
- function register(sound) {
- var multiSoundEffect = null
- if (enabled && sound != Qt.resolvedUrl("")) {
- var soundId = Qt.md5(sound)
- multiSoundEffect = __sounds[soundId]
- if (!multiSoundEffect) {
- multiSoundEffect = Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard 2.1; MultiSoundEffect {}', soundEffect)
- if (multiSoundEffect) {
- multiSoundEffect.playingChanged.connect(soundEffect.playingChanged)
- multiSoundEffect.source = sound
- __sounds[soundId] = multiSoundEffect
- available = true
- }
- }
- }
- return multiSoundEffect
- }
- }
-
- Loader {
- id: keyboardBackground
- z: -1
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: keyboardInnerContainer.height
- sourceComponent: style.keyboardBackground
-
- Item {
- id: keyboardInnerContainer
- z: 1
- width: Math.round(keyboardBackground.width)
- height: Math.round(style.keyboardDesignHeight * width / style.keyboardDesignWidth)
- anchors.horizontalCenter: parent.horizontalCenter
- LayoutMirroring.enabled: false
- LayoutMirroring.childrenInherit: true
-
- Loader {
- id: keyboardLayoutLoader
- objectName: "keyboardLayoutLoader"
-
- anchors.fill: parent
- anchors.leftMargin: Math.round(style.keyboardRelativeLeftMargin * parent.width)
- anchors.rightMargin: Math.round(style.keyboardRelativeRightMargin * parent.width)
- anchors.topMargin: Math.round(style.keyboardRelativeTopMargin * parent.height)
- anchors.bottomMargin: Math.round(style.keyboardRelativeBottomMargin * parent.height)
-
- Binding {
- target: keyboardLayoutLoader
- property: "source"
- value: keyboard.layout
- when: keyboard.layout.length > 0
- restoreMode: Binding.RestoreBinding
- }
-
- onItemChanged: {
- // Reset input mode if the new layout wants to override it
- if (item && item.inputMode !== -1)
- inputModeNeedsReset = true
- }
-
- MultiPointTouchArea {
- id: keyboardInputArea
- objectName: "keyboardInputArea"
-
- property var initialKey: null
- property bool dragSymbolMode
- property real releaseMargin: initialKey !== null ? Math.min(initialKey.width / 3, initialKey.height / 3) : 0
- property point navigationCursor: Qt.point(-1, -1)
-
- anchors.fill: keyboardLayoutLoader
-
- Connections {
- target: keyboardLayoutLoader
- function onStatusChanged() {
- if (keyboardLayoutLoader.status == Loader.Ready &&
- keyboard.navigationModeActive &&
- keyboardInputArea.navigationCursor !== Qt.point(-1, -1))
- keyboard.navigationModeActive = keyboardInputArea.navigateToNextKey(0, 0, false)
- }
- }
- Connections {
- target: keyboard
- function onNavigationModeActiveChanged() {
- if (!keyboard.navigationModeActive) {
- keyboardInputArea.navigationCursor = Qt.point(-1, -1)
- keyboardInputArea.reset()
- }
- }
- }
-
- function press(key, isRealPress) {
- if (key && key.enabled) {
- if (!key.noKeyEvent)
- InputContext.inputEngine.virtualKeyPress(key.key, key.uppercased ? key.text.toUpperCase() : key.text, key.uppercased ? Qt.ShiftModifier : 0, key.repeat && !dragSymbolMode)
- if (isRealPress)
- soundEffect.play(key.soundEffect)
- }
- }
- function release(key) {
- if (key && key.enabled) {
- if (!key.noKeyEvent)
- InputContext.inputEngine.virtualKeyRelease(key.key, key.uppercased ? key.text.toUpperCase() : key.text, key.uppercased ? Qt.ShiftModifier : 0)
- key.clicked()
- }
- }
- function click(key) {
- if (key && key.enabled) {
- if (!key.noKeyEvent)
- InputContext.inputEngine.virtualKeyClick(key.key, InputContext.uppercase ? key.text.toUpperCase() : key.text, InputContext.uppercase ? Qt.ShiftModifier : 0)
- key.clicked()
- }
- }
- function setActiveKey(activeKey) {
- if (keyboard.activeKey === activeKey)
- return
- if (keyboard.activeKey) {
- keyboard.activeKey.active = false
- }
- keyboard.activeKey = activeKey
- if (keyboard.activeKey) {
- keyboard.activeKey.active = true
- }
- }
- function keyOnPoint(px, py) {
- var parentItem = keyboardLayoutLoader
- var child = parentItem.childAt(px, py)
- while (child !== null) {
- var position = parentItem.mapToItem(child, px, py)
- px = position.x; py = position.y
- parentItem = child
- child = parentItem.childAt(px, py)
- if (child && child.key !== undefined)
- return child
- }
- return null
- }
- function hitInitialKey(x, y, margin) {
- if (!initialKey)
- return false
- var position = initialKey.mapFromItem(keyboardInputArea, x, y)
- return (position.x > -margin
- && position.y > -margin
- && position.x < initialKey.width + margin
- && position.y < initialKey.height + margin)
- }
- function containsPoint(touchPoints, point) {
- if (!point)
- return false
- for (var i in touchPoints)
- if (touchPoints[i].pointId == point.pointId)
- return true
- return false
- }
- function releaseActiveKey() {
- if (alternativeKeys.active) {
- alternativeKeys.clicked()
- } else if (keyboard.activeKey) {
- release(keyboard.activeKey)
- }
- reset()
- }
- function reset() {
- releaseInaccuracyTimer.stop()
- pressAndHoldTimer.stop()
- setActiveKey(null)
- activeTouchPoint = null
- alternativeKeys.close()
- if (dragSymbolMode) {
- keyboard.symbolMode = false
- dragSymbolMode = false
- }
- }
- function nextKeyInNavigation(dX, dY, wrapEnabled) {
- var nextKey = null, x, y, itemOffset
- if (dX !== 0 || dY !== 0) {
- var offsetX, offsetY
- for (offsetX = dX, offsetY = dY;
- Math.abs(offsetX) < width && Math.abs(offsetY) < height;
- offsetX += dX, offsetY += dY) {
- x = navigationCursor.x + offsetX
- if (x < 0) {
- if (!wrapEnabled)
- break
- x += width
- } else if (x >= width) {
- if (!wrapEnabled)
- break
- x -= width
- }
- y = navigationCursor.y + offsetY
- if (y < 0) {
- if (!wrapEnabled)
- break
- y += height
- } else if (y >= height) {
- if (!wrapEnabled)
- break
- y -= height
- }
- nextKey = keyOnPoint(x, y)
- if (nextKey) {
- // Check if key is visible. Only the visible keys have keyPanelDelegate set.
- if (nextKey != initialKey && nextKey.hasOwnProperty("keyPanelDelegate") && nextKey.keyPanelDelegate)
- break
- // Jump over the item to reduce the number of iterations in this loop
- itemOffset = mapToItem(nextKey, x, y)
- if (dX > 0)
- offsetX += nextKey.width - itemOffset.x
- else if (dX < 0)
- offsetX -= itemOffset.x
- else if (dY > 0)
- offsetY += nextKey.height - itemOffset.y
- else if (dY < 0)
- offsetY -= itemOffset.y
- }
- nextKey = null
- }
- } else {
- nextKey = keyOnPoint(navigationCursor.x, navigationCursor.y)
- }
- if (nextKey) {
- itemOffset = mapFromItem(nextKey, nextKey.width / 2, nextKey.height / 2)
- if (dX) {
- x = itemOffset.x
- } else if (dY) {
- y = itemOffset.y
- } else {
- x = itemOffset.x
- y = itemOffset.y
- }
- navigationCursor = Qt.point(x, y)
- }
- return nextKey
- }
- function navigateToNextKey(dX, dY, wrapEnabled) {
- // Resolve initial landing point of the navigation cursor
- if (!keyboard.navigationModeActive || keyboard.navigationCursor === Qt.point(-1, -1)) {
- if (dX > 0)
- navigationCursor = Qt.point(0, height / 2)
- else if (dX < 0)
- navigationCursor = Qt.point(width, height / 2)
- else if (dY > 0)
- navigationCursor = Qt.point(width / 2, 0)
- else if (dY < 0)
- navigationCursor = Qt.point(width / 2, height)
- else
- navigationCursor = Qt.point(width / 2, height / 2)
- keyboard.navigationModeActive = true
- }
- if (dX && dY) {
- initialKey = nextKeyInNavigation(dX, 0, wrapEnabled)
- if (initialKey || wrapEnabled)
- initialKey = nextKeyInNavigation(0, dY, wrapEnabled)
- } else {
- initialKey = nextKeyInNavigation(dX, dY, wrapEnabled)
- }
- return initialKey !== null
- }
-
- onPressed: {
- keyboard.navigationModeActive = false
-
- // Immediately release any pending key that the user might be
- // holding (and about to release) when a second key is pressed.
- if (activeTouchPoint)
- releaseActiveKey();
-
- for (var i in touchPoints) {
- // Release any key pressed by a previous iteration of the loop.
- if (containsPoint(touchPoints, activeTouchPoint))
- releaseActiveKey();
-
- releaseInaccuracyTimer.start()
- pressAndHoldTimer.start()
- initialKey = keyOnPoint(touchPoints[i].x, touchPoints[i].y)
- activeTouchPoint = touchPoints[i]
- setActiveKey(initialKey)
- press(initialKey, true)
- }
- }
- onUpdated: {
- if (!containsPoint(touchPoints, activeTouchPoint))
- return
-
- if (alternativeKeys.active) {
- alternativeKeys.move(mapToItem(alternativeKeys, activeTouchPoint.x, 0).x)
- } else {
- var key = null
- if (releaseInaccuracyTimer.running) {
- if (hitInitialKey(activeTouchPoint.x, activeTouchPoint.y, releaseMargin)) {
- key = initialKey
- } else if (initialKey) {
- releaseInaccuracyTimer.stop()
- initialKey = null
- }
- }
- if (key === null) {
- key = keyOnPoint(activeTouchPoint.x, activeTouchPoint.y)
- }
- if (key !== keyboard.activeKey) {
- InputContext.inputEngine.virtualKeyCancel()
- setActiveKey(key)
- press(key, false)
- if (dragSymbolMode) {
- if (key && key.functionKey && key.key !== Qt.Key_Context1)
- pressAndHoldTimer.restart()
- else
- pressAndHoldTimer.stop()
- }
- }
- }
- }
- onReleased: {
- if (containsPoint(touchPoints, activeTouchPoint)) {
- if (dragSymbolMode) {
- var key = keyOnPoint(activeTouchPoint.x, activeTouchPoint.y)
- if (key && key.key === Qt.Key_Context1) {
- dragSymbolMode = false
- InputContext.inputEngine.virtualKeyCancel()
- reset()
- return
- }
- }
- releaseActiveKey();
- }
- }
- onCanceled: {
- if (containsPoint(touchPoints, activeTouchPoint))
- reset()
- }
- }
- }
- }
- }
-
- Item {
- id: languagePopup
- z: 1
- anchors.fill: parent
- LayoutMirroring.enabled: false
- LayoutMirroring.childrenInherit: true
-
- MouseArea {
- onPressed: keyboard.hideLanguagePopup()
- anchors.fill: parent
- enabled: languagePopupList.enabled
- }
-
- PopupList {
- id: languagePopupList
- objectName: "languagePopupList"
- z: 2
- anchors.left: parent.left
- anchors.top: parent.top
- enabled: false
- model: languageListModel
- delegate: keyboard.style ? keyboard.style.languageListDelegate : null
- highlight: keyboard.style ? keyboard.style.languageListHighlight : defaultHighlight
- add: keyboard.style ? keyboard.style.languageListAdd : null
- remove: keyboard.style ? keyboard.style.languageListRemove : null
- background: keyboard.style ? keyboard.style.languageListBackground : null
- property rect previewRect: Qt.rect(keyboard.x + languagePopupList.x,
- keyboard.y + languagePopupList.y,
- languagePopupList.width,
- languagePopupList.height)
- }
-
- ListModel {
- id: languageListModel
-
- function selectItem(index) {
- languagePopupList.currentIndex = index
- keyboard.soundEffect.play(languagePopupList.currentItem.soundEffect)
- changeLanguageTimer.newLocaleIndex = languageListModel.get(index).localeIndex
- changeLanguageTimer.start()
- }
- }
-
- Timer {
- id: changeLanguageTimer
- interval: 1
- property int newLocaleIndex
- onTriggered: {
- if (languagePopupListActive) {
- hideLanguagePopup()
- start()
- } else {
- localeIndex = newLocaleIndex
- }
- }
- }
-
- function show(locales, parentItem, customLayoutsOnly) {
- if (!languagePopupList.enabled) {
- languageListModel.clear()
- for (var i = 0; i < locales.length; i++) {
- languageListModel.append({localeName: locales[i].name, displayName: locales[i].locale.nativeLanguageName, localeIndex: locales[i].index})
- if (locales[i].index === keyboard.localeIndex)
- languagePopupList.currentIndex = i
- }
- languagePopupList.positionViewAtIndex(languagePopupList.currentIndex, ListView.Center)
- languagePopupList.anchors.leftMargin = Qt.binding(function() {return Math.round(keyboard.mapFromItem(parentItem, (parentItem.width - languagePopupList.width) / 2, 0).x)})
- languagePopupList.anchors.topMargin = Qt.binding(function() {return Math.round(keyboard.mapFromItem(parentItem, 0, -languagePopupList.height).y)})
- }
- languagePopupList.enabled = true
- }
-
- function hide() {
- if (languagePopupList.enabled) {
- languagePopupList.enabled = false
- languagePopupList.anchors.leftMargin = undefined
- languagePopupList.anchors.topMargin = undefined
- languageListModel.clear()
- }
- }
- }
-
- function showLanguagePopup(parentItem, customLayoutsOnly) {
- var locales = keyboard.listLocales(customLayoutsOnly, parent.externalLanguageSwitchEnabled)
- if (parent.externalLanguageSwitchEnabled) {
- var currentIndex = 0
- for (var i = 0; i < locales.length; i++) {
- if (locales[i] === keyboard.locale) {
- currentIndex = i
- break
- }
- }
- parent.externalLanguageSwitch(locales, currentIndex)
- return
- }
- languagePopup.show(locales, parentItem, customLayoutsOnly)
- }
-
- function hideLanguagePopup() {
- languagePopup.hide()
- }
-
- MouseArea {
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: keyboard.parent.parent ? keyboard.parent.parent.height : Screen.height
- onPressed: keyboard.hideWordCandidateContextMenu()
- enabled: wordCandidateContextMenuList.enabled
- }
-
- Item {
- id: wordCandidateContextMenu
- objectName: "wordCandidateContextMenu"
- z: 1
- anchors.fill: parent
- LayoutMirroring.enabled: false
- LayoutMirroring.childrenInherit: true
- property int previousWordCandidateIndex: -1
- readonly property bool active: wordCandidateContextMenuList.visible
- property bool openedByNavigationKeyLongPress
-
- PopupList {
- id: wordCandidateContextMenuList
- objectName: "wordCandidateContextMenuList"
- z: 2
- anchors.left: parent.left
- anchors.top: parent.top
- enabled: false
- model: wordCandidateContextMenuListModel
- property rect previewRect: Qt.rect(keyboard.x + wordCandidateContextMenuList.x,
- keyboard.y + wordCandidateContextMenuList.y,
- wordCandidateContextMenuList.width,
- wordCandidateContextMenuList.height)
- }
-
- ListModel {
- id: wordCandidateContextMenuListModel
-
- function selectItem(index) {
- wordCandidateContextMenu.previousWordCandidateIndex = -1
- wordCandidateContextMenuList.currentIndex = index
- keyboard.soundEffect.play(wordCandidateContextMenuList.currentItem.soundEffect)
- switch (get(index).action) {
- case "remove":
- wordCandidateView.model.removeItem(wordCandidateView.currentIndex)
- break
- }
- keyboard.hideWordCandidateContextMenu()
- }
- }
-
- function show(wordCandidateIndex) {
- if (wordCandidateContextMenu.enabled)
- wordCandidateContextMenu.hide()
-
- wordCandidateContextMenuListModel.clear()
-
- var canRemoveSuggestion = wordCandidateView.model.dataAt(wordCandidateIndex, SelectionListModel.Role.CanRemoveSuggestion)
- if (canRemoveSuggestion) {
- var dictionaryType = wordCandidateView.model.dataAt(wordCandidateIndex, SelectionListModel.Role.Dictionary)
- var removeItemText;
- switch (dictionaryType) {
- case SelectionListModel.DictionaryType.User:
- //~ VirtualKeyboard Context menu for word suggestion if it can be removed from the user dictionary.
- removeItemText = qsTr("Remove from dictionary")
- break
- case SelectionListModel.DictionaryType.Default:
- // Fallthrough
- default:
- //~ VirtualKeyboard Context menu for word suggestion if it can be removed from the default dictionary.
- removeItemText = qsTr("Block word")
- break
- }
- wordCandidateContextMenuListModel.append({action: "remove", display: removeItemText, wordCompletionLength: 0})
- }
-
- if (wordCandidateContextMenuListModel.count === 0)
- return
-
- previousWordCandidateIndex = wordCandidateView.currentIndex
- wordCandidateView.currentIndex = wordCandidateIndex
-
- wordCandidateContextMenuList.anchors.leftMargin = Qt.binding(function() {
- var leftBorder = Math.round(wordCandidateView.mapFromItem(wordCandidateView.currentItem, (wordCandidateView.currentItem.width - wordCandidateContextMenuList.width) / 2, 0).x)
- var rightBorder = Math.round(wordCandidateContextMenuList.parent.width - wordCandidateContextMenuList.width)
- return Math.min(leftBorder, rightBorder)
- })
-
- wordCandidateContextMenuList.enabled = true
- }
-
- function hide() {
- if (wordCandidateContextMenuList.enabled) {
- if (previousWordCandidateIndex !== -1) {
- wordCandidateView.currentIndex = previousWordCandidateIndex
- previousWordCandidateIndex = -1
- }
- wordCandidateContextMenuList.enabled = false
- wordCandidateContextMenuList.anchors.leftMargin = undefined
- wordCandidateContextMenuListModel.clear()
- }
- openedByNavigationKeyLongPress = false
- }
-
- function selectCurrentItem() {
- if (active && wordCandidateContextMenuList.currentIndex !== -1)
- wordCandidateContextMenuListModel.selectItem(wordCandidateContextMenuList.currentIndex)
- }
- }
-
- function showWordCandidateContextMenu(wordCandidateIndex) {
- wordCandidateContextMenu.show(wordCandidateIndex)
- }
-
- function hideWordCandidateContextMenu() {
- wordCandidateContextMenu.hide()
- }
-
- function updateInputMethod() {
- if (!keyboardLayoutLoader.item)
- return
- if (!InputContext.priv.focus)
- return
-
- // Reset the custom input method if it is not included in the list of shared layouts
- if (customInputMethod && !inputMethodNeedsReset && customInputMethodSharedLayouts.indexOf(layoutType) === -1)
- inputMethodNeedsReset = true
-
- if (inputMethodNeedsReset) {
- if (customInputMethod) {
- customInputMethod.destroy()
- customInputMethod = null
- }
- customInputMethodSharedLayouts = []
- inputMethodNeedsReset = false
- }
-
- var inputMethod = null
- var inputMode = InputContext.inputEngine.inputMode
-
- // Use input method from keyboard layout
- if (keyboardLayoutLoader.item.inputMethod) {
- inputMethod = keyboardLayoutLoader.item.inputMethod
- } else if (!customInputMethod) {
- try {
- customInputMethod = keyboardLayoutLoader.item.createInputMethod()
- if (customInputMethod) {
- // Pull the list of shared layouts from the keyboard layout
- if (keyboardLayoutLoader.item.sharedLayouts)
- customInputMethodSharedLayouts = customInputMethodSharedLayouts.concat(keyboardLayoutLoader.item.sharedLayouts)
-
- // Make sure the current layout is included in the list
- if (customInputMethodSharedLayouts.indexOf(layoutType) === -1)
- customInputMethodSharedLayouts.push(layoutType)
-
- // Reset input mode, since inputEngine.inputModes is updated
- inputModeNeedsReset = true
- }
- } catch (e) {
- console.error(e.message)
- }
- }
- if (!inputMethod)
- inputMethod = customInputMethod ? customInputMethod : defaultInputMethod
-
- var inputMethodChanged = InputContext.inputEngine.inputMethod !== inputMethod
- if (inputMethodChanged) {
- InputContext.inputEngine.inputMethod = inputMethod
- }
-
- if (InputContext.inputEngine.inputMethod) {
- var inputModes = InputContext.inputEngine.inputModes
- if (inputModes.length > 0) {
- // Reset to default input mode if the input locale has changed
- if (inputModeNeedsReset) {
- inputMode = inputModes[0]
-
- // Check the current layout for input mode override
- if (keyboardLayoutLoader.item.inputMode !== -1)
- inputMode = keyboardLayoutLoader.item.inputMode
-
- // Update input mode automatically in handwriting mode
- if (keyboard.handwritingMode) {
- if (keyboard.dialableCharactersOnly && inputModes.indexOf(InputEngine.InputMode.Dialable) !== -1)
- inputMode = InputEngine.InputMode.Dialable
- else if ((keyboard.formattedNumbersOnly || keyboard.digitsOnly) && inputModes.indexOf(InputEngine.InputMode.Numeric) !== -1)
- inputMode = InputEngine.InputMode.Numeric
- else if (keyboardLayoutLoader.item.inputMode === -1)
- inputMode = inputModes[0]
- }
-
- // Check the input method hints for input mode overrides
- if (latinOnly)
- inputMode = InputEngine.InputMode.Latin
- if (preferNumbers)
- inputMode = InputEngine.InputMode.Numeric
- }
-
- // Make sure the input mode is supported by the current input method
- if (inputModes.indexOf(inputMode) === -1)
- inputMode = inputModes[0]
-
- if (InputContext.inputEngine.inputMode !== inputMode || inputMethodChanged || inputModeNeedsReset)
- InputContext.inputEngine.inputMode = inputMode
-
- inputModeNeedsReset = false
- }
- }
-
- // Clear the toggle shift timer
- InputContext.priv.shiftHandler.clearToggleShiftTimer()
- }
-
- function updateLayout() {
- var newLayout
- newLayout = findLayout(locale, layoutType)
- if (!newLayout.length) {
- newLayout = findLayout(locale, "main")
- }
- layout = newLayout
- inputLocale = locale
- updateInputMethod()
- }
-
- function updateDefaultLocale() {
- updateAvailableLocaleIndices()
- if (layoutsModel.count > 0) {
- var defaultLocales = []
- if (isValidLocale(VirtualKeyboardSettings.locale))
- defaultLocales.push(VirtualKeyboardSettings.locale)
- if (isValidLocale(InputContext.locale))
- defaultLocales.push(InputContext.locale)
- if (VirtualKeyboardSettings.activeLocales.length > 0 && isValidLocale(VirtualKeyboardSettings.activeLocales[0]))
- defaultLocales.push(VirtualKeyboardSettings.activeLocales[0])
- if (VirtualKeyboardSettings.availableLocales.indexOf("en_GB") !== -1)
- defaultLocales.push("en_GB")
- if (availableLocaleIndices.length > 0)
- defaultLocales.push(layoutsModel.get(availableLocaleIndices[0], "fileName"))
- var newDefaultLocaleIndex = -1
- for (var i = 0; i < defaultLocales.length; i++) {
- newDefaultLocaleIndex = findLocale(defaultLocales[i], -1)
- if (availableLocaleIndices.indexOf(newDefaultLocaleIndex) !== -1)
- break;
- newDefaultLocaleIndex = -1
- }
- defaultLocaleIndex = newDefaultLocaleIndex
- } else {
- defaultLocaleIndex = -1
- }
- }
-
- function filterLocaleIndices(filterCb) {
- var localeIndices = []
- for (var i = 0; i < layoutsModel.count; i++) {
- if (localeIndices.indexOf(i) === -1) {
- var localeName = layoutsModel.get(i, "fileName")
- if (filterCb(localeName) && findLayout(localeName, "main"))
- localeIndices.push(i)
- }
- }
- return localeIndices
- }
-
- function updateAvailableLocaleIndices() {
- // Update list of all available locales
- var fallbackIndex = findFallbackIndex()
- var newIndices = filterLocaleIndices(function(localeName) {
- return isValidLocale(localeName)
- })
-
- // Handle case where the VirtualKeyboardSettings.activeLocales contains no valid entries
- // Fetch all locales by ignoring active locales setting
- if (newIndices.length === 0) {
- newIndices = filterLocaleIndices(function(localeName) {
- return isValidLocale(localeName, true)
- })
- }
-
- // Fetch matching locale names
- var newAvailableLocales = []
- for (var i = 0; i < newIndices.length; i++) {
- newAvailableLocales.push(layoutsModel.get(newIndices[i], "fileName"))
- }
-
- newIndices.sort(function(a, b) { return a - b })
- availableLocaleIndices = newIndices
- newAvailableLocales.sort()
- InputContext.priv.updateAvailableLocales(newAvailableLocales)
-
- // Update list of custom locale indices
- newIndices = []
- for (i = 0; i < availableLocaleIndices.length; i++) {
- if (availableLocaleIndices[i] === localeIndex ||
- layoutExists(layoutsModel.get(availableLocaleIndices[i], "fileName"), layoutType))
- newIndices.push(availableLocaleIndices[i])
- }
- availableCustomLocaleIndices = newIndices
- }
-
- function listLocales(customLayoutsOnly, localeNameOnly) {
- var locales = []
- var localeIndices = customLayoutsOnly ? availableCustomLocaleIndices : availableLocaleIndices
- for (var i = 0; i < localeIndices.length; i++) {
- var layoutFolder = layoutsModel.get(localeIndices[i], "fileName")
- if (localeNameOnly)
- locales.push(layoutFolder)
- else
- locales.push({locale:Qt.locale(layoutFolder), index:localeIndices[i], name:layoutFolder})
- }
- return locales
- }
-
- function nextLocaleIndex(customLayoutsOnly) {
- var newLocaleIndex = localeIndex
- var localeIndices = customLayoutsOnly ? availableCustomLocaleIndices : availableLocaleIndices
- var i = localeIndices.indexOf(localeIndex)
- if (i !== -1) {
- i = (i + 1) % localeIndices.length
- newLocaleIndex = localeIndices[i]
- }
- return newLocaleIndex
- }
-
- function changeInputLanguage(customLayoutsOnly) {
- var newLocaleIndex = nextLocaleIndex(customLayoutsOnly)
- if (newLocaleIndex !== -1 && newLocaleIndex !== localeIndex)
- localeIndex = newLocaleIndex
- }
-
- function canChangeInputLanguage(customLayoutsOnly) {
- if (customLayoutsOnly)
- return availableCustomLocaleIndices.length > 1
- return availableLocaleIndices.length > 1
- }
-
- function findLocale(localeName, defaultValue) {
- var languageCode = localeName.substring(0, 3) // Including the '_' delimiter
- var languageMatch = -1
- for (var i = 0; i < layoutsModel.count; i++) {
- if (!layoutsModel.isFolder(i))
- continue
- var layoutFolder = layoutsModel.get(i, "fileName")
- if (layoutFolder === localeName)
- return i
- if (languageMatch == -1 && layoutFolder.substring(0, 3) === languageCode)
- languageMatch = i
- }
- return (languageMatch != -1) ? languageMatch : defaultValue
- }
-
- function findFallbackIndex() {
- for (var i = 0; i < layoutsModel.count; i++) {
- var layoutFolder = layoutsModel.get(i, "fileName")
- if (layoutFolder === "fallback")
- return i
- }
- return -1
- }
-
- function isValidLocale(localeNameOrIndex, ignoreActiveLocales) {
- var localeName
- if (typeof localeNameOrIndex == "number") {
- if (localeNameOrIndex < 0 || localeNameOrIndex >= layoutsModel.count)
- return false
- localeName = layoutsModel.get(localeNameOrIndex, "fileName")
- } else {
- localeName = localeNameOrIndex
- }
-
- if (!localeName)
- return false
-
- if (localeName === "fallback")
- return false
-
- if (Qt.locale(localeName).name === "C")
- return false
-
- if (ignoreActiveLocales !== true &&
- VirtualKeyboardSettings.activeLocales.length > 0 &&
- VirtualKeyboardSettings.activeLocales.indexOf(localeName) === -1)
- return false
-
- return true
- }
-
- function getLayoutFile(localeName, layoutType) {
- if (localeName === "" || layoutType === "")
- return ""
- return layoutsModel.folder + "/" + localeName + "/" + layoutType + ".qml"
- }
-
- function getFallbackFile(localeName, layoutType) {
- if (localeName === "" || layoutType === "")
- return ""
- return layoutsModel.folder + "/" + localeName + "/" + layoutType + ".fallback"
- }
-
- function layoutExists(localeName, layoutType) {
- var result = InputContext.priv.fileExists(getLayoutFile(localeName, layoutType))
- if (!result && layoutType === "handwriting")
- result = InputContext.priv.fileExists(getFallbackFile(localeName, layoutType))
- return result
- }
-
- function findLayout(localeName, layoutType) {
- var layoutFile = getLayoutFile(localeName, layoutType)
- if (InputContext.priv.fileExists(layoutFile))
- return layoutFile
- var fallbackFile = getFallbackFile(localeName, layoutType)
- if (InputContext.priv.fileExists(fallbackFile)) {
- layoutFile = getLayoutFile("fallback", layoutType)
- if (InputContext.priv.fileExists(layoutFile))
- return layoutFile
- }
- return ""
- }
-
- function isHandwritingAvailable() {
- return InputContext.priv.inputMethods.indexOf("HandwritingInputMethod") !== -1 && layoutExists(locale, "handwriting")
- }
-
- function setHandwritingMode(enabled, resetInputMode) {
- if (enabled && resetInputMode)
- inputModeNeedsReset = true
- handwritingMode = enabled
- }
-}
diff --git a/src/virtualkeyboard/content/components/KeyboardColumn.qml b/src/virtualkeyboard/content/components/KeyboardColumn.qml
deleted file mode 100644
index d5b1fbfe..00000000
--- a/src/virtualkeyboard/content/components/KeyboardColumn.qml
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-
-/*!
- \qmltype KeyboardColumn
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits ColumnLayout
-
- \brief Keyboard column for keyboard layouts.
-
- This type can be used in special cases where multiple columns
- are added to a single keyboard layout.
-*/
-
-ColumnLayout {
- /*! Sets the key weight for all children keys.
-
- The default value is inherited from the parent element
- in the layout hierarchy.
- */
- property real keyWeight: parent ? parent.keyWeight : undefined
-
- /*! \since QtQuick.VirtualKeyboard 2.0
-
- Sets the \c smallTextVisible for all children keys.
-
- The default value is inherited from the parent element
- in the layout hierarchy.
- */
- property bool smallTextVisible: parent ? parent.smallTextVisible : false
-
- spacing: 0
-}
diff --git a/src/virtualkeyboard/content/components/KeyboardLayout.qml b/src/virtualkeyboard/content/components/KeyboardLayout.qml
deleted file mode 100644
index 5b790dc6..00000000
--- a/src/virtualkeyboard/content/components/KeyboardLayout.qml
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype KeyboardLayout
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits ColumnLayout
-
- \brief Keyboard layout.
-
- This type is the root element of the keyboard layout.
- Use this element to build a new keyboard layout.
-
- Example:
-
- \code
- import QtQuick 2.0
- import QtQuick.Layouts 1.0
- import QtQuick.VirtualKeyboard 2.1
-
- // file: layouts/en_GB/main.qml
-
- KeyboardLayout {
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- }
- }
- \endcode
-*/
-
-ColumnLayout {
- /*! Sets the input method to be used in this layout.
-
- This property allows a custom input method to be
- used in this layout.
- */
- property var inputMethod
-
- /*! This function may be overridden by the keyboard layout
- to create the input method object dynamically. The default
- implementation returns \c null.
-
- The input method object created by this function can outlive
- keyboard layout transitions in certain cases. In particular,
- this applies to the transitions between the layouts listed in
- the sharedLayouts property.
- */
- function createInputMethod() {
- return null
- }
-
- /*! List of layout names which share the input method created
- by the createInputMethod() function.
-
- If the list is empty (the default) the input method is not
- shared with any other layout and will be destroyed when the
- layout changes.
-
- The list should contain only the name of the layout type,
- e.g., ['symbols']. The current layout does not have to be
- included in the list.
- */
- property var sharedLayouts
-
- /*! Sets the input mode to be used in this layout.
-
- By default, the virtual keyboard attempts to preserve
- the current input mode when switching to a different
- keyboard layout.
-
- If the current input mode is not valid in the current
- context, the default input mode is specified by the
- input method.
- */
- property int inputMode: -1
-
- /*! Sets the key weight for all children keys.
-
- The default value is inherited from the parent element
- in the layout hierarchy.
- */
- property real keyWeight
-
- /*! \since QtQuick.VirtualKeyboard 2.0
-
- Sets the \c smallTextVisible for all children keys.
-
- The default value is inherited from the parent element
- in the layout hierarchy.
- */
- property bool smallTextVisible
-
- spacing: 0
-}
diff --git a/src/virtualkeyboard/content/components/KeyboardLayoutLoader.qml b/src/virtualkeyboard/content/components/KeyboardLayoutLoader.qml
deleted file mode 100644
index 800667d7..00000000
--- a/src/virtualkeyboard/content/components/KeyboardLayoutLoader.qml
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype KeyboardLayoutLoader
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Loader
- \since QtQuick.VirtualKeyboard 1.1
-
- \brief Allows dynamic loading of keyboard layout.
-
- This type is useful for keyboard layouts consisting of multiple pages of keys.
-
- A single keyboard layout (a page) is defined by using the Component
- as a container. The active keyboard layout can then be changed by
- setting the sourceComponent property to a different value.
-
- Example:
-
- \code
- import QtQuick 2.0
- import QtQuick.Layouts 1.0
- import QtQuick.VirtualKeyboard 2.1
-
- // file: layouts/en_GB/symbols.qml
-
- KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- // Keyboard layout definition for page 1
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- // Keyboard layout definition for page 2
- }
- }
- }
- \endcode
-*/
-
-Loader {
- /*! Sets the input method for all the keyboard layouts loaded
- in this context.
-
- The input method can either be set separately for each keyboard
- layout, or commonly at this context. If set separately, then this
- property should not be modified.
- */
- property var inputMethod: item ? item.inputMethod : null
-
- /*! This function may be overridden by the keyboard layout
- to create the input method object dynamically. The default
- implementation forwards the call to the child keyboard
- layout.
-
- The input method object created by this function can outlive
- keyboard layout transitions in certain cases. In particular,
- this applies to the transitions between the layouts listed in
- the sharedLayouts property.
- */
- function createInputMethod() {
- return item ? item.createInputMethod() : null
- }
-
- /*! List of layout names which share the input method created
- by the createInputMethod() function.
-
- If the list is empty (the default) the input method is not
- shared with any other layout and will be destroyed when the
- layout changes.
-
- The list should contain only the name of the layout type,
- e.g., ['symbols']. The current layout does not have to be
- included in the list.
- */
- property var sharedLayouts: item ? item.sharedLayouts : null
-
- /*! Sets the input mode for all the keyboard layouts loaded
- in this context.
-
- The input mode can either be set separately for each keyboard
- layout, or commonly at this context. If set separately, then this
- property should not be modified.
- */
- property int inputMode: item ? item.inputMode : -1
-
- property int __updateCount
-
- active: parent !== null
-
- onItemChanged: if (parent && item && __updateCount++ > 0 && !keyboard.inputMethodNeedsReset) keyboard.updateInputMethod()
-}
diff --git a/src/virtualkeyboard/content/components/KeyboardRow.qml b/src/virtualkeyboard/content/components/KeyboardRow.qml
deleted file mode 100644
index 5c9db6b2..00000000
--- a/src/virtualkeyboard/content/components/KeyboardRow.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-
-/*!
- \qmltype KeyboardRow
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits RowLayout
-
- \brief Keyboard row for keyboard layouts.
-
- Specifies a row of keys in the keyboard layout.
-*/
-
-RowLayout {
- /*! Sets the key weight for all children keys.
-
- The default value is inherited from the parent element
- in the layout hierarchy.
- */
- property real keyWeight: parent ? parent.keyWeight : undefined
-
- /*! \since QtQuick.VirtualKeyboard 2.0
-
- Sets the \c smallTextVisible for all children keys.
-
- The default value is inherited from the parent element
- in the layout hierarchy.
- */
- property bool smallTextVisible: parent ? parent.smallTextVisible : false
-
- spacing: 0
-}
diff --git a/src/virtualkeyboard/content/components/ModeKey.qml b/src/virtualkeyboard/content/components/ModeKey.qml
deleted file mode 100644
index 5fd24b41..00000000
--- a/src/virtualkeyboard/content/components/ModeKey.qml
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype ModeKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Key
- \since QtQuick.VirtualKeyboard 2.0
-
- \brief Generic mode key for keyboard layouts.
-
- This key provides generic mode button functionality.
-
- A key press toggles the current mode without emitting key event
- for input method processing.
-
- ModeKey can be used in situations where a particular mode is switched
- "ON / OFF", and where the mode change does not require changing the
- keyboard layout. When this component is used, the \l { BaseKey::displayText } { displayText } should
- remain the same regardless of the mode, because the keyboard style
- visualizes the status.
-*/
-
-Key {
- /*! This property provides the current mode.
-
- The default is false.
- */
- property bool mode
- noKeyEvent: true
- functionKey: true
- onClicked: mode = !mode
- keyPanelDelegate: keyboard.style ? keyboard.style.modeKeyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/MultiSoundEffect.qml b/src/virtualkeyboard/content/components/MultiSoundEffect.qml
deleted file mode 100644
index 685a21df..00000000
--- a/src/virtualkeyboard/content/components/MultiSoundEffect.qml
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtMultimedia 5.0
-
-Item {
- id: multiSoundEffect
- property url source
- property int maxInstances: 2
- property var __cachedInstances
- property int __currentIndex: 0
-
- signal playingChanged(url source, bool playing)
-
- Component {
- id: soundEffectComp
- SoundEffect {
- source: multiSoundEffect.source
- onPlayingChanged: multiSoundEffect.playingChanged(source, playing)
- }
- }
-
- onSourceChanged: {
- __cachedInstances = []
- __currentIndex = 0
- if (source != Qt.resolvedUrl("")) {
- var i
- for (i = 0; i < maxInstances; i++) {
- var soundEffect = soundEffectComp.createObject(multiSoundEffect)
- if (soundEffect === null)
- return
- __cachedInstances.push(soundEffect)
- }
- }
- }
-
- function play() {
- if (__cachedInstances === undefined || __cachedInstances.length === 0)
- return
- if (__cachedInstances[__currentIndex].playing) {
- __cachedInstances[__currentIndex].stop()
- __currentIndex = (__currentIndex + 1) % __cachedInstances.length
- }
- __cachedInstances[__currentIndex].play()
- }
-}
diff --git a/src/virtualkeyboard/content/components/MultitapInputMethod.qml b/src/virtualkeyboard/content/components/MultitapInputMethod.qml
deleted file mode 100644
index 3c14a544..00000000
--- a/src/virtualkeyboard/content/components/MultitapInputMethod.qml
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-InputMethod {
- property string multitapSequence
- property int multitapIndex: -1
-
- onMultitapSequenceChanged: selectionListChanged(SelectionListModel.Type.WordCandidateList)
- onMultitapIndexChanged: selectionListActiveItemChanged(SelectionListModel.Type.WordCandidateList, multitapIndex)
-
- property variant multiTapTimer: Timer {
- interval: 1200
- onTriggered: {
- update()
- }
- }
-
- function inputModes(locale) {
- return [InputEngine.InputMode.Latin, InputEngine.InputMode.Numeric, InputEngine.InputMode.Dialable];
- }
-
- function setInputMode(locale, inputMode) {
- return true
- }
-
- function setTextCase(textCase) {
- return true
- }
-
- function reset() {
- multiTapTimer.stop()
- multitapIndex = -1
- multitapSequence = ""
- }
-
- function update() {
- multiTapTimer.stop()
- multitapIndex = -1
- multitapSequence = ""
- if (inputContext !== null && inputContext.preeditText.length > 0) {
- inputContext.commit()
- }
- }
-
- function keyEvent(key, text, modifiers) {
- var accept = false
- switch (key) {
- case Qt.Key_Enter:
- case Qt.Key_Return:
- case Qt.Key_Tab:
- update()
- break
- case Qt.Key_Backspace:
- if (inputContext.preeditText.length > 0) {
- inputContext.clear()
- update()
- accept = true
- }
- break
- default:
- if (key !== inputEngine.previousKey) {
- update()
- }
- multitapSequence = text
- if (multitapSequence.length > 1) {
- multitapIndex = multiTapTimer.running ? (multitapIndex + 1) % multitapSequence.length : 0
- inputContext.preeditText = multitapSequence.charAt(multitapIndex)
- multiTapTimer.restart()
- } else {
- inputContext.commit(text)
- }
- accept = true
- break
- }
- return accept;
- }
-
- function selectionLists() {
- return [SelectionListModel.Type.WordCandidateList];
- }
-
- function selectionListItemCount(type) {
- return multitapSequence.length > 1 ? multitapSequence.length : 0
- }
-
- function selectionListData(type, index, role) {
- var result = null
- switch (role) {
- case SelectionListModel.Role.Display:
- result = multitapSequence.charAt(index)
- break
- default:
- break
- }
- return result
- }
-
- function selectionListItemSelected(type, index) {
- multitapIndex = index
- inputContext.preeditText = multitapSequence.charAt(multitapIndex)
- update()
- }
-}
diff --git a/src/virtualkeyboard/content/components/NumberKey.qml b/src/virtualkeyboard/content/components/NumberKey.qml
deleted file mode 100644
index dfe29912..00000000
--- a/src/virtualkeyboard/content/components/NumberKey.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype NumberKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Key
-
- \brief Specialized number key for keyboard layouts.
-
- This key emits the key code and key text for input method processing.
- A NumberKey differs from a normal \l Key in that it does not show a
- character preview.
-*/
-
-Key {
- showPreview: false
-}
diff --git a/src/virtualkeyboard/content/components/PopupList.qml b/src/virtualkeyboard/content/components/PopupList.qml
deleted file mode 100644
index dcd02ee1..00000000
--- a/src/virtualkeyboard/content/components/PopupList.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-ListView {
- property int maxVisibleItems: 5
- readonly property int preferredVisibleItems: count < maxVisibleItems ? count : maxVisibleItems
- readonly property real contentWidth: contentItem.childrenRect.width
- property alias background: popupListBackground.sourceComponent
- property alias defaultHighlight: defaultHighlight
-
- clip: true
- visible: enabled && count > 0
- width: contentWidth
- height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
- orientation: ListView.Vertical
- snapMode: ListView.SnapToItem
- delegate: keyboard.style.popupListDelegate
- highlight: keyboard.style.popupListHighlight ? keyboard.style.popupListHighlight : defaultHighlight
- highlightMoveDuration: 0
- highlightResizeDuration: 0
- add: keyboard.style.popupListAdd
- remove: keyboard.style.popupListRemove
- keyNavigationWraps: true
-
- onCurrentItemChanged: if (currentItem) keyboard.soundEffect.register(currentItem.soundEffect)
-
- Component {
- id: defaultHighlight
- Item {}
- }
-
- Loader {
- id: popupListBackground
- sourceComponent: keyboard.style.popupListBackground
- anchors.fill: parent
- z: -1
- }
-}
diff --git a/src/virtualkeyboard/content/components/SelectionControl.qml b/src/virtualkeyboard/content/components/SelectionControl.qml
deleted file mode 100644
index 16961c23..00000000
--- a/src/virtualkeyboard/content/components/SelectionControl.qml
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-Item {
- id: root
- property bool handleIsMoving: false
- property var inputContext: InputContext
- visible: enabled && (inputContext.selectionControlVisible || handleIsMoving) && !InputContext.animating
-
- Loader {
- id: anchorHandle
- sourceComponent: keyboard.style.selectionHandle
- x: visible ? inputContext.anchorRectangle.x - width/2 : 0
- y: visible ? inputContext.anchorRectangle.y + inputContext.anchorRectangle.height : 0
-
- Behavior on opacity {
- NumberAnimation { duration: 200 }
- }
- opacity: inputContext !== null && inputContext.anchorRectIntersectsClipRect ? 1.0 : 0.0
-
- MouseArea {
- width: parent.width * 2
- height: width * 1.12
- anchors.centerIn: parent
- onPositionChanged: {
- // we don't move the handles, the handles will move as the selection changes.
- // The middle of a handle is mapped to the middle of the line above it
- root.handleIsMoving = true
- var xx = x + anchorHandle.x + mouse.x
- var yy = y + anchorHandle.y + mouse.y - (anchorHandle.height + inputContext.anchorRectangle.height)/2
- var x2 = cursorHandle.x + cursorHandle.width/2
- var y2 = cursorHandle.y - inputContext.cursorRectangle.height/2
- inputContext.setSelectionOnFocusObject(Qt.point(xx,yy), Qt.point(x2,y2))
- }
- onReleased: {
- root.handleIsMoving = false
- }
- }
- }
-
- // selection cursor handle
- Loader {
- id: cursorHandle
- sourceComponent: keyboard.style.selectionHandle
- x: visible ? inputContext.cursorRectangle.x - width/2 : 0
- y: visible ? inputContext.cursorRectangle.y + inputContext.cursorRectangle.height : 0
-
- Behavior on opacity {
- NumberAnimation { duration: 200 }
- }
- opacity: inputContext !== null && inputContext.cursorRectIntersectsClipRect ? 1.0 : 0.0
-
- MouseArea {
- width: parent.width * 2
- height: width * 1.12
- anchors.centerIn: parent
- onPositionChanged: {
- // we don't move the handles, the handles will move as the selection changes.
- root.handleIsMoving = true
- var xx = anchorHandle.x + anchorHandle.width/2
- var yy = anchorHandle.y - inputContext.anchorRectangle.height/2
- var x2 = x + cursorHandle.x + mouse.x
- var y2 = y + cursorHandle.y + mouse.y - (cursorHandle.height + inputContext.cursorRectangle.height)/2
- inputContext.setSelectionOnFocusObject(Qt.point(xx, yy), Qt.point(x2, y2))
- }
- onReleased: {
- root.handleIsMoving = false
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/components/ShadowInputControl.qml b/src/virtualkeyboard/content/components/ShadowInputControl.qml
deleted file mode 100644
index e3cde2e1..00000000
--- a/src/virtualkeyboard/content/components/ShadowInputControl.qml
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
-import QtQml 2.14
-import QtQuick.VirtualKeyboard 2.2
-import QtQuick.VirtualKeyboard.Settings 2.2
-
-Item {
- id: control
-
- enabled: keyboard.active && VirtualKeyboardSettings.fullScreenMode
-
- MouseArea {
- anchors.fill: parent
- }
-
- onXChanged: InputContext.priv.shadow.updateSelectionProperties()
- onYChanged: InputContext.priv.shadow.updateSelectionProperties()
-
- Loader {
- sourceComponent: keyboard.style.fullScreenInputContainerBackground
- anchors.fill: parent
- Loader {
- id: fullScreenInputBackground
- sourceComponent: keyboard.style.fullScreenInputBackground
- anchors.fill: parent
- anchors.margins: keyboard.style.fullScreenInputMargins
- z: 1
- Flickable {
- id: flickable
- clip: true
- z: 2
- width: parent.width
- height: parent.height
- flickableDirection: Flickable.HorizontalFlick
- interactive: contentWidth > width
- contentWidth: shadowInput.width
- onContentXChanged: InputContext.priv.shadow.updateSelectionProperties()
-
- function ensureVisible(rectangle) {
- if (contentX >= rectangle.x)
- contentX = rectangle.x
- else if (contentX + width <= rectangle.x + rectangle.width)
- contentX = rectangle.x + rectangle.width - width;
- }
-
- TextInput {
- id: shadowInput
- objectName: "shadowInput"
- property bool blinkStatus: true
- width: Math.max(flickable.width, implicitWidth)
- height: implicitHeight
- anchors.verticalCenter: parent.verticalCenter
- leftPadding: keyboard.style.fullScreenInputPadding
- rightPadding: keyboard.style.fullScreenInputPadding
- activeFocusOnPress: false
- font: keyboard.style.fullScreenInputFont
- inputMethodHints: InputContext.inputMethodHints
- cursorDelegate: keyboard.style.fullScreenInputCursor
- passwordCharacter: keyboard.style.fullScreenInputPasswordCharacter
- color: keyboard.style.fullScreenInputColor
- selectionColor: keyboard.style.fullScreenInputSelectionColor
- selectedTextColor: keyboard.style.fullScreenInputSelectedTextColor
- echoMode: (InputContext.inputMethodHints & Qt.ImhHiddenText) ? TextInput.Password : TextInput.Normal
- selectByMouse: !!InputContext.inputItem && !!InputContext.inputItem.selectByMouse
- onCursorPositionChanged: {
- cursorSyncTimer.restart()
- blinkStatus = true
- cursorTimer.restart()
- }
- onSelectionStartChanged: cursorSyncTimer.restart()
- onSelectionEndChanged: cursorSyncTimer.restart()
- onCursorRectangleChanged: flickable.ensureVisible(cursorRectangle)
-
- function getAnchorPosition() {
- if (selectionStart == selectionEnd)
- return cursorPosition
- else if (selectionStart == cursorPosition)
- return selectionEnd
- else
- return selectionStart
- }
-
- Timer {
- id: cursorSyncTimer
- interval: 0
- onTriggered: {
- var anchorPosition = shadowInput.getAnchorPosition()
- if (anchorPosition !== InputContext.anchorPosition || shadowInput.cursorPosition !== InputContext.cursorPosition)
- InputContext.priv.forceCursorPosition(anchorPosition, shadowInput.cursorPosition)
- }
- }
-
- Timer {
- id: cursorTimer
- interval: Qt.styleHints.cursorFlashTime / 2
- repeat: true
- running: true
- onTriggered: shadowInput.blinkStatus = !shadowInput.blinkStatus
- }
- }
- }
- }
- }
-
- Binding {
- target: InputContext.priv.shadow
- property: "inputItem"
- value: shadowInput
- when: VirtualKeyboardSettings.fullScreenMode
- restoreMode: Binding.RestoreBinding
- }
-}
diff --git a/src/virtualkeyboard/content/components/ShiftKey.qml b/src/virtualkeyboard/content/components/ShiftKey.qml
deleted file mode 100644
index d31a601a..00000000
--- a/src/virtualkeyboard/content/components/ShiftKey.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype ShiftKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits BaseKey
-
- \brief Shift key for keyboard layouts.
-
- This key changes the shift state of the keyboard.
-*/
-
-BaseKey {
- id: shiftKey
- key: Qt.Key_Shift
- enabled: InputContext.priv.shiftHandler.toggleShiftEnabled
- highlighted: InputContext.capsLockActive
- functionKey: true
- keyPanelDelegate: keyboard.style ? keyboard.style.shiftKeyPanel : undefined
- onClicked: InputContext.priv.shiftHandler.toggleShift()
-}
diff --git a/src/virtualkeyboard/content/components/SpaceKey.qml b/src/virtualkeyboard/content/components/SpaceKey.qml
deleted file mode 100644
index 5bfd25a8..00000000
--- a/src/virtualkeyboard/content/components/SpaceKey.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype SpaceKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Key
-
- \brief Space key for keyboard layouts.
-
- This key emits a space for input method processing.
-*/
-
-Key {
- text: " "
- displayText: ""
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- keyPanelDelegate: keyboard.style ? keyboard.style.spaceKeyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/SymbolModeKey.qml b/src/virtualkeyboard/content/components/SymbolModeKey.qml
deleted file mode 100644
index 5129c390..00000000
--- a/src/virtualkeyboard/content/components/SymbolModeKey.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-/*!
- \qmltype SymbolModeKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Key
-
- \brief Symbol mode key for keyboard layouts.
-
- This key toggles between the symbol mode layout and the main layout.
-*/
-
-Key {
- key: Qt.Key_Context1
- displayText: "&123"
- functionKey: true
- onClicked: keyboard.symbolMode = !keyboard.symbolMode
- keyPanelDelegate: keyboard.style ? keyboard.style.symbolKeyPanel : undefined
-}
diff --git a/src/virtualkeyboard/content/components/TraceInputArea.qml b/src/virtualkeyboard/content/components/TraceInputArea.qml
deleted file mode 100644
index 40cb16f8..00000000
--- a/src/virtualkeyboard/content/components/TraceInputArea.qml
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Window 2.2
-import QtQuick.VirtualKeyboard 2.1
-
-/*!
- \qmltype TraceInputArea
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits MultiPointTouchArea
- \since QtQuick.VirtualKeyboard 2.0
-
- \brief A specialized MultiPointTouchArea for collecting touch input data.
-
- This type handles the trace interaction between the touch screen and the input engine.
-
- The traces are rendered using the delegate from the
- \l {KeyboardStyle::}{traceCanvasDelegate} property of the current
- \l KeyboardStyle.
-*/
-
-MultiPointTouchArea {
- id: traceInputArea
-
- /*! Pattern recognition mode of this input area.
-
- The default value is \l {InputEngine::patternRecognitionModes} {InputEngine.PatternRecognitionMode.None}.
- */
- property int patternRecognitionMode: InputEngine.PatternRecognitionMode.None
-
- /*! List of horizontal rulers in the input area.
-
- The rulers are defined as a number of pixels from the top edge of the boundingBox.
-
- Here is an example that demonstrates how to define rulers:
-
- \code
- horizontalRulers: [boundingBox.height / 3, boundingBox.height / 3 * 2]
- verticalRulers: [boundingBox.width / 3, boundingBox.width / 3 * 2]
- \endcode
- */
- property var horizontalRulers
-
- /*! List of vertical rulers in the input area.
-
- The rulers are defined as a number of pixels from the left edge of the boundingBox.
- */
- property var verticalRulers
-
- /*! Bounding box for the trace input.
-
- This property is readonly and is automatically updated based on the item size
- and margins.
- */
- readonly property rect boundingBox: (width > 0 && height > 0) ?
- Qt.rect(traceInputArea.x + traceInputArea.anchors.leftMargin,
- traceInputArea.y + traceInputArea.anchors.topMargin,
- traceInputArea.width,
- traceInputArea.height) :
- Qt.rect(0, 0, 0, 0)
-
- /*! Canvas type of this trace input area.
-
- This property can be used to distinguish between different types of canvases.
- For example, in full screen handwriting mode this property is set to \c "fullscreen", and
- in keyboard handwriting mode this property is set to \c "keyboard".
- */
- property string canvasType
-
- property var __traceCanvasList: ([])
-
- /*! \internal */
- function findTraceCanvasById(traceId) {
- for (var i = 0; i < __traceCanvasList.length;) {
- var traceCanvas = __traceCanvasList[i]
- if (!traceCanvas || !traceCanvas.trace)
- __traceCanvasList.splice(i, 1)
- else if (traceCanvas.trace.traceId === traceId)
- return traceCanvas
- else
- i++
- }
- return null
- }
-
- property var __traceCaptureDeviceInfo:
- ({
- channels: ['t'],
- sampleRate: 60,
- uniform: false,
- latency: 0.0,
- dpi: Screen.pixelDensity * 25.4
- })
- property var __traceScreenInfo:
- ({
- boundingBox: traceInputArea.boundingBox,
- horizontalRulers: traceInputArea.horizontalRulers,
- verticalRulers: traceInputArea.verticalRulers,
- canvasType: traceInputArea.canvasType
- })
-
- enabled: patternRecognitionMode !== InputEngine.PatternRecognitionMode.None && InputContext.inputEngine.patternRecognitionModes.indexOf(patternRecognitionMode) !== -1
-
- onPressed: {
- if (!keyboard.style.traceCanvasDelegate)
- return
- for (var i = 0; i < touchPoints.length; i++) {
- var trace = InputContext.inputEngine.traceBegin(touchPoints[i].pointId, patternRecognitionMode, __traceCaptureDeviceInfo, __traceScreenInfo)
- if (trace) {
- var traceCanvas = keyboard.style.traceCanvasDelegate.createObject(traceInputArea, { "trace": trace, "autoDestroy": true })
- traceCanvas.anchors.fill = traceCanvas.parent
- var index = trace.addPoint(Qt.point(touchPoints[i].x, touchPoints[i].y))
- if (trace.channels.indexOf('t') !== -1) {
- var dt = new Date()
- trace.setChannelData('t', index, dt.getTime())
- }
- __traceCanvasList.push(traceCanvas)
- }
- }
- }
-
- onUpdated: {
- for (var i = 0; i < touchPoints.length; i++) {
- var traceCanvas = findTraceCanvasById(touchPoints[i].pointId)
- if (traceCanvas) {
- var trace = traceCanvas.trace
- var index = trace.addPoint(Qt.point(touchPoints[i].x, touchPoints[i].y))
- if (trace.channels.indexOf('t') !== -1) {
- var dt = new Date()
- trace.setChannelData('t', index, dt.getTime())
- }
- }
- }
- }
-
- onReleased: {
- for (var i = 0; i < touchPoints.length; i++) {
- var traceCanvas = findTraceCanvasById(touchPoints[i].pointId)
- if (traceCanvas) {
- traceCanvas.trace.final = true
- __traceCanvasList.splice(__traceCanvasList.indexOf(traceCanvas), 1)
- InputContext.inputEngine.traceEnd(traceCanvas.trace)
- }
- }
- }
-
- onCanceled: {
- for (var i = 0; i < touchPoints.length; i++) {
- var traceCanvas = findTraceCanvasById(touchPoints[i].pointId)
- if (traceCanvas) {
- traceCanvas.trace.final = true
- traceCanvas.trace.canceled = true
- __traceCanvasList.splice(__traceCanvasList.indexOf(traceCanvas), 1)
- InputContext.inputEngine.traceEnd(traceCanvas.trace)
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/components/TraceInputKey.qml b/src/virtualkeyboard/content/components/TraceInputKey.qml
deleted file mode 100644
index dfd58ac9..00000000
--- a/src/virtualkeyboard/content/components/TraceInputKey.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-
-/*!
- \qmltype TraceInputKey
- \inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
- \inherits Item
- \since QtQuick.VirtualKeyboard 2.0
-
- \brief A specialized key for collecting touch input data.
-
- This type can be placed in the keyboard layout. It collects
- and renders touch input data (trace) from the key area.
-*/
-
-Item {
- id: traceInputKey
-
- /*! Sets the key weight value which determines the relative size of the key.
-
- Use this property to change the key size in the layout.
-
- The default value is inherited from the parent element
- of the key in the layout hierarchy.
- */
- property real weight: parent.keyWeight
-
- /*! Pattern recognition mode of this input area.
-
- The default value is \l {InputEngine::patternRecognitionModes} {InputEngine.PatternRecognitionMode.None}.
- */
- property alias patternRecognitionMode: traceInputArea.patternRecognitionMode
-
- /*! List of horizontal rulers in the input area.
-
- The rulers are defined as a number of pixels from the top edge of the bounding box.
-
- Here is an example that demonstrates how to define rulers:
-
- \code
- horizontalRulers: [boundingBox.height / 3, boundingBox.height / 3 * 2]
- verticalRulers: [boundingBox.width / 3, boundingBox.width / 3 * 2]
- \endcode
- */
- property alias horizontalRulers: traceInputArea.horizontalRulers
-
- /*! List of vertical rulers in the input area.
-
- The rulers are defined as a number of pixels from the left edge of the bounding box.
- */
- property alias verticalRulers: traceInputArea.verticalRulers
-
- /*! Bounding box for the trace input.
-
- This property is readonly and is automatically updated based on the item size
- and margins.
- */
- readonly property alias boundingBox: traceInputArea.boundingBox
-
- /*! Canvas type of this trace input area.
-
- This property can be used to distinguish between different types of canvases.
- The default value is \c "keyboard".
- */
- property alias canvasType: traceInputArea.canvasType
-
- Layout.minimumWidth: traceInputKeyPanel.implicitWidth
- Layout.minimumHeight: traceInputKeyPanel.implicitHeight
- Layout.preferredWidth: weight
- Layout.fillWidth: true
- Layout.fillHeight: true
- canvasType: "keyboard"
-
- Loader {
- id: traceInputKeyPanel
- sourceComponent: keyboard.style.traceInputKeyPanelDelegate
- anchors.fill: parent
- onStatusChanged: if (status == Loader.Ready) traceInputKeyPanel.item.control = traceInputKey
- }
-
- TraceInputArea {
- id: traceInputArea
- anchors.fill: traceInputKeyPanel
- anchors.margins: traceInputKeyPanel.item ? traceInputKeyPanel.item.traceMargins : 0
- }
-}
diff --git a/src/virtualkeyboard/content/components/WordCandidatePopupList.qml b/src/virtualkeyboard/content/components/WordCandidatePopupList.qml
deleted file mode 100644
index 5790bc74..00000000
--- a/src/virtualkeyboard/content/components/WordCandidatePopupList.qml
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-// Deliberately imported after QtQuick to avoid missing restoreMode property in Binding. Fix in Qt 6.
-import QtQml 2.14
-import QtQuick.VirtualKeyboard 2.3
-
-PopupList {
- id: wordCandidatePopupList
-
- readonly property int preferredVisibleItems: {
- if (!currentItem)
- return 0
- var maxHeight = flipVertical ? Qt.inputMethod.cursorRectangle.y : parent.height - Qt.inputMethod.cursorRectangle.height - Qt.inputMethod.cursorRectangle.y
- var result = Math.min(count, maxVisibleItems)
- while (result > 2 && result * currentItem.height > maxHeight)
- --result
- return result
- }
- readonly property bool flipVertical: currentItem &&
- Qt.inputMethod.cursorRectangle.y + (Qt.inputMethod.cursorRectangle.height / 2) > (parent.height / 2) &&
- Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height + (currentItem.height * 2) > parent.height
-
- height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
- Binding {
- target: wordCandidatePopupList
- property: "x"
- value: Math.round(Qt.inputMethod.cursorRectangle.x -
- (wordCandidatePopupList.currentItem ?
- (wordCandidatePopupList.currentItem.hasOwnProperty("cursorAnchor") ?
- wordCandidatePopupList.currentItem.cursorAnchor : wordCandidatePopupList.currentItem.width) : 0))
- when: wordCandidatePopupList.visible
- restoreMode: Binding.RestoreBinding
- }
- Binding {
- target: wordCandidatePopupList
- property: "y"
- value: Math.round(wordCandidatePopupList.flipVertical ? Qt.inputMethod.cursorRectangle.y - wordCandidatePopupList.height : Qt.inputMethod.cursorRectangle.y + Qt.inputMethod.cursorRectangle.height)
- when: wordCandidatePopupList.visible
- restoreMode: Binding.RestoreBinding
- }
- model: enabled ? InputContext.inputEngine.wordCandidateListModel : null
-
- onContentWidthChanged: viewResizeTimer.restart()
-
- Timer {
- id: viewResizeTimer
- interval: 0
- repeat: false
- onTriggered: wordCandidatePopupList.width = wordCandidatePopupList.contentWidth
- }
-
- Connections {
- target: wordCandidatePopupList.model ? wordCandidatePopupList.model : null
- onActiveItemChanged: wordCandidatePopupList.currentIndex = index
- onItemSelected: if (wordCandidatePopupList.currentItem) keyboard.soundEffect.play(wordCandidatePopupList.currentItem.soundEffect)
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/digits.qml b/src/virtualkeyboard/content/layouts/ar_AR/digits.qml
deleted file mode 100644
index 6d7047f4..00000000
--- a/src/virtualkeyboard/content/layouts/ar_AR/digits.qml
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Plugins 2.3
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.InputMode.Numeric
-
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- Layout.preferredWidth: height
- KeyboardRow {
- Key {
- key: 0x0667
- text: "\u0667"
- alternativeKeys: "\u06677"
- }
- Key {
- key: 0x0668
- text: "\u0668"
- alternativeKeys: "\u06688"
- }
- Key {
- key: 0x0669
- text: "\u0669"
- alternativeKeys: "\u06699"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- Key {
- key: 0x0664
- text: "\u0664"
- alternativeKeys: "\u06644"
- }
- Key {
- key: 0x0665
- text: "\u0665"
- alternativeKeys: "\u06655"
- }
- Key {
- key: 0x0666
- text: "\u0666"
- alternativeKeys: "\u06666"
- }
- Key {
- text: " "
- displayText: "\u2423"
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- }
- }
- KeyboardRow {
- Key {
- key: 0x0661
- text: "\u0661"
- alternativeKeys: "\u06611"
- }
- Key {
- key: 0x0662
- text: "\u0662"
- alternativeKeys: "\u06622"
- }
- Key {
- key: 0x0663
- text: "\u0663"
- alternativeKeys: "\u06633"
- }
- HideKeyboardKey {}
- }
- KeyboardRow {
- ChangeLanguageKey {
- customLayoutsOnly: true
- }
- Key {
- key: 0x0660
- text: "\u0660"
- alternativeKeys: "\u06600"
- }
- Key {
- key: Qt.Key_Comma
- text: "\u066B"
- alternativeKeys: "\u066B,."
- }
- EnterKey {}
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml b/src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml
deleted file mode 100644
index f82e4b6c..00000000
--- a/src/virtualkeyboard/content/layouts/ar_AR/handwriting.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Arabic
- readonly property bool alphabeticInputMode: [InputEngine.InputMode.Latin, InputEngine.InputMode.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- alphabeticInputMode ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- inputModeNameList: [
- "ABC", // InputEngine.InputMode.Latin
- "\u0660\u0661\u0662", // InputEngine.InputMode.Numeric
- "123", // InputEngine.InputMode.Dialable
- "", // InputEngine.InputMode.Pinyin
- "", // InputEngine.InputMode.Cangjie
- "", // InputEngine.InputMode.Zhuyin
- "", // InputEngine.InputMode.Hangul
- "", // InputEngine.InputMode.Hiragana
- "", // InputEngine.InputMode.Katakana
- "", // InputEngine.InputMode.FullwidthLatin
- "", // InputEngine.InputMode.Greek
- "", // InputEngine.InputMode.Cyrillic
- "\u0623\u200C\u0628\u200C\u062C", // InputEngine.InputMode.Arabic
- ]
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: alphabeticInputMode ? Qt.Key_Apostrophe : 0x060C
- text: alphabeticInputMode ? "'" : "\u060C"
- alternativeKeys: alphabeticInputMode ? "<>()#%&*/\\\"'=+-_" : "\"\u060C\u066B\u066C\u066D"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: alphabeticInputMode ? ":;,.?!" : ":\u061B.\u061F!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/main.qml b/src/virtualkeyboard/content/layouts/ar_AR/main.qml
deleted file mode 100644
index a7f0e5b9..00000000
--- a/src/virtualkeyboard/content/layouts/ar_AR/main.qml
+++ /dev/null
@@ -1,340 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- inputMode: InputEngine.InputMode.Arabic
- sourceComponent: InputContext.shiftActive ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u0636"
- }
- Key {
- text: "\u0635"
- }
- Key {
- text: "\u062B"
- }
- Key {
- text: "\u0642"
- }
- Key {
- text: "\u0641"
- }
- Key {
- text: "\u063A"
- }
- Key {
- text: "\u0639"
- }
- Key {
- text: "\u0647"
- }
- Key {
- text: "\u062E"
- }
- Key {
- text: "\u062D"
- }
- Key {
- text: "\u062C"
- }
- Key {
- text: "\u062F"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "\u0634"
- }
- Key {
- text: "\u0633"
- }
- Key {
- text: "\u064A"
- }
- Key {
- text: "\u0628"
- }
- Key {
- text: "\u0644"
- }
- Key {
- text: "\u0627"
- }
- Key {
- text: "\u062A"
- }
- Key {
- text: "\u0646"
- }
- Key {
- text: "\u0645"
- }
- Key {
- text: "\u0643"
- }
- Key {
- text: "\u0637"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- text: "\u0626"
- }
- Key {
- text: "\u0621"
- }
- Key {
- text: "\u0624"
- }
- Key {
- text: "\u0631"
- }
- Key {
- text: "\u0644\u0627"
- }
- Key {
- text: "\u0649"
- }
- Key {
- text: "\u0629"
- }
- Key {
- text: "\u0648"
- }
- Key {
- text: "\u0632"
- }
- Key {
- text: "\u0638"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0661\u0662\u0663\u061F"
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x060C
- text: "\u060C"
- alternativeKeys: "\"\u061F\u060C.!:\u061B\u066B\u066C\u066D"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u064E"
- }
- Key {
- text: "\u064B"
- }
- Key {
- text: "\u064F"
- }
- Key {
- text: "\u064C"
- }
- Key {
- text: "\uFEF9"
- }
- Key {
- text: "\u0625"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- text: "\u0630"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "\u0650"
- }
- Key {
- text: "\u064D"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- text: "\u0644\u0623"
- }
- Key {
- text: "\u0623"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- enabled: false
- }
- Key {
- text: "\u0652"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- text: "\u0644\u0622"
- }
- Key {
- text: "\u0622"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0661\u0662\u0663\u061F"
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x061F
- text: "\u061F"
- alternativeKeys: ".,\u060C\u061F"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/numbers.qml b/src/virtualkeyboard/content/layouts/ar_AR/numbers.qml
deleted file mode 100644
index fe709489..00000000
--- a/src/virtualkeyboard/content/layouts/ar_AR/numbers.qml
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Plugins 2.3
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.InputMode.Numeric
-
- KeyboardRow {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height / 4 * 3
- KeyboardRow {
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_division
- text: "\u00F7"
- }
- Key {
- key: Qt.Key_multiply
- text: "\u00D7"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- }
- KeyboardRow {
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- }
- }
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height / 8
- KeyboardRow {
- FillerKey {}
- }
- }
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height
- KeyboardRow {
- Key {
- key: 0x0667
- text: "\u0667"
- alternativeKeys: "\u06677"
- }
- Key {
- key: 0x0668
- text: "\u0668"
- alternativeKeys: "\u06688"
- }
- Key {
- key: 0x0669
- text: "\u0669"
- alternativeKeys: "\u06699"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- Key {
- key: 0x0664
- text: "\u0664"
- alternativeKeys: "\u06644"
- }
- Key {
- key: 0x0665
- text: "\u0665"
- alternativeKeys: "\u06655"
- }
- Key {
- key: 0x0666
- text: "\u0666"
- alternativeKeys: "\u06666"
- }
- Key {
- text: " "
- displayText: "\u2423"
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- }
- }
- KeyboardRow {
- Key {
- key: 0x0661
- text: "\u0661"
- alternativeKeys: "\u06611"
- }
- Key {
- key: 0x0662
- text: "\u0662"
- alternativeKeys: "\u06622"
- }
- Key {
- key: 0x0663
- text: "\u0663"
- alternativeKeys: "\u06633"
- }
- HideKeyboardKey {}
- }
- KeyboardRow {
- ChangeLanguageKey {
- customLayoutsOnly: true
- }
- Key {
- key: 0x0660
- text: "\u0660"
- alternativeKeys: "\u06600"
- }
- Key {
- key: Qt.Key_Comma
- text: "\u066B"
- alternativeKeys: "\u066B,."
- }
- EnterKey {}
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ar_AR/symbols.qml b/src/virtualkeyboard/content/layouts/ar_AR/symbols.qml
deleted file mode 100644
index 2da52923..00000000
--- a/src/virtualkeyboard/content/layouts/ar_AR/symbols.qml
+++ /dev/null
@@ -1,388 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: 0x0661
- text: "\u0661"
- alternativeKeys: "\u06611"
- }
- Key {
- key: 0x0662
- text: "\u0662"
- alternativeKeys: "\u06622"
- }
- Key {
- key: 0x0663
- text: "\u0663"
- alternativeKeys: "\u06633"
- }
- Key {
- key: 0x0664
- text: "\u0664"
- alternativeKeys: "\u06644"
- }
- Key {
- key: 0x0665
- text: "\u0665"
- alternativeKeys: "\u06655"
- }
- Key {
- key: 0x0666
- text: "\u0666"
- alternativeKeys: "\u06666"
- }
- Key {
- key: 0x0667
- text: "\u0667"
- alternativeKeys: "\u06677"
- }
- Key {
- key: 0x0668
- text: "\u0668"
- alternativeKeys: "\u06688"
- }
- Key {
- key: 0x0669
- text: "\u0669"
- alternativeKeys: "\u06699"
- }
- Key {
- key: 0x0660
- text: "\u0660"
- alternativeKeys: "\u06600"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: 0x061B
- text: "\u061B"
- alternativeKeys: "\u061B;"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: 0x061F
- text: "\u061F"
- alternativeKeys: "\u061F?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0623\u200C\u0628\u200C\u062C"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".\u060C,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: 0xA5
- text: "¥"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0623\u200C\u0628\u200C\u062C"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml b/src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml
deleted file mode 100644
index 16f078cb..00000000
--- a/src/virtualkeyboard/content/layouts/bg_BG/handwriting.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!,.;:?"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/bg_BG/main.qml b/src/virtualkeyboard/content/layouts/bg_BG/main.qml
deleted file mode 100644
index 2e958aa8..00000000
--- a/src/virtualkeyboard/content/layouts/bg_BG/main.qml
+++ /dev/null
@@ -1,370 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
- Component {
- id: cyrillicLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "я"
- }
- Key {
- text: "в"
- }
- Key {
- text: "е"
- }
- Key {
- text: "р"
- }
- Key {
- text: "т"
- }
- Key {
- text: "ъ"
- }
- Key {
- text: "у"
- }
- Key {
- text: "и"
- }
- Key {
- text: "о"
- }
- Key {
- text: "п"
- }
- Key {
- text: "ч"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "а"
- }
- Key {
- text: "с"
- }
- Key {
- text: "д"
- }
- Key {
- text: "ф"
- }
- Key {
- text: "г"
- }
- Key {
- text: "х"
- }
- Key {
- text: "й"
- }
- Key {
- text: "к"
- }
- Key {
- text: "л"
- }
- Key {
- text: "ш"
- }
- Key {
- text: "щ"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- text: "з"
- }
- Key {
- text: "ь"
- }
- Key {
- text: "ц"
- }
- Key {
- text: "ж"
- }
- Key {
- text: "б"
- }
- Key {
- text: "н"
- }
- Key {
- text: "м"
- }
- Key {
- text: "ю"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!.;?"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: latinLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "êeëèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- alternativeKeys: "ŕrř"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- alternativeKeys: "ţtŧť"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "ÿyýŷ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "űūũûüuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "îïīĩiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "œøõôöòóo"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)) ? "a@äåãâàá" : "aäåãâàá"
- smallTextVisible: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly))
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "šsşś"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđď"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- alternativeKeys: "ġgģĝğ"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- alternativeKeys: "ĺŀłļľl"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zžż"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "çcċčć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "ņńnň"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml b/src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml
deleted file mode 100644
index caf820ae..00000000
--- a/src/virtualkeyboard/content/layouts/cs_CZ/handwriting.qml
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/cs_CZ/main.qml b/src/virtualkeyboard/content/layouts/cs_CZ/main.qml
deleted file mode 100644
index 4d328bff..00000000
--- a/src/virtualkeyboard/content/layouts/cs_CZ/main.qml
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eéě"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- alternativeKeys: "rř"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- alternativeKeys: "tť"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "uúů"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ií"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oóö"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåäá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dď"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "yý"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "cćč"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "nń"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "-\"'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/da_DK/main.qml b/src/virtualkeyboard/content/layouts/da_DK/main.qml
deleted file mode 100644
index b03860e6..00000000
--- a/src/virtualkeyboard/content/layouts/da_DK/main.qml
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ií"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oó"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: Qt.Key_Aring
- text: "å"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_AE
- text: "æ"
- alternativeKeys: "æǽ"
- }
- Key {
- key: Qt.Key_Ooblique
- text: "ø"
- alternativeKeys: "øǿ"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/de_DE/main.qml b/src/virtualkeyboard/content/layouts/de_DE/main.qml
deleted file mode 100644
index bd91ec50..00000000
--- a/src/virtualkeyboard/content/layouts/de_DE/main.qml
+++ /dev/null
@@ -1,210 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: Qt.Key_Udiaeresis
- text: "ü"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- key: Qt.Key_A
- text: "a"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sß"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Odiaeresis
- text: "ö"
- }
- Key {
- key: Qt.Key_Adiaeresis
- text: "ä"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/el_GR/handwriting.qml b/src/virtualkeyboard/content/layouts/el_GR/handwriting.qml
deleted file mode 100644
index b010ecf4..00000000
--- a/src/virtualkeyboard/content/layouts/el_GR/handwriting.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.Greek ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!,.;:?"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/el_GR/main.qml b/src/virtualkeyboard/content/layouts/el_GR/main.qml
deleted file mode 100644
index d9fbaf9e..00000000
--- a/src/virtualkeyboard/content/layouts/el_GR/main.qml
+++ /dev/null
@@ -1,364 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Greek ? greekLayout : latinLayout
- Component {
- id: greekLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "ς"
- }
- Key {
- text: "ε"
- alternativeKeys: "εέ"
- }
- Key {
- text: "ρ"
- }
- Key {
- text: "τ"
- }
- Key {
- text: "ψ"
- }
- Key {
- text: "υ"
- alternativeKeys: "υύϋΰ"
- }
- Key {
- text: "θ"
- }
- Key {
- text: "ι"
- alternativeKeys: "ιίϊΐ"
- }
- Key {
- text: "ο"
- alternativeKeys: "οό"
- }
- Key {
- text: "π"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "α"
- alternativeKeys: "αά"
- }
- Key {
- text: "σ"
- }
- Key {
- text: "δ"
- }
- Key {
- text: "φ"
- }
- Key {
- text: "γ"
- }
- Key {
- text: "η"
- alternativeKeys: "ηή"
- }
- Key {
- text: "ξ"
- }
- Key {
- text: "κ"
- }
- Key {
- text: "λ"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Greek, InputEngine.InputMode.Latin]
- }
- Key {
- text: "ζ"
- }
- Key {
- text: "χ"
- }
- Key {
- text: "ψ"
- }
- Key {
- text: "ω"
- alternativeKeys: "ωώ"
- }
- Key {
- text: "β"
- }
- Key {
- text: "ν"
- }
- Key {
- text: "μ"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!.;?"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: latinLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "êeëèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- alternativeKeys: "ŕrř"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- alternativeKeys: "ţtŧť"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "ÿyýŷ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "űūũûüuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "îïīĩiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "œøõôöòóo"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly)) ? "a@äåãâàá" : "aäåãâàá"
- smallTextVisible: (InputContext.inputMethodHints & (Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly))
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "šsşś"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđď"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- alternativeKeys: "ġgģĝğ"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- alternativeKeys: "ĺŀłļľl"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Greek, InputEngine.InputMode.Latin]
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zžż"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "çcċčć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "ņńnň"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/es_ES/handwriting.qml b/src/virtualkeyboard/content/layouts/es_ES/handwriting.qml
deleted file mode 100644
index d4896408..00000000
--- a/src/virtualkeyboard/content/layouts/es_ES/handwriting.qml
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.¿?¡!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/es_ES/main.qml b/src/virtualkeyboard/content/layouts/es_ES/main.qml
deleted file mode 100644
index b98980bb..00000000
--- a/src/virtualkeyboard/content/layouts/es_ES/main.qml
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "ēęėëeêèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "üûuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ïįîiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "öõôoòóº"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {
- weight: 180
- }
- }
- KeyboardRow {
- keyWeight: 156
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "äãaâàáª"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Ntilde
- text: "ñ"
- }
- EnterKey {
- weight: 246
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "čcçć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- alternativeKeys: "¿?¡!"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/es_ES/symbols.qml b/src/virtualkeyboard/content/layouts/es_ES/symbols.qml
deleted file mode 100644
index 17bd3c36..00000000
--- a/src/virtualkeyboard/content/layouts/es_ES/symbols.qml
+++ /dev/null
@@ -1,378 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_exclamdown
- text: "¡"
- alternativeKeys: "¡!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_questiondown
- text: "¿"
- alternativeKeys: "¿?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: 0xA5
- text: "¥"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/es_MX/handwriting.qml b/src/virtualkeyboard/content/layouts/es_MX/handwriting.qml
deleted file mode 100644
index d4896408..00000000
--- a/src/virtualkeyboard/content/layouts/es_MX/handwriting.qml
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.¿?¡!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/es_MX/main.qml b/src/virtualkeyboard/content/layouts/es_MX/main.qml
deleted file mode 100644
index b98980bb..00000000
--- a/src/virtualkeyboard/content/layouts/es_MX/main.qml
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "ēęėëeêèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "üûuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ïįîiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "öõôoòóº"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {
- weight: 180
- }
- }
- KeyboardRow {
- keyWeight: 156
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "äãaâàáª"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Ntilde
- text: "ñ"
- }
- EnterKey {
- weight: 246
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "čcçć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- alternativeKeys: "¿?¡!"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/es_MX/symbols.qml b/src/virtualkeyboard/content/layouts/es_MX/symbols.qml
deleted file mode 100644
index 17bd3c36..00000000
--- a/src/virtualkeyboard/content/layouts/es_MX/symbols.qml
+++ /dev/null
@@ -1,378 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_exclamdown
- text: "¡"
- alternativeKeys: "¡!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_questiondown
- text: "¿"
- alternativeKeys: "¿?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: 0xA5
- text: "¥"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/et_EE/main.qml b/src/virtualkeyboard/content/layouts/et_EE/main.qml
deleted file mode 100644
index 4d62e93e..00000000
--- a/src/virtualkeyboard/content/layouts/et_EE/main.qml
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: Qt.Key_Udiaeresis
- text: "ü"
- }
- Key {
- key: Qt.Key_Otilde
- text: "õ"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- key: Qt.Key_A
- text: "a"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Odiaeresis
- text: "ö"
- }
- Key {
- key: Qt.Key_Adiaeresis
- text: "ä"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/digits.qml b/src/virtualkeyboard/content/layouts/fa_FA/digits.qml
deleted file mode 100644
index ed92201f..00000000
--- a/src/virtualkeyboard/content/layouts/fa_FA/digits.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Plugins 2.3
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.InputMode.Numeric
-
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- Layout.preferredWidth: height
- KeyboardRow {
- Key {
- text: "\u06F7"
- alternativeKeys: "\u06F77"
- }
- Key {
- text: "\u06F8"
- alternativeKeys: "\u06F88"
- }
- Key {
- text: "\u06F9"
- alternativeKeys: "\u06F99"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- Key {
- text: "\u06F4"
- alternativeKeys: "\u06F44"
- }
- Key {
- text: "\u06F5"
- alternativeKeys: "\u06F55"
- }
- Key {
- text: "\u06F6"
- alternativeKeys: "\u06F66"
- }
- Key {
- text: " "
- displayText: "\u2423"
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- }
- }
- KeyboardRow {
- Key {
- text: "\u06F1"
- alternativeKeys: "\u06F11"
- }
- Key {
- text: "\u06F2"
- alternativeKeys: "\u06F22"
- }
- Key {
- text: "\u06F3"
- alternativeKeys: "\u06F33"
- }
- HideKeyboardKey {}
- }
- KeyboardRow {
- ChangeLanguageKey {
- customLayoutsOnly: true
- }
- Key {
- text: "\u06F0"
- alternativeKeys: "\u06F00"
- }
- Key {
- key: Qt.Key_Comma
- text: "\u066B"
- alternativeKeys: "\u066B,."
- }
- EnterKey {}
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml b/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml
deleted file mode 100644
index 1a43b05e..00000000
--- a/src/virtualkeyboard/content/layouts/fa_FA/handwriting.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Arabic
- readonly property bool alphabeticInputMode: [InputEngine.InputMode.Latin, InputEngine.InputMode.Dialable].indexOf(InputContext.inputEngine.inputMode) !== -1
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- alphabeticInputMode ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- inputModeNameList: [
- "ABC", // InputEngine.InputMode.Latin
- "\u0660\u0661\u0662", // InputEngine.InputMode.Numeric
- "123", // InputEngine.InputMode.Dialable
- "", // InputEngine.InputMode.Pinyin
- "", // InputEngine.InputMode.Cangjie
- "", // InputEngine.InputMode.Zhuyin
- "", // InputEngine.InputMode.Hangul
- "", // InputEngine.InputMode.Hiragana
- "", // InputEngine.InputMode.Katakana
- "", // InputEngine.InputMode.FullwidthLatin
- "", // InputEngine.InputMode.Greek
- "", // InputEngine.InputMode.Cyrillic
- "\u0627\u200C\u0628\u200C\u067E", // InputEngine.InputMode.Arabic
- ]
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: alphabeticInputMode ? Qt.Key_Apostrophe : 0x060C
- text: alphabeticInputMode ? "'" : "\u060C"
- alternativeKeys: alphabeticInputMode ? "<>()#%&*/\\\"'=+-_" : "\"\u060C\u066B\u066C\u066D"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: alphabeticInputMode ? ":;,.?!" : ":\u061B.\u061F!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/main.qml b/src/virtualkeyboard/content/layouts/fa_FA/main.qml
deleted file mode 100644
index 0450c772..00000000
--- a/src/virtualkeyboard/content/layouts/fa_FA/main.qml
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- inputMode: InputEngine.InputMode.Arabic
- sourceComponent: InputContext.shiftActive ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u0636"
- }
- Key {
- text: "\u0635"
- }
- Key {
- text: "\u062B"
- }
- Key {
- text: "\u0642"
- }
- Key {
- text: "\u0641"
- }
- Key {
- text: "\u063A"
- }
- Key {
- text: "\u0639"
- }
- Key {
- text: "\u0647"
- }
- Key {
- text: "\u062E"
- }
- Key {
- text: "\u062D"
- }
- Key {
- text: "\u062C"
- }
- Key {
- text: "\u0686"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "\u0634"
- }
- Key {
- text: "\u0633"
- }
- Key {
- text: "\u06CC"
- }
- Key {
- text: "\u0628"
- }
- Key {
- text: "\u0644"
- }
- Key {
- text: "\u0627"
- }
- Key {
- text: "\u062A"
- }
- Key {
- text: "\u0646"
- }
- Key {
- text: "\u0645"
- }
- Key {
- text: "\u06A9"
- }
- Key {
- text: "\u06AF"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- text: "\u0638"
- }
- Key {
- text: "\u0637"
- }
- Key {
- text: "\u0632"
- }
- Key {
- text: "\u0631"
- }
- Key {
- text: "\u0630"
- }
- Key {
- text: "\u062F"
- }
- Key {
- text: "\u067E"
- }
- Key {
- text: "\u0648"
- }
- Key {
- key: 0x060C
- text: "\u060C"
- alternativeKeys: "\u060C,"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u06F1\u06F2\u06F3\u061F"
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- text: "\u200D"
- displayText: "ZWJ"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u0652"
- }
- Key {
- text: "\u064C"
- }
- Key {
- text: "\u064D"
- }
- Key {
- text: "\u064B"
- }
- Key {
- text: "\u064F"
- }
- Key {
- text: "\u0650"
- }
- Key {
- text: "\u064E"
- }
- Key {
- text: "\u0651"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- enabled: false
- }
- Key {
- text: "\u064F"
- }
- Key {
- text: "\u064A"
- }
- Key {
- text: "\u0625"
- }
- Key {
- text: "\u0623"
- }
- Key {
- text: "\u0622"
- }
- Key {
- text: "\u0629"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- text: "\u0643"
- }
- Key {
- text: "\u0653"
- }
- Key {
- text: "\u0698"
- }
- Key {
- text: "\u0670"
- }
- Key {
- text: "\u0621"
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- text: "\u0624"
- }
- Key {
- key: 0x060C
- text: "\u060C"
- alternativeKeys: "\u060C,"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u06F1\u06F2\u06F3\u061F"
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- text: "\u200C"
- displayText: "ZWNJ"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/numbers.qml b/src/virtualkeyboard/content/layouts/fa_FA/numbers.qml
deleted file mode 100644
index e32a1e71..00000000
--- a/src/virtualkeyboard/content/layouts/fa_FA/numbers.qml
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Plugins 2.3
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.InputMode.Numeric
-
- KeyboardRow {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height / 4 * 3
- KeyboardRow {
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_division
- text: "\u00F7"
- }
- Key {
- key: Qt.Key_multiply
- text: "\u00D7"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- }
- KeyboardRow {
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- }
- }
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height / 8
- KeyboardRow {
- FillerKey {}
- }
- }
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height
- KeyboardRow {
- Key {
- text: "\u06F7"
- alternativeKeys: "\u06F77"
- }
- Key {
- text: "\u06F8"
- alternativeKeys: "\u06F88"
- }
- Key {
- text: "\u06F9"
- alternativeKeys: "\u06F99"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- Key {
- text: "\u06F4"
- alternativeKeys: "\u06F44"
- }
- Key {
- text: "\u06F5"
- alternativeKeys: "\u06F55"
- }
- Key {
- text: "\u06F6"
- alternativeKeys: "\u06F66"
- }
- Key {
- text: " "
- displayText: "\u2423"
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- }
- }
- KeyboardRow {
- Key {
- text: "\u06F1"
- alternativeKeys: "\u06F11"
- }
- Key {
- text: "\u06F2"
- alternativeKeys: "\u06F22"
- }
- Key {
- text: "\u06F3"
- alternativeKeys: "\u06F33"
- }
- HideKeyboardKey {}
- }
- KeyboardRow {
- ChangeLanguageKey {
- customLayoutsOnly: true
- }
- Key {
- text: "\u06F0"
- alternativeKeys: "\u06F00"
- }
- Key {
- key: Qt.Key_Comma
- text: "\u066B"
- alternativeKeys: "\u066B,."
- }
- EnterKey {}
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fa_FA/symbols.qml b/src/virtualkeyboard/content/layouts/fa_FA/symbols.qml
deleted file mode 100644
index 8641fdb7..00000000
--- a/src/virtualkeyboard/content/layouts/fa_FA/symbols.qml
+++ /dev/null
@@ -1,378 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u06F1"
- alternativeKeys: "\u06F11"
- }
- Key {
- text: "\u06F2"
- alternativeKeys: "\u06F22"
- }
- Key {
- text: "\u06F3"
- alternativeKeys: "\u06F33"
- }
- Key {
- text: "\u06F4"
- alternativeKeys: "\u06F44"
- }
- Key {
- text: "\u06F5"
- alternativeKeys: "\u06F55"
- }
- Key {
- text: "\u06F6"
- alternativeKeys: "\u06F66"
- }
- Key {
- text: "\u06F7"
- alternativeKeys: "\u06F77"
- }
- Key {
- text: "\u06F8"
- alternativeKeys: "\u06F88"
- }
- Key {
- text: "\u06F9"
- alternativeKeys: "\u06F99"
- }
- Key {
- text: "\u06F0"
- alternativeKeys: "\u06F00"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: 0x061B
- text: "\u061B"
- alternativeKeys: "\u061B;"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: 0x061F
- text: "\u061F"
- alternativeKeys: "\u061F?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0627\u200C\u0628\u200C\u067E"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".\u060C,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: 0xFDFC
- text: "\uFDFC"
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0627\u200C\u0628\u200C\u067E"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fallback/dialpad.qml b/src/virtualkeyboard/content/layouts/fallback/dialpad.qml
deleted file mode 100644
index 89f6873a..00000000
--- a/src/virtualkeyboard/content/layouts/fallback/dialpad.qml
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Plugins 2.3
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.InputMode.Numeric
-
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- Layout.preferredWidth: height
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- text: " "
- displayText: "\u2423"
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- HideKeyboardKey {}
- }
- KeyboardRow {
- Key {
- key: Qt.Key_Asterisk
- displayText: "*+"
- text: "*"
- alternativeKeys: "*+"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- Key {
- text: "#"
- key: Qt.Key_NumberSign
- }
- EnterKey {}
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fallback/digits.qml b/src/virtualkeyboard/content/layouts/fallback/digits.qml
deleted file mode 100644
index 432984a1..00000000
--- a/src/virtualkeyboard/content/layouts/fallback/digits.qml
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Plugins 2.3
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.InputMode.Numeric
-
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- Layout.preferredWidth: height
- KeyboardRow {
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- text: " "
- displayText: "\u2423"
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- HideKeyboardKey {}
- }
- KeyboardRow {
- ChangeLanguageKey {
- customLayoutsOnly: true
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- Key {
- // The decimal key, if it is not "," then we fallback to
- // "." in case it is an unhandled different result
- key: Qt.locale().decimalPoint === "," ? Qt.Key_Comma : Qt.Key_Period
- text: Qt.locale().decimalPoint === "," ? "," : "."
- }
- EnterKey {}
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fallback/handwriting.qml b/src/virtualkeyboard/content/layouts/fallback/handwriting.qml
deleted file mode 100644
index 1da3fc8e..00000000
--- a/src/virtualkeyboard/content/layouts/fallback/handwriting.qml
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fallback/main.qml b/src/virtualkeyboard/content/layouts/fallback/main.qml
deleted file mode 100644
index c9a736f2..00000000
--- a/src/virtualkeyboard/content/layouts/fallback/main.qml
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "êeëèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- alternativeKeys: "ŕrř"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- alternativeKeys: "ţtŧť"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "ÿyýŷ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "űūũûüuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "îïīĩiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "œøõôöòóo"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aäåãâàá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "šsşś"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđď"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- alternativeKeys: "ġgģĝğ"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- alternativeKeys: "ĺŀłļľl"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zžż"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "çcċčć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "ņńnň"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fallback/numbers.qml b/src/virtualkeyboard/content/layouts/fallback/numbers.qml
deleted file mode 100644
index 7fd0a2ab..00000000
--- a/src/virtualkeyboard/content/layouts/fallback/numbers.qml
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Plugins 2.3
-
-KeyboardLayout {
- inputMethod: PlainInputMethod {}
- inputMode: InputEngine.InputMode.Numeric
-
- KeyboardRow {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.alignment: Qt.AlignHCenter
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height / 4 * 3
- KeyboardRow {
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_division
- text: "\u00F7"
- }
- Key {
- key: Qt.Key_multiply
- text: "\u00D7"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- }
- KeyboardRow {
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- }
- }
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height / 8
- KeyboardRow {
- FillerKey {}
- }
- }
- KeyboardColumn {
- Layout.fillWidth: false
- Layout.fillHeight: true
- Layout.preferredWidth: parent.height
- KeyboardRow {
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- text: " "
- displayText: "\u2423"
- repeat: true
- showPreview: false
- key: Qt.Key_Space
- }
- }
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- HideKeyboardKey {}
- }
- KeyboardRow {
- ChangeLanguageKey {
- customLayoutsOnly: true
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- EnterKey {}
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fallback/symbols.qml b/src/virtualkeyboard/content/layouts/fallback/symbols.qml
deleted file mode 100644
index 26d62951..00000000
--- a/src/virtualkeyboard/content/layouts/fallback/symbols.qml
+++ /dev/null
@@ -1,376 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? "АБВ" : "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: 0xA5
- text: "¥"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? "АБВ" : "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fi_FI/main.qml b/src/virtualkeyboard/content/layouts/fi_FI/main.qml
deleted file mode 100644
index a3a8a86f..00000000
--- a/src/virtualkeyboard/content/layouts/fi_FI/main.qml
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: Qt.Key_Aring
- text: "å"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- key: Qt.Key_A
- text: "a"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Odiaeresis
- text: "ö"
- }
- Key {
- key: Qt.Key_Adiaeresis
- text: "ä"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fr_CA/main.qml b/src/virtualkeyboard/content/layouts/fr_CA/main.qml
deleted file mode 100644
index 8866dfd7..00000000
--- a/src/virtualkeyboard/content/layouts/fr_CA/main.qml
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "éèeêë"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "yÿ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "ùuûü"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "îiï"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "ôoœ"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aàâæ"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "cç"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/fr_FR/main.qml b/src/virtualkeyboard/content/layouts/fr_FR/main.qml
deleted file mode 100644
index 753d8e67..00000000
--- a/src/virtualkeyboard/content/layouts/fr_FR/main.qml
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aàâæ"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "éèeêë"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "yÿ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "ùuûü"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "îiï"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "ôoœ"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "cç"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/he_IL/handwriting.qml b/src/virtualkeyboard/content/layouts/he_IL/handwriting.qml
deleted file mode 100644
index 66914c71..00000000
--- a/src/virtualkeyboard/content/layouts/he_IL/handwriting.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.Hebrew ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\'\"=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/he_IL/main.qml b/src/virtualkeyboard/content/layouts/he_IL/main.qml
deleted file mode 100644
index 4c47fc56..00000000
--- a/src/virtualkeyboard/content/layouts/he_IL/main.qml
+++ /dev/null
@@ -1,381 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? hebrewLayout : latinLayout
- Component {
- id: hebrewLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "'\""
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- text: "\u05E7"
- alternativeKeys: "\u05B3\u05E7\u05B8\u05BB"
- }
- Key {
- text: "\u05E8"
- }
- Key {
- text: "\u05D0"
- }
- Key {
- text: "\u05D8"
- }
- Key {
- text: "\u05D5"
- alternativeKeys: [ "\u05D5", "\u05D5\u05B9", "\u05D5\u05BC" ]
- }
- Key {
- text: "\u05DF"
- }
- Key {
- text: "\u05DD"
- }
- Key {
- text: "\u05E4"
- alternativeKeys: "\u05B2\u05B7\u05E4"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "\u05E9"
- alternativeKeys: [ "\u05E9", "\u05B0", "\u05E9\u05C2", "\u05E9\u05C1" ]
- }
- Key {
- text: "\u05D3"
- alternativeKeys: "\u05D3\u05BC"
- }
- Key {
- text: "\u05D2"
- alternativeKeys: [ "\u05D2", "\u05D2\u05F3" ]
- }
- Key {
- text: "\u05DB"
- }
- Key {
- text: "\u05E2"
- }
- Key {
- text: "\u05D9"
- alternativeKeys: [ "\u05D9", "\u05F2\u05B7" ]
- }
- Key {
- text: "\u05D7"
- alternativeKeys: [ "\u05B9", "\u05D7", "\u05D7\u05F3", "\u05B4" ]
- }
- Key {
- text: "\u05DC"
- }
- Key {
- text: "\u05DA"
- }
- Key {
- text: "\u05E3"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Hebrew, InputEngine.InputMode.Latin]
- }
- Key {
- text: "\u05D6"
- alternativeKeys: [ "\u05D6", "\u05D6\u05F3" ]
- }
- Key {
- text: "\u05E1"
- alternativeKeys: "\u05E1\u05B6\u05B1"
- }
- Key {
- text: "\u05D1"
- }
- Key {
- text: "\u05D4"
- }
- Key {
- text: "\u05E0"
- }
- Key {
- text: "\u05DE"
- }
- Key {
- text: "\u05E6"
- alternativeKeys: [ "\u05E6", "\u05E6\u05F3", "\u05B5" ]
- }
- Key {
- text: "\u05EA"
- alternativeKeys: [ "\u05EA", "\u05EA\u05F3" ]
- }
- Key {
- text: "\u05E5"
- alternativeKeys: [ "\u05E5", "\u05E5\u05F3" ]
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- alternativeKeys: ":,;"
- }
- ShiftKey {
- weight: 204
- enabled: false
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!.?"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: latinLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "êeëèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- alternativeKeys: "ŕrř"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- alternativeKeys: "ţtŧť"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "ÿyýŷ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "űūũûüuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "îïīĩiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "œøõôöòóo"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aäåãâàá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "šsşś"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđď"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- alternativeKeys: "ġgģĝğ"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- alternativeKeys: "ĺŀłļľl"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Hebrew, InputEngine.InputMode.Latin]
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zžż"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "çcċčć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "ņńnň"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- alternativeKeys: ":,;"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!.?"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/he_IL/symbols.qml b/src/virtualkeyboard/content/layouts/he_IL/symbols.qml
deleted file mode 100644
index f4e58652..00000000
--- a/src/virtualkeyboard/content/layouts/he_IL/symbols.qml
+++ /dev/null
@@ -1,376 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- alternativeKeys: "$¢"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- text: "₪"
- }
- Key {
- key: 0xA5
- text: "¥"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: InputContext.inputEngine.inputMode === InputEngine.InputMode.Hebrew ? "\u05D0\u05D1\u05D2" : "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml b/src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml
deleted file mode 100644
index 1ae1fa4f..00000000
--- a/src/virtualkeyboard/content/layouts/hi_IN/handwriting.qml
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- Key {
- weight: 217
- key: Qt.Key_Mode_switch
- noKeyEvent: true
- functionKey: true
- text: InputContext.inputEngine.inputMode === InputEngine.InputMode.Latin ? "123" : "ABC"
- onClicked: InputContext.inputEngine.inputMode = InputContext.inputEngine.inputMode === InputEngine.InputMode.Latin ? InputEngine.InputMode.Numeric : InputEngine.InputMode.Latin
- enabled: !(InputContext.inputMethodHints & (Qt.ImhDialableCharactersOnly | Qt.ImhFormattedNumbersOnly | Qt.ImhDigitsOnly))
- keyPanelDelegate: keyboard.style ? keyboard.style.symbolKeyPanel : undefined
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/main.qml b/src/virtualkeyboard/content/layouts/hi_IN/main.qml
deleted file mode 100644
index aac186eb..00000000
--- a/src/virtualkeyboard/content/layouts/hi_IN/main.qml
+++ /dev/null
@@ -1,340 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- inputMode: InputEngine.InputMode.Latin
- sourceComponent: InputContext.shiftActive ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u094C"
- }
- Key {
- text: "\u0948"
- }
- Key {
- text: "\u093E"
- }
- Key {
- text: "\u0940"
- }
- Key {
- text: "\u0942"
- }
- Key {
- text: "\u092C"
- }
- Key {
- text: "\u0939"
- }
- Key {
- text: "\u0917"
- }
- Key {
- text: "\u0926"
- }
- Key {
- text: "\u091C"
- }
- Key {
- text: "\u0921"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- text: "\u094B"
- alternativeKeys: ["\u094B", "\u094A"]
- }
- Key {
- text: "\u0947"
- }
- Key {
- text: "\u094D"
- }
- Key {
- text: "\u093F"
- }
- Key {
- text: "\u0941"
- }
- Key {
- text: "\u092A"
- }
- Key {
- text: "\u0930"
- }
- Key {
- text: "\u0915"
- }
- Key {
- text: "\u0924"
- }
- Key {
- text: "\u091A"
- }
- Key {
- text: "\u091F"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- text: "\u0949"
- }
- Key {
- text: "\u0902"
- alternativeKeys: "\u0902\u0903"
- }
- Key {
- text: "\u092E"
- }
- Key {
- text: "\u0928"
- }
- Key {
- text: "\u0935"
- }
- Key {
- text: "\u0932"
- }
- Key {
- text: "\u0938"
- }
- Key {
- text: "\u092F"
- }
- Key {
- text: "\u093C"
- }
- Key {
- key: 0x2013
- text: "\u2013"
- alternativeKeys: "\u2013-“”"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "&\u0967\u0968\u0969"
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- alternativeKeys: "!?:;.,|"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u0914"
- }
- Key {
- text: "\u0910"
- }
- Key {
- text: "\u0906"
- }
- Key {
- text: "\u0908"
- }
- Key {
- text: "\u090A"
- }
- Key {
- text: "\u092D"
- }
- Key {
- text: "\u0919"
- }
- Key {
- text: "\u0918"
- }
- Key {
- text: "\u0927"
- }
- Key {
- text: "\u091D"
- }
- Key {
- text: "\u0922"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- text: "\u0913"
- }
- Key {
- text: "\u090F"
- }
- Key {
- text: "\u0905"
- }
- Key {
- text: "\u0907"
- }
- Key {
- text: "\u0909"
- }
- Key {
- text: "\u092B"
- }
- Key {
- text: "\u0931"
- }
- Key {
- text: "\u0916"
- }
- Key {
- text: "\u0925"
- }
- Key {
- text: "\u091B"
- }
- Key {
- text: "\u0920"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- text: "\u0911"
- }
- Key {
- text: "\u0901"
- }
- Key {
- text: "\u0923"
- }
- Key {
- text: "\u0929"
- }
- Key {
- text: "\u091E"
- }
- Key {
- text: "\u0933"
- }
- Key {
- text: "\u0936"
- }
- Key {
- text: "\u0937"
- }
- Key {
- text: "\u0943"
- }
- Key {
- key: 0x2013
- text: "\u2013"
- alternativeKeys: "\u2013-“”"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "&\u0967\u0968\u0969"
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- alternativeKeys: "!?:;.,|"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/hi_IN/symbols.qml b/src/virtualkeyboard/content/layouts/hi_IN/symbols.qml
deleted file mode 100644
index 6ae785f9..00000000
--- a/src/virtualkeyboard/content/layouts/hi_IN/symbols.qml
+++ /dev/null
@@ -1,386 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "\u0967"
- alternativeKeys: "\u09671"
- }
- Key {
- key: Qt.Key_2
- text: "\u0968"
- alternativeKeys: "\u09682"
- }
- Key {
- key: Qt.Key_3
- text: "\u0969"
- alternativeKeys: "\u09693"
- }
- Key {
- key: Qt.Key_4
- text: "\u096A"
- alternativeKeys: "\u096A4"
- }
- Key {
- key: Qt.Key_5
- text: "\u096B"
- alternativeKeys: "\u096B5"
- }
- Key {
- key: Qt.Key_6
- text: "\u096C"
- alternativeKeys: "\u096C6"
- }
- Key {
- key: Qt.Key_7
- text: "\u096D"
- alternativeKeys: "\u096D7"
- }
- Key {
- key: Qt.Key_8
- text: "\u096E"
- alternativeKeys: "\u096E8"
- }
- Key {
- key: Qt.Key_9
- text: "\u096F"
- alternativeKeys: "\u096F9"
- }
- Key {
- key: Qt.Key_0
- text: "\u0966"
- alternativeKeys: "\u09660"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0915\u0916\u0917"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: 0x20B9
- text: "\u20B9"
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\u0915\u0916\u0917"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml b/src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml
deleted file mode 100644
index 968bae8e..00000000
--- a/src/virtualkeyboard/content/layouts/hr_HR/handwriting.qml
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- Key {
- key: 0x102
- text: "ă"
- alternativeKeys: "ăîâșț"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/hr_HR/main.qml b/src/virtualkeyboard/content/layouts/hr_HR/main.qml
deleted file mode 100644
index 4b4c46d9..00000000
--- a/src/virtualkeyboard/content/layouts/hr_HR/main.qml
+++ /dev/null
@@ -1,218 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oö"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: 0x160
- text: "š"
- }
- Key {
- key: 0x110
- text: "đ"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåä"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: 0x10C
- text: "č"
- }
- Key {
- key: 0x106
- text: "ć"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {
- weight: 166
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: 0x17D
- text: "ž"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 234
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: [ "-", "\"", "'" ]
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml b/src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml
deleted file mode 100644
index caf820ae..00000000
--- a/src/virtualkeyboard/content/layouts/hu_HU/handwriting.qml
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/hu_HU/main.qml b/src/virtualkeyboard/content/layouts/hu_HU/main.qml
deleted file mode 100644
index 0834dc04..00000000
--- a/src/virtualkeyboard/content/layouts/hu_HU/main.qml
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "úűuü"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ií"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "óőoö"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåäá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "-\"'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/it_IT/main.qml b/src/virtualkeyboard/content/layouts/it_IT/main.qml
deleted file mode 100644
index 72d7c03c..00000000
--- a/src/virtualkeyboard/content/layouts/it_IT/main.qml
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "uùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "iìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oòó"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aàá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml b/src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml
deleted file mode 100644
index 08a74384..00000000
--- a/src/virtualkeyboard/content/layouts/ja_JP/handwriting.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.JapaneseHandwriting ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
-
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "‘"
- alternativeKeys: "《》〈〉•…々〆‘’“”「」¥"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.、。?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/main.qml b/src/virtualkeyboard/content/layouts/ja_JP/main.qml
deleted file mode 100644
index d3fb6ae1..00000000
--- a/src/virtualkeyboard/content/layouts/ja_JP/main.qml
+++ /dev/null
@@ -1,432 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; JapaneseInputMethod {}', parent, "japaneseInputMethod")
- }
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.FullwidthLatin ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- enabled: !(InputContext.inputMethodHints & Qt.ImhLatinOnly) && inputModeCount > 1
- inputModeNameList: [
- "半角", // InputEngine.InputMode.Latin
- "", // InputEngine.InputMode.Numeric
- "", // InputEngine.InputMode.Dialable
- "", // InputEngine.InputMode.Pinyin
- "", // InputEngine.InputMode.Cangjie
- "", // InputEngine.InputMode.Zhuyin
- "", // InputEngine.InputMode.Hangul
- "あ", // InputEngine.InputMode.Hiragana
- "カ", // InputEngine.InputMode.Katakana
- "全角", // InputEngine.InputMode.FullwidthLatin
- ]
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: "\u3001"
- alternativeKeys: "\u3001\uFF01,!"
- }
- Key {
- key: Qt.Key_Period
- text: "\u3002"
- alternativeKeys: "\u3002\uFF1F.?"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 194
- }
- ChangeLanguageKey {
- }
- HandwritingModeKey {
- }
- Key {
- key: Qt.Key_Left
- displayText: "\u2190"
- repeat: true
- noModifier: true
- functionKey: true
- }
- Key {
- key: Qt.Key_Right
- displayText: "\u2192"
- repeat: true
- noModifier: true
- functionKey: true
- }
- SpaceKey {
- weight: 556
- text: InputContext.inputEngine.inputMode != InputEngine.InputMode.Latin ? "\u3000" : " "
- }
- Key {
- key: Qt.Key_Slash
- text: "\u30FB"
- alternativeKeys: "\u30FB/"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "\uFF07"
- alternativeKeys: "\uFF07\uFF02'\""
- }
- Key {
- key: Qt.Key_Underscore
- text: "\u30FC"
- alternativeKeys: "\u30FC\uFF5E\uFF70\uFF3F_"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "\uFF51"
- }
- Key {
- key: Qt.Key_W
- text: "\uFF57"
- }
- Key {
- key: Qt.Key_E
- text: "\uFF45"
- }
- Key {
- key: Qt.Key_R
- text: "\uFF52"
- }
- Key {
- key: Qt.Key_T
- text: "\uFF54"
- }
- Key {
- key: Qt.Key_Y
- text: "\uFF59"
- }
- Key {
- key: Qt.Key_U
- text: "\uFF55"
- }
- Key {
- key: Qt.Key_I
- text: "\uFF49"
- }
- Key {
- key: Qt.Key_O
- text: "\uFF4F"
- }
- Key {
- key: Qt.Key_P
- text: "\uFF50"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "\uFF41"
- }
- Key {
- key: Qt.Key_S
- text: "\uFF53"
- }
- Key {
- key: Qt.Key_D
- text: "\uFF44"
- }
- Key {
- key: Qt.Key_F
- text: "\uFF46"
- }
- Key {
- key: Qt.Key_G
- text: "\uFF47"
- }
- Key {
- key: Qt.Key_H
- text: "\uFF48"
- }
- Key {
- key: Qt.Key_J
- text: "\uFF4A"
- }
- Key {
- key: Qt.Key_K
- text: "\uFF4B"
- }
- Key {
- key: Qt.Key_L
- text: "\uFF4C"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- }
- Key {
- key: Qt.Key_Z
- text: "\uFF5A"
- }
- Key {
- key: Qt.Key_X
- text: "\uFF58"
- }
- Key {
- key: Qt.Key_C
- text: "\uFF43"
- }
- Key {
- key: Qt.Key_V
- text: "\uFF56"
- }
- Key {
- key: Qt.Key_B
- text: "\uFF42"
- }
- Key {
- key: Qt.Key_N
- text: "\uFF4E"
- }
- Key {
- key: Qt.Key_M
- text: "\uFF4D"
- }
- Key {
- key: Qt.Key_Comma
- text: "\u3001"
- alternativeKeys: "\u3001\uFF01,!"
- }
- Key {
- key: Qt.Key_Period
- text: "\u3002"
- alternativeKeys: "\u3002\uFF1F.?"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 194
- }
- ChangeLanguageKey {
- }
- HandwritingModeKey {
- }
- Key {
- key: Qt.Key_Left
- displayText: "\u2190"
- repeat: true
- noModifier: true
- functionKey: true
- }
- Key {
- key: Qt.Key_Right
- displayText: "\u2192"
- repeat: true
- noModifier: true
- functionKey: true
- }
- SpaceKey {
- weight: 556
- text: "\u3000"
- }
- Key {
- key: Qt.Key_Slash
- text: "\u30FB"
- alternativeKeys: "\u30FB/"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "\uFF07"
- alternativeKeys: "\uFF07\uFF02'\""
- }
- Key {
- key: Qt.Key_Underscore
- text: "\u30FC"
- alternativeKeys: "\u30FC\uFF5E\uFF70\uFF3F_"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ja_JP/symbols.qml b/src/virtualkeyboard/content/layouts/ja_JP/symbols.qml
deleted file mode 100644
index 66a4985b..00000000
--- a/src/virtualkeyboard/content/layouts/ja_JP/symbols.qml
+++ /dev/null
@@ -1,294 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; JapaneseInputMethod {}', parent, "japaneseInputMethod")
- }
- sharedLayouts: ['main']
- property int page
- readonly property int numPages: 3
- property var keysPage1: [
- "1234567890",
- "@#$%^&*()",
- "“”、=:;!?~"
- ]
- property var keysPage2: [
- "-+/\\|[]{}·",
- "<>,.:;!?~",
- "/\"'_§¥€£¢"
- ]
- property var keysPage3: [
- "()〔〕〈〉《》【】",
- "→←↑↓↔■□●○",
- "\『』「」★☆◆◇"
- ]
- sourceComponent: {
- switch (page) {
- case 2: return page3
- case 1: return page2
- default: return page1
- }
- }
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage1[0].length
- Key {
- key: keysPage1[0][index].charCodeAt(0)
- text: keysPage1[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage1[1].length
- Key {
- key: keysPage1[1][index].charCodeAt(0)
- text: keysPage1[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage1[2].length
- Key {
- key: keysPage1[2][index].charCodeAt(0)
- text: keysPage1[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2014
- text: "—"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage2[0].length
- Key {
- key: keysPage2[0][index].charCodeAt(0)
- text: keysPage2[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage2[1].length
- Key {
- key: keysPage2[1][index].charCodeAt(0)
- text: keysPage2[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage2[2].length
- Key {
- key: keysPage2[2][index].charCodeAt(0)
- text: keysPage2[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x3002
- text: "。"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page3
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage3[0].length
- Key {
- key: keysPage3[0][index].charCodeAt(0)
- text: keysPage3[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage3[1].length
- Key {
- key: keysPage3[1][index].charCodeAt(0)
- text: keysPage3[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage3[2].length
- Key {
- key: keysPage3[2][index].charCodeAt(0)
- text: keysPage3[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "…"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml b/src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml
deleted file mode 100644
index 563239a4..00000000
--- a/src/virtualkeyboard/content/layouts/ko_KR/handwriting.qml
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: preferredInputMode()
-
- Connections {
- target: InputContext
- onInputMethodHintsChanged: {
- var newInputMode = preferredInputMode()
- if (InputContext.inputEngine.inputModes.indexOf(newInputMode) !== -1)
- InputContext.inputEngine.inputMode = newInputMode
- }
- }
-
- function preferredInputMode() {
- return InputContext.inputMethodHints &
- (Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
- Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.KoreanHandwriting
- }
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.KoreanHandwriting ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
-
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey {
- enabled: InputContext.inputEngine.inputMode !== InputEngine.InputMode.KoreanHandwriting
- }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/main.qml b/src/virtualkeyboard/content/layouts/ko_KR/main.qml
deleted file mode 100644
index 54e6ec57..00000000
--- a/src/virtualkeyboard/content/layouts/ko_KR/main.qml
+++ /dev/null
@@ -1,313 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; HangulInputMethod {}', parent, "hangulInputMethod")
- }
- sourceComponent: InputContext.shiftActive ? page2 : page1
- sharedLayouts: ['symbols']
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u3142"
- }
- Key {
- text: "\u3148"
- }
- Key {
- text: "\u3137"
- }
- Key {
- text: "\u3131"
- }
- Key {
- text: "\u3145"
- }
- Key {
- text: "\u315B"
- }
- Key {
- text: "\u3155"
- }
- Key {
- text: "\u3151"
- }
- Key {
- text: "\u3150"
- }
- Key {
- text: "\u3154"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "\u3141"
- }
- Key {
- text: "\u3134"
- }
- Key {
- text: "\u3147"
- }
- Key {
- text: "\u3139"
- }
- Key {
- text: "\u314E"
- }
- Key {
- text: "\u3157"
- }
- Key {
- text: "\u3153"
- }
- Key {
- text: "\u314F"
- }
- Key {
- text: "\u3163"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- text: "\u314B"
- }
- Key {
- text: "\u314C"
- }
- Key {
- text: "\u314A"
- }
- Key {
- text: "\u314D"
- }
- Key {
- text: "\u3160"
- }
- Key {
- text: "\u315C"
- }
- Key {
- text: "\u3161"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "\u3143"
- }
- Key {
- text: "\u3149"
- }
- Key {
- text: "\u3138"
- }
- Key {
- text: "\u3132"
- }
- Key {
- text: "\u3146"
- }
- Key {
- text: "\u315B"
- }
- Key {
- text: "\u3155"
- }
- Key {
- text: "\u3151"
- }
- Key {
- text: "\u3152"
- }
- Key {
- text: "\u3156"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "\u3141"
- }
- Key {
- text: "\u3134"
- }
- Key {
- text: "\u3147"
- }
- Key {
- text: "\u3139"
- }
- Key {
- text: "\u314E"
- }
- Key {
- text: "\u3157"
- }
- Key {
- text: "\u3153"
- }
- Key {
- text: "\u314F"
- }
- Key {
- text: "\u3163"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- text: "\u314B"
- }
- Key {
- text: "\u314C"
- }
- Key {
- text: "\u314A"
- }
- Key {
- text: "\u314D"
- }
- Key {
- text: "\u3160"
- }
- Key {
- text: "\u315C"
- }
- Key {
- text: "\u3161"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ko_KR/symbols.qml b/src/virtualkeyboard/content/layouts/ko_KR/symbols.qml
deleted file mode 100644
index 352a69e1..00000000
--- a/src/virtualkeyboard/content/layouts/ko_KR/symbols.qml
+++ /dev/null
@@ -1,380 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; HangulInputMethod {}', parent, "hangulInputMethod")
- }
- sharedLayouts: ['main']
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\uC54C\uD30C\uBCB3"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0x20A9
- text: "\u20A9"
- }
- Key {
- key: 0xA5
- text: "¥"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "\uC54C\uD30C\uBCB3"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/nb_NO/main.qml b/src/virtualkeyboard/content/layouts/nb_NO/main.qml
deleted file mode 100644
index 8580045b..00000000
--- a/src/virtualkeyboard/content/layouts/nb_NO/main.qml
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eéèê"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "uü"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oöóòô"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: Qt.Key_Aring
- text: "å"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aäâá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Ooblique
- text: "ø"
- alternativeKeys: "øö"
- }
- Key {
- key: Qt.Key_AE
- text: "æ"
- alternativeKeys: "æä"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/pl_PL/main.qml b/src/virtualkeyboard/content/layouts/pl_PL/main.qml
deleted file mode 100644
index 2a7ebfd0..00000000
--- a/src/virtualkeyboard/content/layouts/pl_PL/main.qml
+++ /dev/null
@@ -1,202 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eę"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oó"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aą"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sś"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- alternativeKeys: "lł"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zźż"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- alternativeKeys: "xź"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "cć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "nń"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/pt_BR/main.qml b/src/virtualkeyboard/content/layouts/pt_BR/main.qml
deleted file mode 100644
index 53ed462f..00000000
--- a/src/virtualkeyboard/content/layouts/pt_BR/main.qml
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "ēęėëeêèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "üûuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ïįîiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "öõôoòó"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "äãaâàá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Ccedilla
- text: "ç"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "čcć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 244
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/pt_PT/main.qml b/src/virtualkeyboard/content/layouts/pt_PT/main.qml
deleted file mode 100644
index 53ed462f..00000000
--- a/src/virtualkeyboard/content/layouts/pt_PT/main.qml
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "ēęėëeêèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "üûuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ïįîiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "öõôoòó"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "äãaâàá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Ccedilla
- text: "ç"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "čcć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 244
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml b/src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml
deleted file mode 100644
index 1d5dedb9..00000000
--- a/src/virtualkeyboard/content/layouts/ro_RO/handwriting.qml
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: InputEngine.InputMode.Latin
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- Key {
- key: 0x102
- text: "ă"
- alternativeKeys: "ăîâșț"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ro_RO/main.qml b/src/virtualkeyboard/content/layouts/ro_RO/main.qml
deleted file mode 100644
index ea3865eb..00000000
--- a/src/virtualkeyboard/content/layouts/ro_RO/main.qml
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "êeëèé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- alternativeKeys: "ŕrř"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- alternativeKeys: "țţtŧť"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "ÿyýŷ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "űūũûüuùú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "îïīĩiìí"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "œøõôöòóo"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: 0x102
- text: "ă"
- }
- Key {
- key: Qt.Key_Icircumflex
- text: "î"
- }
- Key {
- key: Qt.Key_Acircumflex
- text: "â"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aäåãăâàá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "șšsşś"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđď"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- alternativeKeys: "ġgģĝğ"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- alternativeKeys: "ĺŀłļľl"
- }
- Key {
- key: 0x218
- text: "ș"
- }
- Key {
- key: 0x21a
- text: "ț"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zžż"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "çcċčć"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "ņńnň"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: [ "\"", "'" ]
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/ru_RU/main.qml b/src/virtualkeyboard/content/layouts/ru_RU/main.qml
deleted file mode 100644
index 87eb2382..00000000
--- a/src/virtualkeyboard/content/layouts/ru_RU/main.qml
+++ /dev/null
@@ -1,394 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.10
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
- Component {
- id: cyrillicLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: 0x0419
- text: "й"
- }
- Key {
- key: 0x0426
- text: "ц"
- }
- Key {
- key: 0x0423
- text: "у"
- }
- Key {
- key: 0x041A
- text: "к"
- }
- Key {
- key: 0x0415
- text: "е"
- alternativeKeys: "её"
- }
- Key {
- key: 0x041D
- text: "н"
- }
- Key {
- key: 0x0413
- text: "г"
- }
- Key {
- key: 0x0428
- text: "ш"
- }
- Key {
- key: 0x0429
- text: "щ"
- }
- Key {
- key: 0x0417
- text: "з"
- }
- Key {
- key: 0x0425
- text: "х"
- }
- BackspaceKey {
- weight: 180
- }
- }
- KeyboardRow {
- FillerKey {
- weight: 40
- }
- Key {
- key: 0x0424
- text: "ф"
- }
- Key {
- key: 0x042B
- text: "ы"
- }
- Key {
- key: 0x0412
- text: "в"
- }
- Key {
- key: 0x0410
- text: "а"
- }
- Key {
- key: 0x041F
- text: "п"
- }
- Key {
- key: 0x0420
- text: "р"
- }
- Key {
- key: 0x041E
- text: "о"
- }
- Key {
- key: 0x041B
- text: "л"
- }
- Key {
- key: 0x0414
- text: "д"
- }
- Key {
- key: 0x0416
- text: "ж"
- }
- Key {
- key: 0x042D
- text: "э"
- }
- EnterKey {
- weight: 280
- }
- }
- KeyboardRow {
- InputModeKey {
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- key: 0x042F
- text: "я"
- }
- Key {
- key: 0x0427
- text: "ч"
- }
- Key {
- key: 0x0421
- text: "с"
- }
- Key {
- key: 0x041C
- text: "м"
- }
- Key {
- key: 0x0418
- text: "и"
- }
- Key {
- key: 0x0422
- text: "т"
- }
- Key {
- key: 0x042C
- text: "ь"
- alternativeKeys: "ьъ"
- }
- Key {
- key: 0x0411
- text: "б"
- }
- Key {
- key: 0x042E
- text: "ю"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "—"
- }
- ShiftKey {
- weight: 272
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ";:!?,."
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: latinLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oö"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåä"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđ"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "ćcč"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "-\"'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/sk_SK/main.qml b/src/virtualkeyboard/content/layouts/sk_SK/main.qml
deleted file mode 100644
index 1f739d31..00000000
--- a/src/virtualkeyboard/content/layouts/sk_SK/main.qml
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- alternativeKeys: "rŕ"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- alternativeKeys: "tť"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "uú"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ií"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oóöô"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåäá"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dď"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- alternativeKeys: "lĺľ"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "yý"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "cč"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "nň"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "-\"'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/sl_SI/main.qml b/src/virtualkeyboard/content/layouts/sl_SI/main.qml
deleted file mode 100644
index 76293626..00000000
--- a/src/virtualkeyboard/content/layouts/sl_SI/main.qml
+++ /dev/null
@@ -1,203 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eèêëé"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "uúü"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "ií"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "òôöoó"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåäáà"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđ"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "cćč"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "-\"'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/sq_AL/main.qml b/src/virtualkeyboard/content/layouts/sq_AL/main.qml
deleted file mode 100644
index 4b50e883..00000000
--- a/src/virtualkeyboard/content/layouts/sq_AL/main.qml
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: Qt.Key_Ccedilla
- text: "ç"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Ediaeresis
- text: "ë"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 244
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml b/src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml
deleted file mode 100644
index 6f9cbb98..00000000
--- a/src/virtualkeyboard/content/layouts/sr_SP/handwriting.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.Cyrillic ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/sr_SP/main.qml b/src/virtualkeyboard/content/layouts/sr_SP/main.qml
deleted file mode 100644
index acd381ae..00000000
--- a/src/virtualkeyboard/content/layouts/sr_SP/main.qml
+++ /dev/null
@@ -1,363 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
- Component {
- id: cyrillicLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "љ"
- }
- Key {
- text: "њ"
- }
- Key {
- text: "е"
- }
- Key {
- text: "р"
- }
- Key {
- text: "т"
- }
- Key {
- text: "з"
- }
- Key {
- text: "у"
- }
- Key {
- text: "и"
- }
- Key {
- text: "о"
- }
- Key {
- text: "п"
- }
- Key {
- text: "ш"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "а"
- }
- Key {
- text: "с"
- }
- Key {
- text: "д"
- }
- Key {
- text: "ф"
- }
- Key {
- text: "г"
- }
- Key {
- text: "х"
- }
- Key {
- text: "ј"
- }
- Key {
- text: "к"
- }
- Key {
- text: "л"
- }
- Key {
- text: "ч"
- }
- Key {
- text: "ћ"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- text: "ѕ"
- }
- Key {
- text: "џ"
- }
- Key {
- text: "ц"
- }
- Key {
- text: "в"
- }
- Key {
- text: "б"
- }
- Key {
- text: "н"
- }
- Key {
- text: "м"
- }
- Key {
- text: "ђ"
- }
- Key {
- text: "ж"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!.;?"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: latinLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oö"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåä"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđ"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "ćcč"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "-\"'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/sv_SE/main.qml b/src/virtualkeyboard/content/layouts/sv_SE/main.qml
deleted file mode 100644
index a3a8a86f..00000000
--- a/src/virtualkeyboard/content/layouts/sv_SE/main.qml
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- key: Qt.Key_Aring
- text: "å"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- key: Qt.Key_A
- text: "a"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- key: Qt.Key_Odiaeresis
- text: "ö"
- }
- Key {
- key: Qt.Key_Adiaeresis
- text: "ä"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/th_TH/handwriting.qml b/src/virtualkeyboard/content/layouts/th_TH/handwriting.qml
deleted file mode 100644
index 428f29fa..00000000
--- a/src/virtualkeyboard/content/layouts/th_TH/handwriting.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.Thai ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 3]
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: "\""
- alternativeKeys: "<>()#%&*/\\\"'=+-_"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/th_TH/main.qml b/src/virtualkeyboard/content/layouts/th_TH/main.qml
deleted file mode 100644
index 60a8ebc0..00000000
--- a/src/virtualkeyboard/content/layouts/th_TH/main.qml
+++ /dev/null
@@ -1,489 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- inputMode: InputEngine.InputMode.Latin
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; ThaiInputMethod {}', parent, "thaiInputMethod")
- }
- sharedLayouts: [ "symbols" ]
- sourceComponent: InputContext.shiftActive ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Layout.preferredHeight: 3
- smallTextVisible: true
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- Key {
- text: "ๆ"
- alternativeKeys: "ๆ๑"
- }
- Key {
- text: "ๅ"
- alternativeKeys: "ๅ๒"
- }
- Key {
- text: "ภ"
- alternativeKeys: "ภ๓"
- }
- Key {
- text: "ถ"
- alternativeKeys: "ถ๔"
- }
- Key {
- text: "\u0E38"
- displayText: " \u0E38"
- alternativeKeys: [ "\u0E38", " \u0E39" ]
- }
- Key {
- text: "\u0E36"
- displayText: " \u0E36"
- }
- Key {
- text: "ค"
- alternativeKeys: "ค๕"
- }
- Key {
- text: "ต"
- alternativeKeys: "ต๖"
- }
- Key {
- text: "จ"
- alternativeKeys: "จ๗"
- }
- Key {
- text: "ข"
- alternativeKeys: "ข๘"
- }
- Key {
- text: "ช"
- alternativeKeys: "ช๙"
- }
- }
- KeyboardRow {
- Key {
- text: "ไ"
- alternativeKeys: "ไ฿"
- }
- Key {
- text: " ำ"
- alternativeKeys: " ำฎ"
- }
- Key {
- text: "พ"
- alternativeKeys: "พฑ"
- }
- Key {
- text: "ะ"
- alternativeKeys: "ะธ"
- }
- Key {
- text: "\u0E31"
- displayText: " \u0E31"
- alternativeKeys: "\u0E31。"
- }
- Key {
- text: "\u0E35"
- displayText: " \u0E35"
- alternativeKeys: [ "\u0E35", " \u0E4A" ]
- }
- Key {
- text: "ร"
- alternativeKeys: "รณ"
- }
- Key {
- text: "น"
- alternativeKeys: "นฯ"
- }
- Key {
- text: "ย"
- alternativeKeys: "ยญ"
- }
- Key {
- text: "บ"
- alternativeKeys: "บฐ"
- }
- Key {
- text: "ล"
- }
- }
- KeyboardRow {
- Key {
- text: "ฟ"
- alternativeKeys: "ฟฤ"
- }
- Key {
- text: "ห"
- alternativeKeys: "หฆ"
- }
- Key {
- text: "ก"
- alternativeKeys: "กฏ"
- }
- Key {
- text: "ด"
- alternativeKeys: "ดโ"
- }
- Key {
- text: "เ"
- alternativeKeys: "เฌ"
- }
- Key {
- text: "\u0E49"
- displayText: " \u0E49"
- alternativeKeys: [ "\u0E49", " \u0E47" ]
- }
- Key {
- text: "\u0E48"
- displayText: " \u0E48"
- alternativeKeys: [ "\u0E48", " \u0E4B" ]
- }
- Key {
- text: "า"
- alternativeKeys: "าษ"
- }
- Key {
- text: "ส"
- alternativeKeys: "สศ"
- }
- Key {
- text: "ว"
- alternativeKeys: "วซ"
- }
- Key {
- text: "ง"
- }
- }
- KeyboardRow {
- FillerKey {
- weight: 80
- }
- Key {
- text: "ผ"
- }
- Key {
- text: "ป"
- }
- Key {
- text: "แ"
- alternativeKeys: "แฉ"
- }
- Key {
- text: "อ"
- alternativeKeys: "อฮ"
- }
- Key {
- text: "\u0E34"
- displayText: " \u0E34"
- alternativeKeys: [ "\u0E34", " \u0E3A" ]
- }
- Key {
- text: "\u0E37"
- displayText: " \u0E37"
- alternativeKeys: [ "\u0E37", " \u0E4C" ]
- }
- Key {
- text: "ท"
- }
- Key {
- text: "ม"
- alternativeKeys: "มฒ"
- }
- Key {
- text: "ใ"
- alternativeKeys: "ใฬ"
- }
- Key {
- text: "ฝ"
- alternativeKeys: "ฝฦ"
- }
- FillerKey {
- weight: 80
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!?.,"
- smallTextVisible: true
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Layout.preferredHeight: 3
- smallTextVisible: true
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- Key {
- text: "๑"
- }
- Key {
- text: "๒"
- }
- Key {
- text: "๓"
- }
- Key {
- text: "๔"
- }
- Key {
- text: "\u0E39"
- displayText: " \u0E39"
- }
- Key {
- enabled: false
- }
- Key {
- text: "๕"
- }
- Key {
- text: "๖"
- }
- Key {
- text: "๗"
- }
- Key {
- text: "๘"
- }
- Key {
- text: "๙"
- }
- }
- KeyboardRow {
- Key {
- text: "฿"
- }
- Key {
- text: "ฎ"
- }
- Key {
- text: "ฑ"
- }
- Key {
- text: "ธ"
- }
- Key {
- text: "。"
- }
- Key {
- text: "\u0E4A"
- displayText: " \u0E4A"
- }
- Key {
- text: "ณ"
- }
- Key {
- text: "ฯ"
- }
- Key {
- text: "ญ"
- }
- Key {
- text: "ฐ"
- }
- Key {
- enabled: false
- }
- }
- KeyboardRow {
- Key {
- text: "ฤ"
- }
- Key {
- text: "ฆ"
- }
- Key {
- text: "ฏ"
- }
- Key {
- text: "โ"
- }
- Key {
- text: "ฌ"
- }
- Key {
- text: "\u0E47"
- displayText: " \u0E47"
- }
- Key {
- text: "\u0E4B"
- displayText: " \u0E4B"
- }
- Key {
- text: "ษ"
- }
- Key {
- text: "ศ"
- }
- Key {
- text: "ซ"
- }
- Key {
- enabled: false
- }
- }
- KeyboardRow {
- FillerKey {
- weight: 80
- }
- Key {
- enabled: false
- }
- Key {
- enabled: false
- }
- Key {
- text: "ฉ"
- }
- Key {
- text: "ฮ"
- }
- Key {
- text: "\u0E3A"
- displayText: " \u0E3A"
- }
- Key {
- text: "\u0E4C"
- displayText: " \u0E4C"
- }
- Key {
- enabled: false
- }
- Key {
- text: "ฒ"
- }
- Key {
- text: "ฬ"
- }
- Key {
- text: "ฦ"
- }
- FillerKey {
- weight: 80
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- alternativeKeys: "!?,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/th_TH/symbols.qml b/src/virtualkeyboard/content/layouts/th_TH/symbols.qml
deleted file mode 100644
index 53fdcd6e..00000000
--- a/src/virtualkeyboard/content/layouts/th_TH/symbols.qml
+++ /dev/null
@@ -1,376 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "กขค"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!?.,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: 0xA5
- text: "¥"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "กขค"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/tr_TR/main.qml b/src/virtualkeyboard/content/layouts/tr_TR/main.qml
deleted file mode 100644
index 31bf0dc1..00000000
--- a/src/virtualkeyboard/content/layouts/tr_TR/main.qml
+++ /dev/null
@@ -1,221 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- text: "\u0131"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- Key {
- text: "\u011F"
- }
- Key {
- key: Qt.Key_Udiaeresis
- text: "ü"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 66
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåä"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- Key {
- text: "ş"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey { }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- alternativeKeys: "$¢x₺€¥£"
- smallTextVisible: true
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Odiaeresis
- text: "ö"
- }
- Key {
- key: Qt.Key_Ccedilla
- text: "ç"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!?."
- smallTextVisible: true
- }
- ShiftKey {
- weight: 264
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/uk_UA/main.qml b/src/virtualkeyboard/content/layouts/uk_UA/main.qml
deleted file mode 100644
index c2731452..00000000
--- a/src/virtualkeyboard/content/layouts/uk_UA/main.qml
+++ /dev/null
@@ -1,373 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cyrillic ? cyrillicLayout : latinLayout
- Component {
- id: cyrillicLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- text: "й"
- }
- Key {
- text: "ц"
- }
- Key {
- text: "у"
- }
- Key {
- text: "к"
- }
- Key {
- text: "е"
- }
- Key {
- text: "н"
- }
- Key {
- text: "г"
- }
- Key {
- text: "ш"
- }
- Key {
- text: "щ"
- }
- Key {
- text: "з"
- }
- Key {
- text: "х"
- }
- Key {
- text: "ї"
- }
- BackspaceKey {
- weight: 180
- }
- }
- KeyboardRow {
- FillerKey {
- weight: 40
- }
- Key {
- text: "ф"
- }
- Key {
- text: "і"
- }
- Key {
- text: "в"
- }
- Key {
- text: "а"
- }
- Key {
- text: "п"
- }
- Key {
- text: "р"
- }
- Key {
- text: "о"
- }
- Key {
- text: "л"
- }
- Key {
- text: "д"
- }
- Key {
- text: "ж"
- }
- Key {
- text: "є"
- }
- EnterKey {
- weight: 280
- }
- }
- KeyboardRow {
- InputModeKey {
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- text: "ґ"
- }
- Key {
- text: "я"
- alternativeKeys: "$¢я₴€¥£"
- smallTextVisible: true
- }
- Key {
- text: "ч"
- }
- Key {
- text: "с"
- }
- Key {
- text: "м"
- }
- Key {
- text: "и"
- }
- Key {
- text: "т"
- }
- Key {
- text: "ь"
- }
- Key {
- text: "б"
- }
- Key {
- text: "ю"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- ShiftKey {
- weight: 272
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ";:!?.,"
- smallTextVisible: true
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: latinLayout
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "oö"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aåä"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđ"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- InputModeKey {
- inputModes: [InputEngine.InputMode.Cyrillic, InputEngine.InputMode.Latin]
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- alternativeKeys: "$¢x₴€¥£"
- smallTextVisible: true
- }
- Key {
- key: Qt.Key_C
- text: "c"
- alternativeKeys: "ćcč"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- alternativeKeys: "-\"'"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ";:!?.,"
- smallTextVisible: true
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/main.qml b/src/virtualkeyboard/content/layouts/vi_VN/main.qml
deleted file mode 100644
index 9a5c7e37..00000000
--- a/src/virtualkeyboard/content/layouts/vi_VN/main.qml
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- inputMode: InputEngine.InputMode.Latin
- sharedLayouts: ["numbers", "digits"]
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- alternativeKeys: "eèéẻẽẹêềếểễệ"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- alternativeKeys: "yỳýỷỹỵ"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- alternativeKeys: "ưừứửữựuùúủũụ"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- alternativeKeys: "iìíỉĩị"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- alternativeKeys: "ơờớởỡợòóỏõọoôồốổỗộ"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- alternativeKeys: "aàáảãạăằắẳẵặâầấẩẫậ"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- alternativeKeys: "sš"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- alternativeKeys: "dđ"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ShiftKey {}
- Key {
- key: Qt.Key_Z
- text: "z"
- alternativeKeys: "zž"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- alternativeKeys: "nñ"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: ","
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: "!,.?"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/vi_VN/symbols.qml b/src/virtualkeyboard/content/layouts/vi_VN/symbols.qml
deleted file mode 100644
index da5281b3..00000000
--- a/src/virtualkeyboard/content/layouts/vi_VN/symbols.qml
+++ /dev/null
@@ -1,376 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- property bool secondPage
- onVisibleChanged: if (!visible) secondPage = false
- sourceComponent: secondPage ? page2 : page1
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_1
- text: "1"
- }
- Key {
- key: Qt.Key_2
- text: "2"
- }
- Key {
- key: Qt.Key_3
- text: "3"
- }
- Key {
- key: Qt.Key_4
- text: "4"
- }
- Key {
- key: Qt.Key_5
- text: "5"
- }
- Key {
- key: Qt.Key_6
- text: "6"
- }
- Key {
- key: Qt.Key_7
- text: "7"
- }
- Key {
- key: Qt.Key_8
- text: "8"
- }
- Key {
- key: Qt.Key_9
- text: "9"
- }
- Key {
- key: Qt.Key_0
- text: "0"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_At
- text: "@"
- }
- Key {
- key: Qt.Key_NumberSign
- text: "#"
- }
- Key {
- key: Qt.Key_Percent
- text: "%"
- }
- Key {
- key: Qt.Key_Ampersand
- text: "&"
- }
- Key {
- key: Qt.Key_Asterisk
- text: "*"
- }
- Key {
- key: Qt.Key_Minus
- text: "-"
- }
- Key {
- key: Qt.Key_Plus
- text: "+"
- }
- Key {
- key: Qt.Key_ParenLeft
- text: "("
- }
- Key {
- key: Qt.Key_ParenRight
- text: ")"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Exclam
- text: "!"
- }
- Key {
- key: Qt.Key_QuoteDbl
- text: '"'
- }
- Key {
- key: Qt.Key_Less
- text: "<"
- }
- Key {
- key: Qt.Key_Greater
- text: ">"
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Colon
- text: ":"
- }
- Key {
- key: Qt.Key_Semicolon
- text: ";"
- }
- Key {
- key: Qt.Key_Slash
- text: "/"
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- }
- Key {
- weight: 204
- displayText: "1/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ".,"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_AsciiTilde
- text: "~"
- }
- Key {
- key: Qt.Key_Agrave
- text: "`"
- }
- Key {
- key: Qt.Key_Bar
- text: "|"
- }
- Key {
- key: 0x7B
- text: "·"
- }
- Key {
- key: 0x221A
- text: "√"
- }
- Key {
- key: Qt.Key_division
- text: "÷"
- }
- Key {
- key: Qt.Key_multiply
- text: "×"
- }
- Key {
- key: Qt.Key_onehalf
- text: "½"
- alternativeKeys: "¼⅓½¾⅞"
- }
- Key {
- key: Qt.Key_BraceLeft
- text: "{"
- }
- Key {
- key: Qt.Key_BraceRight
- text: "}"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_Dollar
- text: "$"
- }
- Key {
- key: 0x20AC
- text: "€"
- }
- Key {
- key: 0xC2
- text: "£"
- }
- Key {
- key: 0xA2
- text: "¢"
- }
- Key {
- key: 0x20AB
- text: "₫"
- }
- Key {
- key: Qt.Key_Equal
- text: "="
- }
- Key {
- key: Qt.Key_section
- text: "§"
- }
- Key {
- key: Qt.Key_BracketLeft
- text: "["
- }
- Key {
- key: Qt.Key_BracketRight
- text: "]"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- Key {
- key: Qt.Key_Underscore
- text: "_"
- }
- Key {
- key: 0x2122
- text: '™'
- }
- Key {
- key: 0x00AE
- text: '®'
- }
- Key {
- key: Qt.Key_guillemotleft
- text: '«'
- }
- Key {
- key: Qt.Key_guillemotright
- text: '»'
- }
- Key {
- key: 0x201C
- text: '“'
- }
- Key {
- key: 0x201D
- text: '”'
- }
- Key {
- key: Qt.Key_Backslash
- text: "\\"
- }
- Key {
- key: Qt.Key_AsciiCircum
- text: "^"
- }
- Key {
- weight: 204
- displayText: "2/2"
- functionKey: true
- onClicked: secondPage = !secondPage
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "\u2026"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml b/src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml
deleted file mode 100644
index fee04320..00000000
--- a/src/virtualkeyboard/content/layouts/zh_CN/handwriting.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: preferredInputMode()
-
- Connections {
- target: InputContext
- onInputMethodHintsChanged: {
- var newInputMode = preferredInputMode()
- if (InputContext.inputEngine.inputModes.indexOf(newInputMode) !== -1)
- InputContext.inputEngine.inputMode = newInputMode
- }
- }
-
- function preferredInputMode() {
- return InputContext.inputMethodHints &
- (Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
- Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.ChineseHandwriting
- }
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.ChineseHandwriting ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
-
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "‘"
- alternativeKeys: "《》〈〉•…々〆‘’“”「」¥"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.、。?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/main.qml b/src/virtualkeyboard/content/layouts/zh_CN/main.qml
deleted file mode 100644
index 349a14c8..00000000
--- a/src/virtualkeyboard/content/layouts/zh_CN/main.qml
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; PinyinInputMethod {}', parent, "pinyinInputMethod")
- }
- sharedLayouts: ['symbols']
- keyWeight: 160
- KeyboardRow {
- Key {
- key: Qt.Key_Q
- text: "q"
- }
- Key {
- key: Qt.Key_W
- text: "w"
- }
- Key {
- key: Qt.Key_E
- text: "e"
- }
- Key {
- key: Qt.Key_R
- text: "r"
- }
- Key {
- key: Qt.Key_T
- text: "t"
- }
- Key {
- key: Qt.Key_Y
- text: "y"
- }
- Key {
- key: Qt.Key_U
- text: "u"
- }
- Key {
- key: Qt.Key_I
- text: "i"
- }
- Key {
- key: Qt.Key_O
- text: "o"
- }
- Key {
- key: Qt.Key_P
- text: "p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- key: Qt.Key_A
- text: "a"
- }
- Key {
- key: Qt.Key_S
- text: "s"
- }
- Key {
- key: Qt.Key_D
- text: "d"
- }
- Key {
- key: Qt.Key_F
- text: "f"
- }
- Key {
- key: Qt.Key_G
- text: "g"
- }
- Key {
- key: Qt.Key_H
- text: "h"
- }
- Key {
- key: Qt.Key_J
- text: "j"
- }
- Key {
- key: Qt.Key_K
- text: "k"
- }
- Key {
- key: Qt.Key_L
- text: "l"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- enabled: InputContext.preeditText.length > 0
- key: Qt.Key_Apostrophe
- text: "'"
- }
- Key {
- key: Qt.Key_Z
- text: "z"
- }
- Key {
- key: Qt.Key_X
- text: "x"
- }
- Key {
- key: Qt.Key_C
- text: "c"
- }
- Key {
- key: Qt.Key_V
- text: "v"
- }
- Key {
- key: Qt.Key_B
- text: "b"
- }
- Key {
- key: Qt.Key_N
- text: "n"
- }
- Key {
- key: Qt.Key_M
- text: "m"
- }
- Key {
- key: Qt.Key_Comma
- text: "\uFF0C"
- alternativeKeys: "\uFF0C\uFF1B\u3001"
- }
- Key {
- key: Qt.Key_Period
- text: "\uFF0E"
- alternativeKeys: "\uFF0E\uFF1A\u3002"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Question
- text: "?"
- alternativeKeys: "?!"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/zh_CN/symbols.qml b/src/virtualkeyboard/content/layouts/zh_CN/symbols.qml
deleted file mode 100644
index 4ad06baf..00000000
--- a/src/virtualkeyboard/content/layouts/zh_CN/symbols.qml
+++ /dev/null
@@ -1,294 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; PinyinInputMethod {}', parent, "pinyinInputMethod")
- }
- sharedLayouts: ['main']
- property int page
- readonly property int numPages: 3
- property var keysPage1: [
- "1234567890",
- "@#$%^&*()",
- "“”、=:;!?~"
- ]
- property var keysPage2: [
- "-+/\\|[]{}·",
- "<>,.:;!?~",
- "/\"'_§¥€£¢"
- ]
- property var keysPage3: [
- "()〔〕〈〉《》【】",
- "→←↑↓↔■□●○",
- "\『』「」★☆◆◇"
- ]
- sourceComponent: {
- switch (page) {
- case 2: return page3
- case 1: return page2
- default: return page1
- }
- }
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage1[0].length
- Key {
- key: keysPage1[0][index].charCodeAt(0)
- text: keysPage1[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage1[1].length
- Key {
- key: keysPage1[1][index].charCodeAt(0)
- text: keysPage1[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage1[2].length
- Key {
- key: keysPage1[2][index].charCodeAt(0)
- text: keysPage1[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2014
- text: "—"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage2[0].length
- Key {
- key: keysPage2[0][index].charCodeAt(0)
- text: keysPage2[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage2[1].length
- Key {
- key: keysPage2[1][index].charCodeAt(0)
- text: keysPage2[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage2[2].length
- Key {
- key: keysPage2[2][index].charCodeAt(0)
- text: keysPage2[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x3002
- text: "。"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page3
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage3[0].length
- Key {
- key: keysPage3[0][index].charCodeAt(0)
- text: keysPage3[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage3[1].length
- Key {
- key: keysPage3[1][index].charCodeAt(0)
- text: keysPage3[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage3[2].length
- Key {
- key: keysPage3[2][index].charCodeAt(0)
- text: keysPage3[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "…"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml b/src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml
deleted file mode 100644
index fee04320..00000000
--- a/src/virtualkeyboard/content/layouts/zh_TW/handwriting.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayout {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; HandwritingInputMethod {}', parent)
- }
- sharedLayouts: ['symbols']
- inputMode: preferredInputMode()
-
- Connections {
- target: InputContext
- onInputMethodHintsChanged: {
- var newInputMode = preferredInputMode()
- if (InputContext.inputEngine.inputModes.indexOf(newInputMode) !== -1)
- InputContext.inputEngine.inputMode = newInputMode
- }
- }
-
- function preferredInputMode() {
- return InputContext.inputMethodHints &
- (Qt.ImhPreferLatin | Qt.ImhEmailCharactersOnly | Qt.ImhUrlCharactersOnly |
- Qt.ImhLatinOnly) ? InputEngine.InputMode.Latin : InputEngine.InputMode.ChineseHandwriting
- }
-
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- TraceInputKey {
- objectName: "hwrInputArea"
- patternRecognitionMode: InputEngine.PatternRecognitionMode.Handwriting
- horizontalRulers:
- InputContext.inputEngine.inputMode !== InputEngine.InputMode.ChineseHandwriting ? [] :
- [Math.round(boundingBox.height / 4), Math.round(boundingBox.height / 4) * 2, Math.round(boundingBox.height / 4) * 3]
-
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- InputModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- customLayoutsOnly: true
- }
- HandwritingModeKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Apostrophe
- text: "‘"
- alternativeKeys: "《》〈〉•…々〆‘’“”「」¥"
- }
- Key {
- key: Qt.Key_Period
- text: "."
- alternativeKeys: ":;,.、。?!"
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/main.qml b/src/virtualkeyboard/content/layouts/zh_TW/main.qml
deleted file mode 100644
index bd9c1451..00000000
--- a/src/virtualkeyboard/content/layouts/zh_TW/main.qml
+++ /dev/null
@@ -1,458 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.3
-
-KeyboardLayoutLoader {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.3; TCInputMethod {}', parent, "tcInputMethod")
- }
- sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cangjie ? pageCangjie : pageZhuyin
- Component {
- id: pageCangjie
- KeyboardLayout {
- keyWeight: 160
- smallTextVisible: true
- KeyboardRow {
- Key {
- text: "\u624B"
- alternativeKeys: "\u624Bq"
- }
- Key {
- text: "\u7530"
- alternativeKeys: "\u7530w"
- }
- Key {
- text: "\u6C34"
- alternativeKeys: "\u6C34e"
- }
- Key {
- text: "\u53E3"
- alternativeKeys: "\u53E3r"
- }
- Key {
- text: "\u5EFF"
- alternativeKeys: "\u5EFFt"
- }
- Key {
- text: "\u535C"
- alternativeKeys: "\u535Cy"
- }
- Key {
- text: "\u5C71"
- alternativeKeys: "\u5C71u"
- }
- Key {
- text: "\u6208"
- alternativeKeys: "\u6208i"
- }
- Key {
- text: "\u4EBA"
- alternativeKeys: "\u4EBAo"
- }
- Key {
- text: "\u5FC3"
- alternativeKeys: "\u5FC3p"
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Key {
- text: "\u65E5"
- alternativeKeys: "\u65E5a"
- }
- Key {
- text: "\u5C38"
- alternativeKeys: "\u5C38s"
- }
- Key {
- text: "\u6728"
- alternativeKeys: "\u6728d"
- }
- Key {
- text: "\u706B"
- alternativeKeys: "\u706Bf"
- }
- Key {
- text: "\u571F"
- alternativeKeys: "\u571Fg"
- }
- Key {
- text: "\u7AF9"
- alternativeKeys: "\u7AF9h"
- }
- Key {
- text: "\u5341"
- alternativeKeys: "\u5341j"
- }
- Key {
- text: "\u5927"
- alternativeKeys: "\u5927k"
- }
- Key {
- text: "\u4E2D"
- alternativeKeys: "\u4E2Dl"
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- ModeKey {
- id: simplifiedModeKey
- key: Qt.Key_Mode_switch
- displayText: "速成"
- Component.onCompleted: updateBinding()
- Connections {
- target: InputContext.inputEngine
- onInputMethodChanged: simplifiedModeKey.updateBinding()
- }
- function updateBinding() {
- if (InputContext.inputEngine.inputMethod && InputContext.inputEngine.inputMethod.hasOwnProperty("simplified")) {
- simplifiedModeKey.mode = InputContext.inputEngine.inputMethod.simplified
- InputContext.inputEngine.inputMethod.simplified = Qt.binding(function() { return simplifiedModeKey.mode })
- }
- }
- }
- Key {
- text: "\u91CD"
- alternativeKeys: "\u91CDz"
- }
- Key {
- text: "\u96E3"
- alternativeKeys: "\u96E3x"
- }
- Key {
- text: "\u91D1"
- alternativeKeys: "\u91D1c"
- }
- Key {
- text: "\u5973"
- alternativeKeys: "\u5973v"
- }
- Key {
- text: "\u6708"
- alternativeKeys: "\u6708b"
- }
- Key {
- text: "\u5F13"
- alternativeKeys: "\u5F13n"
- }
- Key {
- text: "\u4E00"
- alternativeKeys: "\u4E00m"
- }
- Key {
- key: Qt.Key_Comma
- text: "\uFF0C"
- alternativeKeys: "\uFF0C\uFF1B\u3001"
- }
- Key {
- key: Qt.Key_Period
- text: "\uFF0E"
- alternativeKeys: "\uFF0E\uFF1A\u3002"
- }
- ShiftKey {
- weight: 204
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- InputModeKey {
- visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.InputMode.Zhuyin) !== -1
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: Qt.Key_Question
- text: "\uFF1F"
- alternativeKeys: "\uFF1F\uFF01"
- }
- Key {
- key: 0xE000
- text: ":-)"
- smallTextVisible: false
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: pageZhuyin
- KeyboardLayout {
- smallTextVisible: true
- KeyboardRow {
- Layout.preferredHeight: 3
- KeyboardColumn {
- Layout.preferredWidth: bottomRow.width - hideKeyboardKey.width
- KeyboardRow {
- Key {
- text: "\u3105"
- alternativeKeys: "\u31051"
- }
- Key {
- text: "\u3109"
- alternativeKeys: "\u31092"
- }
- Key {
- text: "\u02C7"
- alternativeKeys: "\u02C73"
- }
- Key {
- text: "\u02CB"
- alternativeKeys: "4"
- displayText: "`"
- }
- Key {
- text: "\u3113"
- alternativeKeys: "\u31135"
- }
- Key {
- text: "\u02CA"
- alternativeKeys: "6"
- displayText: "´"
- }
- Key {
- text: "\u02D9"
- alternativeKeys: "\u02D97"
- }
- Key {
- text: "\u311A"
- alternativeKeys: "\u311A8"
- }
- Key {
- text: "\u311E"
- alternativeKeys: "\u311E9"
- }
- Key {
- text: "\u3122"
- alternativeKeys: "\u31220"
- }
- }
- KeyboardRow {
- Key {
- text: "\u3106"
- alternativeKeys: "\u3106q"
- }
- Key {
- text: "\u310A"
- alternativeKeys: "\u310Aw"
- }
- Key {
- text: "\u310D"
- alternativeKeys: "\u310De"
- }
- Key {
- text: "\u3110"
- alternativeKeys: "\u3110r"
- }
- Key {
- text: "\u3114"
- alternativeKeys: "\u3114t"
- }
- Key {
- text: "\u3117"
- alternativeKeys: "\u3117y"
- }
- Key {
- text: "\u3127"
- alternativeKeys: "\u3127u"
- }
- Key {
- text: "\u311B"
- alternativeKeys: "\u311Bi"
- }
- Key {
- text: "\u311F"
- alternativeKeys: "\u311Fo"
- }
- Key {
- text: "\u3123"
- alternativeKeys: "\u3123p"
- }
- }
- KeyboardRow {
- Key {
- text: "\u3107"
- alternativeKeys: "\u3107a"
- }
- Key {
- text: "\u310B"
- alternativeKeys: "\u310Bs"
- }
- Key {
- text: "\u310E"
- alternativeKeys: "\u310Ed"
- }
- Key {
- text: "\u3111"
- alternativeKeys: "\u3111f"
- }
- Key {
- text: "\u3115"
- alternativeKeys: "\u3115g"
- }
- Key {
- text: "\u3118"
- alternativeKeys: "\u3118h"
- }
- Key {
- text: "\u3128"
- alternativeKeys: "\u3128j"
- }
- Key {
- text: "\u311C"
- alternativeKeys: "\u311Ck"
- }
- Key {
- text: "\u3120"
- alternativeKeys: "\u3120l"
- }
- Key {
- text: "\u3124"
- alternativeKeys: "\u3124…"
- }
- }
- KeyboardRow {
- Key {
- text: "\u3108"
- alternativeKeys: "\u3108z"
- }
- Key {
- text: "\u310C"
- alternativeKeys: "\u310Cx"
- }
- Key {
- text: "\u310F"
- alternativeKeys: "\u310Fc"
- }
- Key {
- text: "\u3112"
- alternativeKeys: "\u3112v"
- }
- Key {
- text: "\u3116"
- alternativeKeys: "\u3116b"
- }
- Key {
- text: "\u3119"
- alternativeKeys: "\u3119n"
- }
- Key {
- text: "\u3129"
- alternativeKeys: "\u3129m"
- }
- Key {
- text: "\u311D"
- alternativeKeys: "、\u311D,"
- }
- Key {
- text: "\u3121"
- alternativeKeys: "。\u3121."
- }
- Key {
- text: "\u3125"
- alternativeKeys: ";\u3125:"
- }
- }
- }
- KeyboardColumn {
- Layout.preferredWidth: hideKeyboardKey.width
- KeyboardRow {
- BackspaceKey {}
- }
- KeyboardRow {
- EnterKey {}
- }
- KeyboardRow {
- ShiftKey { }
- }
- }
- }
- KeyboardRow {
- id: bottomRow
- Layout.preferredHeight: 1
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- }
- ChangeLanguageKey {
- weight: 154
- }
- HandwritingModeKey {
- weight: 154
- }
- InputModeKey {
- visible: InputContext.inputEngine.inputModes.indexOf(InputEngine.InputMode.Cangjie) !== -1
- }
- SpaceKey {
- weight: 864
- }
- Key {
- text: "\u3126"
- }
- Key {
- key: Qt.Key_Question
- text: "\uFF1F"
- alternativeKeys: "\uFF1F\uFF01"
- }
- Key {
- key: 0xE000
- text: ":-)"
- smallTextVisible: false
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- id: hideKeyboardKey
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/layouts/zh_TW/symbols.qml b/src/virtualkeyboard/content/layouts/zh_TW/symbols.qml
deleted file mode 100644
index 3d43ae69..00000000
--- a/src/virtualkeyboard/content/layouts/zh_TW/symbols.qml
+++ /dev/null
@@ -1,294 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Layouts 1.0
-import QtQuick.VirtualKeyboard 2.1
-
-KeyboardLayoutLoader {
- function createInputMethod() {
- return Qt.createQmlObject('import QtQuick 2.0; import QtQuick.VirtualKeyboard.Plugins 2.1; TCInputMethod {}', parent, "tcInputMethod")
- }
- sharedLayouts: ['main']
- property int page
- readonly property int numPages: 3
- property var keysPage1: [
- "1234567890",
- "@#$%^&*()",
- "“”、=:;!?~"
- ]
- property var keysPage2: [
- "-+/\\|[]{}·",
- "<>,.:;!?~",
- "/\"'_§¥€£¢"
- ]
- property var keysPage3: [
- "()〔〕〈〉《》【】",
- "→←↑↓↔■□●○",
- "\『』「」★☆◆◇"
- ]
- sourceComponent: {
- switch (page) {
- case 2: return page3
- case 1: return page2
- default: return page1
- }
- }
- Component {
- id: page1
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage1[0].length
- Key {
- key: keysPage1[0][index].charCodeAt(0)
- text: keysPage1[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage1[1].length
- Key {
- key: keysPage1[1][index].charCodeAt(0)
- text: keysPage1[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage1[2].length
- Key {
- key: keysPage1[2][index].charCodeAt(0)
- text: keysPage1[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2014
- text: "—"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page2
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage2[0].length
- Key {
- key: keysPage2[0][index].charCodeAt(0)
- text: keysPage2[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage2[1].length
- Key {
- key: keysPage2[1][index].charCodeAt(0)
- text: keysPage2[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage2[2].length
- Key {
- key: keysPage2[2][index].charCodeAt(0)
- text: keysPage2[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x3002
- text: "。"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
- Component {
- id: page3
- KeyboardLayout {
- keyWeight: 160
- KeyboardRow {
- Repeater {
- model: keysPage3[0].length
- Key {
- key: keysPage3[0][index].charCodeAt(0)
- text: keysPage3[0][index]
- }
- }
- BackspaceKey {}
- }
- KeyboardRow {
- FillerKey {
- weight: 56
- }
- Repeater {
- model: keysPage3[1].length
- Key {
- key: keysPage3[1][index].charCodeAt(0)
- text: keysPage3[1][index]
- }
- }
- EnterKey {
- weight: 283
- }
- }
- KeyboardRow {
- keyWeight: 156
- Key {
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- Repeater {
- model: keysPage3[2].length
- Key {
- key: keysPage3[2][index].charCodeAt(0)
- text: keysPage3[2][index]
- }
- }
- Key {
- weight: 204
- displayText: (page + 1) + "/" + numPages
- functionKey: true
- onClicked: page = (page + 1) % numPages
- }
- }
- KeyboardRow {
- keyWeight: 154
- SymbolModeKey {
- weight: 217
- displayText: "ABC"
- }
- ChangeLanguageKey {
- weight: 154
- }
- SpaceKey {
- weight: 864
- }
- Key {
- key: 0x2026
- text: "…"
- }
- Key {
- key: 0xE000
- text: ":-)"
- alternativeKeys: [ ";-)", ":-)", ":-D", ":-(", "<3" ]
- }
- HideKeyboardKey {
- weight: 204
- }
- }
- }
- }
-}
diff --git a/src/virtualkeyboard/content/styles/default/images/backspace-868482.svg b/src/virtualkeyboard/content/styles/default/images/backspace-868482.svg
deleted file mode 100644
index 764c3c68..00000000
--- a/src/virtualkeyboard/content/styles/default/images/backspace-868482.svg
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="159px" height="88px" viewBox="0 0 159 88" enable-background="new 0 0 159 88" xml:space="preserve">
-<g>
- <rect fill="none" width="159" height="88"/>
- <g>
- <g>
- <path fill="#868482" d="M158.8,88H44L0,44L44,0h114.8V88z M48.7,76.7h98.8V11.3H48.7L16,44L48.7,76.7z"/>
- </g>
- <g>
- <g>
-
- <rect x="87.3" y="16.2" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 127.5895 140.8497)" fill="#868482" width="11.3" height="55.7"/>
- </g>
- <g>
-
- <rect x="65.1" y="38.4" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 127.5954 140.8499)" fill="#868482" width="55.7" height="11.3"/>
- </g>
- </g>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/check-868482.svg b/src/virtualkeyboard/content/styles/default/images/check-868482.svg
deleted file mode 100644
index 544fec50..00000000
--- a/src/virtualkeyboard/content/styles/default/images/check-868482.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="170px" height="119px" viewBox="0 0 170 119" enable-background="new 0 0 170 119" xml:space="preserve">
-<g>
- <polygon fill="#868482" points="62.3,119 0,56.7 11.3,45.3 62.3,96.3 158.7,0 170,11.3 "/>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/enter-868482.svg b/src/virtualkeyboard/content/styles/default/images/enter-868482.svg
deleted file mode 100644
index 88c14866..00000000
--- a/src/virtualkeyboard/content/styles/default/images/enter-868482.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="211px" height="80px" viewBox="0 0 211 80" enable-background="new 0 0 211 80" xml:space="preserve">
-<g>
- <rect fill="none" width="211" height="80"/>
- <g>
- <rect x="9.2" y="33.8" fill="#868482" width="201.8" height="12.3"/>
- <rect x="198.7" y="10.7" fill="#868482" width="12.3" height="35.3"/>
- <polygon fill="#868482" points="44.5,0 44.5,79.8 0,40.7 "/>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/globe-868482.svg b/src/virtualkeyboard/content/styles/default/images/globe-868482.svg
deleted file mode 100644
index 7cb9b794..00000000
--- a/src/virtualkeyboard/content/styles/default/images/globe-868482.svg
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="144px" height="144px" viewBox="0 0 144 144" enable-background="new 0 0 144 144" xml:space="preserve">
-<g>
- <rect fill="none" width="144" height="144"/>
- <g>
- <path fill="#868482" d="M72,144c-39.5,0-71.8-32.1-72-71.6C-0.2,32.7,31.9,0.2,71.6,0h0.7c19.1,0.1,37.1,7.6,50.6,21.1
- s21,31.5,21.1,50.5c0.1,19.2-7.3,37.4-20.8,51c-13.5,13.7-31.6,21.3-50.8,21.4C72.2,144,72.1,144,72,144z M76.3,101.3v32.3
- c9-8.1,16-17.9,20.6-28.7C90.2,102.9,83.3,101.7,76.3,101.3z M47,104.9c3.2,7.4,7.5,14.3,12.8,20.6c2.4,2.9,5.1,5.6,7.9,8.1v-32.3
- C60.7,101.7,53.8,102.9,47,104.9z M105.2,107.9c-3.9,9.2-9.2,17.6-15.9,25.1c10.4-2.9,19.9-8.5,27.8-16.4c0.5-0.5,1-1.1,1.6-1.6
- C114.3,112.1,109.8,109.8,105.2,107.9z M25.5,114.9c7.8,8.5,17.9,14.8,29.3,18c-0.5-0.6-1.1-1.2-1.6-1.8
- c-6-7.1-10.8-14.9-14.3-23.3C34.2,109.8,29.8,112.1,25.5,114.9z M108.1,99.7c5.5,2.3,10.8,5.1,15.9,8.4
- c6.5-9.4,10.4-20.3,11.2-31.8h-22.9c-0.1,1.2-0.1,2.4-0.2,3.7C111.4,86.8,110.1,93.4,108.1,99.7z M8.8,76.3
- C9.6,88.1,13.6,99,20,108.1c5.1-3.3,10.4-6.1,15.8-8.4c-2.4-7.5-3.7-15.4-4.1-23.4L8.8,76.3L8.8,76.3z M40.4,76.3
- c0.3,7,1.5,13.8,3.6,20.4c7.7-2.4,15.7-3.8,23.7-4.1V76.3H40.4z M76.3,92.6c8,0.4,15.9,1.7,23.6,4.1c1.7-5.6,2.9-11.5,3.4-17.5
- c0.1-1,0.1-2,0.2-2.9H76.3V92.6z M112.2,67.7h23c-0.8-11.5-4.6-22.4-11.2-31.8c-5.1,3.4-10.5,6.2-16.1,8.5
- C110.4,51.9,111.8,59.7,112.2,67.7z M76.3,67.7h27.2c-0.4-7-1.6-13.8-3.7-20.4c-7.7,2.4-15.5,3.7-23.5,4.1V67.7z M40.5,67.7h27.2
- V51.4c-7.9-0.4-15.8-1.7-23.4-4.1c-1.8,5.8-3,11.9-3.6,18.1C40.6,66.2,40.5,66.9,40.5,67.7z M8.8,67.7h23c0.1-1,0.1-2,0.2-3
- c0.6-7,2-13.8,4-20.3c-5.5-2.3-10.9-5.1-16-8.5C13.6,45,9.6,55.9,8.8,67.7z M76.3,11.1v31.6c6.9-0.3,13.7-1.5,20.4-3.5
- c-3.1-7.1-7.3-13.9-12.5-20C81.8,16.3,79.1,13.6,76.3,11.1z M47.3,39.2c6.7,2,13.5,3.2,20.4,3.5V11.1C58.8,19,51.9,28.6,47.3,39.2
- z M88.4,10.8c0.8,0.9,1.6,1.8,2.4,2.8c5.9,6.9,10.6,14.6,14.1,22.7c4.7-2,9.3-4.3,13.7-7.2c-0.6-0.6-1.2-1.2-1.8-1.9
- C108.8,19.2,99,13.6,88.4,10.8z M25.5,29.1c4.4,2.8,8.9,5.2,13.6,7.1c4-9.3,9.5-17.9,16.5-25.4C43.8,14,33.5,20.4,25.5,29.1z"/>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/handwriting-868482.svg b/src/virtualkeyboard/content/styles/default/images/handwriting-868482.svg
deleted file mode 100644
index 65d37874..00000000
--- a/src/virtualkeyboard/content/styles/default/images/handwriting-868482.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="156px" height="104px" viewBox="0 0 156 104" enable-background="new 0 0 156 104" xml:space="preserve">
-<g>
- <rect fill="none" width="156" height="104"/>
- <g>
- <path fill="#868482" d="M37.6,103.3c-10.1,0-18.9-5-23.1-13.6C4.4,68.7,19.9,52.3,36.2,35c1.2-1.2,2.4-2.5,3.6-3.8
- c5.3-5.7,5.2-11.5,3.5-14.8c-1.8-3.4-5.5-4.9-10.2-4.2c-16.5,2.6-21.2,26.4-21.2,26.6L0,36.6C0.3,35.3,6.4,4.3,31.2,0.3
- c9.8-1.6,18.5,2.4,22.7,10.4c4.7,8.9,2.6,20.1-5.3,28.6c-1.2,1.3-2.4,2.6-3.6,3.8C28.3,60.9,19.1,71.6,25.4,84.5
- c3.3,6.8,11.1,7.6,16.9,6.3c9.2-2.1,19.8-11.1,19.7-29.5c-0.2-28.1,16.2-41.8,30.2-44.9c14.5-3.2,28.4,3.6,34.7,17
- c1.3,2.8,2.3,5.4,3.1,8.1c13.3,0.7,25.5,4.3,26,4.4l-3.4,11.5c-0.1,0-9.7-2.8-20.6-3.8c0.5,16.5-8.6,28.9-20.1,34.7
- c-11.9,6-24,3.8-28.9-5.2c-3.1-5.6-1.9-14.7,2.9-22.5c7.9-13,21.3-17.4,31.5-18.8c-0.4-1.2-0.9-2.4-1.4-3.4
- c-3.9-8.3-12.2-12.4-21.1-10.4c-9.7,2.2-21,12.1-20.8,33.1c0.2,25.5-15.6,38.1-29,41.3C42.5,103,40,103.3,37.6,103.3z M119.8,53.7
- c-14,1.5-20.6,8.5-23.4,12.9c-3.3,5.2-3.4,9.8-2.9,10.9c1.6,2.9,7.3,3,13,0.2C117.3,72.2,120.3,62.6,119.8,53.7z"/>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/hidekeyboard-868482.svg b/src/virtualkeyboard/content/styles/default/images/hidekeyboard-868482.svg
deleted file mode 100644
index 31e680a1..00000000
--- a/src/virtualkeyboard/content/styles/default/images/hidekeyboard-868482.svg
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="144px" height="127px" viewBox="0 0 144 127" enable-background="new 0 0 144 127" xml:space="preserve">
-<g>
- <rect fill="none" width="144" height="127"/>
- <g>
- <g>
- <path fill="#868482" d="M144,90.3H0V0h144V90.3z M10.9,79.4h122.2V10.9H10.9V79.4z"/>
- </g>
- <g>
- <rect x="19.5" y="20.2" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="38.1" y="20.2" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="56.8" y="20.2" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="75.5" y="20.2" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="94.2" y="20.2" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="112.9" y="20.2" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="19.5" y="39.7" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="38.1" y="39.7" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="56.8" y="39.7" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="75.5" y="39.7" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="94.2" y="39.7" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="112.9" y="39.7" fill="#868482" width="11.7" height="11.7"/>
- </g>
- <g>
- <rect x="38.1" y="59.2" fill="#868482" width="67.7" height="11.7"/>
- </g>
- <g>
- <polygon fill="#868482" points="72,115.2 62.2,108.2 45.9,108.2 72,126.9 98.1,108.2 81.8,108.2 "/>
- </g>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/search-868482.svg b/src/virtualkeyboard/content/styles/default/images/search-868482.svg
deleted file mode 100644
index 4aff8499..00000000
--- a/src/virtualkeyboard/content/styles/default/images/search-868482.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="148px" height="148px" viewBox="0 0 148 148" enable-background="new 0 0 148 148" xml:space="preserve">
-<g>
- <rect fill="none" width="148" height="148"/>
- <g>
- <path fill="#868482" d="M146.8,132.7c1.6,1.6,1.6,4.1,0,5.7l-8.5,8.5c-1.6,1.6-4.1,1.6-5.7,0l-44.6-44.6c-1.6-1.6-1.6-4.1,0-5.7
- l8.5-8.5c1.6-1.6,4.1-1.6,5.7,0L146.8,132.7z"/>
- <path fill="#868482" d="M58,12c25.4,0,46,20.6,46,46s-20.6,46-46,46c-25.4,0-46-20.6-46-46S32.6,12,58,12 M58,0C26,0,0,26,0,58
- s26,58,58,58c32,0,58-26,58-58S90,0,58,0L58,0z"/>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/shift-868482.svg b/src/virtualkeyboard/content/styles/default/images/shift-868482.svg
deleted file mode 100644
index 95b6d504..00000000
--- a/src/virtualkeyboard/content/styles/default/images/shift-868482.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="144px" height="134px" viewBox="0 0 144 134" enable-background="new 0 0 144 134" xml:space="preserve">
-<g>
- <rect fill="none" width="144" height="134"/>
- <g>
- <path fill="#868482" d="M103.6,134H40.2V77.5H0L71.9,0l71.9,77.5h-40.2V134L103.6,134z M51.7,122.5h40.5V66.1h25.4L71.9,16.8
- L26.2,66.1h25.4L51.7,122.5L51.7,122.5z"/>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/images/textmode-868482.svg b/src/virtualkeyboard/content/styles/default/images/textmode-868482.svg
deleted file mode 100644
index 2f9428c2..00000000
--- a/src/virtualkeyboard/content/styles/default/images/textmode-868482.svg
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="124px" height="96px" viewBox="0 0 124 96" enable-background="new 0 0 124 96" xml:space="preserve">
-<g>
- <g>
- <g>
- <path fill="#868482" d="M55.4,70.8L46.9,49H19.4L11,70.8H2.9L30,2h6.7l27,68.8H55.4z M44.4,41.8l-8-21.2c-1-2.7-2.1-6-3.2-9.9
- c-0.7,3-1.7,6.3-3,9.9l-8.1,21.2H44.4z"/>
- <path fill="#868482" d="M66.6,72.8H54.1L45.5,51H20.8l-8.4,21.8H0L28.7,0h9.4L66.6,72.8z M56.8,68.8h4L35.4,4h-1.9l1.7,6.2
- c1.1,3.8,2.1,7.1,3.1,9.7l9,24h-28l9.1-23.9c1.2-3.5,2.2-6.7,2.9-9.6L32.8,4h-1.4L5.9,68.8h3.8L18.1,47h30.2L56.8,68.8z
- M25.1,39.8h16.4l-7-18.5c-0.4-1.1-0.8-2.2-1.2-3.4c-0.4,1.1-0.7,2.2-1.2,3.4L25.1,39.8z"/>
- </g>
- <g>
- <path fill="#868482" d="M116.2,70.8l-1.5-7.3h-0.4c-2.6,3.2-5.1,5.4-7.7,6.5s-5.7,1.7-9.5,1.7c-5.1,0-9.1-1.3-12-3.9
- s-4.3-6.4-4.3-11.2c0-10.4,8.3-15.8,24.9-16.3l8.7-0.3v-3.2c0-4-0.9-7-2.6-8.9s-4.5-2.9-8.3-2.9c-4.3,0-9.1,1.3-14.5,3.9l-2.4-6
- c2.5-1.4,5.3-2.5,8.3-3.2s6-1.2,9.1-1.2c6.1,0,10.7,1.4,13.6,4.1s4.4,7.1,4.4,13.1v35.1H116.2z M98.7,65.3c4.8,0,8.6-1.3,11.4-4
- s4.1-6.4,4.1-11.2v-4.6l-7.8,0.3c-6.2,0.2-10.6,1.2-13.4,2.9S89,53.1,89,56.7c0,2.8,0.9,5,2.6,6.4S95.6,65.3,98.7,65.3z"/>
- <path fill="#868482" d="M97.1,73.8c-5.6,0-10.1-1.5-13.3-4.5c-3.3-3-5-7.3-5-12.7c0-11.6,9-17.8,26.8-18.3l6.8-0.2v-1.3
- c0-3.5-0.7-6.1-2.1-7.6c-1.3-1.5-3.6-2.2-6.8-2.2c-4,0-8.6,1.3-13.7,3.7l-1.9,0.9L84,22.1l1.6-0.8c2.7-1.4,5.6-2.6,8.8-3.4
- c3.2-0.8,6.4-1.2,9.6-1.2c6.6,0,11.7,1.6,15,4.6c3.4,3.1,5.1,8,5.1,14.5v37.1h-9.4l-1.1-5.3c-2,2-4,3.5-6,4.4
- C104.7,73.1,101.2,73.8,97.1,73.8z M103.5,23c4.4,0,7.7,1.2,9.8,3.5c2.1,2.3,3.1,5.7,3.1,10.3V42l-10.7,0.3
- c-23,0.7-23,10.9-23,14.3c0,4.3,1.2,7.5,3.7,9.7c2.5,2.3,6.1,3.4,10.6,3.4c3.5,0,6.4-0.5,8.7-1.5c2.2-1,4.6-3,6.9-6l0.6-0.8h2.6
- l0.7,1.6l1.2,5.7h2.1V35.8c0-5.4-1.3-9.3-3.8-11.6c-2.6-2.4-6.7-3.5-12.3-3.5c-2.8,0-5.7,0.4-8.6,1.1c-2.2,0.6-4.3,1.3-6.3,2.3
- l0.9,2.3C94.9,24.1,99.4,23,103.5,23z M98.7,67.3c-3.5,0-6.4-0.9-8.5-2.7C88,62.8,87,60.1,87,56.7c0-4.3,1.7-7.6,5-9.6
- c3.1-1.9,7.8-3,14.4-3.2l9.9-0.4v6.7c0,5.3-1.6,9.6-4.8,12.6C108.3,65.8,104,67.3,98.7,67.3z M112.2,47.6l-5.7,0.2
- c-5.8,0.2-10,1.1-12.4,2.6C92,51.8,91,53.8,91,56.7c0,2.2,0.6,3.8,1.9,4.9c1.3,1.1,3.3,1.7,5.8,1.7c4.3,0,7.6-1.1,10-3.4
- c2.4-2.3,3.5-5.5,3.5-9.7V47.6z"/>
- </g>
- </g>
- <rect y="88" fill="#868482" width="124" height="8"/>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/default/style.qml b/src/virtualkeyboard/content/styles/default/style.qml
deleted file mode 100644
index 095d5fc4..00000000
--- a/src/virtualkeyboard/content/styles/default/style.qml
+++ /dev/null
@@ -1,1036 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.7
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Styles 2.1
-
-KeyboardStyle {
- id: currentStyle
- readonly property bool compactSelectionList: [InputEngine.InputMode.Pinyin, InputEngine.InputMode.Cangjie, InputEngine.InputMode.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1
- readonly property string fontFamily: "Sans"
- readonly property real keyBackgroundMargin: Math.round(13 * scaleHint)
- readonly property real keyContentMargin: Math.round(45 * scaleHint)
- readonly property real keyIconScale: scaleHint * 0.6
- readonly property string resourcePrefix: "qrc:/QtQuick/VirtualKeyboard/content/styles/default/"
-
- readonly property string inputLocale: InputContext.locale
- property color inputLocaleIndicatorColor: "white"
- property Timer inputLocaleIndicatorHighlightTimer: Timer {
- interval: 1000
- onTriggered: inputLocaleIndicatorColor = "gray"
- }
- onInputLocaleChanged: {
- inputLocaleIndicatorColor = "white"
- inputLocaleIndicatorHighlightTimer.restart()
- }
-
- keyboardDesignWidth: 2560
- keyboardDesignHeight: 800
- keyboardRelativeLeftMargin: 114 / keyboardDesignWidth
- keyboardRelativeRightMargin: 114 / keyboardDesignWidth
- keyboardRelativeTopMargin: 13 / keyboardDesignHeight
- keyboardRelativeBottomMargin: 86 / keyboardDesignHeight
-
- keyboardBackground: Rectangle {
- color: "black"
- }
-
- keyPanel: KeyPanel {
- id: keyPanel
- Rectangle {
- id: keyBackground
- radius: 5
- color: "#383533"
- anchors.fill: keyPanel
- anchors.margins: keyBackgroundMargin
- Text {
- id: keySmallText
- text: control.smallText
- visible: control.smallTextVisible
- color: "gray"
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.margins: keyContentMargin / 3
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 38 * scaleHint
- capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
- }
- }
- Text {
- id: keyText
- text: control.displayText
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- anchors.fill: parent
- anchors.leftMargin: keyContentMargin
- anchors.topMargin: keyContentMargin
- anchors.rightMargin: keyContentMargin
- anchors.bottomMargin: keyContentMargin
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 52 * scaleHint
- capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
- }
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: keyBackground
- opacity: 0.75
- }
- PropertyChanges {
- target: keyText
- opacity: 0.5
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: keyBackground
- opacity: 0.75
- }
- PropertyChanges {
- target: keyText
- opacity: 0.05
- }
- }
- ]
- }
-
- backspaceKeyPanel: KeyPanel {
- id: backspaceKeyPanel
- Rectangle {
- id: backspaceKeyBackground
- radius: 5
- color: "#23211E"
- anchors.fill: backspaceKeyPanel
- anchors.margins: keyBackgroundMargin
- Image {
- id: backspaceKeyIcon
- anchors.centerIn: parent
- sourceSize.width: 159 * keyIconScale
- sourceSize.height: 88 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/backspace-868482.svg"
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: backspaceKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: backspaceKeyIcon
- opacity: 0.6
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: backspaceKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: backspaceKeyIcon
- opacity: 0.2
- }
- }
- ]
- }
-
- languageKeyPanel: KeyPanel {
- id: languageKeyPanel
- Rectangle {
- id: languageKeyBackground
- radius: 5
- color: "#35322f"
- anchors.fill: languageKeyPanel
- anchors.margins: keyBackgroundMargin
- Image {
- id: languageKeyIcon
- anchors.centerIn: parent
- sourceSize.width: 144 * keyIconScale
- sourceSize.height: 144 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/globe-868482.svg"
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: languageKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: languageKeyIcon
- opacity: 0.75
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: languageKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: languageKeyIcon
- opacity: 0.2
- }
- }
- ]
- }
-
- enterKeyPanel: KeyPanel {
- id: enterKeyPanel
- Rectangle {
- id: enterKeyBackground
- radius: 5
- color: "#1e1b18"
- anchors.fill: enterKeyPanel
- anchors.margins: keyBackgroundMargin
- Image {
- id: enterKeyIcon
- visible: enterKeyText.text.length === 0
- anchors.centerIn: parent
- readonly property size enterKeyIconSize: {
- switch (control.actionId) {
- case EnterKeyAction.Go:
- case EnterKeyAction.Send:
- case EnterKeyAction.Next:
- case EnterKeyAction.Done:
- return Qt.size(170, 119)
- case EnterKeyAction.Search:
- return Qt.size(148, 148)
- default:
- return Qt.size(211, 80)
- }
- }
- sourceSize.width: enterKeyIconSize.width * keyIconScale
- sourceSize.height: enterKeyIconSize.height * keyIconScale
- smooth: false
- source: {
- switch (control.actionId) {
- case EnterKeyAction.Go:
- case EnterKeyAction.Send:
- case EnterKeyAction.Next:
- case EnterKeyAction.Done:
- return resourcePrefix + "images/check-868482.svg"
- case EnterKeyAction.Search:
- return resourcePrefix + "images/search-868482.svg"
- default:
- return resourcePrefix + "images/enter-868482.svg"
- }
- }
- }
- Text {
- id: enterKeyText
- visible: text.length !== 0
- text: control.actionId !== EnterKeyAction.None ? control.displayText : ""
- clip: true
- fontSizeMode: Text.HorizontalFit
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#80c342"
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- capitalization: Font.AllUppercase
- }
- anchors.fill: parent
- anchors.margins: Math.round(42 * scaleHint)
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: enterKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: enterKeyIcon
- opacity: 0.6
- }
- PropertyChanges {
- target: enterKeyText
- opacity: 0.6
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: enterKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: enterKeyIcon
- opacity: 0.2
- }
- PropertyChanges {
- target: enterKeyText
- opacity: 0.2
- }
- }
- ]
- }
-
- hideKeyPanel: KeyPanel {
- id: hideKeyPanel
- Rectangle {
- id: hideKeyBackground
- radius: 5
- color: "#1e1b18"
- anchors.fill: hideKeyPanel
- anchors.margins: keyBackgroundMargin
- Image {
- id: hideKeyIcon
- anchors.centerIn: parent
- sourceSize.width: 144 * keyIconScale
- sourceSize.height: 127 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/hidekeyboard-868482.svg"
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: hideKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: hideKeyIcon
- opacity: 0.6
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: hideKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: hideKeyIcon
- opacity: 0.2
- }
- }
- ]
- }
-
- shiftKeyPanel: KeyPanel {
- id: shiftKeyPanel
- Rectangle {
- id: shiftKeyBackground
- radius: 5
- color: "#1e1b18"
- anchors.fill: shiftKeyPanel
- anchors.margins: keyBackgroundMargin
- Image {
- id: shiftKeyIcon
- anchors.centerIn: parent
- sourceSize.width: 144 * keyIconScale
- sourceSize.height: 134 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/shift-868482.svg"
- }
- states: [
- State {
- name: "capsLockActive"
- when: InputContext.capsLockActive
- PropertyChanges {
- target: shiftKeyBackground
- color: "#5a892e"
- }
- PropertyChanges {
- target: shiftKeyIcon
- source: resourcePrefix + "images/shift-c5d6b6.svg"
- }
- },
- State {
- name: "shiftActive"
- when: InputContext.shiftActive
- PropertyChanges {
- target: shiftKeyIcon
- source: resourcePrefix + "images/shift-80c342.svg"
- }
- }
- ]
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: shiftKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: shiftKeyIcon
- opacity: 0.6
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: shiftKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: shiftKeyIcon
- opacity: 0.2
- }
- }
- ]
- }
-
- spaceKeyPanel: KeyPanel {
- id: spaceKeyPanel
- Rectangle {
- id: spaceKeyBackground
- radius: 5
- color: "#35322f"
- anchors.fill: spaceKeyPanel
- anchors.margins: keyBackgroundMargin
- Text {
- id: spaceKeyText
- text: Qt.locale(InputContext.locale).nativeLanguageName
- color: currentStyle.inputLocaleIndicatorColor
- Behavior on color { PropertyAnimation { duration: 250 } }
- anchors.centerIn: parent
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 48 * scaleHint
- }
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: spaceKeyBackground
- opacity: 0.80
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: spaceKeyBackground
- opacity: 0.8
- }
- }
- ]
- }
-
- symbolKeyPanel: KeyPanel {
- id: symbolKeyPanel
- Rectangle {
- id: symbolKeyBackground
- radius: 5
- color: "#1e1b18"
- anchors.fill: symbolKeyPanel
- anchors.margins: keyBackgroundMargin
- Text {
- id: symbolKeyText
- text: control.displayText
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- anchors.fill: parent
- anchors.margins: keyContentMargin
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- capitalization: Font.AllUppercase
- }
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: symbolKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: symbolKeyText
- opacity: 0.6
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: symbolKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: symbolKeyText
- opacity: 0.2
- }
- }
- ]
- }
-
- modeKeyPanel: KeyPanel {
- id: modeKeyPanel
- Rectangle {
- id: modeKeyBackground
- radius: 5
- color: "#1e1b18"
- anchors.fill: modeKeyPanel
- anchors.margins: keyBackgroundMargin
- Text {
- id: modeKeyText
- text: control.displayText
- color: "white"
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- anchors.fill: parent
- anchors.margins: keyContentMargin
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- capitalization: Font.AllUppercase
- }
- }
- Rectangle {
- id: modeKeyIndicator
- implicitHeight: parent.height * 0.1
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- anchors.leftMargin: parent.width * 0.4
- anchors.rightMargin: parent.width * 0.4
- anchors.bottomMargin: parent.height * 0.12
- color: "#80c342"
- radius: 3
- visible: control.mode
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: modeKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: modeKeyText
- opacity: 0.6
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: modeKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: modeKeyText
- opacity: 0.2
- }
- }
- ]
- }
-
- handwritingKeyPanel: KeyPanel {
- id: handwritingKeyPanel
- Rectangle {
- id: hwrKeyBackground
- radius: 5
- color: "#35322f"
- anchors.fill: handwritingKeyPanel
- anchors.margins: keyBackgroundMargin
- Image {
- id: hwrKeyIcon
- anchors.centerIn: parent
- readonly property size hwrKeyIconSize: keyboard.handwritingMode ? Qt.size(124, 96) : Qt.size(156, 104)
- sourceSize.width: hwrKeyIconSize.width * keyIconScale
- sourceSize.height: hwrKeyIconSize.height * keyIconScale
- smooth: false
- source: resourcePrefix + (keyboard.handwritingMode ? "images/textmode-868482.svg" : "images/handwriting-868482.svg")
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: hwrKeyBackground
- opacity: 0.80
- }
- PropertyChanges {
- target: hwrKeyIcon
- opacity: 0.6
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: hwrKeyBackground
- opacity: 0.8
- }
- PropertyChanges {
- target: hwrKeyIcon
- opacity: 0.2
- }
- }
- ]
- }
-
- characterPreviewMargin: 0
- characterPreviewDelegate: Item {
- property string text
- id: characterPreview
- Rectangle {
- id: characterPreviewBackground
- anchors.fill: parent
- color: "#5d5b59"
- radius: 5
- Text {
- id: characterPreviewText
- color: "white"
- text: characterPreview.text
- fontSizeMode: Text.HorizontalFit
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- anchors.fill: parent
- anchors.margins: Math.round(48 * scaleHint)
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 82 * scaleHint
- }
- }
- }
- }
-
- alternateKeysListItemWidth: 99 * scaleHint
- alternateKeysListItemHeight: 150 * scaleHint
- alternateKeysListDelegate: Item {
- id: alternateKeysListItem
- width: alternateKeysListItemWidth
- height: alternateKeysListItemHeight
- Text {
- id: listItemText
- text: model.text
- color: "#868482"
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 52 * scaleHint
- }
- anchors.centerIn: parent
- }
- states: State {
- name: "current"
- when: alternateKeysListItem.ListView.isCurrentItem
- PropertyChanges {
- target: listItemText
- color: "white"
- }
- }
- }
- alternateKeysListHighlight: Rectangle {
- color: "#5d5b59"
- radius: 5
- }
- alternateKeysListBackground: Rectangle {
- color: "#1e1b18"
- radius: 5
- }
-
- selectionListHeight: 85 * scaleHint
- selectionListDelegate: SelectionListItem {
- id: selectionListItem
- width: Math.round(selectionListLabel.width + selectionListLabel.anchors.leftMargin * 2)
- Text {
- id: selectionListLabel
- anchors.left: parent.left
- anchors.leftMargin: Math.round((compactSelectionList ? 50 : 140) * scaleHint)
- anchors.verticalCenter: parent.verticalCenter
- text: decorateText(display, wordCompletionLength)
- color: "#80c342"
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- }
- function decorateText(text, wordCompletionLength) {
- if (wordCompletionLength > 0) {
- return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
- }
- return text
- }
- }
- Rectangle {
- id: selectionListSeparator
- width: 4 * scaleHint
- height: 36 * scaleHint
- radius: 2
- color: "#35322f"
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.left
- }
- states: State {
- name: "current"
- when: selectionListItem.ListView.isCurrentItem
- PropertyChanges {
- target: selectionListLabel
- color: "white"
- }
- }
- }
- selectionListBackground: Rectangle {
- color: "#1e1b18"
- }
- selectionListAdd: Transition {
- NumberAnimation { property: "y"; from: wordCandidateView.height; duration: 200 }
- NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 }
- }
- selectionListRemove: Transition {
- NumberAnimation { property: "y"; to: -wordCandidateView.height; duration: 200 }
- NumberAnimation { property: "opacity"; to: 0; duration: 200 }
- }
-
- navigationHighlight: Rectangle {
- color: "transparent"
- border.color: "yellow"
- border.width: 5
- }
-
- traceInputKeyPanelDelegate: TraceInputKeyPanel {
- id: traceInputKeyPanel
- traceMargins: keyBackgroundMargin
- Rectangle {
- id: traceInputKeyPanelBackground
- radius: 5
- color: "#35322f"
- anchors.fill: traceInputKeyPanel
- anchors.margins: keyBackgroundMargin
- Text {
- id: hwrInputModeIndicator
- visible: control.patternRecognitionMode === InputEngine.PatternRecognitionMode.Handwriting
- text: {
- switch (InputContext.inputEngine.inputMode) {
- case InputEngine.InputMode.Numeric:
- if (["ar", "fa"].indexOf(InputContext.locale.substring(0, 2)) !== -1)
- return "\u0660\u0661\u0662"
- // Fallthrough
- case InputEngine.InputMode.Dialable:
- return "123"
- case InputEngine.InputMode.Greek:
- return "ΑΒΓ"
- case InputEngine.InputMode.Cyrillic:
- return "АБВ"
- case InputEngine.InputMode.Arabic:
- if (InputContext.locale.substring(0, 2) === "fa")
- return "\u0627\u200C\u0628\u200C\u067E"
- return "\u0623\u200C\u0628\u200C\u062C"
- case InputEngine.InputMode.Hebrew:
- return "\u05D0\u05D1\u05D2"
- case InputEngine.InputMode.ChineseHandwriting:
- return "中文"
- case InputEngine.InputMode.JapaneseHandwriting:
- return "日本語"
- case InputEngine.InputMode.KoreanHandwriting:
- return "한국어"
- case InputEngine.InputMode.Thai:
- return "กขค"
- default:
- return "Abc"
- }
- }
- color: "white"
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.margins: keyContentMargin
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- capitalization: {
- if (InputContext.capsLockActive)
- return Font.AllUppercase
- if (InputContext.shiftActive)
- return Font.MixedCase
- return Font.AllLowercase
- }
- }
- }
- }
- Canvas {
- id: traceInputKeyGuideLines
- anchors.fill: traceInputKeyPanelBackground
- opacity: 0.1
- onPaint: {
- var ctx = getContext("2d")
- ctx.lineWidth = 1
- ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
- ctx.clearRect(0, 0, width, height)
- var i
- var margin = Math.round(30 * scaleHint)
- if (control.horizontalRulers) {
- for (i = 0; i < control.horizontalRulers.length; i++) {
- ctx.beginPath()
- var y = Math.round(control.horizontalRulers[i])
- var rightMargin = Math.round(width - margin)
- if (i + 1 === control.horizontalRulers.length) {
- ctx.moveTo(margin, y)
- ctx.lineTo(rightMargin, y)
- } else {
- var dashLen = Math.round(20 * scaleHint)
- for (var dash = margin, dashCount = 0;
- dash < rightMargin; dash += dashLen, dashCount++) {
- if ((dashCount & 1) === 0) {
- ctx.moveTo(dash, y)
- ctx.lineTo(Math.min(dash + dashLen, rightMargin), y)
- }
- }
- }
- ctx.stroke()
- }
- }
- if (control.verticalRulers) {
- for (i = 0; i < control.verticalRulers.length; i++) {
- ctx.beginPath()
- ctx.moveTo(control.verticalRulers[i], margin)
- ctx.lineTo(control.verticalRulers[i], Math.round(height - margin))
- ctx.stroke()
- }
- }
- }
- Connections {
- target: control
- onHorizontalRulersChanged: traceInputKeyGuideLines.requestPaint()
- onVerticalRulersChanged: traceInputKeyGuideLines.requestPaint()
- }
- }
- }
-
- traceCanvasDelegate: TraceCanvas {
- id: traceCanvas
- onAvailableChanged: {
- if (!available)
- return
- var ctx = getContext("2d")
- if (parent.canvasType === "fullscreen") {
- ctx.lineWidth = 10
- ctx.strokeStyle = Qt.rgba(0, 0, 0)
- } else {
- ctx.lineWidth = 10 * scaleHint
- ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
- }
- ctx.lineCap = "round"
- ctx.fillStyle = ctx.strokeStyle
- }
- autoDestroyDelay: 800
- onTraceChanged: if (trace === null) opacity = 0
- Behavior on opacity { PropertyAnimation { easing.type: Easing.OutCubic; duration: 150 } }
- }
-
- popupListDelegate: SelectionListItem {
- property real cursorAnchor: popupListLabel.x + popupListLabel.width
- id: popupListItem
- width: popupListLabel.width + popupListLabel.anchors.leftMargin * 2
- height: popupListLabel.height + popupListLabel.anchors.topMargin * 2
- Text {
- id: popupListLabel
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.leftMargin: popupListLabel.height / 2
- anchors.topMargin: popupListLabel.height / 3
- text: decorateText(display, wordCompletionLength)
- color: "#5CAA15"
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: Qt.inputMethod.cursorRectangle.height * 0.8
- }
- function decorateText(text, wordCompletionLength) {
- if (wordCompletionLength > 0) {
- return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
- }
- return text
- }
- }
- states: State {
- name: "current"
- when: popupListItem.ListView.isCurrentItem
- PropertyChanges {
- target: popupListLabel
- color: "black"
- }
- }
- }
-
- popupListBackground: Item {
- Rectangle {
- width: parent.width
- height: parent.height
- color: "white"
- border {
- width: 1
- color: "#929495"
- }
- }
- }
-
- popupListAdd: Transition {
- NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
- }
-
- popupListRemove: Transition {
- NumberAnimation { property: "opacity"; to: 0; duration: 200 }
- }
-
- languagePopupListEnabled: true
-
- languageListDelegate: SelectionListItem {
- id: languageListItem
- width: languageNameTextMetrics.width * 17
- height: languageNameTextMetrics.height + languageListLabel.anchors.topMargin + languageListLabel.anchors.bottomMargin
- Text {
- id: languageListLabel
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.leftMargin: languageNameTextMetrics.height / 2
- anchors.rightMargin: anchors.leftMargin
- anchors.topMargin: languageNameTextMetrics.height / 3
- anchors.bottomMargin: anchors.topMargin
- text: languageNameFormatter.elidedText
- color: "#5CAA15"
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- }
- }
- TextMetrics {
- id: languageNameTextMetrics
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- }
- text: "X"
- }
- TextMetrics {
- id: languageNameFormatter
- font {
- family: fontFamily
- weight: Font.Normal
- pixelSize: 44 * scaleHint
- }
- elide: Text.ElideRight
- elideWidth: languageListItem.width - languageListLabel.anchors.leftMargin - languageListLabel.anchors.rightMargin
- text: displayName
- }
- states: State {
- name: "current"
- when: languageListItem.ListView.isCurrentItem
- PropertyChanges {
- target: languageListLabel
- color: "black"
- }
- }
- }
-
- languageListBackground: Rectangle {
- color: "white"
- border {
- width: 1
- color: "#929495"
- }
- }
-
- languageListAdd: Transition {
- NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
- }
-
- languageListRemove: Transition {
- NumberAnimation { property: "opacity"; to: 0; duration: 200 }
- }
-
- selectionHandle: Image {
- sourceSize.width: 20
- source: resourcePrefix + "images/selectionhandle-bottom.svg"
- }
-
- fullScreenInputContainerBackground: Rectangle {
- color: "#FFF"
- }
-
- fullScreenInputBackground: Rectangle {
- color: "#FFF"
- }
-
- fullScreenInputMargins: Math.round(15 * scaleHint)
-
- fullScreenInputPadding: Math.round(30 * scaleHint)
-
- fullScreenInputCursor: Rectangle {
- width: 1
- color: "#000"
- visible: parent.blinkStatus
- }
-
- fullScreenInputFont.pixelSize: 58 * scaleHint
-}
diff --git a/src/virtualkeyboard/content/styles/default/virtualkeyboard_default_style.qrc b/src/virtualkeyboard/content/styles/default/virtualkeyboard_default_style.qrc
deleted file mode 100644
index 277e8cde..00000000
--- a/src/virtualkeyboard/content/styles/default/virtualkeyboard_default_style.qrc
+++ /dev/null
@@ -1,17 +0,0 @@
-<RCC>
- <qresource prefix="/QtQuick/VirtualKeyboard/content/styles/default">
- <file>style.qml</file>
- <file>images/backspace-868482.svg</file>
- <file>images/check-868482.svg</file>
- <file>images/enter-868482.svg</file>
- <file>images/globe-868482.svg</file>
- <file>images/handwriting-868482.svg</file>
- <file>images/hidekeyboard-868482.svg</file>
- <file>images/search-868482.svg</file>
- <file>images/shift-80c342.svg</file>
- <file>images/shift-868482.svg</file>
- <file>images/shift-c5d6b6.svg</file>
- <file>images/textmode-868482.svg</file>
- <file>images/selectionhandle-bottom.svg</file>
- </qresource>
-</RCC>
diff --git a/src/virtualkeyboard/content/styles/retro/images/handwriting-110b05.svg b/src/virtualkeyboard/content/styles/retro/images/handwriting-110b05.svg
deleted file mode 100644
index d19c4da7..00000000
--- a/src/virtualkeyboard/content/styles/retro/images/handwriting-110b05.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="156px" height="104px" viewBox="0 0 156 104" enable-background="new 0 0 156 104" xml:space="preserve">
-<g>
- <rect fill="none" width="156" height="104"/>
- <g>
- <path fill="#110B05" d="M37.6,103.3c-10.1,0-18.9-5-23.1-13.6C4.4,68.7,19.9,52.3,36.2,35c1.2-1.2,2.4-2.5,3.6-3.8
- c5.3-5.7,5.2-11.5,3.5-14.8c-1.8-3.4-5.5-4.9-10.2-4.2c-16.5,2.6-21.2,26.4-21.2,26.6L0,36.6C0.3,35.3,6.4,4.3,31.2,0.3
- c9.8-1.6,18.5,2.4,22.7,10.4c4.7,8.9,2.6,20.1-5.3,28.6c-1.2,1.3-2.4,2.6-3.6,3.8C28.3,60.9,19.1,71.6,25.4,84.5
- c3.3,6.8,11.1,7.6,16.9,6.3c9.2-2.1,19.8-11.1,19.7-29.5c-0.2-28.1,16.2-41.8,30.2-44.9c14.5-3.2,28.4,3.6,34.7,17
- c1.3,2.8,2.3,5.4,3.1,8.1c13.3,0.7,25.5,4.3,26,4.4l-3.4,11.5c-0.1,0-9.7-2.8-20.6-3.8c0.5,16.5-8.6,28.9-20.1,34.7
- c-11.9,6-24,3.8-28.9-5.2c-3.1-5.6-1.9-14.7,2.9-22.5c7.9-13,21.3-17.4,31.5-18.8c-0.4-1.2-0.9-2.4-1.4-3.4
- c-3.9-8.3-12.2-12.4-21.1-10.4c-9.7,2.2-21,12.1-20.8,33.1c0.2,25.5-15.6,38.1-29,41.3C42.5,103,40,103.3,37.6,103.3z M119.8,53.7
- c-14,1.5-20.6,8.5-23.4,12.9c-3.3,5.2-3.4,9.8-2.9,10.9c1.6,2.9,7.3,3,13,0.2C117.3,72.2,120.3,62.6,119.8,53.7z"/>
- </g>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/retro/images/textmode-110b05.svg b/src/virtualkeyboard/content/styles/retro/images/textmode-110b05.svg
deleted file mode 100644
index b891d960..00000000
--- a/src/virtualkeyboard/content/styles/retro/images/textmode-110b05.svg
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="124px" height="96px" viewBox="0 0 124 96" enable-background="new 0 0 124 96" xml:space="preserve">
-<g>
- <g>
- <g>
- <path fill="#110B05" d="M55.4,70.8L46.9,49H19.4L11,70.8H2.9L30,2h6.7l27,68.8H55.4z M44.4,41.8l-8-21.2c-1-2.7-2.1-6-3.2-9.9
- c-0.7,3-1.7,6.3-3,9.9l-8.1,21.2H44.4z"/>
- <path fill="#110B05" d="M66.6,72.8H54.1L45.5,51H20.8l-8.4,21.8H0L28.7,0h9.4L66.6,72.8z M56.8,68.8h4L35.4,4h-1.9l1.7,6.2
- c1.1,3.8,2.1,7.1,3.1,9.7l9,24h-28l9.1-23.9c1.2-3.5,2.2-6.7,2.9-9.6L32.8,4h-1.4L5.9,68.8h3.8L18.1,47h30.2L56.8,68.8z
- M25.1,39.8h16.4l-7-18.5c-0.4-1.1-0.8-2.2-1.2-3.4c-0.4,1.1-0.7,2.2-1.2,3.4L25.1,39.8z"/>
- </g>
- <g>
- <path fill="#110B05" d="M116.2,70.8l-1.5-7.3h-0.4c-2.6,3.2-5.1,5.4-7.7,6.5s-5.7,1.7-9.5,1.7c-5.1,0-9.1-1.3-12-3.9
- s-4.3-6.4-4.3-11.2c0-10.4,8.3-15.8,24.9-16.3l8.7-0.3v-3.2c0-4-0.9-7-2.6-8.9s-4.5-2.9-8.3-2.9c-4.3,0-9.1,1.3-14.5,3.9l-2.4-6
- c2.5-1.4,5.3-2.5,8.3-3.2s6-1.2,9.1-1.2c6.1,0,10.7,1.4,13.6,4.1s4.4,7.1,4.4,13.1v35.1H116.2z M98.7,65.3c4.8,0,8.6-1.3,11.4-4
- s4.1-6.4,4.1-11.2v-4.6l-7.8,0.3c-6.2,0.2-10.6,1.2-13.4,2.9S89,53.1,89,56.7c0,2.8,0.9,5,2.6,6.4S95.6,65.3,98.7,65.3z"/>
- <path fill="#110B05" d="M97.1,73.8c-5.6,0-10.1-1.5-13.3-4.5c-3.3-3-5-7.3-5-12.7c0-11.6,9-17.8,26.8-18.3l6.8-0.2v-1.3
- c0-3.5-0.7-6.1-2.1-7.6c-1.3-1.5-3.6-2.2-6.8-2.2c-4,0-8.6,1.3-13.7,3.7l-1.9,0.9L84,22.1l1.6-0.8c2.7-1.4,5.6-2.6,8.8-3.4
- c3.2-0.8,6.4-1.2,9.6-1.2c6.6,0,11.7,1.6,15,4.6c3.4,3.1,5.1,8,5.1,14.5v37.1h-9.4l-1.1-5.3c-2,2-4,3.5-6,4.4
- C104.7,73.1,101.2,73.8,97.1,73.8z M103.5,23c4.4,0,7.7,1.2,9.8,3.5c2.1,2.3,3.1,5.7,3.1,10.3V42l-10.7,0.3
- c-23,0.7-23,10.9-23,14.3c0,4.3,1.2,7.5,3.7,9.7c2.5,2.3,6.1,3.4,10.6,3.4c3.5,0,6.4-0.5,8.7-1.5c2.2-1,4.6-3,6.9-6l0.6-0.8h2.6
- l0.7,1.6l1.2,5.7h2.1V35.8c0-5.4-1.3-9.3-3.8-11.6c-2.6-2.4-6.7-3.5-12.3-3.5c-2.8,0-5.7,0.4-8.6,1.1c-2.2,0.6-4.3,1.3-6.3,2.3
- l0.9,2.3C94.9,24.1,99.4,23,103.5,23z M98.7,67.3c-3.5,0-6.4-0.9-8.5-2.7C88,62.8,87,60.1,87,56.7c0-4.3,1.7-7.6,5-9.6
- c3.1-1.9,7.8-3,14.4-3.2l9.9-0.4v6.7c0,5.3-1.6,9.6-4.8,12.6C108.3,65.8,104,67.3,98.7,67.3z M112.2,47.6l-5.7,0.2
- c-5.8,0.2-10,1.1-12.4,2.6C92,51.8,91,53.8,91,56.7c0,2.2,0.6,3.8,1.9,4.9c1.3,1.1,3.3,1.7,5.8,1.7c4.3,0,7.6-1.1,10-3.4
- c2.4-2.3,3.5-5.5,3.5-9.7V47.6z"/>
- </g>
- </g>
- <rect y="88" fill="#110B05" width="124" height="8"/>
-</g>
-</svg>
diff --git a/src/virtualkeyboard/content/styles/retro/style.qml b/src/virtualkeyboard/content/styles/retro/style.qml
deleted file mode 100644
index 17d2581e..00000000
--- a/src/virtualkeyboard/content/styles/retro/style.qml
+++ /dev/null
@@ -1,1079 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Styles 2.1
-
-KeyboardStyle {
- id: currentStyle
- readonly property bool compactSelectionList: [InputEngine.InputMode.Pinyin, InputEngine.InputMode.Cangjie, InputEngine.InputMode.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1
- readonly property string fontFamily: "Courier"
- readonly property real keyBackgroundMargin: Math.round(9 * scaleHint)
- readonly property real keyContentMargin: Math.round(30 * scaleHint)
- readonly property real keyIconScale: scaleHint * 0.6
- readonly property string resourcePath: "QtQuick/VirtualKeyboard/content/styles/retro/"
- readonly property string resourcePrefix: "qrc:/" + resourcePath
-
- readonly property string inputLocale: InputContext.locale
- property color inputLocaleIndicatorColor: "#110b05"
- property Timer inputLocaleIndicatorHighlightTimer: Timer {
- interval: 1000
- onTriggered: inputLocaleIndicatorColor = "#413828"
- }
- onInputLocaleChanged: {
- inputLocaleIndicatorColor = "#110b05"
- inputLocaleIndicatorHighlightTimer.restart()
- }
-
- keyboardDesignWidth: 2560
- keyboardDesignHeight: 800
- keyboardRelativeLeftMargin: 114 / keyboardDesignWidth
- keyboardRelativeRightMargin: 114 / keyboardDesignWidth
- keyboardRelativeTopMargin: 9 / keyboardDesignHeight
- keyboardRelativeBottomMargin: 88 / keyboardDesignHeight
-
- keyboardBackground: Rectangle {
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#272727" }
- GradientStop { position: 1.0; color: "black" }
- }
- }
-
- keyPanel: KeyPanel {
- id: keyPanel
- Image {
- id: keyBackground
- source: resourcePrefix + "images/key154px_colorA.png"
- fillMode: Image.PreserveAspectFit
- anchors.fill: keyPanel
- anchors.margins: keyBackgroundMargin
- states: [
- State {
- name: "key154px_colorB"
- when: ['q', 'r', 'y', 'p', 's', 'd', 'j', 'l', 'v', 'b', '\'',
- '1', '4', '6', '0', '#', '%', '+', ')', '>',
- '~', '·', '÷', '}', '€', '£', '§', ']', '«', '»'].indexOf(control.displayText.toLowerCase()) >= 0
- PropertyChanges {
- target: keyBackground
- source: resourcePrefix + "images/key154px_colorB.png"
- }
- },
- State {
- name: "key154px_black"
- when: control.displayText.length > 2
- PropertyChanges {
- target: keyBackground
- source: resourcePrefix + "images/key154px_black.png"
- }
- }
- ]
- }
- Text {
- id: keyText
- text: control.displayText
- color: "#110b05"
- anchors.fill: keyPanel
- anchors.margins: keyContentMargin
- fontSizeMode: Text.Fit
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font {
- family: fontFamily
- weight: Font.Bold
- pixelSize: 82 * scaleHint
- capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase
- }
- states: [
- State {
- name: "fontB"
- when: control.displayText.length > 2
- PropertyChanges {
- target: keyText
- color: "#c5a96f"
- font.pixelSize: 74 * scaleHint
- font.letterSpacing: -5 * scaleHint
- }
- }
- ]
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: keyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: keyText
- opacity: 0.75
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: keyBackground
- opacity: 0.30
- }
- PropertyChanges {
- target: keyText
- opacity: 0.50
- }
- }
- ]
- }
-
- backspaceKeyPanel: KeyPanel {
- id: backspaceKeyPanel
- BorderImage {
- id: backspaceKeyBackground
- source: resourcePrefix + "images/key154px_black.png"
- width: (parent.width - 2 * keyBackgroundMargin) / scale
- height: sourceSize.height
- anchors.centerIn: backspaceKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- }
- Image {
- id: backspaceKeyIcon
- anchors.centerIn: backspaceKeyPanel
- sourceSize.width: 159 * keyIconScale
- sourceSize.height: 88 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/backspace-c5a96f.svg"
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: backspaceKeyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: backspaceKeyIcon
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: backspaceKeyBackground
- opacity: 0.20
- }
- PropertyChanges {
- target: backspaceKeyIcon
- opacity: 0.20
- }
- }
- ]
- }
-
- languageKeyPanel: KeyPanel {
- id: languageKeyPanel
- Image {
- id: languageKeyBackground
- source: resourcePrefix + "images/key154px_colorB.png"
- fillMode: Image.PreserveAspectFit
- anchors.fill: languageKeyPanel
- anchors.margins: keyBackgroundMargin
- }
- Image {
- id: languageKeyIcon
- anchors.centerIn: languageKeyPanel
- sourceSize.width: 144 * keyIconScale
- sourceSize.height: 144 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/globe-110b05.svg"
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: languageKeyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: languageKeyIcon
- opacity: 0.30
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: languageKeyBackground
- opacity: 0.75
- }
- PropertyChanges {
- target: languageKeyIcon
- opacity: 0.50
- }
- }
- ]
- }
-
- enterKeyPanel: KeyPanel {
- id: enterKeyPanel
- BorderImage {
- id: enterKeyBackground
- source: resourcePrefix + "images/key154px_black.png"
- width: (parent.width - 2 * keyBackgroundMargin) / scale
- height: sourceSize.height
- anchors.centerIn: enterKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- }
- Image {
- id: enterKeyIcon
- visible: enterKeyText.text.length === 0
- anchors.centerIn: enterKeyPanel
- readonly property size enterKeyIconSize: {
- switch (control.actionId) {
- case EnterKeyAction.Go:
- case EnterKeyAction.Send:
- case EnterKeyAction.Next:
- case EnterKeyAction.Done:
- return Qt.size(170, 119)
- case EnterKeyAction.Search:
- return Qt.size(148, 148)
- default:
- return Qt.size(211, 80)
- }
- }
- sourceSize.width: enterKeyIconSize.width * keyIconScale
- sourceSize.height: enterKeyIconSize.height * keyIconScale
- smooth: false
- source: {
- switch (control.actionId) {
- case EnterKeyAction.Go:
- case EnterKeyAction.Send:
- case EnterKeyAction.Next:
- case EnterKeyAction.Done:
- return resourcePrefix + "images/check-c5a96f.svg"
- case EnterKeyAction.Search:
- return resourcePrefix + "images/search-c5a96f.svg"
- default:
- return resourcePrefix + "images/enter-c5a96f.svg"
- }
- }
- }
- Text {
- id: enterKeyText
- visible: text.length !== 0
- text: control.actionId !== EnterKeyAction.None ? control.displayText : ""
- clip: true
- fontSizeMode: Text.HorizontalFit
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- anchors.fill: enterKeyPanel
- anchors.leftMargin: keyContentMargin
- anchors.topMargin: Math.round(50 * scaleHint)
- anchors.rightMargin: keyContentMargin
- anchors.bottomMargin: Math.round(30 * scaleHint)
- color: "#c5a96f"
- font {
- family: fontFamily
- weight: Font.Bold
- pixelSize: 74 * scaleHint
- capitalization: Font.AllUppercase
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: enterKeyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: enterKeyIcon
- opacity: 0.70
- }
- PropertyChanges {
- target: enterKeyText
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: enterKeyBackground
- opacity: 0.20
- }
- PropertyChanges {
- target: enterKeyIcon
- opacity: 0.20
- }
- PropertyChanges {
- target: enterKeyText
- opacity: 0.20
- }
- }
- ]
- }
-
- hideKeyPanel: KeyPanel {
- id: hideKeyPanel
- BorderImage {
- id: hideKeyBackground
- source: resourcePrefix + "images/key154px_black.png"
- width: (parent.width - 2 * keyBackgroundMargin) / scale
- height: sourceSize.height
- anchors.centerIn: hideKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- }
- Image {
- id: hideKeyIcon
- anchors.centerIn: hideKeyPanel
- sourceSize.width: 144 * keyIconScale
- sourceSize.height: 127 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/hidekeyboard-c5a96f.svg"
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: hideKeyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: hideKeyIcon
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: hideKeyBackground
- opacity: 0.20
- }
- PropertyChanges {
- target: hideKeyIcon
- opacity: 0.20
- }
- }
- ]
- }
-
- shiftKeyPanel: KeyPanel {
- id: shiftKeyPanel
- BorderImage {
- id: shiftKeyBackground
- source: resourcePrefix + "images/key154px_black.png"
- width: (parent.width - 2 * keyBackgroundMargin) / scale
- height: sourceSize.height
- anchors.centerIn: shiftKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- states: [
- State {
- name: "capsLockActive"
- when: InputContext.capsLockActive
- PropertyChanges {
- target: shiftKeyBackground
- source: resourcePrefix + "images/key154px_capslock.png"
- }
- PropertyChanges {
- target: shiftKeyIcon
- source: resourcePrefix + "images/shift-cd8865.svg"
- }
- },
- State {
- name: "shiftActive"
- when: InputContext.shiftActive
- PropertyChanges {
- target: shiftKeyBackground
- source: resourcePrefix + "images/key154px_shiftcase.png"
- }
- PropertyChanges {
- target: shiftKeyIcon
- source: resourcePrefix + "images/shift-dc4f28.svg"
- }
- }
- ]
- }
- Image {
- id: shiftKeyIcon
- anchors.centerIn: shiftKeyPanel
- sourceSize.width: 144 * keyIconScale
- sourceSize.height: 134 * keyIconScale
- smooth: false
- source: resourcePrefix + "images/shift-c5a96f.svg"
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: shiftKeyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: shiftKeyIcon
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: shiftKeyBackground
- opacity: 0.20
- }
- PropertyChanges {
- target: shiftKeyIcon
- opacity: 0.20
- }
- }
- ]
- }
-
- spaceKeyPanel: KeyPanel {
- id: spaceKeyPanel
- BorderImage {
- id: spaceKeyBackground
- source: resourcePrefix + "images/key154px_colorA.png"
- width: (parent.width - 2 * keyBackgroundMargin) / scale
- height: sourceSize.height
- anchors.centerIn: spaceKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- }
- Text {
- id: spaceKeyText
- text: Qt.locale(InputContext.locale).nativeLanguageName
- color: currentStyle.inputLocaleIndicatorColor
- Behavior on color { PropertyAnimation { duration: 250 } }
- anchors.centerIn: spaceKeyPanel
- font {
- family: fontFamily
- weight: Font.Bold
- pixelSize: 72 * scaleHint
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: spaceKeyBackground
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: spaceKeyBackground
- opacity: 0.30
- }
- }
- ]
- }
-
- symbolKeyPanel: KeyPanel {
- id: symbolKeyPanel
- BorderImage {
- id: symbolKeyBackground
- source: resourcePrefix + "images/key154px_black.png"
- width: (parent.width - 2 * keyBackgroundMargin) / scale
- height: sourceSize.height
- anchors.centerIn: symbolKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- }
- Text {
- id: symbolKeyText
- text: control.displayText
- color: "#c5a96f"
- anchors.centerIn: symbolKeyPanel
- font {
- family: fontFamily
- weight: Font.DemiBold
- pixelSize: 74 * scaleHint
- letterSpacing: -5 * scaleHint
- capitalization: Font.AllUppercase
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: symbolKeyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: symbolKeyText
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: symbolKeyBackground
- opacity: 0.20
- }
- PropertyChanges {
- target: symbolKeyText
- opacity: 0.20
- }
- }
- ]
- }
-
- modeKeyPanel: KeyPanel {
- id: modeKeyPanel
- BorderImage {
- id: modeKeyBackground
- source: resourcePrefix + "images/key154px_black.png"
- width: (parent.width - 2 * keyBackgroundMargin) / scale
- height: sourceSize.height
- anchors.centerIn: modeKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- states: [
- State {
- name: "mode"
- when: control.mode
- PropertyChanges {
- target: modeKeyBackground
- source: resourcePrefix + "images/key154px_capslock.png"
- }
- }
- ]
- }
- Text {
- id: modeKeyText
- text: control.displayText
- color: "#c5a96f"
- anchors.fill: modeKeyPanel
- anchors.margins: keyContentMargin
- fontSizeMode: Text.Fit
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font {
- family: fontFamily
- weight: Font.DemiBold
- pixelSize: 74 * scaleHint
- letterSpacing: -5 * scaleHint
- capitalization: Font.AllUppercase
- }
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: modeKeyBackground
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: modeKeyBackground
- opacity: 0.20
- }
- }
- ]
- }
-
- handwritingKeyPanel: KeyPanel {
- id: handwritingKeyPanel
- BorderImage {
- id: hwrKeyBackground
- source: resourcePrefix + "images/key154px_colorB.png"
- width: (parent.width - 2 * hwrKeyBackground) / scale
- height: sourceSize.height
- anchors.centerIn: handwritingKeyPanel
- border.left: 76
- border.top: 76
- border.right: 76
- border.bottom: 76
- horizontalTileMode: BorderImage.Stretch
- scale: (parent.height - 2 * keyBackgroundMargin) / sourceSize.height
- }
- Image {
- id: hwrKeyIcon
- anchors.centerIn: handwritingKeyPanel
- readonly property size hwrKeyIconSize: keyboard.handwritingMode ? Qt.size(124, 96) : Qt.size(156, 104)
- sourceSize.width: hwrKeyIconSize.width * keyIconScale
- sourceSize.height: hwrKeyIconSize.height * keyIconScale
- smooth: false
- source: resourcePrefix + (keyboard.handwritingMode ? "images/textmode-110b05.svg" : "images/handwriting-110b05.svg")
- }
- states: [
- State {
- name: "pressed"
- when: control.pressed
- PropertyChanges {
- target: hwrKeyBackground
- opacity: 0.70
- }
- PropertyChanges {
- target: hwrKeyIcon
- opacity: 0.70
- }
- },
- State {
- name: "disabled"
- when: !control.enabled
- PropertyChanges {
- target: hwrKeyBackground
- opacity: 0.20
- }
- PropertyChanges {
- target: hwrKeyIcon
- opacity: 0.20
- }
- }
- ]
- }
-
- characterPreviewMargin: Math.round(20 * scaleHint)
- characterPreviewDelegate: Item {
- property string text
- id: characterPreview
- Image {
- id: characterPreviewBackground
- source: resourcePrefix + "images/key_preview.png"
- fillMode: Image.PreserveAspectFit
- anchors.fill: parent
- }
- Text {
- id: characterPreviewText
- color: "#c5a96f"
- text: characterPreview.text
- anchors.centerIn: characterPreviewBackground
- font {
- family: fontFamily
- weight: Font.Bold
- pixelSize: 85 * scaleHint
- }
- states: [
- State {
- name: "fit"
- when: text.length > 1
- PropertyChanges {
- target: characterPreviewText
- font.letterSpacing: -5 * scaleHint
- }
- }
- ]
- }
- }
-
- alternateKeysListItemWidth: Math.round(111 * scaleHint)
- alternateKeysListItemHeight: Math.round(154 * scaleHint)
- alternateKeysListBottomMargin: Math.round(15 * scaleHint)
- alternateKeysListLeftMargin: Math.round(79 * scaleHint)
- alternateKeysListRightMargin: Math.round(79 * scaleHint)
- alternateKeysListDelegate: Item {
- id: alternateKeysListItem
- width: alternateKeysListItemWidth
- height: alternateKeysListItemHeight
- Text {
- id: listItemText
- text: model.text
- color: "#868482"
- font {
- family: fontFamily
- weight: Font.DemiBold
- pixelSize: 52 * scaleHint
- letterSpacing: -6 * scaleHint
- }
- anchors.centerIn: parent
- }
- states: State {
- name: "current"
- when: alternateKeysListItem.ListView.isCurrentItem
- PropertyChanges {
- target: listItemText
- color: "white"
- }
- }
- }
- alternateKeysListHighlight: Item {
- Rectangle {
- anchors.fill: parent
- anchors.topMargin: Math.round(8 * scaleHint)
- anchors.bottomMargin: Math.round(8 * scaleHint)
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#64462a" }
- GradientStop { position: 0.18; color: "#a37648" }
- GradientStop { position: 0.5; color: "#c4a47c" }
- GradientStop { position: 0.82; color: "#a37648" }
- GradientStop { position: 1.0; color: "#64462a" }
- }
- }
- }
- alternateKeysListBackground: Item {
- property real currentItemOffset
- property bool currentItemHighlight: false
- BorderImage {
- cache: false
- source: resourcePrefix + "images/key160px_black.png"
- width: sourceSize.width + parent.width / scale
- height: sourceSize.height
- anchors.centerIn: parent
- border.left: 79
- border.top: 79
- border.right: 79
- border.bottom: 79
- horizontalTileMode: BorderImage.Stretch
- scale: parent.height / sourceSize.height
- }
- Image {
- visible: currentItemOffset !== undefined
- source: currentItemHighlight ? resourcePrefix + "images/triangle_highlight.png" : resourcePrefix + "images/triangle_black.png"
- fillMode: Image.PreserveAspectFit
- width: sourceSize.width * scaleHint
- height: sourceSize.height * scaleHint
- anchors.top: parent.bottom
- anchors.topMargin: Math.round(-8 * scaleHint)
- anchors.left: parent.left
- anchors.leftMargin: Math.round(currentItemOffset - width / 2)
- }
- }
-
- selectionListHeight: 85 * scaleHint
- selectionListDelegate: SelectionListItem {
- id: selectionListItem
- width: Math.round(selectionListLabel.width + selectionListLabel.anchors.leftMargin * 2)
- Text {
- id: selectionListLabel
- anchors.left: parent.left
- anchors.leftMargin: Math.round((compactSelectionList ? 50 : 140) * scaleHint)
- anchors.verticalCenter: parent.verticalCenter
- text: decorateText(display, wordCompletionLength)
- color: "white"
- font {
- family: fontFamily
- weight: Font.Bold
- pixelSize: 44 * scaleHint
- }
- function decorateText(text, wordCompletionLength) {
- if (wordCompletionLength > 0) {
- return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
- }
- return text
- }
- }
- Rectangle {
- id: selectionListSeparator
- width: 4 * scaleHint
- height: 36 * scaleHint
- color: "#35322f"
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.left
- }
- states: State {
- name: "current"
- when: selectionListItem.ListView.isCurrentItem
- PropertyChanges {
- target: selectionListLabel
- color: "#c5a96f"
- }
- }
- }
- selectionListBackground: Rectangle {
- color: "#222222"
- }
- selectionListAdd: Transition {
- NumberAnimation { property: "y"; from: wordCandidateView.height; duration: 200 }
- NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 }
- }
- selectionListRemove: Transition {
- NumberAnimation { property: "y"; to: -wordCandidateView.height; duration: 200 }
- NumberAnimation { property: "opacity"; to: 0; duration: 200 }
- }
-
- navigationHighlight: Rectangle {
- color: "transparent"
- border.color: "yellow"
- border.width: 5
- }
-
- traceInputKeyPanelDelegate: TraceInputKeyPanel {
- traceMargins: keyBackgroundMargin
- BorderImage {
- id: traceInputKeyPanelBackground
- readonly property int traceInputKeyPanelSvgImageHeight: Math.round(height / 12)
- readonly property real traceInputKeyPanelSvgImageScale: traceInputKeyPanelSvgImageHeight / 154
- source: "image://qtvkbsvg/%1/images/key154px_colorA.svg?height=%2".arg(resourcePath).arg(traceInputKeyPanelSvgImageHeight)
- anchors.fill: parent
- anchors.margins: keyBackgroundMargin
- border.left: 76 * traceInputKeyPanelSvgImageScale
- border.top: 76 * traceInputKeyPanelSvgImageScale
- border.right: 78 * traceInputKeyPanelSvgImageScale
- border.bottom: 78 * traceInputKeyPanelSvgImageScale
- horizontalTileMode: BorderImage.Stretch
- verticalTileMode: BorderImage.Stretch
- }
- Text {
- id: hwrInputModeIndicator
- visible: control.patternRecognitionMode === InputEngine.PatternRecognitionMode.Handwriting
- text: {
- switch (InputContext.inputEngine.inputMode) {
- case InputEngine.InputMode.Numeric:
- if (["ar", "fa"].indexOf(InputContext.locale.substring(0, 2)) !== -1)
- return "\u0660\u0661\u0662"
- // Fallthrough
- case InputEngine.InputMode.Dialable:
- return "123"
- case InputEngine.InputMode.Greek:
- return "ΑΒΓ"
- case InputEngine.InputMode.Cyrillic:
- return "АБВ"
- case InputEngine.InputMode.Arabic:
- if (InputContext.locale.substring(0, 2) === "fa")
- return "\u0627\u200C\u0628\u200C\u067E"
- return "\u0623\u200C\u0628\u200C\u062C"
- case InputEngine.InputMode.Hebrew:
- return "\u05D0\u05D1\u05D2"
- case InputEngine.InputMode.ChineseHandwriting:
- return "中文"
- case InputEngine.InputMode.JapaneseHandwriting:
- return "日本語"
- case InputEngine.InputMode.KoreanHandwriting:
- return "한국어"
- case InputEngine.InputMode.Thai:
- return "กขค"
- default:
- return "Abc"
- }
- }
- color: "black"
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.margins: keyContentMargin * 1.5
- font {
- family: fontFamily
- weight: Font.Bold
- pixelSize: 72 * scaleHint
- capitalization: {
- if (InputContext.capsLockActive)
- return Font.AllUppercase
- if (InputContext.shiftActive)
- return Font.MixedCase
- return Font.AllLowercase
- }
- }
- }
- Canvas {
- id: traceInputKeyGuideLines
- anchors.fill: traceInputKeyPanelBackground
- opacity: 0.4
- onPaint: {
- var ctx = getContext("2d")
- ctx.lineWidth = 1
- ctx.strokeStyle = Qt.rgba(0, 0, 0)
- ctx.clearRect(0, 0, width, height)
- var i
- var margin = Math.round(30 * scaleHint)
- if (control.horizontalRulers) {
- for (i = 0; i < control.horizontalRulers.length; i++) {
- ctx.beginPath()
- var y = Math.round(control.horizontalRulers[i])
- var rightMargin = Math.round(width - margin)
- if (i + 1 === control.horizontalRulers.length) {
- ctx.moveTo(margin, y)
- ctx.lineTo(rightMargin, y)
- } else {
- var dashLen = Math.round(20 * scaleHint)
- for (var dash = margin, dashCount = 0;
- dash < rightMargin; dash += dashLen, dashCount++) {
- if ((dashCount & 1) === 0) {
- ctx.moveTo(dash, y)
- ctx.lineTo(Math.min(dash + dashLen, rightMargin), y)
- }
- }
- }
- ctx.stroke()
- }
- }
- if (control.verticalRulers) {
- for (i = 0; i < control.verticalRulers.length; i++) {
- ctx.beginPath()
- ctx.moveTo(control.verticalRulers[i], 0)
- ctx.lineTo(control.verticalRulers[i], height)
- ctx.stroke()
- }
- }
- }
- Connections {
- target: control
- onHorizontalRulersChanged: traceInputKeyGuideLines.requestPaint()
- onVerticalRulersChanged: traceInputKeyGuideLines.requestPaint()
- }
- }
- }
-
- traceCanvasDelegate: TraceCanvas {
- id: traceCanvas
- onAvailableChanged: {
- if (!available)
- return
- var ctx = getContext("2d")
- ctx.lineWidth = parent.canvasType === "fullscreen" ? 10 : 10 * scaleHint
- ctx.lineCap = "round"
- ctx.strokeStyle = Qt.rgba(0, 0, 0)
- ctx.fillStyle = ctx.strokeStyle
- }
- autoDestroyDelay: 800
- onTraceChanged: if (trace === null) opacity = 0
- Behavior on opacity { PropertyAnimation { easing.type: Easing.OutCubic; duration: 150 } }
- }
-
- popupListDelegate: SelectionListItem {
- property real cursorAnchor: popupListLabel.x + popupListLabel.width
- id: popupListItem
- width: popupListLabel.width + popupListLabel.anchors.leftMargin * 2
- height: popupListLabel.height + popupListLabel.anchors.topMargin * 2
- Text {
- id: popupListLabel
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.leftMargin: popupListLabel.height / 2
- anchors.topMargin: popupListLabel.height / 3
- text: decorateText(display, wordCompletionLength)
- color: "#5CAA15"
- font {
- family: "Sans"
- weight: Font.Normal
- pixelSize: Qt.inputMethod.cursorRectangle.height * 0.8
- }
- function decorateText(text, wordCompletionLength) {
- if (wordCompletionLength > 0) {
- return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>'
- }
- return text
- }
- }
- states: State {
- name: "current"
- when: popupListItem.ListView.isCurrentItem
- PropertyChanges {
- target: popupListLabel
- color: "black"
- }
- }
- }
-
- popupListBackground: Item {
- Rectangle {
- width: parent.width
- height: parent.height
- color: "white"
- border {
- width: 1
- color: "#929495"
- }
- }
- }
-
- popupListAdd: Transition {
- NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 }
- }
-
- popupListRemove: Transition {
- NumberAnimation { property: "opacity"; to: 0; duration: 200 }
- }
-
- selectionHandle: Image {
- sourceSize.width: 20
- source: resourcePrefix + "images/selectionhandle-bottom.svg"
- }
-
- fullScreenInputContainerBackground: Rectangle {
- color: "#FFF"
- }
-
- fullScreenInputBackground: Rectangle {
- color: "#FFF"
- }
-
- fullScreenInputMargins: Math.round(15 * scaleHint)
-
- fullScreenInputPadding: Math.round(30 * scaleHint)
-
- fullScreenInputCursor: Rectangle {
- width: 1
- color: "#000"
- visible: parent.blinkStatus
- }
-
- fullScreenInputFont.pixelSize: 58 * scaleHint
-
- fullScreenInputPasswordCharacter: "*"
-
- fullScreenInputSelectionColor: "#B57C47"
-}
diff --git a/src/virtualkeyboard/content/styles/retro/virtualkeyboard_retro_style.qrc b/src/virtualkeyboard/content/styles/retro/virtualkeyboard_retro_style.qrc
deleted file mode 100644
index 881755ef..00000000
--- a/src/virtualkeyboard/content/styles/retro/virtualkeyboard_retro_style.qrc
+++ /dev/null
@@ -1,37 +0,0 @@
-<RCC>
- <qresource prefix="/QtQuick/VirtualKeyboard/content/styles/retro">
- <file>style.qml</file>
- <file>images/key154px_black.png</file>
- <file>images/key154px_black_long.png</file>
- <file>images/key154px_capslock_long.png</file>
- <file>images/key154px_capslock.png</file>
- <file>images/key154px_colorA_long.png</file>
- <file>images/key154px_colorA.png</file>
- <file>images/key154px_colorA.svg</file>
- <file>images/key154px_colorB.png</file>
- <file>images/key154px_shiftcase_long.png</file>
- <file>images/key154px_shiftcase.png</file>
- <file>images/key156px_black_long.png</file>
- <file>images/key156px_black_medium_long.png</file>
- <file>images/key156px_colorA.png</file>
- <file>images/key156px_colorB.png</file>
- <file>images/key160px_black.png</file>
- <file>images/key160px_colorA.png</file>
- <file>images/key160px_colorB.png</file>
- <file>images/key_preview.png</file>
- <file>images/triangle_black.png</file>
- <file>images/triangle_highlight.png</file>
- <file>images/backspace-c5a96f.svg</file>
- <file>images/check-c5a96f.svg</file>
- <file>images/enter-c5a96f.svg</file>
- <file>images/globe-110b05.svg</file>
- <file>images/handwriting-110b05.svg</file>
- <file>images/hidekeyboard-c5a96f.svg</file>
- <file>images/search-c5a96f.svg</file>
- <file>images/shift-c5a96f.svg</file>
- <file>images/shift-cd8865.svg</file>
- <file>images/shift-dc4f28.svg</file>
- <file>images/textmode-110b05.svg</file>
- <file>images/selectionhandle-bottom.svg</file>
- </qresource>
-</RCC>
diff --git a/src/virtualkeyboard/content/virtualkeyboard_content.qrc b/src/virtualkeyboard/content/virtualkeyboard_content.qrc
deleted file mode 100644
index 1e6392f4..00000000
--- a/src/virtualkeyboard/content/virtualkeyboard_content.qrc
+++ /dev/null
@@ -1,35 +0,0 @@
-<RCC>
- <qresource prefix="/QtQuick/VirtualKeyboard/content">
- <file>InputPanel.qml</file>
- <file>HandwritingInputPanel.qml</file>
- <file>components/AlternativeKeys.qml</file>
- <file>components/BackspaceKey.qml</file>
- <file>components/BaseKey.qml</file>
- <file>components/ChangeLanguageKey.qml</file>
- <file>components/CharacterPreviewBubble.qml</file>
- <file>components/EnterKey.qml</file>
- <file>components/FillerKey.qml</file>
- <file>components/HideKeyboardKey.qml</file>
- <file>components/Key.qml</file>
- <file>components/Keyboard.qml</file>
- <file>components/KeyboardColumn.qml</file>
- <file>components/KeyboardLayout.qml</file>
- <file>components/KeyboardLayoutLoader.qml</file>
- <file>components/KeyboardRow.qml</file>
- <file>components/ModeKey.qml</file>
- <file>components/MultiSoundEffect.qml</file>
- <file>components/MultitapInputMethod.qml</file>
- <file>components/NumberKey.qml</file>
- <file>components/ShiftKey.qml</file>
- <file>components/SpaceKey.qml</file>
- <file>components/SymbolModeKey.qml</file>
- <file>components/TraceInputKey.qml</file>
- <file>components/TraceInputArea.qml</file>
- <file>components/HandwritingModeKey.qml</file>
- <file>components/WordCandidatePopupList.qml</file>
- <file>components/PopupList.qml</file>
- <file>components/SelectionControl.qml</file>
- <file>components/ShadowInputControl.qml</file>
- <file>components/InputModeKey.qml</file>
- </qresource>
-</RCC>
diff --git a/src/virtualkeyboard/desktopinputpanel.cpp b/src/virtualkeyboard/desktopinputpanel.cpp
index cdaf1ffd..d578330f 100644
--- a/src/virtualkeyboard/desktopinputpanel.cpp
+++ b/src/virtualkeyboard/desktopinputpanel.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/qvirtualkeyboard_global_p.h>
#include <QtVirtualKeyboard/private/desktopinputpanel_p.h>
@@ -38,10 +12,6 @@
#include <QQmlEngine>
#include <QScreen>
#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
-#if QT_CONFIG(vkb_xcb)
-#include <xcb/xcb.h>
-#include <xcb/xfixes.h>
-#endif
#include <qpa/qplatformnativeinterface.h>
#include <QtCore/private/qobject_p.h>
#include <QtCore/QLibraryInfo>
@@ -155,7 +125,7 @@ void DesktopInputPanel::createView()
break;
}
d->view->setColor(QColor(Qt::transparent));
- d->view->setSource(QUrl(QLatin1String("qrc:///QtQuick/VirtualKeyboard/content/InputPanel.qml")));
+ d->view->setSource(QUrl(QLatin1String("qrc:///qt-project.org/imports/QtQuick/VirtualKeyboard/InputPanel.qml")));
if (QGuiApplication *app = qGuiApp)
connect(app, SIGNAL(aboutToQuit()), SLOT(destroyView()));
}
@@ -226,18 +196,6 @@ void DesktopInputPanel::previewVisibleChanged()
updateInputRegion();
}
-#if QT_CONFIG(vkb_xcb)
-static inline xcb_rectangle_t qRectToXCBRectangle(const QRect &r)
-{
- xcb_rectangle_t result;
- result.x = qMax(SHRT_MIN, r.x());
- result.y = qMax(SHRT_MIN, r.y());
- result.width = qMin((int)USHRT_MAX, r.width());
- result.height = qMin((int)USHRT_MAX, r.height());
- return result;
-}
-#endif
-
void DesktopInputPanel::updateInputRegion()
{
Q_D(DesktopInputPanel);
@@ -249,36 +207,11 @@ void DesktopInputPanel::updateInputRegion()
if (!d->view->handle())
d->view->create();
- switch (d->windowingSystem) {
- case DesktopInputPanelPrivate::Xcb:
-#if QT_CONFIG(vkb_xcb)
- {
- QList<xcb_rectangle_t> rects;
- rects.push_back(qRectToXCBRectangle(d->keyboardRect.toRect()));
- if (d->previewVisible && !d->previewRect.isEmpty())
- rects.push_back(qRectToXCBRectangle(d->previewRect.toRect()));
-
- QWindow *window = d->view.data();
- QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface();
- xcb_connection_t *xbcConnection = static_cast<xcb_connection_t *>(platformNativeInterface->nativeResourceForWindow("connection", window));
- xcb_xfixes_region_t xbcRegion = xcb_generate_id(xbcConnection);
- xcb_xfixes_create_region(xbcConnection, xbcRegion, rects.size(), rects.constData());
- xcb_xfixes_set_window_shape_region(xbcConnection, window->winId(), XCB_SHAPE_SK_INPUT, 0, 0, xbcRegion);
- xcb_xfixes_destroy_region(xbcConnection, xbcRegion);
- }
-#endif
- break;
+ QRegion inputRegion(d->keyboardRect.toRect());
+ if (d->previewVisible && !d->previewRect.isEmpty())
+ inputRegion += d->previewRect.toRect();
- default:
- {
- QRegion inputRegion(d->keyboardRect.toRect());
- if (d->previewVisible && !d->previewRect.isEmpty())
- inputRegion += d->previewRect.toRect();
-
- d->view->setMask(inputRegion);
- break;
- }
- }
+ d->view->setMask(inputRegion);
}
} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/desktopinputpanel_p.h b/src/virtualkeyboard/desktopinputpanel_p.h
index 1a1b1d2f..34a08f78 100644
--- a/src/virtualkeyboard/desktopinputpanel_p.h
+++ b/src/virtualkeyboard/desktopinputpanel_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DESKTOPINPUTPANEL_P_H
#define DESKTOPINPUTPANEL_P_H
@@ -51,7 +25,7 @@ namespace QtVirtualKeyboard {
class DesktopInputPanelPrivate;
-class QVIRTUALKEYBOARD_EXPORT DesktopInputPanel : public AppInputPanel
+class Q_VIRTUALKEYBOARD_EXPORT DesktopInputPanel : public AppInputPanel
{
Q_OBJECT
Q_DECLARE_PRIVATE(DesktopInputPanel)
diff --git a/src/virtualkeyboard/desktopinputselectioncontrol.cpp b/src/virtualkeyboard/desktopinputselectioncontrol.cpp
index 196ab512..0fc5d646 100644
--- a/src/virtualkeyboard/desktopinputselectioncontrol.cpp
+++ b/src/virtualkeyboard/desktopinputselectioncontrol.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/desktopinputselectioncontrol_p.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
@@ -160,7 +134,7 @@ void DesktopInputSelectionControl::updateVisibility()
void DesktopInputSelectionControl::reloadGraphics()
{
Settings *settings = Settings::instance();
- const QString stylePath = QString::fromLatin1(":/QtQuick/VirtualKeyboard/content/styles/%1/images/selectionhandle-bottom.svg")
+ const QString stylePath = QString::fromLatin1(":/qt-project.org/imports/QtQuick/VirtualKeyboard/Styles/Builtin/%1/images/selectionhandle-bottom.svg")
.arg(settings->styleName());
QImageReader imageReader(stylePath);
QSize sz = imageReader.size(); // SVG handler will return default size
@@ -206,6 +180,8 @@ void DesktopInputSelectionControl::setEnabled(bool enable)
connect(m_inputContext, &QVirtualKeyboardInputContext::cursorRectangleChanged, this, &DesktopInputSelectionControl::updateCursorHandlePosition);
connect(m_inputContext, &QVirtualKeyboardInputContext::anchorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
connect(m_inputContext, &QVirtualKeyboardInputContext::cursorRectIntersectsClipRectChanged, this, &DesktopInputSelectionControl::updateVisibility);
+ updateAnchorHandlePosition();
+ updateCursorHandlePosition();
if (focusWindow)
focusWindow->installEventFilter(this);
} else {
@@ -241,7 +217,7 @@ bool DesktopInputSelectionControl::eventFilter(QObject *object, QEvent *event)
}
} else if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
- const QPoint mousePos = me->screenPos().toPoint();
+ const QPoint mousePos = me->globalPosition().toPoint();
// calculate distances from mouse pos to each handle,
// then choose to interact with the nearest handle
@@ -256,8 +232,8 @@ bool DesktopInputSelectionControl::eventFilter(QObject *object, QEvent *event)
for (int i = 0; i <= CursorHandle; ++i) {
SelectionHandleInfo &h = handles[i];
- QPoint curHandleCenter = focusWindow->mapToGlobal(h.rect.center()); // ### map to desktoppanel
- const QPoint delta = mousePos - curHandleCenter;
+ QPoint curHandleTopCenter = focusWindow->mapToGlobal(QPoint(h.rect.x() + qRound((qreal)h.rect.width() / 2), h.rect.top())); // ### map to desktoppanel
+ const QPoint delta = mousePos - curHandleTopCenter;
h.delta = delta;
h.squaredDistance = QPoint::dotProduct(delta, delta);
}
@@ -265,24 +241,24 @@ bool DesktopInputSelectionControl::eventFilter(QObject *object, QEvent *event)
// (squared) distances calculated, pick the closest handle
HandleType closestHandle = (handles[AnchorHandle].squaredDistance < handles[CursorHandle].squaredDistance ? AnchorHandle : CursorHandle);
- // Can not be replaced with me->windowPos(); because the event might be forwarded from the window of the handle
+ // Can not be replaced with me->scenePosition(); because the event might be forwarded from the window of the handle
const QPoint windowPos = focusWindow->mapFromGlobal(mousePos);
if (m_anchorHandleVisible && handles[closestHandle].rect.contains(windowPos)) {
m_currentDragHandle = closestHandle;
- m_distanceBetweenMouseAndCursor = handles[closestHandle].delta - QPoint(0, m_handleWindowSize.height()/2 + 4);
+ m_distanceBetweenMouseAndCursor = handles[closestHandle].delta;
m_handleState = HandleIsHeld;
m_handleDragStartedPosition = mousePos;
const QRect otherRect = handles[1 - closestHandle].rect;
m_otherSelectionPoint = QPoint(otherRect.x() + otherRect.width()/2, otherRect.top() - 4);
- QMouseEvent *mouseEvent = new QMouseEvent(me->type(), me->localPos(), me->windowPos(), me->screenPos(),
+ QMouseEvent *mouseEvent = new QMouseEvent(me->type(), me->position(), me->scenePosition(), me->globalPosition(),
me->button(), me->buttons(), me->modifiers(), me->source());
m_eventQueue.append(mouseEvent);
return true;
}
} else if (event->type() == QEvent::MouseMove) {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
- QPoint mousePos = me->screenPos().toPoint();
+ QPoint mousePos = me->globalPosition().toPoint();
if (m_handleState == HandleIsHeld) {
QPoint delta = m_handleDragStartedPosition - mousePos;
const int startDragDistance = QGuiApplication::styleHints()->startDragDistance();
diff --git a/src/virtualkeyboard/desktopinputselectioncontrol_p.h b/src/virtualkeyboard/desktopinputselectioncontrol_p.h
index 290d4e02..955cafb7 100644
--- a/src/virtualkeyboard/desktopinputselectioncontrol_p.h
+++ b/src/virtualkeyboard/desktopinputselectioncontrol_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef DESKTOPINPUTSELECTIONCONTROL_P_H
#define DESKTOPINPUTSELECTIONCONTROL_P_H
@@ -45,6 +19,7 @@
#include <QtCore/qobject.h>
#include <QtGui/qimage.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -55,7 +30,7 @@ namespace QtVirtualKeyboard {
class InputSelectionHandle;
-class QVIRTUALKEYBOARD_EXPORT DesktopInputSelectionControl : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT DesktopInputSelectionControl : public QObject
{
Q_OBJECT
diff --git a/src/virtualkeyboard/doc/doc.pri b/src/virtualkeyboard/doc/doc.pri
deleted file mode 100644
index 4da77d1f..00000000
--- a/src/virtualkeyboard/doc/doc.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-OTHER_FILES += \
- $$PWD/qtvirtualkeyboard.qdocconf \
- $$PWD/src/qtvirtualkeyboard-index.qdoc \
- $$PWD/src/deployment-guide.qdoc \
- $$PWD/src/technical-guide.qdoc \
- $$PWD/src/user-guide.qdoc \
- $$PWD/src/build.qdoc \
- $$PWD/src/snippets/CustomInputMethod.qml
diff --git a/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf b/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf
index 5391595a..0a87b21f 100644
--- a/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf
+++ b/src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf
@@ -6,26 +6,19 @@ description = Qt Virtual Keyboard
version = $QT_VERSION
buildversion = Qt Virtual Keyboard | Commercial or GPLv3
-headerdirs += ..
-sourcedirs += .. ../../styles/
-excludedirs += ../content/layouts
+headerdirs += .. ../../components/ ../../styles/ ../../settings/
+sourcedirs += .. ../../components/ ../../styles/ ../../settings/
# Specify the install path under QT_INSTALL_EXAMPLES
exampledirs += ../../../examples/virtualkeyboard \
snippets
examplesinstallpath = virtualkeyboard
-Cpp.ignoretokens += \
- QVIRTUALKEYBOARD_EXPORT
-Cpp.ignoredirectives += \
- Q_DECLARE_LOGGING_CATEGORY \
- VIRTUALKEYBOARD_DEBUG
-
-manifestmeta.highlighted.names = "QtVirtualKeyboard/Qt Quick Virtual Keyboard - Basic Example"
+manifestmeta.highlighted.names = "QtVirtualKeyboard/Virtual Keyboard in Qt Quick"
imagedirs += images
-depends += qtdoc qtcore qtgui qtwidgets qtwaylandcompositor qtqml qtquick qtquickcontrols
+depends += qtdoc qtcore qtgui qtwidgets qtwaylandcompositor qtqml qtquick qtquickcontrols qtcmake qmake
qhp.projects = QtVirtualKeyboard
@@ -35,10 +28,6 @@ qhp.QtVirtualKeyboard.virtualFolder = qtvirtualkeyboard
qhp.QtVirtualKeyboard.indexTitle = Qt Virtual Keyboard
qhp.QtVirtualKeyboard.indexRoot =
-qhp.QtVirtualKeyboard.filterAttributes = qtvirtualkeyboard $QT_VERSION qtrefdoc
-qhp.QtVirtualKeyboard.customFilters.Qt.name = QtVirtualKeyboard $QT_VERSION
-qhp.QtVirtualKeyboard.customFilters.Qt.filterAttributes = qtvirtualkeyboard $QT_VERSION
-
qhp.QtVirtualKeyboard.subprojects = classes qmltypes examples
qhp.QtVirtualKeyboard.subprojects.classes.title = C++ Classes
@@ -46,10 +35,10 @@ qhp.QtVirtualKeyboard.subprojects.classes.indexTitle = Qt Virtual Keyboard C++ C
qhp.QtVirtualKeyboard.subprojects.classes.selectors = class doc:headerfile
qhp.QtVirtualKeyboard.subprojects.classes.sortPages = true
-qhp.QtVirtualKeyboard.subprojects.qmltypes.title = QML Types
+qhp.QtVirtualKeyboard.subprojects.qmltypes.title = QML Types
qhp.QtVirtualKeyboard.subprojects.qmltypes.indexTitle = Qt Virtual Keyboard QML Types
-qhp.QtVirtualKeyboard.subprojects.qmltypes.selectors = qmlclass
-qhp.QtVirtualKeyboard.subprojects.qmltypes.sortPages = true
+qhp.QtVirtualKeyboard.subprojects.qmltypes.selectors = qmlclass
+qhp.QtVirtualKeyboard.subprojects.qmltypes.sortPages = true
qhp.QtVirtualKeyboard.subprojects.examples.title = Examples
qhp.QtVirtualKeyboard.subprojects.examples.indexTitle = Qt Virtual Keyboard Examples
@@ -59,3 +48,6 @@ qhp.QtVirtualKeyboard.subprojects.examples.sortPages = true
navigation.landingpage = "Qt Virtual Keyboard"
navigation.qmltypespage = "Qt Virtual Keyboard QML Types"
navigation.cppclassespage = "Qt Virtual Keyboard C++ Classes"
+
+# Enforce zero documentation warnings
+warninglimit = 0
diff --git a/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml b/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml
index 4f5b1f08..7b3b837d 100644
--- a/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml
+++ b/src/virtualkeyboard/doc/snippets/CustomInputMethod.qml
@@ -1,40 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 1.0
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.VirtualKeyboard
// file: CustomInputMethod.qml
InputMethod {
function inputModes(locale) {
- return [InputEngine.Latin];
+ return [InputEngine.InputMode.Latin];
}
function setInputMode(locale, inputMode) {
diff --git a/src/virtualkeyboard/doc/snippets/cmake.txt b/src/virtualkeyboard/doc/snippets/cmake.txt
new file mode 100644
index 00000000..90459244
--- /dev/null
+++ b/src/virtualkeyboard/doc/snippets/cmake.txt
@@ -0,0 +1,4 @@
+//! [find-and-link]
+find_package(Qt6 REQUIRED COMPONENTS VirtualKeyboard)
+target_link_libraries(mytarget PRIVATE Qt6::VirtualKeyboard)
+//! [find-and-link]
diff --git a/src/virtualkeyboard/doc/snippets/qtvirtualkeyboard-custom-language-popup.qml b/src/virtualkeyboard/doc/snippets/qtvirtualkeyboard-custom-language-popup.qml
index 261ad9be..9272d29f 100644
--- a/src/virtualkeyboard/doc/snippets/qtvirtualkeyboard-custom-language-popup.qml
+++ b/src/virtualkeyboard/doc/snippets/qtvirtualkeyboard-custom-language-popup.qml
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
// ![popup]
Dialog {
diff --git a/src/virtualkeyboard/doc/src/build.qdoc b/src/virtualkeyboard/doc/src/build.qdoc
index 46dbfb65..54a77719 100644
--- a/src/virtualkeyboard/doc/src/build.qdoc
+++ b/src/virtualkeyboard/doc/src/build.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
@@ -38,52 +14,37 @@ This document describes how to build the Qt Virtual Keyboard plugin.
The project is split into the following subprojects:
\table
\row
- \li \e examples/virtualkeyboard/basic/basic.pro
+ \li \e examples/virtualkeyboard/basic
\li Qt Virtual Keyboard Demo application
\row
- \li \e src/virtualkeyboard/import/
- \li Qt Virtual Keyboard QML plugin (QtQuick.VirtualKeyboard)
+ \li \e src/components/
+ \li Qt Virtual Keyboard Components QML plugin (QtQuick.VirtualKeyboard.Components)
\row
- \li \e src/virtualkeyboard/plugin/
+ \li \e src/plugin/
\li Qt Virtual Keyboard platform input context plugin. This plugin
- provides the QPlatformInputContext interface for the Qt and is
- also responsible for loading the Virtual Keyboard Plugins
- (QtQuick.VirtualKeyboard.Plugins).
+ provides the QPlatformInputContext interface and works as a
+ layer between QML input context and platform.
\row
- \li \e src/virtualkeyboard/plugins/
- \li A directory containing Qt Virtual Keyboard plugins, such as the Hunspell plugin
+ \li \e src/plugins/
+ \li A directory containing Qt Virtual Keyboard plugins (QtQuick.VirtualKeyboard.Plugins),
+ which implement complex input methods, such as the \e HunspellInputMethod.
+ Build time configuration specifies which plugins are built and loaded at runtime.
\row
- \li \e src/virtualkeyboard/settings/
- \li Qt Virtual Keyboard Settings QML plugin (QtQuick.VirtualKeyboard.Settings)
+ \li \e src/settings/
+ \li Qt Virtual Keyboard Settings QML plugin (QtQuick.VirtualKeyboard.Settings).
+ This plugin provides application-configurable settings for the virtual keyboard.
\row
- \li \e src/virtualkeyboard/styles/styles.pro
- \li Qt Virtual Keyboard Styles QML plugin (QtQuick.VirtualKeyboard.Styles)
+ \li \e src/styles/
+ \li Qt Virtual Keyboard Styles QML plugin (QtQuick.VirtualKeyboard.Styles).
\row
- \li \e src/virtualkeyboard/virtualkeyboard.pro
- \li Qt Virtual Keyboard module, QML components and layouts
+ \li \e src/virtualkeyboard/
+ \li Qt Virtual Keyboard module and QML plugin.
\endtable
-The input methods are implemented either in C++ or QML.
-Qt Virtual Keyboard provides implementations of \e PlainInputMethod,
-\e MultitapInputMethod and \e HunspellInputMethod.
-The \e MultitapInputMethod is implemented in QML while the others are implemented
-in C++.
-
-\section1 Build Instructions
-
-The Qt Virtual Keyboard can be built for Linux Desktop/X11, Windows Desktop
-or Boot2Qt targets.
-The target is automatically detected by QMAKE and requires no special
-configuration parameters.
-
-Qt Creator is the preferred build environment for Qt Virtual Keyboard as you
-can then leverage the shadow build functionality and rapidly switch between
-build targets.
-
\section2 Configuration Options
The table below contains the top-level options for configuring the virtual
-keyboard features.
+keyboard features. These options are passed to the \e configure tool.
\table
\header
@@ -112,13 +73,14 @@ keyboard features.
if no other languages are specified.
\row
\li \e -vkb-handwriting
- \li [yes|no|t9write|lipi]
+ \li \e [no|example-hwr|myscript-hwr|cerence-hwr]
\li Enables or disabled handwriting input
- \li This flag enables handwriting input. By default, the first engine
- available at build time is used. The engines are chosen in the
- following order: \c t9write, \c lipi-toolkit. To force handwriting
- input using to use a specific engine, specify the engine to be used;
- for example, \c {-vkb-handwriting lipi}.
+ \li This flag enables handwriting input. By default, the engine is
+ automatically activated if it is located in the proper plugins folder
+ even without using of this option. But, in case MyScript and Cerence SDK
+ co-exist, one of [no|myscript-hwr|cerence-hwr] must be configured. The
+ \l {Example Handwriting}{example-hwr} option needs to be explicitly
+ activated. This can be done for development and testing purposes.
\row
\li \e [-no]-vkb-arrow-keynavigation
\li
@@ -167,73 +129,69 @@ keyboard features.
\note In this scenario, the \c QT_VIRTUALKEYBOARD_LAYOUT_PATH environment
variable should be set to the file system directory containing the custom
keyboard layouts before running the application.
-\endtable
-
-These options can be passed to configure when doing a full build of Qt.
-Alternatively, when building only the Qt Virtual Keyboard, you can configure
-the keyboard using the following command (where SRCDIR points to the source
-directory of QtVirtualKeyboard):
-
-\badcode
-qmake $SRCDIR -- [options]
-\endcode
-
-\table
\row
- \li \e disable-hunspell
- \li \e n/a
- \li Disables Hunspell integration
- \li Hunspell integration is enabled if the Hunspell library is available on the
- system, or if it is built using the local project file. Integration can be
- disabled using this option.
-\row
- \li \e no-bundle-pinyin
+ \li \e -vkb-hunspell
+ \li \e [no|3rdparty|system]
+ \li Choose Hunspell integration
+ \li Forces the Hunspell integration method to the specified option. The \e 3rdparty option
+ selects the local build of the Hunspell source code using project files in the
+ virtual keyboard repo. This option requires that the Hunspell git repository has
+ been cloned into \e src/plugins/hunspell/3rdparty/hunspell directory. The \e system
+ option selects the system package via \e pkg-config. The \e no option disables the
+ Hunspell plugin.
+\row
+ \li \e -vkb-no-bundle-pinyin
\li \e n/a
\li Disables bundling of pinyin resources
\li This option excludes pinyin resources from the plugin binary. This option may be
used to reduce the plugin binary size.
\row
- \li \e no-bundle-tcime
+ \li \e -vkb-no-bundle-tcime
\li \e n/a
\li Disables bundling of tcime resources
\li This option excludes tcime resources from the plugin binary. This option may be
used to reduce the plugin binary size.
\row
- \li \e pinyin
- \li \e lang-zh_CN
- \li Enables the Pinyin input method for Simplified Chinese.
- \li This option activates the Pinyin input method for the Simplified Chinese
- language.
-
- \include build.qdocinc input-method-language-option-note
-\row
- \li \e tcime
- \li \e lang-zh_TW
- \li Enables the both Cangjie and Zhuyin input methods for Traditional Chinese.
- \li This option activates the both Cangjie and Zhuyin input methods for the
- Traditional Chinese language.
-
- \include build.qdocinc input-method-language-option-note
-\row
- \li \e openwnn
- \li \e lang-ja_JP
- \li Enables the OpenWnn input method for Japanese.
- \li This option activates the OpenWnn input method for the Japanese language.
-
- \include build.qdocinc input-method-language-option-note
+ \li \e -vkb-cerence-sdk
+ \li \e path/to/cerence/sdk
+ \li Configures the Cerence SDK location and enables the Cerence Handwriting and XT9 integrations.
+ \li The Cerence SDK zip file must be unpacked using the \e src/plugins/cerence/unpack.py
+ script. By default, the SDK is unpacked to \e src/plugins/cerence/sdk, where
+ the build scripts can pick it up automatically. However, by using the second parameter to the unpack.py
+ script, it is possible to use different location for the SDK. In that case, the location must be
+ passed to the build script using the -vkb-cerence-sdk command line parameter.
\row
- \li \e lipi-toolkit
+ \li \e -vkb-cerence-static
\li \e handwriting
- \li Enables the handwriting input method using Lipi Toolkit.
- \li Handwriting recognition is based on the open source Lipi Toolkit.
-\endtable
-
-\section2 Building Documentation
-
-\table
+ \li Enables static linking of the Cerence Handwriting engine.
+ \li The Cerence Handwriting engine is linked dynamically by default. Use \e -vkb-cerence-static to
+ force static linking.
\row
- \li \e {make docs}
- \li Generates documentation
+ \li \e -vkb-bundle-cerence-hwr or \e -vkb-bundle-cerence
+ \li \e n/a
+ \li Enables bundling of Cerence Handwriting resources
+ \li This option bundles the Cerence Handwriting resources in the plugin binary.
+\row
+ \li \e -vkb-bundle-xt9 or \e -vkb-bundle-cerence
+ \li \e n/a
+ \li Enables bundling of XT9 resources
+ \li This option bundles the XT9 resources in the plugin binary.
+\row
+ \li \e -vkb-myscript-sdk
+ \li \e path/to/myscript/sdk
+ \li Configures the MyScript Text SDK location and enables the MyScript Handwriting integration.
+ \li The MyScript Text SDK (zip) which is unpacked to \e src/plugins/myscript/sdk, can be
+ picked up automatically by the build scripts. However, the SDK can be placed in different
+ location. In that case, the location must be passed to the build script using the \c -vkb-myscript-sdk
+ command line parameter.
+\row
+ \li \e -vkb-myscript-arch
+ \li \e [x86|x64|armv7hf|armv7|arm64]
+ \li Configures the target CPU architecture
+ \li The MyScript Text SDK offers shared (dynamic) libraries for different CPU architectures
+ - \e [x86|x64|armv7hf|armv7|arm64] for Linux and \e [x86|x64] for Windows. It can automatically configured.
+ However, a user also can specify the target CPU architecture using the \c -vkb-myscript-arch
+ command line parameter.
\endtable
\section2 Hunspell Integration
@@ -241,13 +199,13 @@ qmake $SRCDIR -- [options]
By default, \e HunspellInputMethod will not be available unless the Hunspell
library and development headers are found. For Linux/X11 targets, the Hunspell
library can be provided by installing the libhunspell-dev package.
-Alternatively, the Hunspell sources can be extracted into the
+Alternatively, the Hunspell git repository can be cloned into the
\e src/plugins/hunspell/3rdparty/hunspell directory. The sources are automatically
detected by the qmake and the project will be configured to use the local Hunspell.
If Hunspell sources are used, then the dictionary files must also be
copied into the \e src/plugins/hunspell/3rdparty/hunspell/data directory.
-An example of how the directory structure should look after copying in the
+An example of how the directory structure should look after setting up the
Hunspell sources and dictionary files is listed below:
\badcode
@@ -256,96 +214,104 @@ Hunspell sources and dictionary files is listed below:
├── data
│ ├── en_GB.aff
│ └── en_GB.dic
- ├── hunspell.pro
- └── src
- └── hunspell
- ├── affentry.cxx
- ├── affentry.hxx
- (etc.)
+ ├── hunspell <-- Hunspell git repository
+ └── CMakeLists.txt
\endcode
-\section2 T9 Write Integration
+\section2 Cerence Handwriting Integration
-T9 Write integration supports the T9 Write Alphabetic and T9 Write CJK engines. Both
-engines are integrated via T9WriteInputMethod. The input method can be initialized
-with either of the engines at runtime. The engine selection happens automatically
-based on input locale and input mode from the keyboard.
+Cerence Handwriting integration supports the Alphabetic and CJK (Chinese Japanese Korean)
+engines. Both engines are integrated via T9WriteInputMethod. The input method is initialized
+with one engine at the time. The engine selection happens automatically based on the current
+input locale.
-\section3 T9 Write Compatibility
+\section3 Cerence Handwriting Compatibility
-Qt Virtual Keyboard is compatible with T9 Write v7.5.0 onward.
+Qt Virtual Keyboard is compatible with Cerence Handwriting v8.7 or later.
-The latest tested version is v7.8.1.
+\section3 Cerence Handwriting Build Preparations
-\section3 T9 Write Build Preparations
+The contents of the SDK must unpacked using the \e unpack.py script located in the \e cerence
+directory. This ensures the correct directory structure for CMake to find the content.
-The contents of the SDK must be either manually copied to the directory structure
-described below, or by using the \e unpack.py script found in the t9write directory.
+\badcode
+$ cd src/plugins/cerence/
+$ python unpack.py filename.zip
+\endcode
-To unpack the SDK using the script:
+This will unpack the contents to the \e src/plugins/cerence/sdk directory, where the CMake can
+pick it up automatically.
+
+Alternatively, you can unpack to any other directory by adding extra parameter to the command
+line. In this case, the location of the SDK must be passed to the \e configure script.
\badcode
-$ cd src/plugins/t9write/3rdparty/t9write/
-$ python unpack.py T9Write_Alpha_v7-8-0_SDK.zip .
+configure ... -vkb-cerence-sdk /path/to/cerence/sdk
\endcode
+\section3 Layout of the Cerence SDK
+
+The extracted content of the SDK looks like this:
+
\badcode
-3rdparty
-└── t9write
- ├─── api
- │ ├─── decuma*.h
- │ ├─── t9write*.h
- │ └─── xxt9w*.h
- ├─── data
- │ ├─── arabic
- │ │ └─── *.bin [T9 Write Arabic]
- │ ├─── hebrew
- │ │ └─── *.bin [T9 Write Hebrew]
- │ ├─── *.bin [T9 Write Alphabetic]
- │ ├─── *.hdb
- │ ├─── *.phd
- │ └─── *.ldb [T9 Write v7.5]
- └─── lib
- ├─── arm
- │ ├─── shared
- │ │ ├─── alphabetic
- │ │ │ └─── *.so
- │ │ └─── cjk
- │ │ └─── *.so
- │ └─── static
- │ ├─── alphabetic
- │ │ └─── *.a / *.o
- │ └─── cjk
- │ └─── *.a / *.o
- ├─── linux-x86
- │ ├─── shared
- │ │ ├─── alphabetic
- │ │ │ └─── *.so
- │ │ └─── cjk
- │ │ └─── *.so
- │ └─── static
- │ ├─── alphabetic
- │ │ └─── *.a / *.o
- │ └─── cjk
- │ └─── *.a / *.o
- └─── win32
- ├─── shared
- │ ├─── alphabetic
- │ │ ├─── *.dll
- │ │ └─── *.lib
- │ └─── cjk
- │ ├─── *.dll
- │ └─── *.lib
- └─── static
- ├─── alphabetic
- │ └─── *.lib / *.obj
- └─── cjk
- └─── *.lib / *.obj
+sdk
+├───t9write
+│ ├───api
+│ ├───data
+│ │ ├───arabic
+│ │ ├───hebrew
+│ │ └───thai
+│ └───lib
+│ ├───linux
+│ │ ├───arm64
+│ │ │ ├───shared
+│ │ │ │ ├───alphabetic
+│ │ │ │ └───cjk
+│ │ │ └───static
+│ │ │ ├───alphabetic
+│ │ │ └───cjk
+│ │ └───x86_64
+│ │ ├───shared
+│ │ │ ├───alphabetic
+│ │ │ └───cjk
+│ │ └───static
+│ │ ├───alphabetic
+│ │ └───cjk
+│ └───win32
+│ ├───x86
+│ │ ├───shared
+│ │ │ ├───alphabetic
+│ │ │ └───cjk
+│ │ └───static
+│ │ ├───alphabetic
+│ │ └───cjk
+│ └───x86_64
+│ ├───shared
+│ │ ├───alphabetic
+│ │ └───cjk
+│ └───static
+│ ├───alphabetic
+│ └───cjk
+└───xt9
+ ├───api
+ ├───data
+ └───lib
+ ├───linux
+ │ ├───arm64
+ │ │ ├───shared
+ │ │ └───static
+ │ └───x86_64
+ │ ├───shared
+ │ └───static
+ └───win32
+ ├───x86
+ │ ├───shared
+ │ └───static
+ └───x86_64
+ ├───shared
+ └───static
\endcode
-\note The above files are from the T9 Write demo SDK for Windows; the contents may vary for other
- platforms.
-
Where the contents of each directory are:
\table
@@ -365,12 +331,12 @@ Where the contents of each directory are:
\li \e data
\li This directory should contain all HWR databases and optionally
XT9 databases.
- \li HWR database for the T9 Write Alphabetic:
+ \li HWR database for the Cerence Handwriting Alphabetic:
\list
\li \e _databas_le.bin
\endlist
- HWR database for the T9 Write CJK:
+ HWR database for the Cerence Handwriting CJK:
\list
\li \e cjk_HK_std_le.hdb HongKong Chinese
\li \e cjk_J_std_le.hdb Japanese
@@ -389,14 +355,23 @@ Where the contents of each directory are:
\li These directories should hold the desired target libraries.
If both shared and static libraries are found, shared libraries
are preferred.
-
- For example, to enable a static win32 build, copy
- \e t9write_alphabetic_rel.obj to \e lib/win32/static/alphabetic
- directory.
\endtable
-Finally, the SDK is included in the build by adding CONFIG+=t9write to the
-qmake command line.
+The Cerence Handwriting and XT9 integration code is automatically activated when the
+Cerence SDK is detected.
+
+All other extensions should be cleaned from the \e [qtbase]/plugins/virtualkeyboard directory
+before building the Cerence extensions to avoid conflicting behavior at runtime. The
+Cerence extensions do not require any other virtual keyboard plugin to function.
+
+Handwriting databases and language databases for XT9 are installed in the
+\e [qtbase]/qtvirtualkeyboard/cerence directory. In addition, there are two other
+alternatives for locating these files:
+
+\list
+ \li A custom runtime location defined by \l {Environment Variables}
+ \li The \e -vkb-bundle-cerence command line option to embed resources in the plugin binaries
+\endlist
\section2 MyScript Text SDK Integration
@@ -419,22 +394,50 @@ is no need for an explicit gesture.
<div align="center"><figure><svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg2" viewbox="0 0 156.63411 96.840738" height="27.330608mm" width="44.205627mm"> <defs id="defs4"></defs> <metadata id="metadata7"> </metadata> <g transform="translate(-19.991064,-156.76845)" id="layer1"> <path id="path3338" stroke-dasharray="700" stroke-dashoffset="700" d="m 20.203051,228.07773 c 7.019038,3.28583 18.296996,2.19868 25.253814,2.0203 27.834023,-0.71369 42.825541,-21.91043 41.416254,-47.98224 -0.323001,-5.97553 -7.191269,-26.45641 -10.606602,-24.74874 -10.259596,5.1298 -9.124503,41.18434 -7.576144,52.02286 1.430314,10.01219 2.165272,8.95563 3.030458,20.20305 0.514408,6.68731 0.563751,12.53255 1.515229,19.19289 0.191958,1.34371 0.355181,2.69156 0.505076,4.04061 0.01859,0.16733 0,0.67344 0,0.50508 0,-2.49868 0.106479,0.64925 -1.010153,-4.04061 -1.138171,-4.78032 -2.879899,-14.31543 -2.525381,-18.68782 0.215131,-2.65328 1.334905,-5.19519 2.525381,-7.57615 1.190476,-2.38095 2.750791,-4.60015 4.545687,-6.56599 2.880061,-3.15435 5.631315,-6.15186 10.101525,-5.55584 7.218425,0.96246 9.158962,18.77507 9.596449,24.24367 0.312712,3.90889 -0.730173,4.84918 1.010153,8.08122 2.037193,3.78335 3.387013,4.88523 8.081223,5.55583 5.47716,0.78246 9.60547,-2.86344 13.63706,-6.06091 2.23856,-1.77541 4.56788,-3.62491 6.06091,-6.06092 4.94323,-8.06526 6.7262,-26.15308 -6.06091,-28.28427 -20.629129,-3.43819 -15.11782,36.04559 11.11167,35.35534 3.30658,-0.087 6.53787,-1.26596 9.59645,-2.52538 25.47885,-10.49129 20.89279,-45.3686 11.61676,-65.65992 -1.54311,-3.37554 -5.32932,-11.06285 -9.09137,-13.13198 -1.47519,-0.81135 -3.36718,0 -5.05077,0 -1.01015,0 -2.08112,-0.34521 -3.03046,0 -9.66282,3.51375 -12.01346,27.64821 -11.11167,36.36549 0.68611,6.63247 4.06851,21.716 8.08122,26.76905 8.89766,11.20446 20.90822,13.3675 34.34518,14.64721 4.58435,0.4366 7.15182,0.9294 10.10153,-2.02031" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;"> <animate begin="0s;helOpacityFinal.end" attributename="stroke-dashoffset" from="700px" to="0px" dur="2s" fill="freeze" id="hel"></animate> <animate begin="hel.end" attributename="opacity" from="1" to="0.2" dur="3s" fill="freeze" id="helOpacity"></animate> <animate begin="loOpacity.end" attributename="opacity" from="0.2" to="0" dur="0.1s" fill="remove" id="helOpacityFinal"></animate> <set begin="helOpacityFinal.end" attributename="opacity" to="1"></set> </path> <path id="path3344" stroke-dasharray="500" stroke-dashoffset="500" d="m 41.416254,231.61326 c 3.094802,7.92585 11.797035,7.22396 19.192898,7.57614 31.260076,1.48858 50.776938,-24.97346 43.436558,-55.55839 -2.10376,-8.76565 -7.342388,-19.06976 -17.172591,-20.70812 -0.664273,-0.11071 -1.494441,-0.42069 -2.020305,0 -0.542049,0.43364 -0.354492,1.34267 -0.505077,2.0203 -0.522917,2.35313 -1.164511,4.68619 -1.515229,7.07107 -2.708747,18.41948 0.296465,32.36077 6.565992,49.49747 2.682486,7.33213 5.639357,17.22468 15.15229,17.67767 13.38648,0.63746 15.45757,-25.2821 7.07106,-32.82995 -1.55953,-1.40358 -5.88665,6.03367 -4.54568,15.15228 1.46349,9.95173 11.80613,17.40505 21.71828,15.15229 4.41964,-1.00446 11.43406,-9.0399 12.6269,-11.11167 7.10359,-12.33781 -9.7499,-22.51604 -18.18274,-26.26397 -11.05732,-4.91436 -18.5283,7.61904 -12.62691,11.61675 9.07281,6.1461 23.89173,1.97435 32.32488,-1.51523 4.27171,-1.7676 7.7445,-5.05076 11.61676,-7.57614" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4"> <animate begin="hel.end" attributename="stroke-dashoffset" from="500px" to="0px" dur="3s" fill="freeze" id="lo"></animate> <animate begin="lo.end" attributename="opacity" from="1" to="0" dur="2s" fill="freeze" id="loOpacity"></animate> <set begin="hel.end" attributename="opacity" to="1"></set> </path> </g></svg><figcaption>Writing fragments of word over the others</figcaption></figure></div>
\endraw
+\raw DocBook
+<db:figure>
+<db:title>Writing one character over the other</db:title>
+<db:mediaobject>
+<db:imageobject>
+<db:imagedata>
+<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="21.057215mm" height="23.094498mm" viewbox="0 0 74.612178 81.830896" id="svg4891" version="1.1"> <defs id="defs4893"></defs> <metadata id="metadata4896"> </metadata> <g id="layer1" transform="translate(523.68284,-132.09962)"> <filter id="dropshadow" height="130%"> <fegaussianblur in="SourceAlpha" stddeviation="3"></fegaussianblur> <feoffset dx="2" dy="2" result="offsetblur"></feoffset> <fecomponenttransfer xmlns="http://www.w3.org/2000/svg"> <fefunca type="linear" slope="0.5"></fefunca> </fecomponenttransfer> <femerge> <femergenode></femergenode> <femergenode in="SourceGraphic"></femergenode> </femerge></filter> <path style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" stroke-dasharray="300" stroke-dashoffset="300" d="m -523.25902,200.29853 c 6.95139,11.10595 25.78874,3.22177 32.32488,-4.04061 11.79865,-13.1096 17.63403,-31.02787 14.14214,-48.48732 -0.50587,-2.52933 -5.5167,-18.22189 -9.09137,-14.64721 -5.55428,5.55427 -5.5673,24.06358 -6.06092,30.80965 -0.76585,10.46668 -2.8203,20.43699 -4.04061,30.80965 -0.6416,5.45361 -0.50508,9.28437 -0.50508,14.64722 0,1.34687 1.34687,4.04061 0,4.04061 -0.61968,0 0.23734,-4.20009 2.52539,-10.60661 3.69589,-10.34851 8.06488,-17.115 18.68782,-21.71828 2.1627,-0.93717 6.32571,-2.23606 7.07106,0 1.75433,5.26298 -3.71882,27.10875 8.08123,24.74874 1.4766,-0.29532 3.0107,-0.92173 4.04061,-2.0203 1.59968,-1.70633 2.42154,-4.00433 3.53553,-6.06092 1.07581,-1.98612 2.0203,-4.04061 3.03046,-6.06091" id="path4899"> <animate begin="0s;hOpacityFinal.end" attributename="stroke-dashoffset" from="300px" to="0px" dur="2s" fill="freeze" id="h"></animate> <animate begin="h.end" attributename="opacity" from="1" to="0.2" dur="2s" fill="freeze" id="hOpacity"></animate> <animate begin="oOpacity.end" attributename="opacity" from="0.2" to="0" dur="0.1s" fill="remove" id="hOpacityFinal"></animate> <set begin="hOpacityFinal.end" attributename="opacity" to="1"></set> </path> <path style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" stroke-dasharray="150" stroke-dashoffset="150" d="m -503.05597,187.16655 c 6.30156,1.57539 7.48006,2.26745 14.64721,2.0203 4.68337,-0.16149 7.79914,-1.02611 11.11168,-4.54568 10.51043,-11.16733 -11.38898,-18.31643 -18.18274,-3.03046 -0.77578,1.7455 -0.56279,12.84339 0,14.14214 6.50612,15.01414 20.7593,7.81972 27.77919,-2.52539 1.4399,-2.12194 2.02031,-4.71404 3.03046,-7.07106" id="path4901"> <animate begin="h.end+0.01s" attributename="stroke-dashoffset" from="150px" to="0px" dur="2s" fill="freeze" id="e"></animate> <animate begin="e.end" attributename="opacity" from="1" to="0.2" dur="2s" fill="freeze" id="eOpacity"></animate> <animate begin="oOpacity.end" attributename="opacity" from="0.2" to="0" dur="0.1s" fill="remove" id="eOpacityFinal"></animate> <set begin="h.end" attributename="opacity" to="1"></set> </path> <path style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" stroke-dasharray="200" stroke-dashoffset="200" d="m -501.03566,200.80361 c 11.64322,7.6781 20.14867,-6.67932 24.24366,-16.16244 1.65295,-3.82789 5.7942,-16.09995 4.54568,-21.71828 -0.76783,-3.45526 -2.7246,-6.56132 -4.54568,-9.59645 -10.0858,-16.80967 -16.78281,-1.60069 -18.68782,10.10152 -1.35371,8.31563 -3.14678,22.86131 -0.50508,31.31473 4.4811,14.33953 15.24399,22.1694 26.76904,8.5863 3.22845,-3.80496 5.30918,-10.30708 7.07107,-15.15229" id="path4903"> <animate begin="e.end+0.01s" attributename="stroke-dashoffset" from="200px" to="0px" dur="2s" fill="freeze" id="l"></animate> <animate begin="l.end" attributename="opacity" from="1" to="0.2" dur="2s" fill="freeze" id="lOpacity"></animate> <animate begin="oOpacity.end" attributename="opacity" from="0.2" to="0" dur="0.1s" fill="remove" id="lOpacityFinal"></animate> <set begin="e.end" attributename="opacity" to="1"></set> </path> <path style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" stroke-dasharray="220" stroke-dashoffset="220" d="m -507.60165,205.3493 c 1.53719,3.07439 0.25722,2.0203 4.54568,2.0203 11.013,0 16.92189,-7.83289 21.21321,-17.67767 1.48054,-3.39653 3.24098,-15.42468 3.03045,-18.68782 -0.31004,-4.80567 -4.96262,-9.4326 -7.57614,-12.62691 -5.01521,-6.1297 -7.93642,-7.18375 -11.61676,1.51523 -3.61721,8.54979 -5.0193,26.86342 -2.0203,35.86042 3.71905,11.15714 12.82566,21.08507 24.74874,11.61675 3.11162,-2.47099 4.71404,-6.39763 7.07106,-9.59645" id="path4905"> <animate begin="l.end+0.01s" attributename="stroke-dashoffset" from="220px" to="0px" dur="2s" fill="freeze" id="l2"></animate> <animate begin="l2.end" attributename="opacity" from="1" to="0.2" dur="2s" fill="freeze" id="l2Opacity"></animate> <animate begin="oOpacity.end" attributename="opacity" from="0.2" to="0" dur="0.1s" fill="remove" id="l2OpacityFinal"></animate> <set begin="l.end" attributename="opacity" to="1"></set> </path> <path style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" stroke-dasharray="120" stroke-dashoffset="120" d="m -483.86307,185.14624 c -4.91638,-10.38229 -25.09874,-2.01585 -21.71828,9.09138 4.18358,13.74606 25.60472,15.81949 31.31473,2.0203 8.05585,-19.4683 -24.24366,-20.3309 -24.24366,-12.12183" id="path4907"> <animate begin="l2.end+0.01s" attributename="stroke-dashoffset" from="100px" to="0px" dur="2s" fill="freeze" id="o"></animate> <animate begin="o.end" attributename="opacity" from="1" to="0" dur="2s" fill="freeze" id="oOpacity"></animate> <set begin="l2.end" attributename="opacity" to="1"></set> </path> </g></svg></db:imagedata>
+</db:imageobject>
+</db:mediaobject>
+</db:figure>
+<db:figure>
+<db:title>Writing fragments of word over the others</db:title>
+<db:mediaobject>
+<db:imageobject>
+<db:imagedata>
+<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg2" viewbox="0 0 156.63411 96.840738" height="27.330608mm" width="44.205627mm"> <defs id="defs4"></defs> <metadata id="metadata7"> </metadata> <g transform="translate(-19.991064,-156.76845)" id="layer1"> <path id="path3338" stroke-dasharray="700" stroke-dashoffset="700" d="m 20.203051,228.07773 c 7.019038,3.28583 18.296996,2.19868 25.253814,2.0203 27.834023,-0.71369 42.825541,-21.91043 41.416254,-47.98224 -0.323001,-5.97553 -7.191269,-26.45641 -10.606602,-24.74874 -10.259596,5.1298 -9.124503,41.18434 -7.576144,52.02286 1.430314,10.01219 2.165272,8.95563 3.030458,20.20305 0.514408,6.68731 0.563751,12.53255 1.515229,19.19289 0.191958,1.34371 0.355181,2.69156 0.505076,4.04061 0.01859,0.16733 0,0.67344 0,0.50508 0,-2.49868 0.106479,0.64925 -1.010153,-4.04061 -1.138171,-4.78032 -2.879899,-14.31543 -2.525381,-18.68782 0.215131,-2.65328 1.334905,-5.19519 2.525381,-7.57615 1.190476,-2.38095 2.750791,-4.60015 4.545687,-6.56599 2.880061,-3.15435 5.631315,-6.15186 10.101525,-5.55584 7.218425,0.96246 9.158962,18.77507 9.596449,24.24367 0.312712,3.90889 -0.730173,4.84918 1.010153,8.08122 2.037193,3.78335 3.387013,4.88523 8.081223,5.55583 5.47716,0.78246 9.60547,-2.86344 13.63706,-6.06091 2.23856,-1.77541 4.56788,-3.62491 6.06091,-6.06092 4.94323,-8.06526 6.7262,-26.15308 -6.06091,-28.28427 -20.629129,-3.43819 -15.11782,36.04559 11.11167,35.35534 3.30658,-0.087 6.53787,-1.26596 9.59645,-2.52538 25.47885,-10.49129 20.89279,-45.3686 11.61676,-65.65992 -1.54311,-3.37554 -5.32932,-11.06285 -9.09137,-13.13198 -1.47519,-0.81135 -3.36718,0 -5.05077,0 -1.01015,0 -2.08112,-0.34521 -3.03046,0 -9.66282,3.51375 -12.01346,27.64821 -11.11167,36.36549 0.68611,6.63247 4.06851,21.716 8.08122,26.76905 8.89766,11.20446 20.90822,13.3675 34.34518,14.64721 4.58435,0.4366 7.15182,0.9294 10.10153,-2.02031" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;"> <animate begin="0s;helOpacityFinal.end" attributename="stroke-dashoffset" from="700px" to="0px" dur="2s" fill="freeze" id="hel"></animate> <animate begin="hel.end" attributename="opacity" from="1" to="0.2" dur="3s" fill="freeze" id="helOpacity"></animate> <animate begin="loOpacity.end" attributename="opacity" from="0.2" to="0" dur="0.1s" fill="remove" id="helOpacityFinal"></animate> <set begin="helOpacityFinal.end" attributename="opacity" to="1"></set> </path> <path id="path3344" stroke-dasharray="500" stroke-dashoffset="500" d="m 41.416254,231.61326 c 3.094802,7.92585 11.797035,7.22396 19.192898,7.57614 31.260076,1.48858 50.776938,-24.97346 43.436558,-55.55839 -2.10376,-8.76565 -7.342388,-19.06976 -17.172591,-20.70812 -0.664273,-0.11071 -1.494441,-0.42069 -2.020305,0 -0.542049,0.43364 -0.354492,1.34267 -0.505077,2.0203 -0.522917,2.35313 -1.164511,4.68619 -1.515229,7.07107 -2.708747,18.41948 0.296465,32.36077 6.565992,49.49747 2.682486,7.33213 5.639357,17.22468 15.15229,17.67767 13.38648,0.63746 15.45757,-25.2821 7.07106,-32.82995 -1.55953,-1.40358 -5.88665,6.03367 -4.54568,15.15228 1.46349,9.95173 11.80613,17.40505 21.71828,15.15229 4.41964,-1.00446 11.43406,-9.0399 12.6269,-11.11167 7.10359,-12.33781 -9.7499,-22.51604 -18.18274,-26.26397 -11.05732,-4.91436 -18.5283,7.61904 -12.62691,11.61675 9.07281,6.1461 23.89173,1.97435 32.32488,-1.51523 4.27171,-1.7676 7.7445,-5.05076 11.61676,-7.57614" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4"> <animate begin="hel.end" attributename="stroke-dashoffset" from="500px" to="0px" dur="3s" fill="freeze" id="lo"></animate> <animate begin="lo.end" attributename="opacity" from="1" to="0" dur="2s" fill="freeze" id="loOpacity"></animate> <set begin="hel.end" attributename="opacity" to="1"></set> </path> </g></svg></db:imagedata>
+</db:imageobject>
+</db:mediaobject>
+</db:figure>
+\endraw
+
\section3 Language coverage of MyScript Text SDK
-MyScript Superimposed supports 70 languages.
+MyScript Superimposed supports 72 languages.
\section3 MyScript Text SDK Packages Installation
The MyScript delivery team can provide you the packages with various \c .zip archives.
To access all the code, tools, and resources needed for building your own
handwriting application, \b {extract all the packages in the same destination folder} as
-\c src/plugins/myscript/3rdparty/myscript.
+\c src/plugins/myscript/sdk, where the CMake can pick it up automatically.
+
+Alternatively, you can extract the packages to any other directory.
+In this case, the location of the SDK must be passed to the \e configure script.
+
+\badcode
+configure ... -vkb-myscript-sdk /path/to/myscript/sdk
+\endcode
The file hierarchy should look like below:
\badcode
-3rdparty
-└── myscript
+myscript
+└── sdk
├─── conf
├─── doc
├─── edk
@@ -444,6 +447,8 @@ The file hierarchy should look like below:
│ │ └─── *.so
│ ├─── lin-armv7
│ │ └─── *.so
+ │ ├─── lin-armv7hf
+ │ │ └─── *.so
│ ├─── lin-x64
│ │ └─── *.so
│ ├─── lin-x86
@@ -474,6 +479,8 @@ The file hierarchy should look like below:
│ │ └─── *.so
│ ├─── lin-armv7
│ │ └─── *.so
+ │ ├─── lin-armv7hf
+ │ │ └─── *.so
│ ├─── lin-x64
│ │ └─── *.so
│ ├─── lin-x86
@@ -525,15 +532,16 @@ security measure that uniquely identifies you as a legitimate customer of MyScri
technologies. The certificate helps MyScript trace customers' identify and the products
that have been purchased.
-The certificate is delivered in the /c [your_login].vo.zip package. When you unzip
+The certificate is delivered in the \c {[your_login].vo.zip package}. When you unzip
this package, the certificate is automatically put in the appropriate location.
This ensure that the certificate is instantly working within the services and code
samples that you have been provided with.
\section3 How to build Qt Virtual Keyboard with MyScript Text SDK
-The MyScript Text SDK is included in the build of Qt Virtual Keyboard by either
-adding \c CONFIG+=handwriting or \c CONFIG+=myscript to the qmake command line.
+The MyScript integration code is automatically activated when the MyScript Text SDK is detected.
+
+Language resources for MyScript Text SDK are installed in the \e [qtbase]/qtvirtualkeyboard/myscript directory.
\section2 Static builds
@@ -541,41 +549,4 @@ The virtual keyboard can be built and linked statically against the application.
This implies that Qt is also built statically (using the -static option in the
configure command line).
-Static builds of the virtual keyboard are enabled by adding \c CONFIG+=static to
-the qmake command line and then rebuilding.
-
-Some third party modules used by the virtual keyboard are always built as shared
-libraries. These modules are Hunspell and Lipi Toolkit.
-
-\section3 Using the static plugin
-
-The following section should be added to the application project file that uses the
-statically built virtual keyboard.
-
-\code
-static {
- QTPLUGIN += qtvirtualkeyboardplugin
- QT += svg
-}
-\endcode
-
-\c QTPLUGIN causes qmake to pull linker dependencies for the virtual keyboard
-plugin. The SVG module is required as an extra dependency for Qt, since the SVG format is
-required by the default styles.
-
-From here on, using a statically built virtual keyboard is no different from the normal
-case.
-
-\section1 Deployment
-
-\section2 Desktop Targets
-
-Add a Deploy Step that executes the \e {make install} command, then deploy using
-the \e {Deploy All} command.
-
-\section2 Boot2Qt Targets
-
-The installation is done by copying the necessary files to the memory card, or
-by using the adb push command.
-
*/
diff --git a/src/virtualkeyboard/doc/src/deployment-guide.qdoc b/src/virtualkeyboard/doc/src/deployment-guide.qdoc
index d7ea786c..04abd288 100644
--- a/src/virtualkeyboard/doc/src/deployment-guide.qdoc
+++ b/src/virtualkeyboard/doc/src/deployment-guide.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
@@ -34,7 +10,7 @@
\section1 Overview
This document describes how to deploy and use the Qt Virtual Keyboard plugin
-with Qt 5 applications.
+with Qt applications.
\section1 Deployment
@@ -47,32 +23,55 @@ locations:
\li Desktop install path
\li Boot2Qt install path
\row
- \li qtvirtualkeyboardplugin
- \li \c $$[QT_INSTALL_PLUGINS]/platforminputcontexts
+ \li qtvirtualkeyboardplugin platform input context plugin
+ \li \c <QT_INSTALL_PLUGINS>/platforminputcontexts
\li \c /system/plugins/platforminputcontexts
\row
- \li qtvirtualkeyboardextensionplugin
- \li \c $$[QT_INSTALL_PLUGINS]/virtualkeyboard
- \li \c /system/plugins/virtualkeyboard
-\row
- \li qtvirtualkeyboardplugin QML files
- \li \c $$[QT_INSTALL_QML]/QtQuick/VirtualKeyboard
+ \li qtvkbplugin QML plugin
+ \li \c <QT_INSTALL_QML>/QtQuick/VirtualKeyboard
\li \c /system/qml/QtQuick/VirtualKeyboard
\row
- \li qtvirtualkeyboardstylesplugin
- \li \c $$[QT_INSTALL_QML]/QtQuick/VirtualKeyboard/Styles
+ \li qtvkbcomponentsplugin QML plugin
+ \li \c <QT_INSTALL_QML>/QtQuick/VirtualKeyboard/Components
+ \li \c /system/qml/QtQuick/VirtualKeyboard/Components
+\row
+ \li qtvkblayoutsplugin QML plugin
+ \li \c <QT_INSTALL_QML>/QtQuick/VirtualKeyboard/Layouts
+ \li \c /system/qml/QtQuick/VirtualKeyboard/Layouts
+\row
+ \li qtvkbpluginsplugin QML plugin
+ \li \c <QT_INSTALL_QML>/QtQuick/VirtualKeyboard/Plugins
+ \li \c /system/qml/QtQuick/VirtualKeyboard/Plugins
+\row
+ \li extension QML plugins
+ \li \c <QT_INSTALL_QML>/QtQuick/VirtualKeyboard/Plugins/*
+ \li \c /system/qml/QtQuick/VirtualKeyboard/Plugins/*
+\row
+ \li qtvkbsettingsplugin QML plugin
+ \li \c <QT_INSTALL_QML>/QtQuick/VirtualKeyboard/Settings
+ \li \c /system/qml/QtQuick/VirtualKeyboard/Settings
+\row
+ \li qtvkbstylesplugin QML plugin
+ \li \c <QT_INSTALL_QML>/QtQuick/VirtualKeyboard/Styles
\li \c /system/qml/QtQuick/VirtualKeyboard/Styles
+\row
+ \li Virtual keyboard data
+ \li \c <QT_INSTALL_DATA>/qtvirtualkeyboard
+ \li \c /system/qtvirtualkeyboard
\endtable
+\section2 Dependencies
+
+Read more at \l {Deploying Qt's Libraries}.
+
\section1 Integration Method
Qt Virtual Keyboard currently supports two alternative integration methods
for using the plugin:
\list
- \li \c Desktop: requires no changes to existing applications.
- The virtual keyboard is available to all of the Qt 5 applications
- in the system.
+ \li \c Desktop: requires no changes to existing applications. The virtual
+ keyboard is available to all Qt applications in the system.
In this integration method, the keyboard is shown in a dedicated
top-level window.
@@ -91,23 +90,23 @@ The integration method is automatically selected by the project files.
However, in desktop environments, it is possible to override the desktop
integration method and use the application integration method instead,
by using the \c QT_VIRTUALKEYBOARD_DESKTOP_DISABLE environment variable,
-or by adding \c CONFIG+=disable-desktop to the \c qmake command line.
+or by adding \c -no-vkb-desktop to the \c configure command line.
\section2 Using Qt Virtual Keyboard with Qt Wayland
This section explains how to use Qt Virtual Keyboard to interact with the
\l {Line Edits Example}{Qt Widgets Line Edits example} using the
-\l {Qt Wayland Compositor Examples - Pure QML}{Pure QML example}
-as a compositor.
+\l {Fancy Compositor}{Fancy Compositor example} as a compositor.
We will be using Ubuntu 18.04 to run the example, using the X11 as the
-windowing system. The example compositor (\c pure-qml) will open
+windowing system. The example compositor (\c fancy-compositor) will open
as a window within an X11 session.
\list 1
\li Start the compositor:
\badcode
-QT_XCB_GL_INTEGRATION=xcb_egl QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-egl QT_IM_MODULE=qtvirtualkeyboard ./pure-qml -platform xcb
+QT_XCB_GL_INTEGRATION=xcb_egl QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-egl \
+QT_IM_MODULE=qtvirtualkeyboard ./fancy-compositor -platform xcb
\endcode
\li Before running the client application, ensure that QT_IM_MODULE is unset:
\badcode
@@ -154,8 +153,8 @@ The following example shows how to create an InputPanel and how to
divide the screen area with the application container.
\code
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
Item {
id: root
@@ -195,7 +194,7 @@ There are several environment variables defined by the module that are listed be
\li Overrides the location of the Hunspell data files.
The default location depends on the value of
- \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ \c {QLibraryInfo::path(QLibraryInfo::DataPath)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/hunspell}.
@@ -206,9 +205,9 @@ There are several environment variables defined by the module that are listed be
By default, the dictionary is bundled into the plugin's resources.
- To disable resource bundling, add \c CONFIG+=no-bundle-pinyin in the
- plugin's qmake command line. In this scenario, the default location
- depends on the value of \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ To disable resource bundling, add \e -vkb-no-bundle-pinyin to the
+ Qt configure command line. In this scenario, the default location
+ depends on the value of \c {QLibraryInfo::path(QLibraryInfo::DataPath)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/pinyin/dict_pinyin.dat}.
\row
@@ -217,9 +216,9 @@ There are several environment variables defined by the module that are listed be
By default, the dictionary is bundled into the plugin's resources.
- To disable resource bundling, add \c CONFIG+=no-bundle-tcime in the
- plugin's qmake command line. In this scenario, the default location
- depends on the value of \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ To disable resource bundling, add \e -vkb-no-bundle-tcime to the
+ Qt configure command line. In this scenario, the default location
+ depends on the value of \c {QLibraryInfo::path(QLibraryInfo::DataPath)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_cangjie.dat}.
\row
@@ -228,9 +227,9 @@ There are several environment variables defined by the module that are listed be
By default, the dictionary is bundled into the plugin's resources.
- To disable resource bundling, add \c CONFIG+=no-bundle-tcime in the
- plugin's qmake command line. In this scenario, the default location
- depends on the value of \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ To disable resource bundling, add \e -vkb-no-bundle-tcime to the
+ Qt configure command line. In this scenario, the default location
+ depends on the value of \c {QLibraryInfo::path(QLibraryInfo::DataPath)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_zhuyin.dat}.
\row
@@ -239,17 +238,47 @@ There are several environment variables defined by the module that are listed be
By default, the dictionary is bundled into the plugin's resources.
- To disable resource bundling, add \c CONFIG+=no-bundle-tcime in the
- plugin's qmake command line. In this scenario, the default location
- depends on the value of \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
+ To disable resource bundling, add \e -vkb-no-bundle-tcime to the
+ Qt configure command line. In this scenario, the default location
+ depends on the value of \c {QLibraryInfo::path(QLibraryInfo::DataPath)}.
For example, for Qt libraries built from source,
it could be \c {qtbase/qtvirtualkeyboard/tcime/dict_phrases.dat}.
\row
+ \li QT_VIRTUALKEYBOARD_CERENCE_HWR_DB_PATH
+ \li Specifies the location of Cerence Handwriting handwriting database.
+
+ The default search location for Cerence Handwriting handwriting database are:
+ \list
+ \li \c QT_VIRTUALKEYBOARD_CERENCE_HWR_DB_PATH
+ \li \c {QLibraryInfo::location(QLibraryInfo::DataPath) + "/qtvirtualkeyboard/cerence/handwriting"}
+ \li \c {":/qt-project.org/imports/QtQuick/VirtualKeyboard/Cerence/Handwriting"}
+ \endlist
+
+ The environment variable may contain multiple paths. Multiple paths are separated with
+ semicolon in Windows and with colon in other operating systems.
+ \row
+ \li QT_VIRTUALKEYBOARD_XT9_LDB_PATH
+ \li Specifies the location of XT9 databases.
+
+ The default search location for LDB files are:
+ \list
+ \li \c QT_VIRTUALKEYBOARD_XT9_LDB_PATH
+ \li \c {QLibraryInfo::location(QLibraryInfo::DataPath) + "/qtvirtualkeyboard/cerence/xt9"}
+ \li \c {":/qt-project.org/imports/QtQuick/VirtualKeyboard/Cerence/Xt9"}
+ \endlist
+
+ Additional search paths can be specified by setting this environment variable. Multiple paths are
+ separated with semicolon in Windows and with colon in other operating systems.
+
+ The LDB files are shared between XT9 and Cerence Handwriting plugins, so this environment variable
+ affects both plugins.
+ \row
\li QT_VIRTUALKEYBOARD_STYLE
\li Specifies the location of the style to use with the virtual keyboard.
This can also be specified in QML by setting \l {VirtualKeyboardSettings::styleName},
- or at build time by using the \l {Advanced Configuration Options}{qmake configuration options}.
+ or at build time by using the
+ \l [DOC] {Advanced Usage} {Configuration Options}.
\row
\li QT_VIRTUALKEYBOARD_LAYOUT_PATH
\li Specifies the location of the layouts to be used with the virtual keyboard.
@@ -257,23 +286,6 @@ There are several environment variables defined by the module that are listed be
\li QT_VIRTUALKEYBOARD_DESKTOP_DISABLE
\li Disables the desktop integration method.
\row
- \li LIPI_ROOT
- \li Specifies the location of lipi-toolkit.
-
- The default location depends on the value of
- \c {QLibraryInfo::location(QLibraryInfo::DataPath)}.
- For example, for Qt libraries built from source,
- it could be \c {qtbase/qtvirtualkeyboard/lipi_toolkit}.
- \row
- \li LIPI_LIB
- \li Specifies the location of lipi-toolkit plugins.
-
- The default location depends on \c LIPI_ROOT:
- \list
- \li \c {LIPI_ROOT + "/lib"} if \c LIPI_ROOT is set.
- \li \c {QLibraryInfo::location(QLibraryInfo::PluginsPath) + "/lipi_toolkit"} if \c LIPI_ROOT is not set.
- \endlist
- \row
\li QT_VIRTUALKEYBOARD_FORCE_EVENTS_WITHOUT_FOCUS
\li Enables Qt Virtual Keyboard to send key events and use Shift key without having any text input in focus.
diff --git a/src/virtualkeyboard/doc/src/handwriting.qdoc b/src/virtualkeyboard/doc/src/handwriting.qdoc
index 61fdd92c..204b4269 100644
--- a/src/virtualkeyboard/doc/src/handwriting.qdoc
+++ b/src/virtualkeyboard/doc/src/handwriting.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
@@ -45,66 +21,33 @@ For instructions on how to activate and use the handwriting input mode, see the
For information about building Qt Virtual Keyboard with a particular
handwriting engine, see \l {Configuration Options}.
-\section1 Lipi Toolkit
+\section1 Example Handwriting
-\l {http://lipitk.sourceforge.net/lipi-toolkit.htm}{Lipi Toolkit} is an
-open source handwriting recognition engine.
+The Example Handwriting Plugin offers a simulated handwriting recognition experience
+producing random characters regardless of what is written. It serves as a tool for
+examining handwriting layouts and as a foundation for developing new plugins.
-Lipi Toolkit only supports handwriting written in the English language.
+\section1 Cerence Handwriting
-\section1 T9 Write
-
-\l {https://www.nuance.com/mobile/mobile-solutions/text-input-solutions/t9-write.html}{T9 Write}
+\l {https://cerence.com}{Cerence Handwriting}
is a commercial handwriting recognition engine.
-T9 Write supports handwriting written in the following languages:
+Cerence Handwriting works with all languages supported by the virtual keyboard.
-\table
-\row
-\li \list
- \li Arabic
- \li Bulgarian
- \li Croatian
- \li Czech
- \li Danish
- \li Dutch
- \li English
-\endlist
-\li \list
- \li Estonian
- \li Finnish
- \li French
- \li German
- \li Greek
- \li Hebrew
- \li Hungarian
-\endlist
-\li \list
- \li Italian
- \li Japanese
- \li Korean
- \li Norwegian
- \li Persian/Farsi
- \li Polish
- \li Portugese
-\endlist
-\li \list
- \li Romanian
- \li Russian
- \li Serbian
- \li Simplified Chinese
- \li Spanish
- \li Swedish
- \li Traditional Chinese
-\endlist
-\endtable
+ \list
+ \li \l {Qt Virtual Keyboard Overview#Supported Languages}{Supported Languages}
+ \endlist
+
+\b {See also}: \l {Cerence Handwriting Integration}
+
+\b {See also}: \l {Cerence XT9 Advanced Input}
\section1 MyScript
\l {https://www.myscript.com}{MyScript}
SDK is a commercial handwriting recognition engine.
-MyScript SDK supports 71 handwriting recognition languages:
+MyScript SDK supports 72 handwriting recognition languages:
\table
\row
@@ -126,12 +69,13 @@ MyScript SDK supports 71 handwriting recognition languages:
\li Croatian
\li Czech
\li Danish
+ \li Dutch, Flemish
\endlist
\li \list
- \li Dutch, Flemish
\li Dutch
\li English - Canada
\li English - Philippines
+ \li English - South Africa
\li English - United Kingdom
\li English - United States
\li Estonian
@@ -192,7 +136,7 @@ MyScript SDK supports 71 handwriting recognition languages:
MyScript is integrated into Qt Virtual Keyboard with identical coverage of supported languages.
\list
- \li \l {Qt Virtual Keyboard#Supported Languages}{Supported Languages}
+ \li \l {Qt Virtual Keyboard Overview#Supported Languages}{Supported Languages}
\endlist
However, with minor modifications to the Qt Virtual Keyboard source code, it is easy to add handwriting panels for other languages supported by \MyScript.
diff --git a/src/virtualkeyboard/doc/src/includes/build.qdocinc b/src/virtualkeyboard/doc/src/includes/build.qdocinc
deleted file mode 100644
index 44988ce7..00000000
--- a/src/virtualkeyboard/doc/src/includes/build.qdocinc
+++ /dev/null
@@ -1,7 +0,0 @@
-//! [input-method-language-option-note]
-
-As this option activates a particular language, the \c lang-all option
-will not be enabled if this option is specified. To build all languages,
-use \c CONFIG+=lang-all.
-
-//! [input-method-language-option-note]
diff --git a/src/virtualkeyboard/doc/src/layouts.qdoc b/src/virtualkeyboard/doc/src/layouts.qdoc
index 70ab2f05..e0e4e285 100644
--- a/src/virtualkeyboard/doc/src/layouts.qdoc
+++ b/src/virtualkeyboard/doc/src/layouts.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-components.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-components.qdoc
new file mode 100644
index 00000000..44e172fb
--- /dev/null
+++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-components.qdoc
@@ -0,0 +1,17 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \qmlmodule QtQuick.VirtualKeyboard.Components
+ \title Qt Quick Virtual Keyboard Components QML Types
+ \ingroup qmlmodules
+ \ingroup qtvirtualkeyboard-components-qml
+ \brief Provides QML types for customizing virtual keyboard layouts.
+
+ The QML types can be imported into your application using the following
+ import statement in your .qml file:
+
+ \qml
+ import QtQuick.VirtualKeyboard.Components
+ \endqml
+*/
diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc
index 408a919a..f0edd5ab 100644
--- a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc
+++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-examples.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group qtvirtualkeyboard-examples
@@ -32,11 +8,13 @@
*/
/*!
- \title Qt Quick Virtual Keyboard - Basic Example
+ \title Virtual Keyboard in Qt Quick
\example basic
- \brief This is a basic QML example that uses the virtual keyboard.
+ \examplecategory {Embedded}
+ \brief This example shows how to use the virtual keyboard in a Qt Quick application.
\ingroup qtvirtualkeyboard-examples
\image basic-example.png
+ \meta tags {quick}
The example has two implementations: one for desktop
platforms and another for embedded platforms. The former version
@@ -47,7 +25,7 @@
appropriate implementation based on the CONFIG options:
\quotefromfile basic/basic.pro
- \skipto android-embedded
+ \skipto vkb-desktop
\printuntil /^\}$/
The example enables the virtual keyboard by setting the \c QT_IM_MODULE
diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc
index a3156cd0..037acf44 100644
--- a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc
+++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-index.qdoc
@@ -1,141 +1,138 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\title Qt Virtual Keyboard
\page qtvirtualkeyboard-index.html
The Qt Virtual Keyboard project provides an input framework and reference
- keyboard frontend for Qt 5 on Linux Desktop/X11, Windows Desktop, and
+ keyboard frontend for Qt 6 on Linux Desktop/X11, Windows Desktop, and
Boot2Qt targets.
The input framework makes it easy to write custom input methods or to
integrate 3rd party input engines. The input methods can be implemented
in C++ or QML.
- \section1 Features
+ \section1 Using the Module
- Key features of the Qt Virtual Keyboard include:
+ \include {module-use.qdocinc} {using the c++ api}
- \list
- \li Customizable keyboard layouts and styles with dynamic switching.
- \li Predictive text input with word selection.
- \li Character preview and alternative character view.
- \li Automatic capitalization and space insertion.
- \li Scalability to different resolutions.
- \li Support for different character sets (Latin, Simplified/Traditional Chinese,
- Hindi, Japanese, Arabic, Hebrew, Korean, and others).
- \li Support for most common input \l {Supported Languages}{languages},
- with possibility to easily extend the language support.
- \li Left-to-right and right-to-left input.
- \li Hardware key support for 2-way and 5-way navigation.
- \li \l {Handwriting Recognition}{Handwriting support}, with gestures for fullscreen input.
- \li Audio feedback.
- \li Cross-platform functionality.
- \li Supports both \l {Integration Method}{Qt Quick and Qt Widgets applications}.
- \endlist
-
- \section1 Supported Languages
+ \section2 Building with CMake
- \include layouts.qdocinc layout-list
+ \include {module-use.qdocinc} {building with cmake} {VirtualKeyboard}
- \section1 Third-party Plugins
+ \section2 Building with qmake
- The Qt Virtual Keyboard supports third-party plugins from the following vendors:
- \list
- \li \l {Handwriting Recognition#T9 Write}{T9 Write} handwriting text input.
- \li \l {Handwriting Recognition#MyScript}{MyScript} Text handwriting recognition
- \endlist
+ \include {module-use.qdocinc} {building_with_qmake} {virtualkeyboard}
- \l {Building Qt Virtual Keyboard} describes how to integrate these plugins
- into the Qt Virtual Keyboard.
-
- \section1 Guides
+ \section1 Articles and Guides
\list
\li \l {Building Qt Virtual Keyboard}
\li \l {Deployment Guide}
- \li \l {Technical Guide}
+ \li \l {Qt Virtual Keyboard Overview}
\li \l {User Guide}
\endlist
- \section1 API Reference
+ \section1 Examples
\list
- \li \l{Qt Virtual Keyboard QML Types}{QML Types}
- \li \l{Qt Virtual Keyboard C++ Classes}{C++ Classes}
+ \li \l{Qt Virtual Keyboard Examples}
\endlist
- \section1 Examples
+ \section1 Reference
+
+ \list
+ \li \l{Qt Virtual Keyboard API for Applications}
+ \li \l{Qt Virtual Keyboard API for Advanced Use Cases}
+ \li \l{Qt Virtual Keyboard QML Types}
+ \li \l{Qt Virtual Keyboard C++ Classes}
+ \endlist
- \list
- \li \l{Qt Virtual Keyboard Examples}
- \endlist
\section1 Licenses and Attributions
- Qt Virtual Keyboard is available under commercial licenses from \l{The Qt Company}.
- In addition, it is available under the \l{GNU General Public License, version 3}.
+ Qt Virtual Keyboard is available under commercial licenses from
+ \l{The Qt Company}. In addition, it is available under the
+ \l{GNU General Public License, version 3}.
See \l{Qt Licensing} for further details.
- Furthermore Qt Virtual Keyboard potentially contains third party
- modules under following permissive licenses:
+ Furthermore, Qt Virtual Keyboard potentially contains third party
+ modules under the following permissive licenses:
\generatelist{groupsbymodule attributions-qtvirtualkeyboard}
*/
/*!
-\qmlmodule QtQuick.VirtualKeyboard 2.\QtMinorVersion
-\title Qt Virtual Keyboard QML Types
-\ingroup qmlmodules
-\brief Provides QML types for an input framework and a reference keyboard front
-end.
+ \page qtquick-virtualkeyboard-for-application.html
+ \title Qt Virtual Keyboard API for Applications
+ \brief Provides API for integrating the virtual keyboard into an application.
The QML types can be imported into your application using the following
import statements in your .qml file:
- \qml \QtMinorVersion
- import QtQuick.VirtualKeyboard 2.\1
- import QtQuick.VirtualKeyboard.Styles 2.\1
- import QtQuick.VirtualKeyboard.Settings 2.\1
+ \qml
+ import QtQuick.VirtualKeyboard
+ import QtQuick.VirtualKeyboard.Settings
\endqml
In addition to importing the types, the \c QT_IM_MODULE environment
variable must be set to \c qtvirtualkeyboard. For more information, see
\l {Loading the Plugin}.
-Styling:
+ \section1 \l {Qt Virtual Keyboard Module QML Types} {Virtual Keyboard}
+
+ QML types
+
+ \generatelist groupsbymodule qtvirtualkeyboard-qml
+
+ C++ types
+
+ \generatelist groupsbymodule qtvirtualkeyboard-cpp-for-apps
-\generatelist qmltypesbymodule QtQuick.VirtualKeyboard.Styles
+ \section1 \l {Qt Quick Virtual Keyboard Settings QML Types} {Virtual Keyboard Settings}
-Settings:
+ QML types
-\generatelist qmltypesbymodule QtQuick.VirtualKeyboard.Settings
+ \generatelist qmltypesbymodule QtQuick.VirtualKeyboard.Settings
+*/
+
+/*!
+ \page qtquick-virtualkeyboard-for-advanced-use-cases.html
+ \title Qt Virtual Keyboard API for Advanced Use Cases
+ \brief Provides API for extending or modifying virtual keyboard functionality.
+
+ These QML types fall under the categories of virtual keyboard plugin vendors,
+ style providers, and keyboard layouts. They should not be used by application
+ or middleware.
+
+ \section1 \l {Qt Quick Virtual Keyboard Styles QML Types} {Styles}
+
+ QML types
+
+ \generatelist qmltypesbymodule QtQuick.VirtualKeyboard.Styles
+
+ \section1 \l {Qt Quick Virtual Keyboard Components QML Types} {Components}
+
+ QML types
-Input framework and keys:
+ \generatelist qmltypesbymodule QtQuick.VirtualKeyboard.Components
+
+ C++ types
+
+ \generatelist groupsbymodule qtvirtualkeyboard-cpp-for-devs
+*/
+
+/*!
+ \qmlmodule QtQuick.VirtualKeyboard
+ \title Qt Virtual Keyboard Module QML Types
+ \brief Provides QML types for the virtual keyboard.
+*/
+
+/*!
+ \page qtvirtualkeyboard-qmltypes.html
+ \title Qt Virtual Keyboard QML Types
+ \brief QML types for the virtual keyboard.
+ \generatelist groupsbymodule qmlclass
*/
diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc
index ed069630..64553d34 100644
--- a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc
+++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-module-cpp.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\module QtVirtualKeyboard
@@ -40,7 +16,15 @@
#include <QtVirtualKeyboard>
\endcode
- To link against the module, add this line to your qmake .pro file:
+ \include module-use.qdocinc using qt module
+ \snippet cmake.txt find-and-link
+
+ See \l{Getting started with CMake} for more information.
+
+ \section2 Building with qmake
+
+ To link against this module, add the following line to your qmake \c .pro
+ file:
\badcode
QT += virtualkeyboard
diff --git a/src/virtualkeyboard/doc/src/qtvirtualkeyboard-namespace.qdoc b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-namespace.qdoc
new file mode 100644
index 00000000..6c2635e5
--- /dev/null
+++ b/src/virtualkeyboard/doc/src/qtvirtualkeyboard-namespace.qdoc
@@ -0,0 +1,53 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \namespace QtVirtualKeyboard
+ \inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
+ \keyword Qt Virtual Keyboard Namespace
+ \brief Contains enums used by the virtual keyboard classes.
+*/
+
+/*!
+ \enum QtVirtualKeyboard::KeyType
+
+ \inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
+
+ \brief Key type for the virtual keyboard key.
+
+ \value BaseKey
+ \value BackspaceKey
+ \value ChangeLanguageKey
+ \value EnterKey
+ \value FillerKey
+ \value HandwritingModeKey
+ \value HideKeyboardKey
+ \value InputModeKey
+ \value Key
+ \value ModeKey
+ \value NumberKey
+ \value ShiftKey
+ \value SpaceKey
+ \value SymbolModeKey
+ \value FlickKey
+*/
+
+/*!
+ \enum QtVirtualKeyboard::KeyboardFunction
+
+ \inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
+
+ \brief Specifies a keyboard function to be executed by the virtual keyboard.
+
+ This enumeration is used as an alias for predefined keyboard functions, such
+ as hiding the virtual keyboard. The enumeration is used internally by the
+ virtual keyboard to implement common functionality. The enumeration value is
+ passed to Keyboard.doKeyboardFunction() for execution.
+
+ \value HideInputPanel
+ \value ChangeLanguage
+ \value ToggleHandwritingMode
+*/
diff --git a/src/virtualkeyboard/doc/src/technical-guide.qdoc b/src/virtualkeyboard/doc/src/technical-guide.qdoc
index 91711447..eb424765 100644
--- a/src/virtualkeyboard/doc/src/technical-guide.qdoc
+++ b/src/virtualkeyboard/doc/src/technical-guide.qdoc
@@ -1,46 +1,58 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
-\page technical-guide.html
+\page qtvirtualkeyboard-overview.html
+\title Qt Virtual Keyboard Overview
+\brief Describes the technical details of the Qt Virtual Keyboard module.
+\ingroup explanantion
+This document provides a technical overview of the Qt Virtual Keyboard plugin.
-\title Technical Guide
+\section1 Features
-\section1 Overview
+Key features of the Qt Virtual Keyboard include:
-This document provides a technical overview of the Qt Virtual Keyboard plugin.
+\list
+ \li Customizable keyboard layouts and styles with dynamic switching.
+ \li Predictive text input with word selection.
+ \li Character preview and alternative character view.
+ \li Automatic capitalization and space insertion.
+ \li Scalability to different resolutions.
+ \li Support for different character sets (Latin, Simplified/Traditional Chinese,
+ Hindi, Japanese, Arabic, Hebrew, Korean, and others).
+ \li Support for most common input \l {Supported Languages}{languages},
+ with possibility to easily extend the language support.
+ \li Left-to-right and right-to-left input.
+ \li Hardware key support for 2-way and 5-way navigation.
+ \li \l {Handwriting Recognition}{Handwriting support}, with gestures for fullscreen input.
+ \li Audio feedback.
+ \li Cross-platform functionality.
+ \li Supports both \l {Integration Method}{Qt Quick and Qt Widgets applications}.
+\endlist
+
+\section1 Supported Languages
+
+\include layouts.qdocinc layout-list
+
+\section1 Third-party Plugins
+
+The Qt Virtual Keyboard supports third-party plugins from the following vendors:
+\list
+ \li \l {Cerence XT9 Advanced Input}{Cerence XT9} advanced input.
+ \li \l {Handwriting Recognition#Cerence Handwriting}{Cerence Handwriting} text input.
+ \li \l {Handwriting Recognition#MyScript}{MyScript} Text handwriting recognition
+\endlist
+
+\l {Building Qt Virtual Keyboard} describes how to integrate these plugins
+into the Qt Virtual Keyboard.
\section1 Basic Concepts
-The Qt Virtual Keyboard project is a Qt 5 input context plugin which implements
+The Qt Virtual Keyboard project is a Qt input context plugin that implements
QPlatformInputContextPlugin and QPlatformInputContext interfaces.
These interfaces allow the plugin to be used as a platform input
-context plugin in Qt 5 applications.
+context plugin in Qt applications.
The plugin itself provides an input framework supporting multiple
input methods as well as a QML UI for the virtual keyboard. The input
@@ -61,8 +73,6 @@ The input framework provides the following main interfaces:
\li InputMethod: a base type for QML-based input methods. The input method
usually handles key events, but can also handle mouse and touch input
events.
- \li QVirtualKeyboardExtensionPlugin: a plugin interface for virtual keyboard
- extensions that provide additional functionality.
\endlist
\section1 Input Context
@@ -87,46 +97,68 @@ from the application. This information includes, but is not limited to:
\section2 Locale
-The list of supported locales is specified by the existence of a locale specific
-layout directory in "layouts/*". Each layout directory may contain one
-or more layouts, for example fi_FI/main.qml or symbols.qml. If the locale specific
-layout is not different from the fallback locale, then a place holder file \c
-<layout type>.fallback can be added for the layout. This will specify the virtual
-keyboard that a fallback layout can be used instead.
+The Virtual Keyboard Engine generates the list of supported locales from
+locale-specific layout directories in \c {layouts/}. Each layout directory
+must contain a definition or fallback for the following layout types:
+\e dialpad, \e digits, \e handwriting, \e main, \e numbers, and \e symbols.
+Definitions are implemented in \c {.qml}-files, fallbacks are defined by a
+placeholder file with the \c {.fallback} file extension. The \c {layouts/}
+directory must contain a \c {fallback/} sub-directory that contains definitions
+for each layout type.
-At minimum the layout directory must contain the files:
+Each layout directory may contain the definition of one or more layout types.
+If the locale-specific layout is the same as that of the fallback locale, you
+can add a placeholder file for the layout called \c {<layout type>.fallback}.
+This instructs the virtual keyboard to use the fallback layout instead.
-\list
- \li \c dialpad.fallback
- \li \c digits.fallback
- \li \c main.fallback
- \li \c numbers.fallback
- \li \c symbols.fallback
-\endlist
+For example: you may add a locale-specific layout for Finnish, that defines the
+main layout type in \c {main.qml}. For the other layout types, you opt for the
+fallback mechanism. Your \c {layouts/} tree will look like this:
+
+\badcode
+.
+├── fallback
+│   ├── dialpad.qml
+│   ├── digits.qml
+│   ├── handwriting.qml
+│   ├── main.qml
+│   ├── numbers.qml
+│   └── symbols.qml
+└── fi_FI
+ ├── dialpad.fallback
+ ├── digits.fallback
+ ├── handwriting.fallback
+ ├── main.qml
+ ├── numbers.fallback
+ └── symbols.fallback
+\endcode
+
+It's imperative that the \c {layouts/fallback} directory always contain a set
+of full implementation files.
The application can specify the initial layout by changing the default locale.
-However, this needs to be done before the application is initialized and the
-input method plugin is loaded. If no changes are made to the default locale, the
-current system locale is used.
+However, this must be done before the application initializes and loads the
+input method plugin. If there are no changes to the default locale, the current
+system locale is used.
-The keyboard locale matching is performed in the following sequence:
+Matching the keyboard locale follows this sequence:
\list
- \li layouts/<language>_<country>
- \li layouts/<language>_*
- \li layouts/en_GB
+ \li \c {layouts/<language>_<country>}
+ \li \c {layouts/<language>_*}
+ \li \c {layouts/fallback} -- the default layout here is \e en_GB.
\endlist
-The locale is first matched against the full locale name. If a full match is
-not found, then only the locale language is matched. If a partial match is
-not found, then the "en_GB" locale is used as a fallback.
+First, the locale is matched against the full locale name. If a there isn't a
+full match, then only the locale language is matched. Finally, the contents of
+\c {layouts/fallback} is used as a fallback when there's also no partial match.
After the locale selection is done, the keyboard updates the input locale and
input direction to match the current layout. The application can receive this
information through the QInputMethod interface.
-Internally, the current input locale is also updated to the QVirtualKeyboardInputEngine
-and the current input method instances.
+Internally, the current input locale is also updated to
+QVirtualKeyboardInputEngine and the current input method instances.
\section1 Input Engine
@@ -179,28 +211,17 @@ case:
input method.
\endlist
-\section1 Virtual Keyboard Extension Plugin
-
-An extension plugin allows third-party providers to enhance the functionality
-of the virtual keyboard without recompiling it. Currently the extension plugin
-can provide keyboard layouts and custom input methods. Creating a plugin for
-Qt Virtual Keyboard is similar to the standard way of creating a Qt plugin:
-
-\list
- \li \b {Link against the virtualkeyboard library}.
-
- The virtualkeyboard module must be linked against the plugin:
+\section1 Virtual Keyboard Plugins
- \badcode
- QT += virtualkeyboard
- \endcode
+The \e src/plugins directory of the virtual keyboard contains the existing plugins
+for the virtual keyboard. These plugins are standard QML modules loaded implicitly
+by the QtQuick.VirtualKeyboard.Plugins QML module.
- This allows the plugin to access \l QVirtualKeyboardInputContext and other interfaces.
- \li \b {Implement a subclass of QVirtualKeyboardExtensionPlugin.}
-
- The plugin provides the virtual keyboard with the necessary metadata,
- which allows it to sort and load the plugins.
-\endlist
+A plugin may provide keyboard layouts and input methods (usually both). The input method
+used by the virtual keyboard depends on which keyboard layout is in use. The keyboard layout
+may provide an instance of a custom input method by the KeyboardLayout.createInputMethod()
+function. Otherwise, the default input method (DefaultInputMethod) created by the virtual
+keyboard is used.
\section2 Adding Keyboard Layouts
@@ -208,82 +229,29 @@ The plugin can add keyboard layouts for the virtual keyboard by including
the layout files in the Qt resources of the plugin binary.
The virtual keyboard searches for the keyboard layouts (per language) from a specific
-path \e /QtQuick/VirtualKeyboard/content/layouts/<language_COUNTRY>, so it is essential
-to use this exact path also in the plugin. Qt resource paths can be overlapped, however,
-the plugin cannot override the existing layouts in the virtual keyboard plugin.
-
-If the extension plugin needs to override the built-in keyboard layout, the virtual
-keyboard must be recompiled with only specific languages (e.g. \e CONFIG+=lang-en) or without
-keyboard layouts at (e.g. \e CONFIG+=disable-layouts). Alternatively, if recompiling is not an
-option, it is possible to override the built-in keyboard layouts and have them loaded directly
+path \e /qt-project.org/imports/QtQuick/VirtualKeyboard/Layouts/<language_COUNTRY>, so it is essential
+to use this exact path also in the plugin. Qt resource paths can overlap, meaning that
+the plugin can override existing layouts on the virtual keyboard.
+
+It is also possible to override the built-in keyboard layouts by having them loaded directly
from the file system by using the \e QT_VIRTUALKEYBOARD_LAYOUT_PATH environment variable.
\section2 Adding Input Method
The plugin can register an input method that other keyboard layouts can use by
default (such as \c DefaultInputMethod) or an input method that is used privately
-in the plugin.
-
-The input method must implement \l {QVirtualKeyboardAbstractInputMethod} (C++) or InputMethod (QML)
-interface and the plugin must register it as a QML type in
-{QVirtualKeyboardExtensionPlugin::registerTypes} method.
-
-\section2 Metadata for the Extension Plugin
-
-Metadata allows the virtual keyboard to inspect the plugin before loading
-the actual library. It also prevents the virtual keyboard from loading
-conflicting extension plugins, for example, two handwriting extensions.
-
-\table
- \row
- \li \c Name
- \li \c Required
- \li This field defines the plugin name. There are several built-in
- plugins available by default:
-
- \list
- \li \c hangul
- \li \c default (Hunspell)
- \li \c handwriting (T9 Write, Lipi-Toolkit)
- \li \c japanese (OpenWNN)
- \li \c pinyin
- \li \c traditional_chinese
- \endlist
- \row
- \li \c Provider
- \li \c Optional
- \li An informative name of the plugin provider. Used mainly for diagnostics.
- \row
- \li \c InputMethod
- \li \c Optional
- \li This field tells the virtual keyboard the plugin contains an input method.
- When this field is defined, the virtual keyboard will invoke the
- \l {QVirtualKeyboardExtensionPlugin::registerTypes} {interface}
- for registering the QML types.
- Similar to the \c Name, there can be only one provider for each input method.
- \row
- \li \c Version
- \li \c Required
- \li An integer defining the version number of the plugin. If there are two or more
- plugins available of the same \c Name, the one with greatest version number is
- preferred.
-\endtable
+in the plugin (by also providing custom keyboard layout, which creates the input
+method).
-The following metadata example is from the Lipi-Toolkit extension plugin (lipi.json):
-
-\badcode
-{
- "Name": "handwriting",
- "Provider": "Qt Lipi-Toolkit Extension",
- "InputMethod": "HandwritingInputMethod",
- "Version": 100
-}
-\endcode
+The input method must implement a \l {QVirtualKeyboardAbstractInputMethod} (C++) or InputMethod (QML)
+interface and it must be registered as a QML type (\l {QML_NAMED_ELEMENT}) by the plugin.
\section1 Implementing a Custom Input Method
-The implementation of input methods starts by deciding which interface is used;
-QML or C++. In this example the QML interface is used.
+The implementation of input methods starts by deciding which interface is used,
+QML or C++. In this example the QML interface is used. The same logic and interfaces
+apply with the C++ interface \l {QVirtualKeyboardAbstractInputMethod}. In this case,
+the plugin must be linked to the \e VirtualKeyboard module.
The following example shows the minimum functionality that is required
from an input method:
@@ -399,17 +367,19 @@ function selectionListItemSelected(type, index) {
\section1 Integrating Handwriting Recognition
-Since version 2.0 of the virtual keyboard, input methods can consume
-touch input data from touch screens or other input devices. This allows
-integration of a handwriting recognition engine seamlessly to the virtual
-keyboard, without any changes to the existing keyboard layouts (as
-the virtual keyboard already provides the handwriting keyboard layouts for
-most languages).
+An input method can also use input data from the touch screen or other input devices.
+
+When the input begins, the virtual keyboard calls the input method function
+\l { QVirtualKeyboardAbstractInputMethod::traceBegin } { traceBegin }, which returns a new \l {QVirtualKeyboardTrace} {Trace}
+object to which the input is collected on behalf of the input method. Similarly, when
+the finger or stylus is raised, the event is terminated with the \l { QVirtualKeyboardAbstractInputMethod::traceEnd } { traceEnd } call.
+The input method processes the collected data and produces text using the
+\l {QVirtualKeyboardInputContext} {InputContext} interface.
-Towards an input method, handwriting recognition works on the same principle
-as handling of normal keyboard input, i.e. input data is collected by the
-keyboard layout and transferred by the input engine to the input method for
-processing.
+There are predefined keyboard layouts for handwriting. However, they are not included
+by default, and the handwriting plugin should include them in its own resources. For
+examples of how to do this, see the existing plugins for handwriting from \e MyScript
+or \e Cerence.
\section2 Data Model for Handwriting Input
@@ -465,7 +435,7 @@ the object. This also removes the trace rendered to the screen.
\section1 Keyboard Layouts
-Keyboard layouts are located in the \e src/virtualkeyboard/content/layouts
+Keyboard layouts are located in the \e src/layouts/builtin
directory. Each subdirectory of the layout directory represents a locale.
The locale directory is a string of the form "language_country", where
language is a lowercase, two-letter ISO 639 language code, and country is an
@@ -517,29 +487,16 @@ Otherwise, the key weight is inherited from its parent element.
New keys are added to the keyboard row using the Key type or one of the
specialized key types. Below is the list of all key types:
-\list
- \li \l Key
- \li \l BackspaceKey
- \li \l ChangeLanguageKey
- \li \l EnterKey
- \li \l FillerKey
- \li \l HideKeyboardKey
- \li \l NumberKey
- \li \l ShiftKey
- \li \l SpaceKey
- \li \l SymbolModeKey
- \li \l HandwritingModeKey
- \li \l TraceInputKey
-\endlist
+\generatelist groupsbymodule qtvirtualkeyboard-key-types
For example, to add a regular key which sends a key event to the input method:
\code
- import QtQuick 2.0
- import QtQuick.Layouts 1.0
- import QtQuick.VirtualKeyboard 2.1
+ import QtQuick
+ import QtQuick.VirtualKeyboard
+ import QtQuick.VirtualKeyboard.Components
- // file: layouts/en_GB/main.qml
+ // file: en_GB/main.qml
KeyboardLayout {
keyWeight: 160
@@ -568,11 +525,11 @@ The effective value for the key weight will be 160. For the sake of the
example, we add another key which specifies a custom key weight:
\code
- import QtQuick 2.0
- import QtQuick.Layouts 1.0
- import QtQuick.VirtualKeyboard 2.1
+ import QtQuick
+ import QtQuick.VirtualKeyboard
+ import QtQuick.VirtualKeyboard.Components
- // file: layouts/en_GB/main.qml
+ // file: en_GB/main.qml
KeyboardLayout {
keyWeight: 160
@@ -626,11 +583,11 @@ sourceComponent property.
For example:
\code
- import QtQuick 2.0
- import QtQuick.Layouts 1.0
- import QtQuick.VirtualKeyboard 2.1
+ import QtQuick
+ import QtQuick.VirtualKeyboard
+ import QtQuick.VirtualKeyboard.Components
- // file: layouts/en_GB/symbols.qml
+ // file: en_GB/symbols.qml
KeyboardLayoutLoader {
property bool secondPage
@@ -674,7 +631,7 @@ This type of keyboard layout must meet the following requirements:
\li provides an instance of HandwritingInputMethod as the input method.
\endlist
-The handwriting layout may also include ChangeLanguageKey. For this purpose, it is
+The handwriting layout may also include \l ChangeLanguageKey. For this purpose, it is
important to use the \l {ChangeLanguageKey::customLayoutsOnly} {customLayoutsOnly} attribute, which will filter out languages
that do not use handwriting.
@@ -695,8 +652,8 @@ In case the environment variable is not set, or contains an invalid
directory, the virtual keyboard falls back to the default built-in layouts.
To prevent the built-in layouts from being built into the virtual keyboard
-plugin when using custom layouts, add \c disable-layouts to the \c CONFIG qmake variable.
-For more information, see \l {Advanced Configuration Options}.
+plugin when using custom layouts, add \c -no-vkb-layouts option to the \c configure script.
+For more information, see \l [DOC] {Advanced Usage} {Configuration Options}.
\section1 Keyboard Styles
@@ -721,7 +678,7 @@ style name, the virtual keyboard falls back in the default built-in style.
The process of creating a new style begins by creating a new subdirectory
for the style in a QML import path under the URL-based directory structure
-QtQuick/VirtualKeyboard/Styles/. See \l {QML Import Path}
+QtQuick/VirtualKeyboard/Styles/. See \l[QtQml]{QML Import Path}
for information about QML import paths. The directory
name can not contain spaces or special characters other than underscore.
Also, the directory name can not be the same as one of the built-in style,
@@ -730,7 +687,7 @@ which currently includes "default" and "retro".
A good starting point for creating a new style is to use an existing
built-in style as a template and edit it. You can find the built-in
styles from the virtual keyboard sources directory
-src/virtualkeyboard/content/styles. Copy one of the directories containing
+src/styles/builtin. Copy one of the directories containing
a built-in style into the \e Styles directory and rename it to "test".
The directory structure should now be as follows:
diff --git a/src/virtualkeyboard/doc/src/user-guide.qdoc b/src/virtualkeyboard/doc/src/user-guide.qdoc
index e334e2d5..e1352d14 100644
--- a/src/virtualkeyboard/doc/src/user-guide.qdoc
+++ b/src/virtualkeyboard/doc/src/user-guide.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
@@ -31,8 +7,6 @@
\title User Guide
-\section1 Overview
-
This document explains how to interact with the virtual keyboard.
\section1 Opening the Keyboard
@@ -62,7 +36,6 @@ The handwriting mode can be activated by pressing the handwriting key:
\table
\header
\li Gesture
- \li Lipi Toolkit
\li T9 Write
\li MyScript Text SDK
\row
diff --git a/src/virtualkeyboard/doc/src/xt9.qdoc b/src/virtualkeyboard/doc/src/xt9.qdoc
new file mode 100644
index 00000000..884d6e8e
--- /dev/null
+++ b/src/virtualkeyboard/doc/src/xt9.qdoc
@@ -0,0 +1,58 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+
+\page xt9.html
+
+\title Cerence XT9 Advanced Input
+
+The Cerence XT9 advanced input offers high-quality spell correction and predictive
+text input that works with standard keyboard layouts bundled with
+the Qt Virtual Keyboard.
+
+The Cerence XT9 works as an add-on loaded into the Qt Virtual Keyboard at start-up.
+
+Main features:
+
+\list
+ \li \l {Multilingual}
+ \li \l {Advanced correction and learning capabilities}
+ \li \l {Next word prediction}
+ \li \l {Application specific dictionaries} (e.g. phone book)
+ \li \l {Handwriting Recognition with XT9 Capabilities}
+\endlist
+
+\section2 Multilingual
+
+The XT9 engine supports all the alphabetical languages as well as other languages, such
+as Chinese, Japanese and Korean.
+
+\section2 Advanced correction and learning capabilities
+
+Correction and learning capabilities are based the advanced language model that XT9 uses
+to correct and learn from the user input. For instance, frequently used words are prioritized
+in the word candidate list.
+
+\section2 Next word prediction
+
+Next word prediction is activated after selecting a candidate from the word candidate list.
+It automatically fills the word candidate list with followup words based on the context and
+previous input.
+
+\section2 Application specific dictionaries
+
+With the new QVirtualKeyboardDictionaryManager, the application can
+create custom dictionaries and attach them to any context within the
+application. Together with the
+\l{VirtualKeyboardSettings::defaultDictionaryDisabled}{VirtualKeyboardSettings.defaultDictionaryDisabled}
+property, it is possible to use custom dictionaries exclusively, without the standard
+built-in dictionaries.
+
+\section2 Handwriting Recognition with XT9 Capabilities
+
+Cerence handwriting recognition and XT9 engines are uniquely integrated together in the Qt
+Virtual Keyboard. This means that the improved word candidate suggestions and next word
+prediction are also available in the handwriting mode.
+
+*/
diff --git a/src/virtualkeyboard/enterkeyaction.cpp b/src/virtualkeyboard/enterkeyaction.cpp
index 6d9361b1..1555caf9 100644
--- a/src/virtualkeyboard/enterkeyaction.cpp
+++ b/src/virtualkeyboard/enterkeyaction.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/enterkeyaction_p.h>
#include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h>
@@ -36,6 +10,7 @@ namespace QtVirtualKeyboard {
/*!
\qmltype EnterKeyAction
\inqmlmodule QtQuick.VirtualKeyboard
+ \ingroup qmlclass
\ingroup qtvirtualkeyboard-qml
\brief Provides attached properties for customizing the enter key.
diff --git a/src/virtualkeyboard/enterkeyaction_p.h b/src/virtualkeyboard/enterkeyaction_p.h
index 2de309ad..0b06a079 100644
--- a/src/virtualkeyboard/enterkeyaction_p.h
+++ b/src/virtualkeyboard/enterkeyaction_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ENTERKEYACTION_P_H
#define ENTERKEYACTION_P_H
@@ -41,17 +15,23 @@
// We mean it.
//
-#include <qqml.h>
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
class EnterKeyActionAttachedType;
-class QVIRTUALKEYBOARD_EXPORT EnterKeyAction : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT EnterKeyAction : public QObject
{
Q_OBJECT
+ QML_NAMED_ELEMENT(EnterKeyAction)
+ QML_UNCREATABLE("EnterKeyAction is an abstract type that is only available as an attached property.")
+ QML_ATTACHED(EnterKeyActionAttachedType)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
public:
enum Id {
diff --git a/src/virtualkeyboard/enterkeyactionattachedtype.cpp b/src/virtualkeyboard/enterkeyactionattachedtype.cpp
index ca0ee934..2a290e58 100644
--- a/src/virtualkeyboard/enterkeyactionattachedtype.cpp
+++ b/src/virtualkeyboard/enterkeyactionattachedtype.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h>
diff --git a/src/virtualkeyboard/enterkeyactionattachedtype_p.h b/src/virtualkeyboard/enterkeyactionattachedtype_p.h
index a7a7f4f8..bc778f12 100644
--- a/src/virtualkeyboard/enterkeyactionattachedtype_p.h
+++ b/src/virtualkeyboard/enterkeyactionattachedtype_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef ENTERKEYACTIONATTACHEDTYPE_P_H
#define ENTERKEYACTIONATTACHEDTYPE_P_H
@@ -48,12 +22,15 @@
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT EnterKeyActionAttachedType : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT EnterKeyActionAttachedType : public QObject
{
Q_OBJECT
Q_PROPERTY(int actionId READ actionId WRITE setActionId NOTIFY actionIdChanged)
Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
+ QML_ANONYMOUS
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
public:
explicit EnterKeyActionAttachedType(QObject *parent);
diff --git a/src/virtualkeyboard/fallbackinputmethod.cpp b/src/virtualkeyboard/fallbackinputmethod.cpp
index a6f7c0d8..539fc387 100644
--- a/src/virtualkeyboard/fallbackinputmethod.cpp
+++ b/src/virtualkeyboard/fallbackinputmethod.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/fallbackinputmethod_p.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
diff --git a/src/virtualkeyboard/fallbackinputmethod_p.h b/src/virtualkeyboard/fallbackinputmethod_p.h
index f3bbdb47..b2a7c9d0 100644
--- a/src/virtualkeyboard/fallbackinputmethod_p.h
+++ b/src/virtualkeyboard/fallbackinputmethod_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef FALLBACKINPUTMETHOD_P_H
#define FALLBACKINPUTMETHOD_P_H
@@ -42,11 +16,12 @@
//
#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT FallbackInputMethod : public QVirtualKeyboardAbstractInputMethod
+class Q_VIRTUALKEYBOARD_EXPORT FallbackInputMethod : public QVirtualKeyboardAbstractInputMethod
{
Q_OBJECT
diff --git a/src/virtualkeyboard/gesturerecognizer.cpp b/src/virtualkeyboard/gesturerecognizer.cpp
index c50102fe..266a5230 100644
--- a/src/virtualkeyboard/gesturerecognizer.cpp
+++ b/src/virtualkeyboard/gesturerecognizer.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/gesturerecognizer_p.h>
diff --git a/src/virtualkeyboard/gesturerecognizer_p.h b/src/virtualkeyboard/gesturerecognizer_p.h
index d7b14b20..b74005a9 100644
--- a/src/virtualkeyboard/gesturerecognizer_p.h
+++ b/src/virtualkeyboard/gesturerecognizer_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef GESTURERECOGNIZER_P_H
#define GESTURERECOGNIZER_P_H
@@ -45,11 +19,12 @@
#include <QVariantMap>
#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT GestureRecognizer : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT GestureRecognizer : public QObject
{
Q_OBJECT
public:
diff --git a/src/virtualkeyboard/handwritinggesturerecognizer.cpp b/src/virtualkeyboard/handwritinggesturerecognizer.cpp
index 36fe8cf8..72337132 100644
--- a/src/virtualkeyboard/handwritinggesturerecognizer.cpp
+++ b/src/virtualkeyboard/handwritinggesturerecognizer.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/handwritinggesturerecognizer_p.h>
@@ -53,7 +27,7 @@ int HandwritingGestureRecognizer::dpi() const
QVariantMap HandwritingGestureRecognizer::recognize(const QList<QVirtualKeyboardTrace *> traceList)
{
- if (traceList.count() > 0 && traceList.count() < 3) {
+ if (traceList.size() > 0 && traceList.size() < 3) {
// Swipe gesture detection
// =======================
@@ -90,7 +64,7 @@ QVariantMap HandwritingGestureRecognizer::recognize(const QList<QVirtualKeyboard
const QVirtualKeyboardTrace *trace = traceList.at(traceIndex);
const QVariantList &points = trace->points();
QVector2D swipeVector;
- const int pointCount = points.count();
+ const int pointCount = points.size();
int pointIndex = 0;
if (pointCount >= 2) {
@@ -136,7 +110,7 @@ QVariantMap HandwritingGestureRecognizer::recognize(const QList<QVirtualKeyboard
bool matchesToExisting = true;
const qreal minimumSwipeLength = (swipeLength * (100.0 - MAXIMUM_WIDTH_VARIANCE) / 100.0);
const qreal maximumSwipeLength = (swipeLength * (100.0 + MAXIMUM_WIDTH_VARIANCE) / 100.0);
- for (const QVector2D &otherSwipeVector : qAsConst(swipeVectors)) {
+ for (const QVector2D &otherSwipeVector : std::as_const(swipeVectors)) {
const qreal otherSwipeLength = otherSwipeVector.length();
const qreal theta = qAcos(QVector2D::dotProduct(swipeVector, otherSwipeVector) / (swipeLength * otherSwipeLength));
diff --git a/src/virtualkeyboard/handwritinggesturerecognizer_p.h b/src/virtualkeyboard/handwritinggesturerecognizer_p.h
index 69472bec..1cb3c2c8 100644
--- a/src/virtualkeyboard/handwritinggesturerecognizer_p.h
+++ b/src/virtualkeyboard/handwritinggesturerecognizer_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef HANDWRITINGGESTURERECOGNIZER_P_H
#define HANDWRITINGGESTURERECOGNIZER_P_H
@@ -46,7 +20,7 @@
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT HandwritingGestureRecognizer : public GestureRecognizer
+class Q_VIRTUALKEYBOARD_EXPORT HandwritingGestureRecognizer : public GestureRecognizer
{
Q_OBJECT
public:
diff --git a/src/virtualkeyboard/inputmethod.cpp b/src/virtualkeyboard/inputmethod.cpp
index b108be34..1cd232d3 100644
--- a/src/virtualkeyboard/inputmethod.cpp
+++ b/src/virtualkeyboard/inputmethod.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/inputmethod_p.h>
#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
@@ -38,7 +12,7 @@ namespace QtVirtualKeyboard {
\qmltype InputMethod
\instantiates QtVirtualKeyboard::InputMethod
\inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
+ \ingroup qtvirtualkeyboard-internal-qml
\brief Base type for creating input method in QML.
The InputMethod type lets you create a custom input method
@@ -407,5 +381,10 @@ void InputMethod::update()
QMetaObject::invokeMethod(this, "update");
}
+void InputMethod::clearInputMode()
+{
+ QMetaObject::invokeMethod(this, "clearInputMode");
+}
+
} // namespace QtVirtualKeyboard
QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/inputmethod_p.h b/src/virtualkeyboard/inputmethod_p.h
index c5b6b347..7141226f 100644
--- a/src/virtualkeyboard/inputmethod_p.h
+++ b/src/virtualkeyboard/inputmethod_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef INPUTMETHOD_P_H
#define INPUTMETHOD_P_H
@@ -41,17 +15,22 @@
// We mean it.
//
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT InputMethod : public QVirtualKeyboardAbstractInputMethod
+class Q_VIRTUALKEYBOARD_EXPORT InputMethod : public QVirtualKeyboardAbstractInputMethod
{
Q_OBJECT
Q_PROPERTY(QVirtualKeyboardInputContext *inputContext READ inputContext CONSTANT)
Q_PROPERTY(QVirtualKeyboardInputEngine *inputEngine READ inputEngine CONSTANT)
Q_MOC_INCLUDE("qvirtualkeyboardinputcontext.h")
+ QML_NAMED_ELEMENT(InputMethod)
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
public:
explicit InputMethod(QObject *parent = nullptr);
@@ -80,6 +59,7 @@ public:
void reset() override;
void update() override;
+ void clearInputMode() override;
};
} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/inputselectionhandle.cpp b/src/virtualkeyboard/inputselectionhandle.cpp
index 3f4817a2..8d2558f7 100644
--- a/src/virtualkeyboard/inputselectionhandle.cpp
+++ b/src/virtualkeyboard/inputselectionhandle.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/inputselectionhandle_p.h>
#include <QtVirtualKeyboard/private/desktopinputselectioncontrol_p.h>
diff --git a/src/virtualkeyboard/inputselectionhandle_p.h b/src/virtualkeyboard/inputselectionhandle_p.h
index d62e4147..64877317 100644
--- a/src/virtualkeyboard/inputselectionhandle_p.h
+++ b/src/virtualkeyboard/inputselectionhandle_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef INPUTSELECTIONHANDLE_P_H
#define INPUTSELECTIONHANDLE_P_H
@@ -43,6 +17,7 @@
#include <QtGui/QRasterWindow>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -52,7 +27,7 @@ namespace QtVirtualKeyboard {
class DesktopInputSelectionControl;
-class QVIRTUALKEYBOARD_EXPORT InputSelectionHandle : public QRasterWindow
+class Q_VIRTUALKEYBOARD_EXPORT InputSelectionHandle : public QRasterWindow
{
Q_OBJECT
diff --git a/src/virtualkeyboard/inputview.cpp b/src/virtualkeyboard/inputview.cpp
index 304a3419..c2e29e0f 100644
--- a/src/virtualkeyboard/inputview.cpp
+++ b/src/virtualkeyboard/inputview.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/inputview_p.h>
diff --git a/src/virtualkeyboard/inputview_p.h b/src/virtualkeyboard/inputview_p.h
index 59d983a3..c36ce3f8 100644
--- a/src/virtualkeyboard/inputview_p.h
+++ b/src/virtualkeyboard/inputview_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef INPUTVIEW_P_H
#define INPUTVIEW_P_H
@@ -43,11 +17,12 @@
#include <QQuickView>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT InputView : public QQuickView
+class Q_VIRTUALKEYBOARD_EXPORT InputView : public QQuickView
{
Q_OBJECT
public:
diff --git a/src/virtualkeyboard/plaininputmethod.cpp b/src/virtualkeyboard/plaininputmethod.cpp
index c9a107e5..3ec1046a 100644
--- a/src/virtualkeyboard/plaininputmethod.cpp
+++ b/src/virtualkeyboard/plaininputmethod.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/plaininputmethod_p.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
diff --git a/src/virtualkeyboard/plaininputmethod_p.h b/src/virtualkeyboard/plaininputmethod_p.h
index c117358e..4e8c2217 100644
--- a/src/virtualkeyboard/plaininputmethod_p.h
+++ b/src/virtualkeyboard/plaininputmethod_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PLAININPUTMETHOD_P_H
#define PLAININPUTMETHOD_P_H
@@ -42,13 +16,16 @@
//
#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT PlainInputMethod : public QVirtualKeyboardAbstractInputMethod
+class Q_VIRTUALKEYBOARD_EXPORT PlainInputMethod : public QVirtualKeyboardAbstractInputMethod
{
Q_OBJECT
+ QML_NAMED_ELEMENT(PlainInputMethod)
+ QML_ADDED_IN_VERSION(2, 0)
public:
explicit PlainInputMethod(QObject *parent = nullptr);
diff --git a/src/virtualkeyboard/platforminputcontext.cpp b/src/virtualkeyboard/platforminputcontext.cpp
index eef26574..ab3f3887 100644
--- a/src/virtualkeyboard/platforminputcontext.cpp
+++ b/src/virtualkeyboard/platforminputcontext.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
@@ -96,7 +70,7 @@ void PlatformInputContext::commit()
void PlatformInputContext::update(Qt::InputMethodQueries queries)
{
VIRTUALKEYBOARD_DEBUG() << "PlatformInputContext::update():" << queries;
- bool enabled = inputMethodQuery(Qt::ImEnabled).toBool();
+ const bool enabled = inputMethodAccepted();
#ifdef QT_VIRTUALKEYBOARD_DESKTOP
if (enabled && !m_inputPanel && !m_desktopModeDisabled) {
m_inputPanel = new DesktopInputPanel(this);
@@ -110,14 +84,10 @@ void PlatformInputContext::update(Qt::InputMethodQueries queries)
}
#endif
if (m_inputContext) {
- if (enabled) {
+ if (enabled)
m_inputContext->priv()->update(queries);
- if (m_visible)
- updateInputPanelVisible();
- } else {
- hideInputPanel();
- }
m_inputContext->priv()->setFocus(enabled);
+ updateInputPanelVisible();
}
}
@@ -200,6 +170,9 @@ void PlatformInputContext::setFocusObject(QObject *object)
Q_ASSERT(m_inputContext == nullptr ||
m_inputContext->priv()->shadow()->inputItem() == nullptr ||
m_inputContext->priv()->shadow()->inputItem() != object);
+ QScopedPointer<QVirtualKeyboardScopedState> setFocusState;
+ if (m_inputContext)
+ setFocusState.reset(new QVirtualKeyboardScopedState(m_inputContext->priv(), QVirtualKeyboardInputContextPrivate::State::SetFocus));
if (m_focusObject != object) {
if (m_focusObject)
m_focusObject->removeEventFilter(this);
@@ -223,16 +196,6 @@ bool PlatformInputContext::eventFilter(QObject *object, QEvent *event)
return false;
}
-void PlatformInputContext::setInputMethods(const QStringList &inputMethods)
-{
- m_inputMethods = inputMethods;
-}
-
-QStringList PlatformInputContext::inputMethods() const
-{
- return m_inputMethods;
-}
-
void PlatformInputContext::sendEvent(QEvent *event)
{
if (m_focusObject) {
@@ -285,6 +248,16 @@ void PlatformInputContext::setInputContext(QVirtualKeyboardInputContext *context
}
}
+bool PlatformInputContext::evaluateInputPanelVisible() const
+{
+ // Show input panel when input panel is requested by showInputPanel()
+ // and focus object is set to an input control with input method accepted (Qt::ImEnabled)
+ // or input events without focus are enabled.
+ return m_visible &&
+ ((m_focusObject && inputMethodAccepted()) ||
+ QT_VIRTUALKEYBOARD_FORCE_EVENTS_WITHOUT_FOCUS);
+}
+
void PlatformInputContext::keyboardRectangleChanged()
{
m_inputPanel->setInputRect(m_inputContext->priv()->keyboardRectangle().toRect());
@@ -295,13 +268,16 @@ void PlatformInputContext::updateInputPanelVisible()
if (!m_inputPanel)
return;
- if (m_visible != m_inputPanel->isVisible()) {
- if (m_visible)
+ const bool visible = evaluateInputPanelVisible();
+ if (visible != m_inputPanel->isVisible()) {
+ if (visible)
m_inputPanel->show();
else
m_inputPanel->hide();
- if (m_selectionControl)
- m_selectionControl->setEnabled(m_visible);
+ if (m_selectionControl) {
+ m_selectionControl->setEnabled(visible);
+ m_inputContext->priv()->updateSelectionControlVisible(visible);
+ }
emitInputPanelVisibleChanged();
}
}
diff --git a/src/virtualkeyboard/platforminputcontext_p.h b/src/virtualkeyboard/platforminputcontext_p.h
index e7d29405..f6b57c31 100644
--- a/src/virtualkeyboard/platforminputcontext_p.h
+++ b/src/virtualkeyboard/platforminputcontext_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PLATFORMINPUTCONTEXT_P_H
#define PLATFORMINPUTCONTEXT_P_H
@@ -57,7 +31,7 @@ namespace QtVirtualKeyboard {
class AbstractInputPanel;
-class QVIRTUALKEYBOARD_EXPORT PlatformInputContext : public QPlatformInputContext
+class Q_VIRTUALKEYBOARD_EXPORT PlatformInputContext : public QPlatformInputContext
{
Q_OBJECT
public:
@@ -90,9 +64,6 @@ public:
bool eventFilter(QObject *object, QEvent *event) override;
- void setInputMethods(const QStringList &inputMethods);
- QStringList inputMethods() const;
-
signals:
void focusObjectChanged();
@@ -101,6 +72,7 @@ protected:
void sendKeyEvent(QKeyEvent *event);
QVariant inputMethodQuery(Qt::InputMethodQuery query);
void setInputContext(QVirtualKeyboardInputContext *context);
+ bool evaluateInputPanelVisible() const;
private slots:
void keyboardRectangleChanged();
@@ -110,7 +82,6 @@ private:
friend class ::QVirtualKeyboardInputContext;
friend class ::QVirtualKeyboardInputContextPrivate;
QPointer<QVirtualKeyboardInputContext> m_inputContext;
- QStringList m_inputMethods;
QPointer<AbstractInputPanel> m_inputPanel;
QPointer<DesktopInputSelectionControl> m_selectionControl;
QPointer<QObject> m_focusObject;
diff --git a/src/virtualkeyboard/qt_cmdline.cmake b/src/virtualkeyboard/qt_cmdline.cmake
new file mode 100644
index 00000000..e66b46c8
--- /dev/null
+++ b/src/virtualkeyboard/qt_cmdline.cmake
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_commandline_option(vkb-sensitive-debug TYPE boolean)
+qt_commandline_option(vkb-arrow-keynavigation TYPE boolean)
+qt_commandline_option(vkb-enable TYPE enableLang)
+qt_commandline_option(vkb-disable TYPE disableLang)
+qt_commandline_option(vkb-layouts TYPE boolean)
+qt_commandline_option(vkb-desktop TYPE boolean)
+qt_commandline_option(vkb-hunspell TYPE enum VALUES no 3rdparty system)
+qt_commandline_option(vkb-handwriting TYPE optionalString VALUES no myscript-hwr cerence-hwr example-hwr)
+qt_commandline_option(vkb-cerence-sdk TYPE string)
+qt_commandline_option(vkb-style TYPE string VALUES standard retro none)
+qt_commandline_option(vkb-no-bundle-pinyin TYPE boolean)
+qt_commandline_option(vkb-no-bundle-tcime TYPE boolean)
+qt_commandline_option(vkb-cerence-static TYPE boolean)
+qt_commandline_option(vkb-bundle-cerence TYPE boolean)
+qt_commandline_option(vkb-bundle-cerence-hwr TYPE boolean)
+qt_commandline_option(vkb-bundle-cerence-xt9 TYPE boolean)
+qt_commandline_option(vkb-cerence-xt9-debug TYPE boolean)
+qt_commandline_option(vkb-cerence-xt9-9key-layouts TYPE boolean)
+qt_commandline_option(vkb-myscript-sdk TYPE string)
+qt_commandline_option(vkb-myscript-arch TYPE optionalString VALUES x86 x64 armv7hf armv7 arm64)
+
diff --git a/src/virtualkeyboard/qvirtualkeyboard_global.h b/src/virtualkeyboard/qvirtualkeyboard_global.h
index b4719d3c..a5ef3aad 100644
--- a/src/virtualkeyboard/qvirtualkeyboard_global.h
+++ b/src/virtualkeyboard/qvirtualkeyboard_global.h
@@ -1,50 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QVIRTUALKEYBOARD_GLOBAL_H
#define QVIRTUALKEYBOARD_GLOBAL_H
#include <QtCore/qglobal.h>
#include <QtVirtualKeyboard/qtvirtualkeyboard-config.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QVIRTUALKEYBOARD_LIBRARY)
-# define QVIRTUALKEYBOARD_EXPORT Q_DECL_EXPORT
-# else
-# define QVIRTUALKEYBOARD_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define QVIRTUALKEYBOARD_EXPORT
-#endif
-
-QT_END_NAMESPACE
+#include <QtVirtualKeyboard/qtvirtualkeyboardexports.h>
#endif
diff --git a/src/virtualkeyboard/qvirtualkeyboard_global_p.h b/src/virtualkeyboard/qvirtualkeyboard_global_p.h
index a8f0f12a..28218311 100644
--- a/src/virtualkeyboard/qvirtualkeyboard_global_p.h
+++ b/src/virtualkeyboard/qvirtualkeyboard_global_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtVirtualkeyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QTVIRTUALKEYBOARDGLOBAL_H
#define QTVIRTUALKEYBOARDGLOBAL_H
diff --git a/src/virtualkeyboard/qvirtualkeyboard_namespace.h b/src/virtualkeyboard/qvirtualkeyboard_namespace.h
new file mode 100644
index 00000000..84871c1a
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboard_namespace.h
@@ -0,0 +1,13 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QVIRTUALKEYBOARD_NAMESPACE_H
+#define QVIRTUALKEYBOARD_NAMESPACE_H
+
+#if 0
+# pragma qt_sync_skip_header_check
+#endif
+// TODO: Remove in Qt 7
+#include <QtVirtualKeyboard/private/qvirtualkeyboardnamespace_p.h>
+
+#endif // QVIRTUALKEYBOARD_NAMESPACE_H
diff --git a/src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h b/src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h
deleted file mode 100644
index 00ac394c..00000000
--- a/src/virtualkeyboard/qvirtualkeyboard_staticplugin_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIRTUALKEYBOARD_STATICPLUGIN_P_H
-#define QVIRTUALKEYBOARD_STATICPLUGIN_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#if defined(QT_STATICPLUGIN)
-#include <QtPlugin>
-#include <QPluginLoader>
-
-QT_BEGIN_NAMESPACE
-
-// This macro is similar to Q_IMPORT_PLUGIN, except it does not
-// register duplicate entries as static plugins.
-// The check is required since the application may already have
-// initialized the plugin by its own dependencies.
-#define Q_VKB_IMPORT_PLUGIN(PLUGIN) \
- extern const QT_PREPEND_NAMESPACE(QStaticPlugin) qt_static_plugin_##PLUGIN(); \
- class Static##PLUGIN##PluginInstance{ \
- public: \
- Static##PLUGIN##PluginInstance() { \
- if (!QPluginLoader::staticInstances().contains(qt_static_plugin_##PLUGIN().instance())) \
- qRegisterStaticPluginFunction(qt_static_plugin_##PLUGIN()); \
- } \
- }; \
- static Static##PLUGIN##PluginInstance static##PLUGIN##Instance;
-
-QT_END_NAMESPACE
-
-#endif
-
-#endif // QVIRTUALKEYBOARD_STATICPLUGIN_P_H
diff --git a/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.cpp b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.cpp
index 4ff99785..e3e6c4e6 100644
--- a/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.cpp
@@ -1,59 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
-#include <QtCore/private/qobject_p.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardabstractinputmethod_p.h>
QT_BEGIN_NAMESPACE
-class QVirtualKeyboardAbstractInputMethodPrivate : public QObjectPrivate
-{
-public:
- QVirtualKeyboardAbstractInputMethodPrivate();
-
- QVirtualKeyboardInputEngine *inputEngine;
-};
-
-/*!
- \class AbstractInputMethodPrivate
- \internal
-*/
-
-QVirtualKeyboardAbstractInputMethodPrivate::QVirtualKeyboardAbstractInputMethodPrivate() :
- inputEngine(nullptr)
-{
-}
-
/*!
\class QVirtualKeyboardAbstractInputMethod
\inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
\brief The base class for input methods.
@@ -61,9 +18,15 @@ QVirtualKeyboardAbstractInputMethodPrivate::QVirtualKeyboardAbstractInputMethodP
method using C/C++ language.
*/
+QVirtualKeyboardAbstractInputMethod::QVirtualKeyboardAbstractInputMethod(QVirtualKeyboardAbstractInputMethodPrivate &dd, QObject *parent) :
+ QObject(dd, parent)
+{
+}
+
/*!
Constructs an input method with \a parent.
*/
+
QVirtualKeyboardAbstractInputMethod::QVirtualKeyboardAbstractInputMethod(QObject *parent) :
QObject(*new QVirtualKeyboardAbstractInputMethodPrivate(), parent)
{
@@ -116,6 +79,25 @@ void QVirtualKeyboardAbstractInputMethod::update()
}
/*!
+ Clears input mode.
+
+ This method is called by the virtual keyboard when this input method is being replaced
+ by another input method. It should clear the operations performed by setInputMode() method,
+ for example, to disconnect signal handlers from the virtual keyboard or free up resources.
+
+ The input mode may be reactivated by calling setInputMode(). However, note that the calls to
+ setInputMethod() and clearInputMethod() are not in balance. Thus, for example, setInputMethod()
+ may be called multiple times without matching calls to clearInputMethod().
+
+ The default implementation does nothing.
+
+ \since QtQuick.VirtualKeyboard 6.1
+*/
+void QVirtualKeyboardAbstractInputMethod::clearInputMode()
+{
+}
+
+/*!
\internal
Called by the input engine when the input method is activated and
deactivated.
diff --git a/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h
index b3fc0f04..92a9c633 100644
--- a/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h
+++ b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod.h
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_H
#define QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_H
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
#include <QtVirtualKeyboard/qvirtualkeyboardselectionlistmodel.h>
@@ -37,10 +12,16 @@ QT_BEGIN_NAMESPACE
class QVirtualKeyboardAbstractInputMethodPrivate;
-class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardAbstractInputMethod : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardAbstractInputMethod : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QVirtualKeyboardAbstractInputMethod)
+ QML_ANONYMOUS
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
+
+protected:
+ QVirtualKeyboardAbstractInputMethod(QVirtualKeyboardAbstractInputMethodPrivate &dd, QObject *parent = nullptr);
public:
explicit QVirtualKeyboardAbstractInputMethod(QObject *parent = nullptr);
@@ -78,6 +59,7 @@ Q_SIGNALS:
public Q_SLOTS:
virtual void reset();
virtual void update();
+ Q_REVISION(6, 1) virtual void clearInputMode();
private:
void setInputEngine(QVirtualKeyboardInputEngine *inputEngine);
diff --git a/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.cpp b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.cpp
new file mode 100644
index 00000000..57acf104
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.cpp
@@ -0,0 +1,19 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtVirtualKeyboard/private/qvirtualkeyboardabstractinputmethod_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QVirtualKeyboardAbstractInputMethodPrivate
+ \internal
+*/
+
+QVirtualKeyboardAbstractInputMethodPrivate::QVirtualKeyboardAbstractInputMethodPrivate() :
+ QObjectPrivate(),
+ inputEngine(nullptr)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.h b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.h
new file mode 100644
index 00000000..d29f37e2
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardabstractinputmethod_p.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_P_H
+#define QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardInputEngine;
+
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardAbstractInputMethodPrivate : public QObjectPrivate
+{
+public:
+ QVirtualKeyboardAbstractInputMethodPrivate();
+
+ QVirtualKeyboardInputEngine *inputEngine;
+};
+
+QT_END_NAMESPACE
+
+#endif // QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_P_H
diff --git a/src/virtualkeyboard/qvirtualkeyboarddictionary.cpp b/src/virtualkeyboard/qvirtualkeyboarddictionary.cpp
new file mode 100644
index 00000000..417c81f7
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboarddictionary.cpp
@@ -0,0 +1,70 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionary.h>
+
+/*!
+ \class QVirtualKeyboardDictionary
+
+ \inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-apps
+
+ \brief An application-defined dictionary for virtual keyboard input methods.
+
+ This class defines a named dictionary that consists of words or phrases. The
+ dictionary can be enabled in the desired context and its usage depends on
+ the current input method of the virtual keyboard.
+*/
+
+QVirtualKeyboardDictionary::QVirtualKeyboardDictionary(const QString &name, QObject *parent) :
+ QObject(parent),
+ _name(name)
+{
+
+}
+
+QString QVirtualKeyboardDictionary::name() const
+{
+ return _name;
+}
+
+QStringList QVirtualKeyboardDictionary::contents() const
+{
+ return _wordList;
+}
+
+void QVirtualKeyboardDictionary::setContents(const QStringList &wordList)
+{
+ if (_wordList != wordList) {
+ _wordList = wordList;
+ emit contentsChanged();
+ }
+}
+
+/*!
+ \property QVirtualKeyboardDictionary::name
+ \brief name of the dictionary.
+
+ This property holds the name of the dictionary that was specified when
+ the dictionary was created. The name is necessary when referring to a
+ specific dictionary (for example when you activate it in the input context).
+
+ \note The dictionary name cannot be changed later.
+*/
+
+/*!
+ \property QVirtualKeyboardDictionary::contents
+ \brief contents of the dictionary.
+
+ This property holds the contents of the dictionary. Typically, the content
+ consists of words or phrases. Note that the dictionary is language neutral,
+ meaning it is the application's responsibility to localize the dictionary if
+ it contains language-dependent data.
+
+ The content can be set at any time, although it makes sense to set it when
+ the input method is not active.
+*/
+
+QT_BEGIN_NAMESPACE
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboarddictionary.h b/src/virtualkeyboard/qvirtualkeyboarddictionary.h
new file mode 100644
index 00000000..a85cc636
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboarddictionary.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QVIRTUALKEYBOARDDICTIONARY_H
+#define QVIRTUALKEYBOARDDICTIONARY_H
+
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/QStringList>
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardDictionary : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name CONSTANT)
+ Q_PROPERTY(QStringList contents READ contents WRITE setContents NOTIFY contentsChanged RESET resetContents)
+
+ explicit QVirtualKeyboardDictionary(const QString &name, QObject *parent = nullptr);
+ friend class QVirtualKeyboardDictionaryManager;
+
+public:
+ QString name() const;
+
+ QStringList contents() const;
+ void setContents(const QStringList &contents);
+ void resetContents() { setContents({}); }
+
+Q_SIGNALS:
+ void contentsChanged();
+
+private:
+ const QString _name;
+ QStringList _wordList;
+};
+
+QT_END_NAMESPACE
+
+#endif // QVIRTUALKEYBOARDDICTIONARY_H
diff --git a/src/virtualkeyboard/qvirtualkeyboarddictionarymanager.cpp b/src/virtualkeyboard/qvirtualkeyboarddictionarymanager.cpp
new file mode 100644
index 00000000..14b2bb10
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboarddictionarymanager.cpp
@@ -0,0 +1,214 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionarymanager.h>
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionary.h>
+#include <QtGlobal>
+#include <QSet>
+
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardDictionaryManagerPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QVirtualKeyboardDictionaryManager)
+public:
+ QVirtualKeyboardDictionaryManagerPrivate(QVirtualKeyboardDictionaryManager *q)
+ {
+ q_ptr = q;
+ }
+
+ void updateActiveDictionaries()
+ {
+ Q_Q(QVirtualKeyboardDictionaryManager);
+ QSet<QString> newActiveDictionaries(baseDictionaries);
+ newActiveDictionaries.unite(extraDictionaries);
+ if (activeDictionaries != newActiveDictionaries) {
+ activeDictionaries = newActiveDictionaries;
+ emit q->activeDictionariesChanged();
+ }
+ }
+
+ QSet<QString> baseDictionaries;
+ QSet<QString> extraDictionaries;
+ QSet<QString> activeDictionaries;
+ QMap<QString, QVirtualKeyboardDictionary *> dictionaries;
+};
+
+struct QVirtualKeyboardDictionaryManagerSingleton {
+ QVirtualKeyboardDictionaryManager instance;
+};
+
+Q_GLOBAL_STATIC(QVirtualKeyboardDictionaryManagerSingleton, singleton)
+
+/*!
+ \class QVirtualKeyboardDictionaryManager
+
+ \inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-apps
+
+ \brief Dictionary management for application-defined dictionaries.
+
+ This class allows you to manage dictionaries for virtual keyboard input
+ methods. Dictionaries are application-defined and can be activated in the
+ desired context.
+
+ \note Dictionaries do not refer to the built-in dictionaries of the input
+ method, but to the application's own dictionaries (for example, a phonebook
+ application).
+
+ The following operations are supported by the dictionary manager:
+ \list
+ \li Create dictionaries using the \c createDictionary() function.
+ \li Add or modify content of the dictionary instance.
+ \li Activate dictionaries by adding them to the list of
+ \l {baseDictionaries}{base dictionaries} or
+ \l {extraDictionaries}{extra dictionaries}.
+ \endlist
+
+ To activate dictionaries from QML, use the \l VirtualKeyboard attached
+ type.
+*/
+
+QVirtualKeyboardDictionaryManager::QVirtualKeyboardDictionaryManager(QObject *parent) :
+ QObject(*new QVirtualKeyboardDictionaryManagerPrivate(this), parent)
+{
+ Q_D(QVirtualKeyboardDictionaryManager);
+ connect(this, &QVirtualKeyboardDictionaryManager::baseDictionariesChanged, this,
+ [d]() { d->updateActiveDictionaries(); });
+ connect(this, &QVirtualKeyboardDictionaryManager::extraDictionariesChanged, this,
+ [d]() { d->updateActiveDictionaries(); });
+}
+
+/*!
+ Returns the singleton instance of the QVirtualKeyboardDictionaryManager.
+
+ All the functionalities must be called from the main thread.
+ */
+
+QVirtualKeyboardDictionaryManager *QVirtualKeyboardDictionaryManager::instance()
+{
+ return &singleton->instance;
+}
+
+QStringList QVirtualKeyboardDictionaryManager::availableDictionaries() const
+{
+ Q_D(const QVirtualKeyboardDictionaryManager);
+ return d->dictionaries.keys();
+}
+
+QStringList QVirtualKeyboardDictionaryManager::baseDictionaries() const
+{
+ Q_D(const QVirtualKeyboardDictionaryManager);
+ return d->baseDictionaries.values();
+}
+
+void QVirtualKeyboardDictionaryManager::setBaseDictionaries(const QStringList &baseDictionaries)
+{
+ Q_D(QVirtualKeyboardDictionaryManager);
+ QSet<QString> newBaseDictionaries(baseDictionaries.begin(), baseDictionaries.end());
+ const QStringList availableDict = availableDictionaries();
+ newBaseDictionaries.intersect(QSet<QString>(availableDict.begin(), availableDict.end()));
+ if (d->baseDictionaries != newBaseDictionaries) {
+ d->baseDictionaries = newBaseDictionaries;
+ emit baseDictionariesChanged();
+ }
+}
+
+QStringList QVirtualKeyboardDictionaryManager::extraDictionaries() const
+{
+ Q_D(const QVirtualKeyboardDictionaryManager);
+ return d->extraDictionaries.values();
+}
+
+void QVirtualKeyboardDictionaryManager::setExtraDictionaries(const QStringList &extraDictionaries)
+{
+ Q_D(QVirtualKeyboardDictionaryManager);
+ QSet<QString> newExtraDictionaries(extraDictionaries.begin(), extraDictionaries.end());
+ const QStringList availableDict = availableDictionaries();
+ newExtraDictionaries.intersect(QSet<QString>(availableDict.begin(), availableDict.end()));
+ if (d->extraDictionaries != newExtraDictionaries) {
+ d->extraDictionaries = newExtraDictionaries;
+ emit extraDictionariesChanged();
+ }
+}
+
+QStringList QVirtualKeyboardDictionaryManager::activeDictionaries() const
+{
+ Q_D(const QVirtualKeyboardDictionaryManager);
+ return d->activeDictionaries.values();
+}
+
+/*!
+ Create a dictionary with the given \a name or return the dictionary if it
+ already exists.
+
+ The dictionary instance is owned by the dictionary manager and must not be
+ destroyed manually. To free memory allocated for the dictionary, the
+ application may reset the \l{QVirtualKeyboardDictionary::contents}{contents}
+ of the dictionary.
+
+ \sa dictionary()
+ */
+
+QVirtualKeyboardDictionary *QVirtualKeyboardDictionaryManager::createDictionary(const QString &name)
+{
+ Q_D(QVirtualKeyboardDictionaryManager);
+
+ QVirtualKeyboardDictionary *dictionary = d->dictionaries.value(name);
+ if (!dictionary) {
+ dictionary = new QVirtualKeyboardDictionary(name, this);
+ d->dictionaries[name] = dictionary;
+ emit availableDictionariesChanged();
+ }
+
+ return dictionary;
+}
+
+/*!
+ Returns an existing dictionary with the given \a name if it exists, otherwise returns
+ \nullptr.
+
+ \sa createDictionary()
+ */
+
+QVirtualKeyboardDictionary *QVirtualKeyboardDictionaryManager::dictionary(const QString &name) const
+{
+ Q_D(const QVirtualKeyboardDictionaryManager);
+
+ return d->dictionaries.value(name);
+}
+
+/*!
+ \property QVirtualKeyboardDictionaryManager::availableDictionaries
+ \brief the list of all dictionaries.
+
+ This property holds the names of all existing dictionaries.
+*/
+
+/*!
+ \property QVirtualKeyboardDictionaryManager::baseDictionaries
+ \brief the list of currently active base dictionaries.
+
+ This property holds the names of base dictionaries. The application manages
+ this property.
+*/
+
+/*!
+ \property QVirtualKeyboardDictionaryManager::extraDictionaries
+ \brief the list of currently active extra dictionaries.
+
+ This property holds the names of extra dictionaries. The application manages
+ this property.
+*/
+
+/*!
+ \property QVirtualKeyboardDictionaryManager::activeDictionaries
+ \brief the list of currently active dictionaries.
+
+ This property holds the list of active dictionaries, which is a combination
+ of unique names included in baseDictionaries and extraDictionaries.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboarddictionarymanager.h b/src/virtualkeyboard/qvirtualkeyboarddictionarymanager.h
new file mode 100644
index 00000000..fe549fc0
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboarddictionarymanager.h
@@ -0,0 +1,54 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QVIRTUALKEYBOARDDICTIONARYMANAGER_H
+#define QVIRTUALKEYBOARDDICTIONARYMANAGER_H
+
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/QStringList>
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardDictionary;
+class QVirtualKeyboardDictionaryManagerPrivate;
+
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardDictionaryManager : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QVirtualKeyboardDictionaryManager)
+ Q_DECLARE_PRIVATE(QVirtualKeyboardDictionaryManager)
+ Q_PROPERTY(QStringList availableDictionaries READ availableDictionaries NOTIFY availableDictionariesChanged)
+ Q_PROPERTY(QStringList baseDictionaries READ baseDictionaries WRITE setBaseDictionaries NOTIFY baseDictionariesChanged)
+ Q_PROPERTY(QStringList extraDictionaries READ extraDictionaries WRITE setExtraDictionaries NOTIFY extraDictionariesChanged)
+ Q_PROPERTY(QStringList activeDictionaries READ activeDictionaries NOTIFY activeDictionariesChanged)
+
+ explicit QVirtualKeyboardDictionaryManager(QObject *parent = nullptr);
+ friend struct QVirtualKeyboardDictionaryManagerSingleton;
+
+public:
+ static QVirtualKeyboardDictionaryManager *instance();
+
+ QStringList availableDictionaries() const;
+
+ QStringList baseDictionaries() const;
+ void setBaseDictionaries(const QStringList &baseDictionaries);
+
+ QStringList extraDictionaries() const;
+ void setExtraDictionaries(const QStringList &extraDictionaries);
+
+ QStringList activeDictionaries() const;
+
+ QVirtualKeyboardDictionary *createDictionary(const QString &name);
+ QVirtualKeyboardDictionary *dictionary(const QString &name) const;
+
+Q_SIGNALS:
+ void availableDictionariesChanged();
+ void baseDictionariesChanged();
+ void extraDictionariesChanged();
+ void activeDictionariesChanged();
+};
+
+QT_END_NAMESPACE
+
+#endif // QVIRTUALKEYBOARDDICTIONARYMANAGER_H
diff --git a/src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp b/src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp
deleted file mode 100644
index 78bf82a1..00000000
--- a/src/virtualkeyboard/qvirtualkeyboardextensionplugin.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QVirtualKeyboardExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVirtualKeyboardExtensionPlugin
- \inmodule QtVirtualKeyboard
- \brief Extension plugin for the Qt Virtual Keyboard.
-
- Extension plugin allows customizing and extending the Qt Virtual Keyboard
- functionality. Extension plugin can provide additional keyboard layouts and
- input methods.
-
- Virtual keyboard loads all the extension plugins at startup. It searches for
- \c plugins/virtualkeyboard directory and matches the metadata found in the
- plugin. If there are two or more extension plugins with the same \c Name, it
- loads the one with the highest \c Version number.
-
- \sa {Virtual Keyboard Extension Plugin}
-*/
-
-QVirtualKeyboardExtensionPlugin::~QVirtualKeyboardExtensionPlugin()
-{
-}
-
-/*!
- If the plugin metadata contains \c InputMethod field defining an input method
- name, Qt Virtual Keyboard will call registerTypes() for registering the input
- method as QML type. The type must be registered with a \a uri if the input method
- is used by the default keyboard layouts. If the input method type is only used in
- private layouts (known only by the plugin), the uri can be omitted and chosen
- freely.
-*/
-void QVirtualKeyboardExtensionPlugin::registerTypes(const char *uri) const
-{
- Q_UNUSED(uri);
-}
-
-QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardextensionplugin.h b/src/virtualkeyboard/qvirtualkeyboardextensionplugin.h
deleted file mode 100644
index 40e2192f..00000000
--- a/src/virtualkeyboard/qvirtualkeyboardextensionplugin.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIRTUALKEYBOARDEXTENSIONPLUGIN_H
-#define QVIRTUALKEYBOARDEXTENSIONPLUGIN_H
-
-#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
-#include <QtCore/QtPlugin>
-
-QT_BEGIN_NAMESPACE
-
-#define QVirtualKeyboardExtensionPluginFactoryInterface_iid "org.qt-project.qt.virtualkeyboard.plugin/5.12"
-
-class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardExtensionPlugin : public QObject
-{
- Q_OBJECT
-public:
- virtual ~QVirtualKeyboardExtensionPlugin();
-
- virtual void registerTypes(const char *uri) const;
-};
-
-Q_DECLARE_INTERFACE(QVirtualKeyboardExtensionPlugin,
- QVirtualKeyboardExtensionPluginFactoryInterface_iid)
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/virtualkeyboard/qvirtualkeyboardfeatures_namespace_p.h b/src/virtualkeyboard/qvirtualkeyboardfeatures_namespace_p.h
new file mode 100644
index 00000000..19791285
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardfeatures_namespace_p.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QVIRTUALKEYBOARDFEATURES_NAMESPACE_P_H
+#define QVIRTUALKEYBOARDFEATURES_NAMESPACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QMetaEnum>
+#include <QtQml/qqml.h>
+#include <QtVirtualKeyboard/qtvirtualkeyboardexports.h>
+#include <QtVirtualKeyboard/private/qtvirtualkeyboard-config_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QVirtualKeyboardFeatures {
+
+Q_VIRTUALKEYBOARD_EXPORT Q_NAMESPACE
+QML_NAMED_ELEMENT(VirtualKeyboardFeatures)
+QML_ADDED_IN_VERSION(6, 4)
+
+enum Feature {
+ Handwriting =
+#if QT_CONFIG(cerence_hwr) || QT_CONFIG(myscript) || QT_CONFIG(example_hwr)
+ 1
+#else
+ 0
+#endif
+ // possibly extend for other things you may want to detect in the future
+};
+Q_ENUM_NS(Feature)
+
+} // namespace QVirtualKeyboardFeatures
+
+QT_END_NAMESPACE
+
+#endif // QVIRTUALKEYBOARDFEATURES_NAMESPACE_P_H
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp b/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
index fb65b29e..1da578d3 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext.cpp
@@ -1,40 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
#include <QtVirtualKeyboard/private/shifthandler_p.h>
#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardobserver.h>
#include <QTextFormat>
#include <QGuiApplication>
+#include <QtGui/private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE
using namespace QtVirtualKeyboard;
@@ -43,7 +19,7 @@ using namespace QtVirtualKeyboard;
\qmltype InputContext
\instantiates QVirtualKeyboardInputContext
\inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
+ \ingroup qtvirtualkeyboard-internal-qml
\brief Provides access to an input context.
The InputContext can be accessed as singleton instance.
@@ -52,6 +28,7 @@ using namespace QtVirtualKeyboard;
/*!
\class QVirtualKeyboardInputContext
\inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
\brief Provides access to an input context.
*/
@@ -131,7 +108,7 @@ void QVirtualKeyboardInputContext::setPreeditText(const QString &text, QList<QIn
if (!d->testAttribute(attributes, QInputMethodEvent::TextFormat)) {
QTextCharFormat textFormat;
textFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, text.length(), textFormat));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, text.size(), textFormat));
}
} else if (d->_forceCursorPosition != -1) {
d->addSelectionAttribute(attributes);
@@ -208,7 +185,7 @@ QVirtualKeyboardInputEngine *QVirtualKeyboardInputContext::inputEngine() const
/*!
\qmlmethod void InputContext::sendKeyClick(int key, string text, int modifiers = 0)
- Sends a key click event with the given \a key, \a text and \e modifiers to
+ Sends a key click event with the given \a key, \a text and \a modifiers to
the input item that currently has focus.
*/
/*!
@@ -231,6 +208,10 @@ void QVirtualKeyboardInputContext::sendKeyClick(int key, const QString &text, in
d->setState(QVirtualKeyboardInputContextPrivate::State::KeyEvent);
d->platformInputContext->sendKeyEvent(&pressEvent);
d->platformInputContext->sendKeyEvent(&releaseEvent);
+
+ if (key == Qt::Key_Return || key == Qt::Key_Enter)
+ d->maybeCloseOnReturn();
+
if (d->activeKeys.isEmpty())
d->clearState(QVirtualKeyboardInputContextPrivate::State::KeyEvent);
} else {
@@ -336,7 +317,11 @@ void QVirtualKeyboardInputContext::clear()
*/
void QVirtualKeyboardInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos)
{
- QPlatformInputContext::setSelectionOnFocusObject(anchorPos, cursorPos);
+ QWindow *window = qApp->focusWindow();
+ const QPointF &nativeAnchorPos = QHighDpi::toNativePixels(anchorPos, window);
+ const QPointF &nativeCursorPos = QHighDpi::toNativePixels(cursorPos, window);
+
+ QPlatformInputContext::setSelectionOnFocusObject(nativeAnchorPos, nativeCursorPos);
}
/*!
@@ -406,6 +391,25 @@ QVirtualKeyboardInputContextPrivate *QVirtualKeyboardInputContext::priv() const
}
/*!
+ \property QVirtualKeyboardInputContext::keyboardObserver
+ \since QtQuick.VirtualKeyboard 6.1
+ \brief Holds the keyboard observer object, which can be used to receive
+ notifications of keyboard change events.
+*/
+/*!
+ \qmlproperty KeyboardObserver InputContext::keyboardObserver
+ \readonly
+ \since QtQuick.VirtualKeyboard 6.1
+ \brief Holds the keyboard observer object, which can be used to receive
+ notifications of keyboard change events.
+*/
+QVirtualKeyboardObserver *QVirtualKeyboardInputContext::keyboardObserver() const
+{
+ Q_D(const QVirtualKeyboardInputContext);
+ return d->keyboardObserver;
+}
+
+/*!
\qmlproperty bool InputContext::shift
\deprecated
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext.h b/src/virtualkeyboard/qvirtualkeyboardinputcontext.h
index e511bbfb..1bd81d58 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputcontext.h
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext.h
@@ -1,40 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QVIRTUALKEYBOARDINPUTCONTEXT_H
#define QVIRTUALKEYBOARDINPUTCONTEXT_H
-#include <QObject>
-#include <QRectF>
-#include <QLocale>
-#include <QInputMethodEvent>
-#include <QInputMethod>
+#include <QtCore/QObject>
+#include <QtCore/QRectF>
+#include <QtCore/QLocale>
+#include <QtGui/QInputMethodEvent>
+#include <QtGui/QInputMethod>
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
QT_BEGIN_NAMESPACE
@@ -44,16 +19,17 @@ class PlatformInputContext;
}
class QVirtualKeyboardInputEngine;
class QVirtualKeyboardInputContextPrivate;
+class QVirtualKeyboardObserver;
-class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputContext : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputContext : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(QVirtualKeyboardInputContext)
Q_DECLARE_PRIVATE(QVirtualKeyboardInputContext)
Q_PROPERTY(bool shift READ isShiftActive NOTIFY shiftActiveChanged)
- Q_PROPERTY(bool shiftActive READ isShiftActive NOTIFY shiftActiveChanged REVISION 4)
+ Q_PROPERTY(bool shiftActive READ isShiftActive NOTIFY shiftActiveChanged REVISION(2, 4))
Q_PROPERTY(bool capsLock READ isCapsLockActive NOTIFY capsLockActiveChanged)
- Q_PROPERTY(bool capsLockActive READ isCapsLockActive NOTIFY capsLockActiveChanged REVISION 4)
+ Q_PROPERTY(bool capsLockActive READ isCapsLockActive NOTIFY capsLockActiveChanged REVISION(2, 4))
Q_PROPERTY(bool uppercase READ isUppercase NOTIFY uppercaseChanged)
Q_PROPERTY(int anchorPosition READ anchorPosition NOTIFY anchorPositionChanged)
Q_PROPERTY(int cursorPosition READ cursorPosition NOTIFY cursorPositionChanged)
@@ -70,10 +46,17 @@ class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputContext : public QObject
Q_PROPERTY(bool selectionControlVisible READ isSelectionControlVisible NOTIFY selectionControlVisibleChanged)
Q_PROPERTY(bool anchorRectIntersectsClipRect READ anchorRectIntersectsClipRect NOTIFY anchorRectIntersectsClipRectChanged)
Q_PROPERTY(bool cursorRectIntersectsClipRect READ cursorRectIntersectsClipRect NOTIFY cursorRectIntersectsClipRectChanged)
- Q_PROPERTY(QVirtualKeyboardInputContextPrivate *priv READ priv CONSTANT)
+ Q_PROPERTY(QVirtualKeyboardInputContextPrivate *priv READ priv CONSTANT REVISION(2, 0))
+ Q_PROPERTY(QVirtualKeyboardObserver *keyboardObserver READ keyboardObserver CONSTANT REVISION(6, 1))
Q_MOC_INCLUDE("qvirtualkeyboardinputengine.h")
Q_MOC_INCLUDE("qvirtualkeyboardinputcontext_p.h")
+ // The QML macros are unused for now, until we can move the QML_NAMED_ELEMENT back here.
+ // QML_SINGLETON generates some code that might or might not emit symbols on some platforms.
+ QML_SINGLETON
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
+
public:
explicit QVirtualKeyboardInputContext(QObject *parent = nullptr);
~QVirtualKeyboardInputContext();
@@ -100,6 +83,7 @@ public:
bool anchorRectIntersectsClipRect() const;
bool cursorRectIntersectsClipRect() const;
QVirtualKeyboardInputContextPrivate *priv() const;
+ QVirtualKeyboardObserver *keyboardObserver() const;
Q_INVOKABLE void sendKeyClick(int key, const QString &text, int modifiers = 0);
Q_INVOKABLE void commit();
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
index 4365178f..3483a6cc 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
#include <QtVirtualKeyboard/private/platforminputcontext_p.h>
@@ -34,6 +8,10 @@
#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
#include <QtVirtualKeyboard/private/enterkeyaction_p.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardobserver.h>
+#include <QtVirtualKeyboard/private/enterkeyactionattachedtype_p.h>
+#include <QtVirtualKeyboard/private/virtualkeyboardattachedtype_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboarddictionarymanager.h>
#include <QFile>
#include <QGuiApplication>
@@ -41,17 +19,10 @@
#include <QtQuick/qquickwindow.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QQmlEngine>
QT_BEGIN_NAMESPACE
-bool operator==(const QInputMethodEvent::Attribute &attribute1, const QInputMethodEvent::Attribute &attribute2)
-{
- return attribute1.start == attribute2.start &&
- attribute1.length == attribute2.length &&
- attribute1.type == attribute2.type &&
- attribute1.value == attribute2.value;
-}
-
using namespace QtVirtualKeyboard;
const bool QtVirtualKeyboard::QT_VIRTUALKEYBOARD_FORCE_EVENTS_WITHOUT_FOCUS = qEnvironmentVariableIsSet("QT_VIRTUALKEYBOARD_FORCE_EVENTS_WITHOUT_FOCUS");
@@ -172,6 +143,8 @@ QString QVirtualKeyboardInputContextPrivate::locale() const
void QVirtualKeyboardInputContextPrivate::setLocale(const QString &locale)
{
VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContextPrivate::setLocale():" << locale;
+ if (!platformInputContext)
+ return;
QLocale newLocale(locale);
if (newLocale != platformInputContext->locale()) {
platformInputContext->setLocale(newLocale);
@@ -195,9 +168,12 @@ ShadowInputContext *QVirtualKeyboardInputContextPrivate::shadow() const
return const_cast<ShadowInputContext *>(&_shadow);
}
-QStringList QVirtualKeyboardInputContextPrivate::inputMethods() const
+void QVirtualKeyboardInputContextPrivate::setKeyboardObserver(QVirtualKeyboardObserver *keyboardObserver)
{
- return platformInputContext ? platformInputContext->inputMethods() : QStringList();
+ if (!this->keyboardObserver.isNull())
+ return;
+
+ this->keyboardObserver = keyboardObserver;
}
bool QVirtualKeyboardInputContextPrivate::fileExists(const QUrl &fileUrl)
@@ -221,8 +197,6 @@ void QVirtualKeyboardInputContextPrivate::registerInputPanel(QObject *inputPanel
VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputContextPrivate::registerInputPanel():" << inputPanel;
Q_ASSERT(!this->inputPanel);
this->inputPanel = inputPanel;
- if (QQuickItem *item = qobject_cast<QQuickItem *>(inputPanel))
- item->setZ(std::numeric_limits<qreal>::max());
}
void QVirtualKeyboardInputContextPrivate::hideInputPanel()
@@ -253,7 +227,7 @@ void QVirtualKeyboardInputContextPrivate::forceCursorPosition(int anchorPosition
forceAnchorPosition = -1;
_forceCursorPosition = cursorPosition;
if (cursorPosition > this->cursorPosition)
- _forceCursorPosition += preeditText.length();
+ _forceCursorPosition += preeditText.size();
commit();
} else {
forceAnchorPosition = anchorPosition;
@@ -269,18 +243,69 @@ void QVirtualKeyboardInputContextPrivate::forceCursorPosition(int anchorPosition
}
}
+/*! \internal
+ The context private becomes a containment mask for a dimmer opened by a
+ modal QQuickPopup. The dimmer eats events, and the virtual keyboard must
+ continue to work during modal sessions as well. This implementation lets
+ all pointer events within the area of the input panel through.
+*/
+bool QVirtualKeyboardInputContextPrivate::contains(const QPointF &point) const
+{
+ bool hit = false;
+ if (dimmer) {
+ const auto scenePoint = dimmer->mapToScene(point);
+ if (keyboardRectangle().contains(scenePoint)) {
+ hit = true;
+ } else if (QQuickItem *vkbPanel = qobject_cast<QQuickItem*>(inputPanel)) {
+ const auto vkbPanelPoint = vkbPanel->mapFromScene(scenePoint);
+ if (vkbPanel->contains(vkbPanelPoint))
+ hit = true;
+ }
+ }
+ // dimmer doesn't contain points that hit the input panel
+ return !hit;
+}
+
+KeyboardFunctionKey QVirtualKeyboardInputContextPrivate::keyboardFunctionKey(QtVirtualKeyboard::KeyboardFunction keyboardFunction) const
+{
+ switch (keyboardFunction) {
+ case KeyboardFunction::HideInputPanel:
+ return KeyboardFunctionKey::Hide;
+ case KeyboardFunction::ChangeLanguage:
+ return KeyboardFunctionKey::Language;
+ case KeyboardFunction::ToggleHandwritingMode:
+ return KeyboardFunctionKey::None;
+ }
+ return KeyboardFunctionKey::None;
+}
+
void QVirtualKeyboardInputContextPrivate::onInputItemChanged()
{
- if (QObject *item = inputItem()) {
+ QObject *item = inputItem();
+ if (item) {
if (QQuickItem *vkbPanel = qobject_cast<QQuickItem*>(inputPanel)) {
if (QQuickItem *quickItem = qobject_cast<QQuickItem*>(item)) {
const QVariant isDesktopPanel = vkbPanel->property("desktopPanel");
- /*
- For integrated keyboards, make sure it's a sibling to the overlay. The
- high z-order will make sure it gets events also during a modal session.
- */
- if (isDesktopPanel.isValid() && !isDesktopPanel.toBool())
- vkbPanel->setParentItem(quickItem->window()->contentItem());
+ if (isDesktopPanel.isValid() && !isDesktopPanel.toBool()) {
+ // Integrated keyboards used in a Qt Quick Controls UI must continue to
+ // work during a modal session, which is implemented using an overlay
+ // and dimmer item. So, make use of some QQC2 internals to find out if
+ // there is a dimmer, and if so, make ourselves the containment mask
+ // that can let pointer events through to the keyboard.
+ if (QQuickWindow *quickWindow = quickItem->window()) {
+ if (QQuickItem *overlay = quickWindow->property("_q_QQuickOverlay").value<QQuickItem*>()) {
+ if (dimmer && dimmer->containmentMask() == this) {
+ dimmer->setContainmentMask(nullptr);
+ dimmer = nullptr;
+ }
+ if (overlay && overlay->isVisible()) {
+ dimmer = overlay->property("_q_dimmerItem").value<QQuickItem*>();
+ if (dimmer)
+ dimmer->setContainmentMask(this);
+ }
+ }
+ }
+ }
}
}
} else {
@@ -291,6 +316,14 @@ void QVirtualKeyboardInputContextPrivate::onInputItemChanged()
}
}
clearState(State::InputMethodClick);
+
+ QStringList extraDictionaries;
+ if (item) {
+ VirtualKeyboardAttachedType *virtualKeyboardAttachedType = static_cast<VirtualKeyboardAttachedType *>(qmlAttachedPropertiesObject<VirtualKeyboard>(item, false));
+ if (virtualKeyboardAttachedType)
+ extraDictionaries = virtualKeyboardAttachedType->extraDictionaries();
+ }
+ QVirtualKeyboardDictionaryManager::instance()->setExtraDictionaries(extraDictionaries);
}
void QVirtualKeyboardInputContextPrivate::sendPreedit(const QString &text, const QList<QInputMethodEvent::Attribute> &attributes, int replaceFrom, int replaceLength)
@@ -370,6 +403,7 @@ void QVirtualKeyboardInputContextPrivate::update(Qt::InputMethodQueries queries)
Qt::ImQueryInput | Qt::ImInputItemClipRectangle));
platformInputContext->sendEvent(&imQueryEvent);
Qt::InputMethodHints inputMethodHints = Qt::InputMethodHints(imQueryEvent.value(Qt::ImHints).toInt());
+ inputMethodHints |= Settings::instance()->inputMethodHints();
const int cursorPosition = imQueryEvent.value(Qt::ImCursorPosition).toInt();
const int anchorPosition = imQueryEvent.value(Qt::ImAnchorPosition).toInt();
QRectF anchorRectangle;
@@ -392,7 +426,7 @@ void QVirtualKeyboardInputContextPrivate::update(Qt::InputMethodQueries queries)
bool newCursorPosition = cursorPosition != this->cursorPosition;
bool newAnchorRectangle = anchorRectangle != this->anchorRectangle;
bool newCursorRectangle = cursorRectangle != this->cursorRectangle;
- bool selectionControlVisible = platformInputContext->isInputPanelVisible() && (cursorPosition != anchorPosition) && !inputMethodHints.testFlag(Qt::ImhNoTextHandles);
+ bool selectionControlVisible = platformInputContext->evaluateInputPanelVisible() && (cursorPosition != anchorPosition) && !inputMethodHints.testFlag(Qt::ImhNoTextHandles);
bool newSelectionControlVisible = selectionControlVisible != this->selectionControlVisible;
QRectF inputItemClipRect = imQueryEvent.value(Qt::ImInputItemClipRectangle).toRectF();
@@ -483,13 +517,13 @@ void QVirtualKeyboardInputContextPrivate::invokeAction(QInputMethod::Action acti
if (inputEngine->clickPreeditText(cursorPosition))
break;
- bool reselect = !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && selectedText.isEmpty() && cursorPosition < preeditText.length();
+ bool reselect = !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && selectedText.isEmpty() && cursorPosition < preeditText.size();
if (reselect) {
QVirtualKeyboardScopedState reselectState(this, State::Reselect);
_forceCursorPosition = this->cursorPosition + cursorPosition;
commit();
inputEngine->reselect(this->cursorPosition, QVirtualKeyboardInputEngine::ReselectFlag::WordBeforeCursor);
- } else if (!preeditText.isEmpty() && cursorPosition == preeditText.length()) {
+ } else if (!preeditText.isEmpty() && cursorPosition == preeditText.size()) {
commit();
}
}
@@ -501,11 +535,52 @@ void QVirtualKeyboardInputContextPrivate::invokeAction(QInputMethod::Action acti
}
}
+void QVirtualKeyboardInputContextPrivate::maybeCloseOnReturn()
+{
+ if (!Settings::instance()->closeOnReturn())
+ return;
+
+ const int imHints = QInputMethod::queryFocusObject(Qt::ImHints, QVariant()).toInt();
+ if (imHints & Qt::ImhMultiLine)
+ return;
+
+ const Qt::EnterKeyType keyType = static_cast<Qt::EnterKeyType>(QInputMethod::queryFocusObject(Qt::ImEnterKeyType, QVariant()).toInt());
+ switch (keyType) {
+ case Qt::EnterKeyDefault:
+ case Qt::EnterKeyDone:
+ case Qt::EnterKeyGo:
+ case Qt::EnterKeySend:
+ case Qt::EnterKeySearch:
+ break;
+ case Qt::EnterKeyReturn:
+ case Qt::EnterKeyNext:
+ case Qt::EnterKeyPrevious:
+ return;
+ }
+
+ if (EnterKeyActionAttachedType *enterKeyActionAttachedType = static_cast<EnterKeyActionAttachedType *>(qmlAttachedPropertiesObject<EnterKeyAction>(inputItem(), false))) {
+ const EnterKeyAction::Id enterKeyActionId = static_cast<EnterKeyAction::Id>(enterKeyActionAttachedType->actionId());
+ switch (enterKeyActionId) {
+ case EnterKeyAction::None:
+ case EnterKeyAction::Done:
+ case EnterKeyAction::Go:
+ case EnterKeyAction::Search:
+ case EnterKeyAction::Send:
+ break;
+ case EnterKeyAction::Next:
+ return;
+ }
+ }
+
+ hideInputPanel();
+}
+
bool QVirtualKeyboardInputContextPrivate::filterEvent(const QEvent *event)
{
QEvent::Type type = event->type();
if (type == QEvent::KeyPress || type == QEvent::KeyRelease) {
const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
+ const int key = keyEvent->key();
// Keep track of pressed keys update key event state
if (type == QEvent::KeyPress)
@@ -519,7 +594,6 @@ bool QVirtualKeyboardInputContextPrivate::filterEvent(const QEvent *event)
setState(State::KeyEvent);
#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
- int key = keyEvent->key();
if ((key >= Qt::Key_Left && key <= Qt::Key_Down) || key == Qt::Key_Return) {
if (type == QEvent::KeyPress && platformInputContext->isInputPanelVisible()) {
activeNavigationKeys += key;
@@ -533,9 +607,21 @@ bool QVirtualKeyboardInputContextPrivate::filterEvent(const QEvent *event)
}
#endif
+ if (type == QEvent::KeyRelease && (key == Qt::Key_Return || key == Qt::Key_Enter)) {
+ maybeCloseOnReturn();
+ }
+
// Break composing text since the virtual keyboard does not support hard keyboard events
- if (!preeditText.isEmpty())
- commit();
+ if (!preeditText.isEmpty()) {
+ if (type == QEvent::KeyPress && (key == Qt::Key_Delete || key == Qt::Key_Backspace)) {
+ reset();
+ Q_Q(QVirtualKeyboardInputContext);
+ q->clear();
+ return true;
+ } else {
+ commit();
+ }
+ }
}
#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
else if (type == QEvent::ShortcutOverride) {
@@ -575,7 +661,7 @@ void QVirtualKeyboardInputContextPrivate::addSelectionAttribute(QList<QInputMeth
bool QVirtualKeyboardInputContextPrivate::testAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const
{
- for (const QInputMethodEvent::Attribute &attribute : qAsConst(attributes)) {
+ for (const QInputMethodEvent::Attribute &attribute : std::as_const(attributes)) {
if (attribute.type == attributeType)
return true;
}
@@ -584,7 +670,7 @@ bool QVirtualKeyboardInputContextPrivate::testAttribute(const QList<QInputMethod
int QVirtualKeyboardInputContextPrivate::findAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const
{
- const int count = attributes.count();
+ const int count = attributes.size();
for (int i = 0; i < count; ++i) {
if (attributes.at(i).type == attributeType)
return i;
@@ -592,4 +678,26 @@ int QVirtualKeyboardInputContextPrivate::findAttribute(const QList<QInputMethodE
return -1;
}
+void QVirtualKeyboardInputContextPrivate::updateSelectionControlVisible(bool inputPanelVisible)
+{
+ Q_Q(QVirtualKeyboardInputContext);
+ bool newSelectionControlVisible = inputPanelVisible && (cursorPosition != anchorPosition) && !inputMethodHints.testFlag(Qt::ImhNoTextHandles);
+ if (selectionControlVisible != newSelectionControlVisible) {
+ selectionControlVisible = newSelectionControlVisible;
+ emit q->selectionControlVisibleChanged();
+ }
+}
+
+QVirtualKeyboardInputContext *QVirtualKeyboardInputContextForeign::create(
+ QQmlEngine *qmlEngine, QJSEngine *)
+{
+ static QMutex mutex;
+ static QHash<QQmlEngine *, QVirtualKeyboardInputContext *> instances;
+ QMutexLocker locker(&mutex);
+ QVirtualKeyboardInputContext *&instance = instances[qmlEngine];
+ if (instance == nullptr)
+ instance = new QVirtualKeyboardInputContext(qmlEngine);
+ return instance;
+}
+
QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h
index 05eae901..f81c57b1 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QVIRTUALKEYBOARDINPUTCONTEXT_P_H
#define QVIRTUALKEYBOARDINPUTCONTEXT_P_H
@@ -45,8 +19,13 @@
#include <QRectF>
#include <QSet>
#include <QInputMethodEvent>
+#include <QQuickItem>
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
#include <QtVirtualKeyboard/private/shadowinputcontext_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboardobserver.h>
+#include <QtVirtualKeyboard/private/qvirtualkeyboardnamespace_p.h>
+
+#include <QtCore/qpointer.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +43,7 @@ class ShiftHandler;
class QVirtualKeyboardInputEngine;
class QVirtualKeyboardInputContextPrivate;
-class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputContextPrivate : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputContextPrivate : public QObject
{
Q_OBJECT
Q_DECLARE_PUBLIC(QVirtualKeyboardInputContext)
@@ -76,8 +55,10 @@ class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputContextPrivate : public QObje
Q_PROPERTY(QObject *inputItem READ inputItem NOTIFY inputItemChanged)
Q_PROPERTY(QtVirtualKeyboard::ShiftHandler *shiftHandler READ shiftHandler CONSTANT)
Q_PROPERTY(QtVirtualKeyboard::ShadowInputContext *shadow READ shadow CONSTANT)
- Q_PROPERTY(QStringList inputMethods READ inputMethods CONSTANT)
Q_MOC_INCLUDE("shifthandler_p.h")
+ QML_NAMED_ELEMENT(InputContextPrivate)
+ QML_UNCREATABLE("InputContextPrivate is only available via InputContext.priv")
+ QML_ADDED_IN_VERSION(2, 0)
explicit QVirtualKeyboardInputContextPrivate(QVirtualKeyboardInputContext *q_ptr);
void init();
@@ -88,7 +69,8 @@ public:
InputMethodEvent = 0x2,
KeyEvent = 0x4,
InputMethodClick = 0x8,
- SyncShadowInput = 0x10
+ SyncShadowInput = 0x10,
+ SetFocus = 0x20
};
Q_FLAG(State)
Q_DECLARE_FLAGS(StateFlags, QVirtualKeyboardInputContextPrivate::State)
@@ -108,12 +90,14 @@ public:
QObject *inputItem() const;
QtVirtualKeyboard::ShiftHandler *shiftHandler() const;
QtVirtualKeyboard::ShadowInputContext *shadow() const;
- QStringList inputMethods() const;
+ Q_INVOKABLE void setKeyboardObserver(QVirtualKeyboardObserver *keyboardObserver);
// Helper functions
Q_INVOKABLE bool fileExists(const QUrl &fileUrl);
Q_INVOKABLE bool hasEnterKeyAction(QObject *item) const;
Q_INVOKABLE void registerInputPanel(QObject *inputPanel);
+ Q_INVOKABLE bool contains(const QPointF &point) const;
+ Q_INVOKABLE QtVirtualKeyboard::KeyboardFunctionKey keyboardFunctionKey(QtVirtualKeyboard::KeyboardFunction keyboardFunction) const;
Q_SIGNALS:
void focusChanged();
@@ -140,6 +124,7 @@ private:
void commit();
void update(Qt::InputMethodQueries queries);
void invokeAction(QInputMethod::Action action, int cursorPosition);
+ void maybeCloseOnReturn();
bool filterEvent(const QEvent *event);
void addSelectionAttribute(QList<QInputMethodEvent::Attribute> &attributes);
bool testAttribute(const QList<QInputMethodEvent::Attribute> &attributes, QInputMethodEvent::AttributeType attributeType) const;
@@ -148,6 +133,7 @@ private:
inline void clearState(const State &state) { stateFlags &= ~StateFlags(state); }
inline bool testState(const State &state) const { return stateFlags.testFlag(state); }
inline bool isEmptyState() const { return !stateFlags; }
+ void updateSelectionControlVisible(bool inputPanelVisible);
private:
QVirtualKeyboardInputContext *q_ptr;
@@ -155,6 +141,7 @@ private:
QVirtualKeyboardInputEngine *inputEngine;
QtVirtualKeyboard::ShiftHandler *_shiftHandler;
QPointer<QObject> inputPanel;
+ QPointer<QQuickItem> dimmer;
QRectF keyboardRect;
QRectF previewRect;
bool _previewVisible;
@@ -180,6 +167,7 @@ private:
#endif
QSet<quint32> activeKeys;
QtVirtualKeyboard::ShadowInputContext _shadow;
+ QPointer<QVirtualKeyboardObserver> keyboardObserver;
friend class QtVirtualKeyboard::PlatformInputContext;
friend class QVirtualKeyboardScopedState;
@@ -208,6 +196,23 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QVirtualKeyboardInputContextPrivate::StateFlags)
+/*!
+ TODO: Remove this type and move the registration back into QVirtualKeyboardInputContext when
+ QML stops creating separate singleton instances for each version.
+ */
+struct QVirtualKeyboardInputContextForeign
+{
+ Q_GADGET
+ QML_FOREIGN(QVirtualKeyboardInputContext)
+ QML_NAMED_ELEMENT(InputContext)
+ QML_SINGLETON
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
+
+public:
+ static QVirtualKeyboardInputContext *create(QQmlEngine *qmlEngine, QJSEngine *);
+};
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QVirtualKeyboardInputContextPrivate::State)
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputengine.cpp b/src/virtualkeyboard/qvirtualkeyboardinputengine.cpp
index e64ea4eb..59ddb6b1 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputengine.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardinputengine.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
@@ -35,6 +9,8 @@
#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
+#include <QQmlContext>
+#include <QQmlEngine>
#include <QTimerEvent>
#include <QtCore/private/qobject_p.h>
@@ -124,7 +100,7 @@ private:
/*!
\qmltype InputEngine
\inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
+ \ingroup qtvirtualkeyboard-internal-qml
\instantiates QVirtualKeyboardInputEngine
\brief Maps the user input to the input methods.
@@ -139,6 +115,7 @@ private:
/*!
\class QVirtualKeyboardInputEngine
\inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
\brief The InputEngine class provides an input engine
that supports C++ and QML integration.
@@ -390,6 +367,7 @@ void QVirtualKeyboardInputEngine::setInputMethod(QVirtualKeyboardAbstractInputMe
if (d->inputMethod != inputMethod) {
update();
if (d->inputMethod) {
+ d->inputMethod->clearInputMode();
QObject::disconnect(d->inputMethod.data(), &QVirtualKeyboardAbstractInputMethod::selectionListsChanged, this, &QVirtualKeyboardInputEngine::updateSelectionListModels);
d->inputMethod->setInputEngine(nullptr);
}
@@ -475,7 +453,7 @@ QList<int> QVirtualKeyboardInputEngine::patternRecognitionModes() const
if (patterRecognitionModeList.isEmpty())
return resultList;
resultList.reserve(patterRecognitionModeList.size());
- for (const PatternRecognitionMode &patternRecognitionMode : qAsConst(patterRecognitionModeList))
+ for (const PatternRecognitionMode &patternRecognitionMode : std::as_const(patterRecognitionModeList))
resultList.append(static_cast<int>(patternRecognitionMode));
return resultList;
}
@@ -538,8 +516,14 @@ QVirtualKeyboardTrace *QVirtualKeyboardInputEngine::traceBegin(
if (!d->inputMethod->patternRecognitionModes().contains(patternRecognitionMode))
return nullptr;
QVirtualKeyboardTrace *trace = d->inputMethod->traceBegin(traceId, patternRecognitionMode, traceCaptureDeviceInfo, traceScreenInfo);
- if (trace)
+ if (trace) {
+ if (QQmlContext *context = QQmlEngine::contextForObject(this)) {
+ if (QQmlEngine *engine = context->engine()) {
+ engine->setObjectOwnership(trace, QQmlEngine::CppOwnership);
+ }
+ }
trace->setTraceId(traceId);
+ }
return trace;
}
@@ -676,7 +660,7 @@ void QVirtualKeyboardInputEngine::updateSelectionListModels()
}
// Deallocate inactive selection lists
- for (const QVirtualKeyboardSelectionListModel::Type &selectionListType : qAsConst(inactiveSelectionLists)) {
+ for (const QVirtualKeyboardSelectionListModel::Type &selectionListType : std::as_const(inactiveSelectionLists)) {
const auto it = d->selectionListModels.constFind(selectionListType);
if (it != d->selectionListModels.cend()) {
it.value()->setDataSource(nullptr, selectionListType);
@@ -693,8 +677,9 @@ void QVirtualKeyboardInputEngine::updateInputModes()
{
Q_D(QVirtualKeyboardInputEngine);
QList<int> newInputModes;
+ QList<InputMode> tmpList;
if (d->inputMethod) {
- QList<InputMode> tmpList(d->inputMethod->inputModes(d->inputContext->locale()));
+ tmpList = d->inputMethod->inputModes(d->inputContext->locale());
if (!tmpList.isEmpty()) {
std::transform(tmpList.constBegin(), tmpList.constEnd(),
std::back_inserter(newInputModes),
@@ -705,6 +690,7 @@ void QVirtualKeyboardInputEngine::updateInputModes()
}
if (d->inputModes != newInputModes) {
d->inputModes = newInputModes;
+ VIRTUALKEYBOARD_DEBUG() << "QVirtualKeyboardInputEngine::inputModesChanged():" << tmpList;
emit inputModesChanged();
}
}
@@ -716,9 +702,11 @@ void QVirtualKeyboardInputEngine::timerEvent(QTimerEvent *timerEvent)
{
Q_D(QVirtualKeyboardInputEngine);
if (timerEvent->timerId() == d->repeatTimer) {
- d->repeatTimer = 0;
d->virtualKeyClick(d->activeKey, d->activeKeyText, d->activeKeyModifiers, true);
- d->repeatTimer = startTimer(50);
+ if (!d->repeatCount) {
+ killTimer(d->repeatTimer);
+ d->repeatTimer = startTimer(50);
+ }
d->repeatCount++;
}
}
@@ -806,6 +794,8 @@ void QVirtualKeyboardInputEngine::timerEvent(QTimerEvent *timerEvent)
\li \c InputEngine.InputMode.JapaneseHandwriting Japanese handwriting.
\li \c InputEngine.InputMode.KoreanHandwriting Korean handwriting.
\li \c InputEngine.InputMode.Thai Thai input mode.
+ \li \c InputEngine.InputMode.Stroke Stroke input mode for Chinese.
+ \li \c InputEngine.InputMode.Romaji Romaji input mode for Japanese.
\endlist
*/
@@ -889,6 +879,10 @@ void QVirtualKeyboardInputEngine::timerEvent(QTimerEvent *timerEvent)
Korean handwriting input mode.
\value Thai
Thai input mode.
+ \value Stroke
+ Stroke input mode for Chinese.
+ \value Romaji
+ Romaji input mode for Japanese.
*/
/*!
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputengine.h b/src/virtualkeyboard/qvirtualkeyboardinputengine.h
index f3deb657..4e1f9481 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputengine.h
+++ b/src/virtualkeyboard/qvirtualkeyboardinputengine.h
@@ -1,37 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QVIRTUALKEYBOARDINPUTENGINE_H
#define QVIRTUALKEYBOARDINPUTENGINE_H
-#include <QObject>
-#include <QPointer>
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
QT_BEGIN_NAMESPACE
@@ -42,7 +17,7 @@ class QVirtualKeyboardAbstractInputMethod;
class QVirtualKeyboardInputEnginePrivate;
class QVirtualKeyboardTrace;
-class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputEngine : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputEngine : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(QVirtualKeyboardInputEngine)
@@ -56,6 +31,10 @@ class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardInputEngine : public QObject
Q_PROPERTY(QVirtualKeyboardSelectionListModel *wordCandidateListModel READ wordCandidateListModel NOTIFY wordCandidateListModelChanged)
Q_PROPERTY(bool wordCandidateListVisibleHint READ wordCandidateListVisibleHint NOTIFY wordCandidateListVisibleHintChanged)
Q_MOC_INCLUDE("qvirtualkeyboardabstractinputmethod.h")
+ QML_NAMED_ELEMENT(InputEngine)
+ QML_UNCREATABLE("InputEngine is only available via InputContext.inputEngine")
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
explicit QVirtualKeyboardInputEngine(QVirtualKeyboardInputContext *parent = nullptr);
void init();
@@ -85,7 +64,9 @@ public:
ChineseHandwriting,
JapaneseHandwriting,
KoreanHandwriting,
- Thai
+ Thai,
+ Stroke,
+ Romaji,
};
Q_ENUM(InputMode)
diff --git a/src/virtualkeyboard/qvirtualkeyboardnamespace_p.h b/src/virtualkeyboard/qvirtualkeyboardnamespace_p.h
new file mode 100644
index 00000000..60587a50
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardnamespace_p.h
@@ -0,0 +1,70 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QVIRTUALKEYBOARDNAMESPACE_P_H
+#define QVIRTUALKEYBOARDNAMESPACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qmetaobject.h>
+#include <QtQml/qqml.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtVirtualKeyboard {
+
+Q_VIRTUALKEYBOARD_EXPORT Q_NAMESPACE
+QML_NAMED_ELEMENT(QtVirtualKeyboard)
+QML_ADDED_IN_VERSION(6, 4)
+
+enum class KeyType {
+ BaseKey,
+ BackspaceKey,
+ ChangeLanguageKey,
+ EnterKey,
+ FillerKey,
+ HandwritingModeKey,
+ HideKeyboardKey,
+ InputModeKey,
+ Key,
+ ModeKey,
+ NumberKey,
+ ShiftKey,
+ SpaceKey,
+ SymbolModeKey,
+ FlickKey,
+};
+Q_ENUM_NS(KeyType)
+
+enum class KeyboardFunction {
+ HideInputPanel,
+ ChangeLanguage,
+ ToggleHandwritingMode,
+};
+Q_ENUM_NS(KeyboardFunction)
+
+enum class KeyboardFunctionKey : quint32 {
+ None = 0,
+ Hide = 0x1,
+ Language = 0x2,
+ All = 0xffffffff,
+};
+Q_DECLARE_FLAGS(KeyboardFunctionKeys, KeyboardFunctionKey)
+Q_DECLARE_OPERATORS_FOR_FLAGS(KeyboardFunctionKeys)
+Q_FLAG_NS(KeyboardFunctionKeys)
+
+} // namespace QtVirtualKeyboard
+
+QT_END_NAMESPACE
+
+#endif // QVIRTUALKEYBOARDNAMESPACE_P_H
diff --git a/src/virtualkeyboard/qvirtualkeyboardobserver.cpp b/src/virtualkeyboard/qvirtualkeyboardobserver.cpp
new file mode 100644
index 00000000..fc2e57ed
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardobserver.cpp
@@ -0,0 +1,65 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "qvirtualkeyboardobserver.h"
+
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardObserverPrivate : public QObjectPrivate
+{
+public:
+ QVirtualKeyboardObserverPrivate()
+ {}
+
+ QVariant layout;
+};
+
+/*!
+ \qmltype KeyboardObserver
+ \instantiates QVirtualKeyboardObserver
+ \inqmlmodule QtQuick.VirtualKeyboard
+ \ingroup qtvirtualkeyboard-internal-qml
+ \brief Acts as a hub for keyboard event notifications.
+*/
+
+/*!
+ \class QVirtualKeyboardObserver
+ \inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
+ \brief Acts as a hub for keyboard event notifications.
+*/
+
+QVirtualKeyboardObserver::QVirtualKeyboardObserver(QObject *parent) :
+ QObject(*new QVirtualKeyboardObserverPrivate, parent)
+{
+ connect(this, &QVirtualKeyboardObserver::layoutChanged, this, &QVirtualKeyboardObserver::invalidateLayout);
+}
+
+/*!
+ \property QVirtualKeyboardObserver::layout
+ \brief The current keyboard layout expressed as a variant.
+*/
+/*!
+ \qmlproperty variant KeyboardObserver::layout
+ \readonly
+ \brief The current keyboard layout expressed as a variant.
+*/
+QVariant QVirtualKeyboardObserver::layout()
+{
+ Q_D(QVirtualKeyboardObserver);
+
+ if (d->layout.isNull())
+ QMetaObject::invokeMethod(this, "scanLayout", Q_RETURN_ARG(QVariant, d->layout));
+
+ return d->layout;
+}
+
+void QVirtualKeyboardObserver::invalidateLayout()
+{
+ Q_D(QVirtualKeyboardObserver);
+ d->layout = QVariant();
+}
+
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/qvirtualkeyboardobserver.h b/src/virtualkeyboard/qvirtualkeyboardobserver.h
new file mode 100644
index 00000000..7609a521
--- /dev/null
+++ b/src/virtualkeyboard/qvirtualkeyboardobserver.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef QVIRTUALKEYBOARDOBSERVER_H
+#define QVIRTUALKEYBOARDOBSERVER_H
+
+#include <QtCore/QObject>
+#include <QtCore/QVariant>
+#include <QtQml/qqml.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVirtualKeyboardObserverPrivate;
+
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardObserver : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QVirtualKeyboardObserver)
+ Q_DISABLE_COPY(QVirtualKeyboardObserver)
+ Q_PROPERTY(QVariant layout READ layout NOTIFY layoutChanged)
+ QML_NAMED_ELEMENT(KeyboardObserver)
+ QML_ADDED_IN_VERSION(6, 1)
+
+public:
+ explicit QVirtualKeyboardObserver(QObject *parent = nullptr);
+
+ QVariant layout();
+
+Q_SIGNALS:
+ void layoutChanged();
+
+private Q_SLOTS:
+ void invalidateLayout();
+};
+
+QT_END_NAMESPACE
+
+#endif // QVIRTUALKEYBOARDOBSERVER_H
diff --git a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
index d2cbc22e..9cece734 100644
--- a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/qvirtualkeyboardselectionlistmodel.h>
#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
@@ -60,7 +34,7 @@ public:
\qmltype SelectionListModel
\instantiates QVirtualKeyboardSelectionListModel
\inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
+ \ingroup qtvirtualkeyboard-internal-qml
\brief Provides a data model for the selection lists.
The SelectionListModel is a data model for word candidates
@@ -92,6 +66,7 @@ public:
\class QVirtualKeyboardSelectionListModel
\inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
\brief List model for selection lists.
@@ -170,6 +145,7 @@ void QVirtualKeyboardSelectionListModel::setDataSource(QVirtualKeyboardAbstractI
if (d->dataSource) {
disconnect(this, SLOT(selectionListChanged(Type)));
disconnect(this, SLOT(selectionListActiveItemChanged(Type, int)));
+ disconnect(this, SLOT(dataSourceDestroyed()));
}
d->type = type;
if (d->dataSource) {
@@ -181,6 +157,7 @@ void QVirtualKeyboardSelectionListModel::setDataSource(QVirtualKeyboardAbstractI
if (d->dataSource) {
QObject::connect(d->dataSource.data(), &QVirtualKeyboardAbstractInputMethod::selectionListChanged, this, &QVirtualKeyboardSelectionListModel::selectionListChanged);
QObject::connect(d->dataSource.data(), &QVirtualKeyboardAbstractInputMethod::selectionListActiveItemChanged, this, &QVirtualKeyboardSelectionListModel::selectionListActiveItemChanged);
+ QObject::connect(d->dataSource.data(), &QObject::destroyed, this, &QVirtualKeyboardSelectionListModel::dataSourceDestroyed);
}
}
@@ -209,7 +186,14 @@ int QVirtualKeyboardSelectionListModel::rowCount(const QModelIndex &parent) cons
QVariant QVirtualKeyboardSelectionListModel::data(const QModelIndex &index, int role) const
{
Q_D(const QVirtualKeyboardSelectionListModel);
- return d->dataSource ? d->dataSource->selectionListData(d->type, index.row(), static_cast<Role>(role)) : QVariant();
+
+ if (!d->dataSource)
+ return QVariant();
+
+ if (index.row() < 0 || index.row() >= d->rowCount)
+ return QVariant();
+
+ return d->dataSource->selectionListData(d->type, index.row(), static_cast<Role>(role));
}
/*!
@@ -312,7 +296,7 @@ void QVirtualKeyboardSelectionListModel::selectionListChanged(QVirtualKeyboardSe
if (static_cast<QVirtualKeyboardSelectionListModel::Type>(type) == QVirtualKeyboardSelectionListModel::Type::WordCandidateList)
d->wclAutoCommitWord = ((oldCount > 1 || (oldCount == 1 && d->wclAutoCommitWord)) && newCount == 1 &&
Settings::instance()->wclAutoCommitWord() &&
- dataAt(0).toString().length() > 1);
+ dataAt(0).toString().size() > 1);
if (d->rowCount != oldCount)
emit countChanged();
}
@@ -332,6 +316,16 @@ void QVirtualKeyboardSelectionListModel::selectionListActiveItemChanged(QVirtual
}
/*!
+ \internal
+*/
+void QVirtualKeyboardSelectionListModel::dataSourceDestroyed()
+{
+ Q_D(QVirtualKeyboardSelectionListModel);
+ selectionListChanged(d->type);
+ selectionListActiveItemChanged(d->type, -1);
+}
+
+/*!
\qmlsignal void SelectionListModel::activeItemChanged(int index)
This signal is emitted when the active item in the list changes. The
diff --git a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h
index 12382860..06fab1f6 100644
--- a/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h
+++ b/src/virtualkeyboard/qvirtualkeyboardselectionlistmodel.h
@@ -1,36 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QVIRTUALKEYBOARDSELECTIONLISTMODEL_H
#define QVIRTUALKEYBOARDSELECTIONLISTMODEL_H
-#include <QAbstractListModel>
+#include <QtCore/QAbstractListModel>
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
QT_BEGIN_NAMESPACE
@@ -39,11 +14,15 @@ class QVirtualKeyboardAbstractInputMethod;
class QVirtualKeyboardInputEngine;
class QVirtualKeyboardSelectionListModelPrivate;
-class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardSelectionListModel : public QAbstractListModel
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardSelectionListModel : public QAbstractListModel
{
Q_OBJECT
Q_DECLARE_PRIVATE(QVirtualKeyboardSelectionListModel)
Q_PROPERTY(int count READ count NOTIFY countChanged)
+ QML_NAMED_ELEMENT(SelectionListModel)
+ QML_UNCREATABLE("SelectionListModel is only available via InputEngine.wordCandidateListModel")
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
explicit QVirtualKeyboardSelectionListModel(QObject *parent = nullptr);
@@ -93,6 +72,7 @@ Q_SIGNALS:
protected Q_SLOTS:
void selectionListChanged(Type type);
void selectionListActiveItemChanged(Type type, int index);
+ void dataSourceDestroyed();
private:
friend class QVirtualKeyboardInputEngine;
diff --git a/src/virtualkeyboard/qvirtualkeyboardtrace.cpp b/src/virtualkeyboard/qvirtualkeyboardtrace.cpp
index 4f29d0ea..e3e5b8f4 100644
--- a/src/virtualkeyboard/qvirtualkeyboardtrace.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardtrace.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
#include <QtCore/private/qobject_p.h>
@@ -40,7 +14,8 @@ public:
traceId(0),
final(false),
canceled(false),
- opacity(1.0)
+ opacity(1.0),
+ hideTimer(0)
{ }
int traceId;
@@ -49,11 +24,13 @@ public:
bool final;
bool canceled;
qreal opacity;
+ int hideTimer;
};
/*!
\class QVirtualKeyboardTrace
\inmodule QtVirtualKeyboard
+ \ingroup qtvirtualkeyboard-cpp-for-devs
\since QtQuick.VirtualKeyboard 2.0
\brief Trace is a data model for touch input data.
@@ -115,7 +92,7 @@ public:
\qmltype Trace
\instantiates QVirtualKeyboardTrace
\inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
+ \ingroup qtvirtualkeyboard-internal-qml
\since QtQuick.VirtualKeyboard 2.0
\brief Trace is a data model for touch input data.
@@ -177,6 +154,7 @@ public:
QVirtualKeyboardTrace::QVirtualKeyboardTrace(QObject *parent) :
QObject(*new QVirtualKeyboardTracePrivate(), parent)
{
+ Q_ASSERT(parent);
}
/*! \internal */
@@ -384,6 +362,45 @@ void QVirtualKeyboardTrace::setOpacity(qreal opacity)
}
}
+/*! \qmlmethod void Trace::startHideTimer(int delayMs)
+
+ Starts a timer to set opacity to zero after \a delayMs. If called again
+ within \a delayMs, the timer is restarted.
+
+ With this function the input method can hide the trace from screen before
+ destroying the trace object, for example, to indicate that the trace has
+ been processed.
+
+ \since QtQuick.VirtualKeyboard.Styles 6.1
+*/
+
+/*! Starts a timer to set opacity to zero after \a delayMs. If called again
+ within \a delayMs, the timer is restarted.
+
+ With this function the input method can hide the trace from screen before
+ destroying the trace object, for example, to indicate that the trace has
+ been processed.
+
+ \since QtQuick.VirtualKeyboard.Styles 6.1
+*/
+
+void QVirtualKeyboardTrace::startHideTimer(int delayMs)
+{
+ Q_D(QVirtualKeyboardTrace);
+ if (d->hideTimer != 0) {
+ killTimer(d->hideTimer);
+ }
+ d->hideTimer = startTimer(delayMs);
+}
+
+void QVirtualKeyboardTrace::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event)
+ Q_D(QVirtualKeyboardTrace);
+ d->hideTimer = 0;
+ setOpacity(0);
+}
+
/*! \qmlproperty int Trace::traceId
Unique id of this Trace.
diff --git a/src/virtualkeyboard/qvirtualkeyboardtrace.h b/src/virtualkeyboard/qvirtualkeyboardtrace.h
index 18544742..84161f4d 100644
--- a/src/virtualkeyboard/qvirtualkeyboardtrace.h
+++ b/src/virtualkeyboard/qvirtualkeyboardtrace.h
@@ -1,45 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QVIRTUALKEYBOARDTRACE_H
#define QVIRTUALKEYBOARDTRACE_H
-#include <QObject>
-#include <QVariant>
-#include <QPointF>
+#include <QtCore/QObject>
+#include <QtCore/QVariant>
+#include <QtCore/QPointF>
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
QT_BEGIN_NAMESPACE
class QVirtualKeyboardTracePrivate;
-class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardTrace : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardTrace : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QVirtualKeyboardTrace)
@@ -49,6 +24,10 @@ class QVIRTUALKEYBOARD_EXPORT QVirtualKeyboardTrace : public QObject
Q_PROPERTY(bool final READ isFinal WRITE setFinal NOTIFY finalChanged)
Q_PROPERTY(bool canceled READ isCanceled WRITE setCanceled NOTIFY canceledChanged)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
+ QML_NAMED_ELEMENT(Trace)
+ QML_UNCREATABLE("Trace object is created by InputContext.inputEngine.traceBegin() function")
+ QML_ADDED_IN_VERSION(2, 0)
+
public:
explicit QVirtualKeyboardTrace(QObject *parent = nullptr);
~QVirtualKeyboardTrace();
@@ -76,6 +55,11 @@ public:
qreal opacity() const;
void setOpacity(qreal opacity);
+ Q_REVISION(6, 1) Q_INVOKABLE void startHideTimer(int delayMs);
+
+protected:
+ void timerEvent(QTimerEvent *event) override;
+
Q_SIGNALS:
void traceIdChanged(int traceId);
void channelsChanged();
diff --git a/src/virtualkeyboard/settings.cpp b/src/virtualkeyboard/settings.cpp
index 1d324687..15d66bbc 100644
--- a/src/virtualkeyboard/settings.cpp
+++ b/src/virtualkeyboard/settings.cpp
@@ -1,34 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/settings_p.h>
#include <QtCore/private/qobject_p.h>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+#include "virtualkeyboarddebug_p.h"
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
@@ -47,8 +25,29 @@ public:
wclAutoHideDelay(5000),
wclAlwaysVisible(false),
wclAutoCommitWord(false),
- fullScreenMode(false)
- {}
+ fullScreenMode(false),
+ userDataPath(QStringLiteral("%1/qtvirtualkeyboard")
+ .arg(QStandardPaths::writableLocation(
+ QStandardPaths::GenericConfigLocation))),
+ hwrTimeoutForAlphabetic(500),
+ hwrTimeoutForCjk(500),
+ handwritingModeDisabled(false),
+ defaultInputMethodDisabled(false),
+ defaultDictionaryDisabled(false),
+ visibleFunctionKeys(QtVirtualKeyboard::KeyboardFunctionKey::All),
+ closeOnReturn(false)
+ {
+ ensureUserDataPathExists();
+ }
+
+ void ensureUserDataPathExists() const
+ {
+ if (!userDataPath.isEmpty() && !QFileInfo::exists(userDataPath)) {
+ if (!QDir::root().mkpath(userDataPath)) {
+ VIRTUALKEYBOARD_WARN() << "Cannot create directory for user data" << userDataPath;
+ }
+ }
+ }
QString style;
QString styleName;
@@ -60,6 +59,15 @@ public:
bool wclAlwaysVisible;
bool wclAutoCommitWord;
bool fullScreenMode;
+ QString userDataPath;
+ int hwrTimeoutForAlphabetic;
+ int hwrTimeoutForCjk;
+ Qt::InputMethodHints inputMethodHints;
+ bool handwritingModeDisabled;
+ bool defaultInputMethodDisabled;
+ bool defaultDictionaryDisabled;
+ QtVirtualKeyboard::KeyboardFunctionKeys visibleFunctionKeys;
+ bool closeOnReturn;
};
static QScopedPointer<Settings> s_settingsInstance;
@@ -231,5 +239,141 @@ void Settings::setFullScreenMode(bool fullScreenMode)
}
}
+QString Settings::userDataPath() const
+{
+ Q_D(const Settings);
+ return d->userDataPath;
+}
+
+void Settings::setUserDataPath(const QString &userDataPath)
+{
+ Q_D(Settings);
+ if (d->userDataPath != userDataPath) {
+ d->userDataPath = userDataPath;
+ d->ensureUserDataPathExists();
+ emit userDataPathChanged();
+ }
+}
+
+int Settings::hwrTimeoutForAlphabetic() const
+{
+ Q_D(const Settings);
+ return d->hwrTimeoutForAlphabetic;
+}
+
+void Settings::setHwrTimeoutForAlphabetic(int hwrTimeoutForAlphabetic)
+{
+ Q_D(Settings);
+ if (d->hwrTimeoutForAlphabetic != hwrTimeoutForAlphabetic) {
+ d->hwrTimeoutForAlphabetic = hwrTimeoutForAlphabetic;
+ emit hwrTimeoutForAlphabeticChanged();
+ }
+}
+
+int Settings::hwrTimeoutForCjk() const
+{
+ Q_D(const Settings);
+ return d->hwrTimeoutForCjk;
+}
+
+void Settings::setHwrTimeoutForCjk(int hwrTimeoutForCjk)
+{
+ Q_D(Settings);
+ if (d->hwrTimeoutForCjk != hwrTimeoutForCjk) {
+ d->hwrTimeoutForCjk = hwrTimeoutForCjk;
+ emit hwrTimeoutForCjkChanged();
+ }
+}
+
+Qt::InputMethodHints Settings::inputMethodHints() const
+{
+ Q_D(const Settings);
+ return d->inputMethodHints;
+}
+
+void Settings::setInputMethodHints(const Qt::InputMethodHints &inputMethodHints)
+{
+ Q_D(Settings);
+ if (d->inputMethodHints != inputMethodHints) {
+ d->inputMethodHints = inputMethodHints;
+ emit inputMethodHintsChanged();
+ }
+}
+
+bool Settings::isHandwritingModeDisabled() const
+{
+ Q_D(const Settings);
+ return d->handwritingModeDisabled;
+}
+
+void Settings::setHandwritingModeDisabled(bool handwritingModeDisabled)
+{
+ Q_D(Settings);
+ if (d->handwritingModeDisabled != handwritingModeDisabled) {
+ d->handwritingModeDisabled = handwritingModeDisabled;
+ emit handwritingModeDisabledChanged();
+ }
+}
+
+bool Settings::isDefaultInputMethodDisabled() const
+{
+ Q_D(const Settings);
+ return d->defaultInputMethodDisabled;
+}
+
+void Settings::setDefaultInputMethodDisabled(bool defaultInputMethodDisabled)
+{
+ Q_D(Settings);
+ if (d->defaultInputMethodDisabled != defaultInputMethodDisabled) {
+ d->defaultInputMethodDisabled = defaultInputMethodDisabled;
+ emit defaultInputMethodDisabledChanged();
+ }
+}
+
+bool QtVirtualKeyboard::Settings::isDefaultDictionaryDisabled() const
+{
+ Q_D(const Settings);
+ return d->defaultDictionaryDisabled;
+}
+
+void QtVirtualKeyboard::Settings::setDefaultDictionaryDisabled(bool defaultDictionaryDisabled)
+{
+ Q_D(Settings);
+ if (d->defaultDictionaryDisabled != defaultDictionaryDisabled) {
+ d->defaultDictionaryDisabled = defaultDictionaryDisabled;
+ emit defaultDictionaryDisabledChanged();
+ }
+}
+
+QtVirtualKeyboard::KeyboardFunctionKeys Settings::visibleFunctionKeys() const
+{
+ Q_D(const Settings);
+ return d->visibleFunctionKeys;
+}
+
+void Settings::setVisibleFunctionKeys(QtVirtualKeyboard::KeyboardFunctionKeys newVisibleFunctionKeys)
+{
+ Q_D(Settings);
+ if (d->visibleFunctionKeys != newVisibleFunctionKeys) {
+ d->visibleFunctionKeys = newVisibleFunctionKeys;
+ emit visibleFunctionKeysChanged();
+ }
+}
+
+bool Settings::closeOnReturn() const
+{
+ Q_D(const Settings);
+ return d->closeOnReturn;
+}
+
+void Settings::setCloseOnReturn(bool enabled)
+{
+ Q_D(Settings);
+ if (d->closeOnReturn != enabled) {
+ d->closeOnReturn = enabled;
+ emit closeOnReturnChanged();
+ }
+}
+
} // namespace QtVirtualKeyboard
QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/settings_p.h b/src/virtualkeyboard/settings_p.h
index 843592fe..4efd757f 100644
--- a/src/virtualkeyboard/settings_p.h
+++ b/src/virtualkeyboard/settings_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SETTINGS_P_H
#define SETTINGS_P_H
@@ -41,16 +15,18 @@
// We mean it.
//
+#include "qvirtualkeyboardnamespace_p.h"
#include <QObject>
#include <QUrl>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
class SettingsPrivate;
-class QVIRTUALKEYBOARD_EXPORT Settings : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT Settings : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Settings)
@@ -91,6 +67,33 @@ public:
bool fullScreenMode() const;
void setFullScreenMode(bool fullScreenMode);
+ QString userDataPath() const;
+ void setUserDataPath(const QString &userDataPath);
+
+ int hwrTimeoutForAlphabetic() const;
+ void setHwrTimeoutForAlphabetic(int hwrTimeoutForAlphabetic);
+
+ int hwrTimeoutForCjk() const;
+ void setHwrTimeoutForCjk(int hwrTimeoutForCjk);
+
+ Qt::InputMethodHints inputMethodHints() const;
+ void setInputMethodHints(const Qt::InputMethodHints &inputMethodHints);
+
+ bool isHandwritingModeDisabled() const;
+ void setHandwritingModeDisabled(bool handwritingModeDisabled);
+
+ bool isDefaultInputMethodDisabled() const;
+ void setDefaultInputMethodDisabled(bool defaultInputMethodDisabled);
+
+ bool isDefaultDictionaryDisabled() const;
+ void setDefaultDictionaryDisabled(bool defaultDictionaryDisabled);
+
+ QtVirtualKeyboard::KeyboardFunctionKeys visibleFunctionKeys() const;
+ void setVisibleFunctionKeys(QtVirtualKeyboard::KeyboardFunctionKeys newVisibleFunctionKeys);
+
+ bool closeOnReturn() const;
+ void setCloseOnReturn(bool enable);
+
signals:
void styleChanged();
void styleNameChanged();
@@ -102,6 +105,16 @@ signals:
void wclAlwaysVisibleChanged();
void wclAutoCommitWordChanged();
void fullScreenModeChanged();
+ void userDataPathChanged();
+ void userDataReset();
+ void hwrTimeoutForAlphabeticChanged();
+ void hwrTimeoutForCjkChanged();
+ void inputMethodHintsChanged();
+ void handwritingModeDisabledChanged();
+ void defaultInputMethodDisabledChanged();
+ void defaultDictionaryDisabledChanged();
+ void visibleFunctionKeysChanged();
+ void closeOnReturnChanged();
};
} // namespace QtVirtualKeyboard
diff --git a/src/virtualkeyboard/shadowinputcontext.cpp b/src/virtualkeyboard/shadowinputcontext.cpp
index 2390e04c..c7a5387c 100644
--- a/src/virtualkeyboard/shadowinputcontext.cpp
+++ b/src/virtualkeyboard/shadowinputcontext.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/shadowinputcontext_p.h>
#include <QtVirtualKeyboard/qvirtualkeyboardinputcontext.h>
@@ -36,7 +10,6 @@
#include <QQuickItem>
QT_BEGIN_NAMESPACE
-bool operator==(const QInputMethodEvent::Attribute &attribute1, const QInputMethodEvent::Attribute &attribute2);
namespace QtVirtualKeyboard {
@@ -133,6 +106,8 @@ void ShadowInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, con
if (success) {
int cursor = queryFocusObject(Qt::ImCursorPosition, quickItem ? quickItem->mapFromScene(cursorPos) : cursorPos).toInt(&success);
if (success) {
+ if (anchor == cursor && anchorPos != cursorPos)
+ return;
QList<QInputMethodEvent::Attribute> imAttributes;
imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant()));
QInputMethodEvent event(QString(), imAttributes);
@@ -203,22 +178,28 @@ void ShadowInputContext::update(Qt::InputMethodQueries queries)
const int newCursorPosition = d->inputContext->cursorPosition();
const int newAnchorPosition = d->inputContext->anchorPosition();
+ const QString newPreeditText = d->inputContext->preeditText();
+ const QList<QInputMethodEvent::Attribute> newPreeditAttributes = d->inputContext->preeditTextAttributes();
+
bool updateSurroundingText = newSurroundingText != surroundingText;
bool updateSelection = newCursorPosition != cursorPosition || newAnchorPosition != anchorPosition;
+ if (updateSurroundingText) {
+ QInputMethodEvent inputEvent;
+ inputEvent.setCommitString(newSurroundingText, -cursorPosition, surroundingText.size());
+ QGuiApplication::sendEvent(d->inputItem, &inputEvent);
+ }
+
if (updateSurroundingText || updateSelection) {
QList<QInputMethodEvent::Attribute> attributes;
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection,
newAnchorPosition,
newCursorPosition - newAnchorPosition, QVariant()));
QInputMethodEvent inputEvent(QString(), attributes);
- if (updateSurroundingText)
- inputEvent.setCommitString(newSurroundingText, -cursorPosition, surroundingText.length());
QGuiApplication::sendEvent(d->inputItem, &inputEvent);
}
- const QString newPreeditText = d->inputContext->preeditText();
- const QList<QInputMethodEvent::Attribute> newPreeditAttributes = d->inputContext->preeditTextAttributes();
- if (d->preeditText != newPreeditText || d->preeditTextAttributes != newPreeditAttributes) {
+ const bool forcePreeditText = !newPreeditText.isEmpty() && (updateSurroundingText || updateSelection);
+ if (forcePreeditText || d->preeditText != newPreeditText || d->preeditTextAttributes != newPreeditAttributes) {
d->preeditText = newPreeditText;
d->preeditTextAttributes = newPreeditAttributes;
QInputMethodEvent inputEvent(d->preeditText, d->preeditTextAttributes);
diff --git a/src/virtualkeyboard/shadowinputcontext_p.h b/src/virtualkeyboard/shadowinputcontext_p.h
index f77aba08..aa07ddb6 100644
--- a/src/virtualkeyboard/shadowinputcontext_p.h
+++ b/src/virtualkeyboard/shadowinputcontext_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SHADOWINPUTCONTEXT_P_H
#define SHADOWINPUTCONTEXT_P_H
@@ -45,7 +19,9 @@
#include <QPointer>
#include <QMetaType>
#include <QRectF>
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +32,7 @@ namespace QtVirtualKeyboard {
class ShadowInputContextPrivate;
-class QVIRTUALKEYBOARD_EXPORT ShadowInputContext : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT ShadowInputContext : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(ShadowInputContext)
@@ -67,6 +43,9 @@ class QVIRTUALKEYBOARD_EXPORT ShadowInputContext : public QObject
Q_PROPERTY(bool anchorRectIntersectsClipRect READ anchorRectIntersectsClipRect NOTIFY anchorRectIntersectsClipRectChanged)
Q_PROPERTY(bool cursorRectIntersectsClipRect READ cursorRectIntersectsClipRect NOTIFY cursorRectIntersectsClipRectChanged)
Q_PROPERTY(bool selectionControlVisible READ selectionControlVisible NOTIFY selectionControlVisibleChanged)
+ QML_NAMED_ELEMENT(ShadowInputContext)
+ QML_UNCREATABLE("ShadowInputContext is only available via InputContext.priv.shadow")
+ QML_ADDED_IN_VERSION(2, 0)
explicit ShadowInputContext(QObject *parent = nullptr);
diff --git a/src/virtualkeyboard/shifthandler.cpp b/src/virtualkeyboard/shifthandler.cpp
index f170ee59..559f9752 100644
--- a/src/virtualkeyboard/shifthandler.cpp
+++ b/src/virtualkeyboard/shifthandler.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/shifthandler_p.h>
#include <QtVirtualKeyboard/private/qvirtualkeyboardinputcontext_p.h>
@@ -38,6 +12,12 @@
#include <QStyleHints>
QT_BEGIN_NAMESPACE
+
+size_t qHash(QLocale::Language lang, size_t seed)
+{
+ return qHash(ushort(lang), seed);
+}
+
namespace QtVirtualKeyboard {
class ShiftHandlerPrivate : public QObjectPrivate
@@ -55,7 +35,7 @@ public:
resetWhenVisible(false),
manualShiftLanguageFilter(QSet<QLocale::Language>() << QLocale::Arabic << QLocale::Persian << QLocale::Hindi << QLocale::Korean << QLocale::Thai),
manualCapsInputModeFilter(QSet<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::Cangjie << QVirtualKeyboardInputEngine::InputMode::Zhuyin << QVirtualKeyboardInputEngine::InputMode::Hebrew),
- noAutoUppercaseInputModeFilter(QSet<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::FullwidthLatin << QVirtualKeyboardInputEngine::InputMode::Pinyin << QVirtualKeyboardInputEngine::InputMode::Cangjie << QVirtualKeyboardInputEngine::InputMode::Zhuyin << QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting << QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting << QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting),
+ noAutoUppercaseInputModeFilter(QSet<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::FullwidthLatin << QVirtualKeyboardInputEngine::InputMode::Pinyin << QVirtualKeyboardInputEngine::InputMode::Cangjie << QVirtualKeyboardInputEngine::InputMode::Zhuyin << QVirtualKeyboardInputEngine::InputMode::ChineseHandwriting << QVirtualKeyboardInputEngine::InputMode::JapaneseHandwriting << QVirtualKeyboardInputEngine::InputMode::KoreanHandwriting << QVirtualKeyboardInputEngine::InputMode::Romaji),
allCapsInputModeFilter(QSet<QVirtualKeyboardInputEngine::InputMode>() << QVirtualKeyboardInputEngine::InputMode::Hiragana << QVirtualKeyboardInputEngine::InputMode::Katakana)
{
}
@@ -79,7 +59,7 @@ public:
/*!
\qmltype ShiftHandler
\inqmlmodule QtQuick.VirtualKeyboard
- \ingroup qtvirtualkeyboard-qml
+ \ingroup qtvirtualkeyboard-internal-qml
\instantiates QtVirtualKeyboard::ShiftHandler
\brief Manages the shift state.
*/
@@ -301,7 +281,7 @@ void ShiftHandler::autoCapitalize()
} else { // space after sentence-ending character triggers auto-capitalization
QString text = d->inputContext->surroundingText();
text.truncate(cursorPosition);
- if (text.trimmed().length() == 0)
+ if (text.trimmed().size() == 0)
setShiftActive(!preferLowerCase);
else if (text.endsWith(QLatin1Char(' ')))
setShiftActive(d->sentenceEndingCharacters.contains(QStringView{text}.right(2)[0])
diff --git a/src/virtualkeyboard/shifthandler_p.h b/src/virtualkeyboard/shifthandler_p.h
index 1dcce96c..e520402e 100644
--- a/src/virtualkeyboard/shifthandler_p.h
+++ b/src/virtualkeyboard/shifthandler_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SHIFTHANDLER_P_H
#define SHIFTHANDLER_P_H
@@ -42,7 +16,9 @@
//
#include <QObject>
+#include <QtQml/qqml.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -53,7 +29,7 @@ namespace QtVirtualKeyboard {
class ShiftHandlerPrivate;
-class QVIRTUALKEYBOARD_EXPORT ShiftHandler : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT ShiftHandler : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(ShiftHandler)
@@ -64,6 +40,10 @@ class QVIRTUALKEYBOARD_EXPORT ShiftHandler : public QObject
Q_PROPERTY(bool shiftActive READ isShiftActive WRITE setShiftActive NOTIFY shiftActiveChanged)
Q_PROPERTY(bool capsLockActive READ isCapsLockActive WRITE setCapsLockActive NOTIFY capsLockActiveChanged)
Q_PROPERTY(bool uppercase READ isUppercase NOTIFY uppercaseChanged)
+ QML_NAMED_ELEMENT(ShiftHandler)
+ QML_UNCREATABLE("ShiftHandler is only available via InputContextPrivate.shiftHandler")
+ QML_ADDED_IN_VERSION(1, 0)
+ QML_EXTRA_VERSION(2, 0)
explicit ShiftHandler(QVirtualKeyboardInputContext *parent = nullptr);
void init();
diff --git a/src/virtualkeyboard/unipentrace.cpp b/src/virtualkeyboard/unipentrace.cpp
index eca531c2..123ffcbd 100644
--- a/src/virtualkeyboard/unipentrace.cpp
+++ b/src/virtualkeyboard/unipentrace.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard/private/unipentrace_p.h>
#include <QRectF>
@@ -65,7 +39,7 @@ UnipenTrace::UnipenTrace(const QVariantMap &traceCaptureDeviceInfo,
void UnipenTrace::record(const QList<QVirtualKeyboardTrace *> &traceList)
{
qlonglong t0 = 0;
- for (const QVirtualKeyboardTrace *trace : qAsConst(traceList)) {
+ for (const QVirtualKeyboardTrace *trace : std::as_const(traceList)) {
const QVariantList &points = trace->points();
const bool hasTime = trace->channels().contains(QLatin1String("t"));
const QVariantList timeData = hasTime ? trace->channelData(QLatin1String("t")) : QVariantList();
diff --git a/src/virtualkeyboard/unipentrace_p.h b/src/virtualkeyboard/unipentrace_p.h
index 09441e59..ec058c32 100644
--- a/src/virtualkeyboard/unipentrace_p.h
+++ b/src/virtualkeyboard/unipentrace_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef UNIPENTRACE_H
#define UNIPENTRACE_H
@@ -44,11 +18,12 @@
#include <QObject>
#include <QtVirtualKeyboard/qvirtualkeyboardtrace.h>
#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
-class QVIRTUALKEYBOARD_EXPORT UnipenTrace : public QObject
+class Q_VIRTUALKEYBOARD_EXPORT UnipenTrace : public QObject
{
Q_OBJECT
public:
diff --git a/src/virtualkeyboard/virtualkeyboard.cpp b/src/virtualkeyboard/virtualkeyboard.cpp
new file mode 100644
index 00000000..6b2fa50d
--- /dev/null
+++ b/src/virtualkeyboard/virtualkeyboard.cpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtVirtualKeyboard/private/virtualkeyboard_p.h>
+#include <QtVirtualKeyboard/private/virtualkeyboardattachedtype_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \qmltype VirtualKeyboard
+ \inqmlmodule QtQuick.VirtualKeyboard
+ \ingroup qmlclass
+ \ingroup qtvirtualkeyboard-qml
+ \brief Provides attached properties for customizing the virtual keyboard.
+ \since QtQuick.VirtualKeyboard 6.1
+
+ The VirtualKeyboard type provides attached properties which allow
+ customizing the virtual keyboard, such as attaching custom dictionaries.
+
+ The VirtualKeyboard must be used directly inside the item
+ receiving input focus, e.g. TextInput.
+
+ For example:
+ \code
+ TextInput {
+ VirtualKeyboard.extraDictionaries: ["myDictionary"]
+ }
+ \endcode
+*/
+
+/*!
+ \class QtVirtualKeyboard::VirtualKeyboard
+ \internal
+*/
+
+/*!
+ \internal
+*/
+VirtualKeyboardAttachedType *VirtualKeyboard::qmlAttachedProperties(QObject *object)
+{
+ return new VirtualKeyboardAttachedType(object);
+}
+
+/*!
+ \qmlattachedproperty list VirtualKeyboard::extraDictionaries
+
+ Sets active user dictionaries in this context.
+*/
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/virtualkeyboard.pro b/src/virtualkeyboard/virtualkeyboard.pro
deleted file mode 100644
index 37e695cc..00000000
--- a/src/virtualkeyboard/virtualkeyboard.pro
+++ /dev/null
@@ -1,433 +0,0 @@
-TARGET = QtVirtualKeyboard
-MODULE = virtualkeyboard
-MODULE_PLUGIN_TYPES = virtualkeyboard
-
-include(../shared.pri)
-
-QMAKE_DOCS = $$PWD/doc/qtvirtualkeyboard.qdocconf
-include(doc/doc.pri)
-
-QT += qml quick gui gui-private core-private
-CONFIG += qtquickcompiler
-
-qtConfig(vkb-sensitive-debug) {
- MODULE_DEFINES += SENSITIVE_DEBUG
-}
-
-
-DEFINES += QVIRTUALKEYBOARD_LIBRARY
-
-SOURCES += \
- platforminputcontext.cpp \
- qvirtualkeyboardinputcontext.cpp \
- qvirtualkeyboardinputcontext_p.cpp \
- qvirtualkeyboardabstractinputmethod.cpp \
- plaininputmethod.cpp \
- qvirtualkeyboardinputengine.cpp \
- shifthandler.cpp \
- inputmethod.cpp \
- inputselectionhandle.cpp \
- qvirtualkeyboardselectionlistmodel.cpp \
- fallbackinputmethod.cpp \
- abstractinputpanel.cpp \
- appinputpanel.cpp \
- enterkeyaction.cpp \
- enterkeyactionattachedtype.cpp \
- settings.cpp \
- virtualkeyboardsettings.cpp \
- qvirtualkeyboardtrace.cpp \
- desktopinputselectioncontrol.cpp \
- shadowinputcontext.cpp \
- gesturerecognizer.cpp \
- handwritinggesturerecognizer.cpp \
- qvirtualkeyboardextensionplugin.cpp
-
-HEADERS += \
- platforminputcontext_p.h \
- qvirtualkeyboardinputcontext.h \
- qvirtualkeyboardinputcontext_p.h \
- qvirtualkeyboardabstractinputmethod.h \
- plaininputmethod_p.h \
- qvirtualkeyboardinputengine.h \
- shifthandler_p.h \
- inputmethod_p.h \
- inputselectionhandle_p.h \
- qvirtualkeyboardselectionlistmodel.h \
- fallbackinputmethod_p.h \
- abstractinputpanel_p.h \
- appinputpanel_p.h \
- appinputpanel_p_p.h \
- virtualkeyboarddebug_p.h \
- enterkeyaction_p.h \
- enterkeyactionattachedtype_p.h \
- settings_p.h \
- virtualkeyboardsettings_p.h \
- qvirtualkeyboardtrace.h \
- desktopinputselectioncontrol_p.h \
- shadowinputcontext_p.h \
- gesturerecognizer_p.h \
- handwritinggesturerecognizer_p.h \
- qvirtualkeyboard_global.h \
- qvirtualkeyboard_global_p.h \
- qvirtualkeyboardextensionplugin.h \
- qvirtualkeyboard_staticplugin_p.h
-
-!no-builtin-style: RESOURCES += \
- content/styles/default/virtualkeyboard_default_style.qrc \
- content/styles/retro/virtualkeyboard_retro_style.qrc
-
-RESOURCES += \
- content/virtualkeyboard_content.qrc
-
-# Fallback for languages which don't have these special layouts
-LAYOUT_FILES += \
- content/layouts/fallback/dialpad.qml \
- content/layouts/fallback/digits.qml \
- content/layouts/fallback/numbers.qml \
- content/layouts/fallback/main.qml \
- content/layouts/fallback/symbols.qml
-qtConfig(vkb-lang-en_GB) {
- LAYOUT_FILES += \
- content/layouts/en_GB/dialpad.fallback \
- content/layouts/en_GB/digits.fallback \
- content/layouts/en_GB/main.fallback \
- content/layouts/en_GB/numbers.fallback \
- content/layouts/en_GB/symbols.fallback
-}
-qtConfig(vkb-lang-en_US) {
- LAYOUT_FILES += \
- content/layouts/en_US/dialpad.fallback \
- content/layouts/en_US/digits.fallback \
- content/layouts/en_US/main.fallback \
- content/layouts/en_US/numbers.fallback \
- content/layouts/en_US/symbols.fallback
-}
-qtConfig(vkb-lang-ar_AR) {
- LAYOUT_FILES += \
- content/layouts/ar_AR/dialpad.fallback \
- content/layouts/ar_AR/digits.qml \
- content/layouts/ar_AR/main.qml \
- content/layouts/ar_AR/numbers.qml \
- content/layouts/ar_AR/symbols.qml
-}
-qtConfig(vkb-lang-bg_BG) {
- LAYOUT_FILES += \
- content/layouts/bg_BG/dialpad.fallback \
- content/layouts/bg_BG/digits.fallback \
- content/layouts/bg_BG/main.qml \
- content/layouts/bg_BG/numbers.fallback \
- content/layouts/bg_BG/symbols.fallback
-}
-qtConfig(vkb-lang-cs_CZ) {
- LAYOUT_FILES += \
- content/layouts/cs_CZ/dialpad.fallback \
- content/layouts/cs_CZ/digits.fallback \
- content/layouts/cs_CZ/main.qml \
- content/layouts/cs_CZ/numbers.fallback \
- content/layouts/cs_CZ/symbols.fallback
-}
-qtConfig(vkb-lang-da_DK) {
- LAYOUT_FILES += \
- content/layouts/da_DK/dialpad.fallback \
- content/layouts/da_DK/digits.fallback \
- content/layouts/da_DK/main.qml \
- content/layouts/da_DK/numbers.fallback \
- content/layouts/da_DK/symbols.fallback
-}
-qtConfig(vkb-lang-de_DE) {
- LAYOUT_FILES += \
- content/layouts/de_DE/dialpad.fallback \
- content/layouts/de_DE/digits.fallback \
- content/layouts/de_DE/main.qml \
- content/layouts/de_DE/numbers.fallback \
- content/layouts/de_DE/symbols.fallback
-}
-qtConfig(vkb-lang-el_GR) {
- LAYOUT_FILES += \
- content/layouts/el_GR/dialpad.fallback \
- content/layouts/el_GR/digits.fallback \
- content/layouts/el_GR/main.qml \
- content/layouts/el_GR/numbers.fallback \
- content/layouts/el_GR/symbols.fallback
-}
-qtConfig(vkb-lang-es_ES) {
- LAYOUT_FILES += \
- content/layouts/es_ES/dialpad.fallback \
- content/layouts/es_ES/digits.fallback \
- content/layouts/es_ES/main.qml \
- content/layouts/es_ES/numbers.fallback \
- content/layouts/es_ES/symbols.qml
-}
-qtConfig(vkb-lang-es_MX) {
- LAYOUT_FILES += \
- content/layouts/es_MX/dialpad.fallback \
- content/layouts/es_MX/digits.fallback \
- content/layouts/es_MX/main.qml \
- content/layouts/es_MX/numbers.fallback \
- content/layouts/es_MX/symbols.qml
-}
-qtConfig(vkb-lang-et_EE) {
- LAYOUT_FILES += \
- content/layouts/et_EE/dialpad.fallback \
- content/layouts/et_EE/digits.fallback \
- content/layouts/et_EE/main.qml \
- content/layouts/et_EE/numbers.fallback \
- content/layouts/et_EE/symbols.fallback
-}
-qtConfig(vkb-lang-fa_FA) {
- LAYOUT_FILES += \
- content/layouts/fa_FA/dialpad.fallback \
- content/layouts/fa_FA/digits.qml \
- content/layouts/fa_FA/main.qml \
- content/layouts/fa_FA/numbers.qml \
- content/layouts/fa_FA/symbols.qml
-}
-qtConfig(vkb-lang-fi_FI) {
- LAYOUT_FILES += \
- content/layouts/fi_FI/dialpad.fallback \
- content/layouts/fi_FI/digits.fallback \
- content/layouts/fi_FI/main.qml \
- content/layouts/fi_FI/numbers.fallback \
- content/layouts/fi_FI/symbols.fallback
-}
-qtConfig(vkb-lang-fr_CA) {
- LAYOUT_FILES += \
- content/layouts/fr_CA/dialpad.fallback \
- content/layouts/fr_CA/digits.fallback \
- content/layouts/fr_CA/main.qml \
- content/layouts/fr_CA/numbers.fallback \
- content/layouts/fr_CA/symbols.fallback
-}
-qtConfig(vkb-lang-fr_FR) {
- LAYOUT_FILES += \
- content/layouts/fr_FR/dialpad.fallback \
- content/layouts/fr_FR/digits.fallback \
- content/layouts/fr_FR/main.qml \
- content/layouts/fr_FR/numbers.fallback \
- content/layouts/fr_FR/symbols.fallback
-}
-qtConfig(vkb-lang-he_IL) {
- LAYOUT_FILES += \
- content/layouts/he_IL/dialpad.fallback \
- content/layouts/he_IL/digits.fallback \
- content/layouts/he_IL/main.qml \
- content/layouts/he_IL/numbers.fallback \
- content/layouts/he_IL/symbols.qml
-}
-qtConfig(vkb-lang-hi_IN) {
- LAYOUT_FILES += \
- content/layouts/hi_IN/dialpad.fallback \
- content/layouts/hi_IN/digits.fallback \
- content/layouts/hi_IN/main.qml \
- content/layouts/hi_IN/numbers.fallback \
- content/layouts/hi_IN/symbols.qml
-}
-qtConfig(vkb-lang-hr_HR) {
- LAYOUT_FILES += \
- content/layouts/hr_HR/dialpad.fallback \
- content/layouts/hr_HR/digits.fallback \
- content/layouts/hr_HR/main.qml \
- content/layouts/hr_HR/numbers.fallback \
- content/layouts/hr_HR/symbols.fallback
-}
-qtConfig(vkb-lang-hu_HU) {
- LAYOUT_FILES += \
- content/layouts/hu_HU/dialpad.fallback \
- content/layouts/hu_HU/digits.fallback \
- content/layouts/hu_HU/main.qml \
- content/layouts/hu_HU/numbers.fallback \
- content/layouts/hu_HU/symbols.fallback
-}
-qtConfig(vkb-lang-id_ID) {
- LAYOUT_FILES += \
- content/layouts/id_ID/dialpad.fallback \
- content/layouts/id_ID/digits.fallback \
- content/layouts/id_ID/main.fallback \
- content/layouts/id_ID/numbers.fallback \
- content/layouts/id_ID/symbols.fallback
-}
-qtConfig(vkb-lang-it_IT) {
- LAYOUT_FILES += \
- content/layouts/it_IT/dialpad.fallback \
- content/layouts/it_IT/digits.fallback \
- content/layouts/it_IT/main.qml \
- content/layouts/it_IT/numbers.fallback \
- content/layouts/it_IT/symbols.fallback
-}
-qtConfig(vkb-lang-nb_NO) {
- LAYOUT_FILES += \
- content/layouts/nb_NO/dialpad.fallback \
- content/layouts/nb_NO/digits.fallback \
- content/layouts/nb_NO/main.qml \
- content/layouts/nb_NO/numbers.fallback \
- content/layouts/nb_NO/symbols.fallback
-}
-qtConfig(vkb-lang-ms_MY) {
- LAYOUT_FILES += \
- content/layouts/ms_MY/dialpad.fallback \
- content/layouts/ms_MY/digits.fallback \
- content/layouts/ms_MY/main.fallback \
- content/layouts/ms_MY/numbers.fallback \
- content/layouts/ms_MY/symbols.fallback
-}
-qtConfig(vkb-lang-nl_NL) {
- LAYOUT_FILES += \
- content/layouts/nl_NL/dialpad.fallback \
- content/layouts/nl_NL/digits.fallback \
- content/layouts/nl_NL/main.fallback \
- content/layouts/nl_NL/numbers.fallback \
- content/layouts/nl_NL/symbols.fallback
-}
-qtConfig(vkb-lang-pl_PL) {
- LAYOUT_FILES += \
- content/layouts/pl_PL/dialpad.fallback \
- content/layouts/pl_PL/digits.fallback \
- content/layouts/pl_PL/main.qml \
- content/layouts/pl_PL/numbers.fallback \
- content/layouts/pl_PL/symbols.fallback
-}
-qtConfig(vkb-lang-pt_BR) {
- LAYOUT_FILES += \
- content/layouts/pt_BR/dialpad.fallback \
- content/layouts/pt_BR/digits.fallback \
- content/layouts/pt_BR/main.qml \
- content/layouts/pt_BR/numbers.fallback \
- content/layouts/pt_BR/symbols.fallback
-}
-qtConfig(vkb-lang-pt_PT) {
- LAYOUT_FILES += \
- content/layouts/pt_PT/dialpad.fallback \
- content/layouts/pt_PT/digits.fallback \
- content/layouts/pt_PT/main.qml \
- content/layouts/pt_PT/numbers.fallback \
- content/layouts/pt_PT/symbols.fallback
-}
-qtConfig(vkb-lang-ro_RO) {
- LAYOUT_FILES += \
- content/layouts/ro_RO/dialpad.fallback \
- content/layouts/ro_RO/digits.fallback \
- content/layouts/ro_RO/main.qml \
- content/layouts/ro_RO/numbers.fallback \
- content/layouts/ro_RO/symbols.fallback
-}
-qtConfig(vkb-lang-ru_RU) {
- LAYOUT_FILES += \
- content/layouts/ru_RU/dialpad.fallback \
- content/layouts/ru_RU/digits.fallback \
- content/layouts/ru_RU/main.qml \
- content/layouts/ru_RU/numbers.fallback \
- content/layouts/ru_RU/symbols.fallback
-}
-qtConfig(vkb-lang-sk_SK) {
- LAYOUT_FILES += \
- content/layouts/sk_SK/dialpad.fallback \
- content/layouts/sk_SK/digits.fallback \
- content/layouts/sk_SK/main.qml \
- content/layouts/sk_SK/numbers.fallback \
- content/layouts/sk_SK/symbols.fallback
-}
-qtConfig(vkb-lang-sl_SI) {
- LAYOUT_FILES += \
- content/layouts/sl_SI/dialpad.fallback \
- content/layouts/sl_SI/digits.fallback \
- content/layouts/sl_SI/main.qml \
- content/layouts/sl_SI/numbers.fallback \
- content/layouts/sl_SI/symbols.fallback
-}
-qtConfig(vkb-lang-sq_AL) {
- LAYOUT_FILES += \
- content/layouts/sq_AL/dialpad.fallback \
- content/layouts/sq_AL/digits.fallback \
- content/layouts/sq_AL/main.qml \
- content/layouts/sq_AL/numbers.fallback \
- content/layouts/sq_AL/symbols.fallback
-}
-qtConfig(vkb-lang-sr_SP) {
- LAYOUT_FILES += \
- content/layouts/sr_SP/dialpad.fallback \
- content/layouts/sr_SP/digits.fallback \
- content/layouts/sr_SP/main.qml \
- content/layouts/sr_SP/numbers.fallback \
- content/layouts/sr_SP/symbols.fallback
-}
-qtConfig(vkb-lang-sv_SE) {
- LAYOUT_FILES += \
- content/layouts/sv_SE/dialpad.fallback \
- content/layouts/sv_SE/digits.fallback \
- content/layouts/sv_SE/main.qml \
- content/layouts/sv_SE/numbers.fallback \
- content/layouts/sv_SE/symbols.fallback
-}
-qtConfig(vkb-lang-tr_TR) {
- LAYOUT_FILES += \
- content/layouts/tr_TR/dialpad.fallback \
- content/layouts/tr_TR/digits.fallback \
- content/layouts/tr_TR/main.qml \
- content/layouts/tr_TR/numbers.fallback \
- content/layouts/tr_TR/symbols.fallback
-}
-qtConfig(vkb-lang-uk_UA) {
- LAYOUT_FILES += \
- content/layouts/uk_UA/dialpad.fallback \
- content/layouts/uk_UA/digits.fallback \
- content/layouts/uk_UA/main.qml \
- content/layouts/uk_UA/numbers.fallback \
- content/layouts/uk_UA/symbols.fallback
-}
-qtConfig(vkb-lang-vi_VN) {
- LAYOUT_FILES += \
- content/layouts/vi_VN/dialpad.fallback \
- content/layouts/vi_VN/digits.fallback \
- content/layouts/vi_VN/main.qml \
- content/layouts/vi_VN/numbers.fallback \
- content/layouts/vi_VN/symbols.qml
-}
-
-qtConfig(vkb-no-builtin-style){
- DEFINES += QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"\\\"
-} else:qtConfig(vkb-retro-style) {
- DEFINES += QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"retro\\\"
-} else {
- DEFINES += QT_VIRTUALKEYBOARD_DEFAULT_STYLE=\\\"default\\\"
-}
-
-DEFINES += QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR=\\\"qrc:/QtQuick/VirtualKeyboard/content/layouts\\\"
-
-DEFINES += \
- QT_NO_CAST_TO_ASCII \
- QT_ASCII_CAST_WARNINGS \
- QT_NO_CAST_FROM_ASCII \
- QT_NO_CAST_FROM_BYTEARRAY
-
-OTHER_FILES += \
- content/styles/default/*.qml \
- content/styles/retro/*.qml \
- content/*.qml \
- content/components/*.qml \
- qtvirtualkeyboard.json \
- $$LAYOUT_FILES
-
-qtConfig(vkb-desktop) {
- SOURCES += desktopinputpanel.cpp inputview.cpp
- HEADERS += desktopinputpanel_p.h inputview_p.h
- DEFINES += QT_VIRTUALKEYBOARD_DESKTOP
- qtConfig(vkb-xcb): \
- QMAKE_USE += xcb-xfixes
-}
-
-qtConfig(vkb-record-trace-input) {
- SOURCES += unipentrace.cpp
- HEADERS += unipentrace_p.h
- MODULE_DEFINES += QT_VIRTUALKEYBOARD_RECORD_TRACE_INPUT
-}
-
-qtConfig(vkb-arrow-keynavigation): \
- DEFINES += QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
-
-qtConfig(vkb-layouts) {
- virtualkeyboard_layouts.files = $$LAYOUT_FILES
- virtualkeyboard_layouts.prefix = $$LAYOUTS_PREFIX
- RESOURCES += virtualkeyboard_layouts
-}
-
-load(qt_module)
diff --git a/src/virtualkeyboard/virtualkeyboard_p.h b/src/virtualkeyboard/virtualkeyboard_p.h
new file mode 100644
index 00000000..f00cbfdc
--- /dev/null
+++ b/src/virtualkeyboard/virtualkeyboard_p.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef VIRTUALKEYBOARD_P_H
+#define VIRTUALKEYBOARD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml/qqml.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+#include <QtCore/private/qglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class VirtualKeyboardAttachedType;
+
+class Q_VIRTUALKEYBOARD_EXPORT VirtualKeyboard : public QObject
+{
+ Q_OBJECT
+ QML_NAMED_ELEMENT(VirtualKeyboard)
+ QML_UNCREATABLE("VirtualKeyboard is an abstract type that is only available as an attached property.")
+ QML_ATTACHED(VirtualKeyboardAttachedType)
+ QML_ADDED_IN_VERSION(6, 1)
+
+public:
+ static VirtualKeyboardAttachedType *qmlAttachedProperties(QObject *object);
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QT_PREPEND_NAMESPACE(QtVirtualKeyboard)::VirtualKeyboard, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
diff --git a/src/virtualkeyboard/virtualkeyboardattachedtype.cpp b/src/virtualkeyboard/virtualkeyboardattachedtype.cpp
new file mode 100644
index 00000000..6a433020
--- /dev/null
+++ b/src/virtualkeyboard/virtualkeyboardattachedtype.cpp
@@ -0,0 +1,33 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtVirtualKeyboard/private/virtualkeyboardattachedtype_p.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+/*!
+ \class QtVirtualKeyboard::VirtualKeyboardAttachedType
+ \internal
+*/
+
+VirtualKeyboardAttachedType::VirtualKeyboardAttachedType(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QStringList QtVirtualKeyboard::VirtualKeyboardAttachedType::extraDictionaries() const
+{
+ return _extraDictionaries;
+}
+
+void QtVirtualKeyboard::VirtualKeyboardAttachedType::setExtraDictionaries(const QStringList &extraDictionaries)
+{
+ if (_extraDictionaries != extraDictionaries) {
+ _extraDictionaries = extraDictionaries;
+ emit extraDictionariesChanged();
+ }
+}
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/virtualkeyboardattachedtype_p.h b/src/virtualkeyboard/virtualkeyboardattachedtype_p.h
new file mode 100644
index 00000000..ff3a2630
--- /dev/null
+++ b/src/virtualkeyboard/virtualkeyboardattachedtype_p.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef VIRTUALKEYBOARDATTACHEDTYPE_P_H
+#define VIRTUALKEYBOARDATTACHEDTYPE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QtVirtualKeyboard/private/virtualkeyboard_p.h>
+#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
+
+QT_BEGIN_NAMESPACE
+namespace QtVirtualKeyboard {
+
+class Q_VIRTUALKEYBOARD_EXPORT VirtualKeyboardAttachedType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList extraDictionaries READ extraDictionaries WRITE setExtraDictionaries NOTIFY extraDictionariesChanged)
+ QML_ANONYMOUS
+ QML_ADDED_IN_VERSION(6, 1)
+
+public:
+ explicit VirtualKeyboardAttachedType(QObject *parent);
+
+ QStringList extraDictionaries() const;
+ void setExtraDictionaries(const QStringList& dictionaries);
+
+signals:
+ void extraDictionariesChanged();
+
+private:
+ QStringList _extraDictionaries;
+};
+
+} // namespace QtVirtualKeyboard
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/virtualkeyboard/virtualkeyboarddebug_p.h b/src/virtualkeyboard/virtualkeyboarddebug_p.h
index 02374663..1d737ed2 100644
--- a/src/virtualkeyboard/virtualkeyboarddebug_p.h
+++ b/src/virtualkeyboard/virtualkeyboarddebug_p.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef VIRTUALKEYBOARDDEBUG_H
#define VIRTUALKEYBOARDDEBUG_H
@@ -43,6 +17,7 @@
#include <QDebug>
#include <QLoggingCategory>
+#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {
diff --git a/src/virtualkeyboard/virtualkeyboardsettings.cpp b/src/virtualkeyboard/virtualkeyboardsettings.cpp
deleted file mode 100644
index d415c36c..00000000
--- a/src/virtualkeyboard/virtualkeyboardsettings.cpp
+++ /dev/null
@@ -1,471 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtVirtualKeyboard/private/virtualkeyboardsettings_p.h>
-#include <QtVirtualKeyboard/private/settings_p.h>
-#include <QtVirtualKeyboard/private/virtualkeyboarddebug_p.h>
-#include <QQmlEngine>
-#include <QFileInfo>
-#include <QDir>
-#include <QRegularExpression>
-#include <QtCore/private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class VirtualKeyboardSettingsPrivate : public QObjectPrivate
-{
-public:
- VirtualKeyboardSettingsPrivate() :
- QObjectPrivate(),
- engine()
- {}
-
- QString buildStyleImportPath(const QString &path, const QString &name) const
- {
- QString importPath(path + name + QLatin1String("/style.qml"));
- if (!importPath.startsWith(QLatin1String("qrc:"))) {
- QUrl url = QUrl::fromLocalFile(importPath);
- importPath = url.toString();
- }
- return importPath;
- }
-
- QString buildStyleFilePath(const QString &path, const QString &name) const
- {
- QString filePath(path);
- if (filePath.startsWith(QLatin1String("qrc:")))
- filePath.remove(0, 3);
- return filePath + name + QLatin1String("/style.qml");
- }
-
- QString styleImportPath(const QString &name) const
- {
- if (name.isEmpty())
- return QString();
-
- QStringList styleImportPathList;
- styleImportPathList << QLatin1String("qrc:/QtQuick/VirtualKeyboard/content/styles/");
- const QStringList importPathList = engine->importPathList();
- // Add QML import path (Note: the QML base dir is usually the last entry in the list)
- for (int i = importPathList.size() - 1; i >= 0; --i) {
- const QString stylesPath = importPathList.at(i)
- + QLatin1String("/QtQuick/VirtualKeyboard/Styles/");
- styleImportPathList += stylesPath;
- }
-
- for (const QString &styleImportPath : qAsConst(styleImportPathList)) {
- QString filePath = buildStyleFilePath(styleImportPath, name);
- bool pathExist = false;
- pathExist = QFileInfo::exists(filePath);
- if (pathExist)
- return buildStyleImportPath(styleImportPath, name);
- }
- return QString();
- }
-
- QPointer<QQmlEngine> engine;
- WordCandidateListSettings wordCandidateListSettings;
-};
-
-/*!
- \qmlmodule QtQuick.VirtualKeyboard.Settings 2.\QtMinorVersion
- \title Qt Quick Virtual Keyboard Settings QML Types
- \ingroup qmlmodules
-
- \brief Provides settings for Qt Virtual Keyboard.
-
- The QML types can be imported into your application using the following
- import statements in your .qml file:
-
- \qml \QtMinorVersion
- import QtQuick.VirtualKeyboard.Settings 2.\1
- \endqml
-*/
-
-/*!
- \qmltype VirtualKeyboardSettings
- \inqmlmodule QtQuick.VirtualKeyboard.Settings
- \ingroup qtvirtualkeyboard-settings-qml
- \since QtQuick.VirtualKeyboard 1.2
- \brief Provides settings for virtual keyboard.
-
- This type provides a VirtualKeyboardSettings singleton instance,
- which can be used to configure the virtual keyboard settings.
-
- Please note that the settings have only effect in the current
- application's lifetime, that is, configuration changes are not
- permanent.
-
- For example, to change the keyboard style in application:
-
- \code
- Component.onCompleted: VirtualKeyboardSettings.styleName = "retro"
- \endcode
-*/
-
-/*!
- \internal
-*/
-QObject *VirtualKeyboardSettings::registerSettingsModule(QQmlEngine *engine, QJSEngine *jsEngine)
-{
- Q_UNUSED(jsEngine);
- return new VirtualKeyboardSettings(engine);
-}
-
-/*!
- \class QtVirtualKeyboard::VirtualKeyboardSettings
- \internal
-*/
-
-/*!
- \internal
-*/
-VirtualKeyboardSettings::VirtualKeyboardSettings(QQmlEngine *engine) :
- QObject(*new VirtualKeyboardSettingsPrivate())
-{
- Q_D(VirtualKeyboardSettings);
- d->engine = engine;
- Settings *settings = Settings::instance();
- if (settings->styleName().isEmpty())
- resetStyle();
- if (settings->layoutPath().isEmpty())
- resetLayoutPath();
- connect(settings, SIGNAL(styleChanged()), SIGNAL(styleChanged()));
- connect(settings, SIGNAL(styleNameChanged()), SIGNAL(styleNameChanged()));
- connect(settings, SIGNAL(localeChanged()), SIGNAL(localeChanged()));
- connect(settings, SIGNAL(availableLocalesChanged()), SIGNAL(availableLocalesChanged()));
- connect(settings, SIGNAL(activeLocalesChanged()), SIGNAL(activeLocalesChanged()));
- connect(settings, SIGNAL(layoutPathChanged()), SIGNAL(layoutPathChanged()));
- connect(settings, SIGNAL(wclAutoHideDelayChanged()), &d->wordCandidateListSettings, SIGNAL(autoHideDelayChanged()));
- connect(settings, SIGNAL(wclAlwaysVisibleChanged()), &d->wordCandidateListSettings, SIGNAL(alwaysVisibleChanged()));
- connect(settings, SIGNAL(wclAutoCommitWordChanged()), &d->wordCandidateListSettings, SIGNAL(autoCommitWordChanged()));
- connect(settings, SIGNAL(fullScreenModeChanged()), SIGNAL(fullScreenModeChanged()));
-}
-
-/*!
- \internal
-*/
-QString VirtualKeyboardSettings::style() const
-{
- return Settings::instance()->style();
-}
-
-/*!
- \internal
-*/
-QString VirtualKeyboardSettings::styleName() const
-{
- return Settings::instance()->styleName();
-}
-
-/*!
- \internal
-*/
-void VirtualKeyboardSettings::setStyleName(const QString &styleName)
-{
- Q_D(VirtualKeyboardSettings);
- Settings *settings = Settings::instance();
- QString style = d->styleImportPath(styleName);
- if (style.isEmpty()) {
- qWarning() << "WARNING: Cannot find style" << styleName << "- fallback:" << settings->styleName();
- return;
- }
- settings->setStyleName(styleName);
- settings->setStyle(style);
-}
-
-/*!
- \internal
-*/
-QUrl VirtualKeyboardSettings::layoutPath() const
-{
- return Settings::instance()->layoutPath();
-}
-
-/*!
- \internal
-*/
-void VirtualKeyboardSettings::setLayoutPath(const QUrl &layoutPath)
-{
- Settings *settings = Settings::instance();
- QDir layoutDirectory(layoutPath.toLocalFile());
- if (!layoutDirectory.exists()) {
- qWarning() << "WARNING: Cannot find layout path" << layoutPath;
- return;
- }
- settings->setLayoutPath(layoutPath);
-}
-
-void VirtualKeyboardSettings::resetLayoutPath()
-{
- Settings *settings = Settings::instance();
- QUrl layoutPath(QLatin1String(QT_VIRTUALKEYBOARD_DEFAULT_LAYOUTS_DIR));
- const QString customLayoutPath(QDir::fromNativeSeparators(qEnvironmentVariable("QT_VIRTUALKEYBOARD_LAYOUT_PATH")));
- if (!customLayoutPath.isEmpty()) {
- bool found = false;
- QDir customLayoutDirectory(customLayoutPath);
- if (customLayoutDirectory.exists()) {
- found = true;
- layoutPath = QUrl::fromLocalFile(customLayoutPath);
- } else {
- customLayoutDirectory = QDir(QUrl(customLayoutPath).toLocalFile());
- if (customLayoutDirectory.exists()) {
- found = true;
- layoutPath = QUrl(customLayoutPath);
- }
- }
- if (!found) {
- qWarning() << "WARNING: Cannot assign custom layout path" << customLayoutPath << "- fallback:" << layoutPath;
- }
- }
- settings->setLayoutPath(layoutPath);
-}
-
-QString VirtualKeyboardSettings::locale() const
-{
- return Settings::instance()->locale();
-}
-
-void VirtualKeyboardSettings::setLocale(const QString &locale)
-{
- Settings::instance()->setLocale(locale);
-}
-
-QStringList VirtualKeyboardSettings::availableLocales() const
-{
- return Settings::instance()->availableLocales();
-}
-
-void VirtualKeyboardSettings::setActiveLocales(const QStringList &activeLocales)
-{
- Settings::instance()->setActiveLocales(activeLocales);
-}
-
-QStringList VirtualKeyboardSettings::activeLocales() const
-{
- return Settings::instance()->activeLocales();
-}
-
-WordCandidateListSettings *VirtualKeyboardSettings::wordCandidateList() const
-{
- Q_D(const VirtualKeyboardSettings);
- return const_cast<WordCandidateListSettings *>(&d->wordCandidateListSettings);
-}
-
-bool VirtualKeyboardSettings::fullScreenMode() const
-{
- return Settings::instance()->fullScreenMode();
-}
-
-void VirtualKeyboardSettings::setFullScreenMode(bool fullScreenMode)
-{
- return Settings::instance()->setFullScreenMode(fullScreenMode);
-}
-
-void VirtualKeyboardSettings::resetStyle()
-{
- Q_D(VirtualKeyboardSettings);
- Settings *settings = Settings::instance();
- QString styleName = QLatin1String(QT_VIRTUALKEYBOARD_DEFAULT_STYLE);
- QString style = d->styleImportPath(styleName);
- QString customStyleName = QString::fromLatin1(qgetenv("QT_VIRTUALKEYBOARD_STYLE"));
- if (!customStyleName.isEmpty()) {
- bool found = false;
- QRegularExpression styleNameValidator(QLatin1String("\\A(?:\\w+)\\z"));
- QRegularExpressionMatch match = styleNameValidator.match(customStyleName);
- if (match.hasMatch()) {
- QString customStyle = d->styleImportPath(customStyleName);
- if (!customStyle.isEmpty()) {
- styleName = customStyleName;
- style = customStyle;
- found = true;
- }
- }
- if (!found) {
- qWarning() << "WARNING: Cannot find style" << customStyleName << "- fallback:" << styleName;
- }
- }
- if (!style.isEmpty()) {
- settings->setStyleName(styleName);
- settings->setStyle(style);
- }
-}
-
-/*!
- \qmlproperty string VirtualKeyboardSettings::style
- \internal
-*/
-
-/*!
- \qmlproperty string VirtualKeyboardSettings::styleName
-
- This property provides the current style. Application can change
- the keyboard style by setting the styleName to different value.
-
- The system wide keyboard style can be affected by setting
- the QT_VIRTUALKEYBOARD_STYLE environment variable.
-*/
-
-/*!
- \qmlproperty string VirtualKeyboardSettings::locale
- \since QtQuick.VirtualKeyboard.Settings 2.0
-
- This property provides the default locale for the keyboard.
-
- When the locale is not specified, the default system locale is used instead.
-
- If the keyboard locale is different from the new default locale, keyboard
- language is changed immediately to reflect the new locale. If the locale setting
- is incorrect, or it is not in the list of supported locales, it is ignored and
- the default setting is used instead.
-
- A locale is supported if it is included in the list of availableLocales.
-*/
-
-/*!
- \qmlproperty list<string> VirtualKeyboardSettings::availableLocales
- \since QtQuick.VirtualKeyboard.Settings 2.0
-
- This property contains a list of languages supported by the virtual keyboard.
-
- This list is read-only and depends on the build-time configuration of the
- virtual keyboard.
-*/
-
-/*!
- \qmlproperty list<string> VirtualKeyboardSettings::activeLocales
- \since QtQuick.VirtualKeyboard.Settings 2.0
-
- This property contains a list of activated languages of the virtual keyboard.
-
- The list of active languages is a subset of the available languages, and can be
- used to limit the list of available languages in the application lifetime.
-*/
-
-/*!
- \qmlproperty bool VirtualKeyboardSettings::fullScreenMode
- \since QtQuick.VirtualKeyboard.Settings 2.2
-
- This property enables the fullscreen mode for the virtual keyboard.
-
- In fullscreen mode, the virtual keyboard replicates the contents of the
- focused input field to the fullscreen input field located at the top of the
- keyboard.
-
- For example, to activate the fullscreen mode when the screen aspect ratio
- is greater than 16:9:
-
- \code
- Binding {
- target: VirtualKeyboardSettings
- property: "fullScreenMode"
- value: (Screen.width / Screen.height) > (16.0 / 9.0)
- }
- \endcode
-*/
-
-/*!
- \since QtQuick.VirtualKeyboard.Settings 2.2
- \qmlpropertygroup QtQuick.VirtualKeyboard::VirtualKeyboardSettings::wordCandidateList
- \qmlproperty int QtQuick.VirtualKeyboard::VirtualKeyboardSettings::wordCandidateList.autoHideDelay
- \qmlproperty bool QtQuick.VirtualKeyboard::VirtualKeyboardSettings::wordCandidateList.alwaysVisible
-
- \table
- \header
- \li Name
- \li Description
- \row
- \li autoHideDelay
- \li This property defines the delay, in milliseconds, after which the
- word candidate list is hidden if empty.
-
- If the value is \c 0, the list is immediately hidden when cleared.
-
- If the value is \c -1, the list is visible until input focus
- changes, or the input panel is hidden.
-
- The default value is \c 5000 milliseconds.
- \row
- \li alwaysVisible
- \li This property defines whether the word candidate list should always
- remain visible.
-
- The default value is \c false.
- \row
- \li autoCommitWord
- \li This property enables the automatic commit feature that is activated
- when the word candidate list is narrowed down to a single candidate.
-
- The automatic commit feature takes effect when the word candidate
- list initially contains multiple words and is reduced to single word
- after additional input. This word will be selected and committed
- automatically without user interaction.
-
- This property is set to \c false by default.
- \endtable
-*/
-
-WordCandidateListSettings::WordCandidateListSettings(QObject *parent) :
- QObject(parent)
-{
-}
-
-int WordCandidateListSettings::autoHideDelay() const
-{
- return Settings::instance()->wclAutoHideDelay();
-}
-
-void WordCandidateListSettings::setAutoHideDelay(int autoHideDelay)
-{
- Settings::instance()->setWclAutoHideDelay(autoHideDelay);
-}
-
-bool WordCandidateListSettings::alwaysVisible() const
-{
- return Settings::instance()->wclAlwaysVisible();
-}
-
-void WordCandidateListSettings::setAlwaysVisible(bool alwaysVisible)
-{
- Settings::instance()->setWclAlwaysVisible(alwaysVisible);
-}
-
-bool WordCandidateListSettings::autoCommitWord() const
-{
- return Settings::instance()->wclAutoCommitWord();
-}
-
-void WordCandidateListSettings::setAutoCommitWord(bool autoCommitWord)
-{
- Settings::instance()->setWclAutoCommitWord(autoCommitWord);
-}
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
diff --git a/src/virtualkeyboard/virtualkeyboardsettings_p.h b/src/virtualkeyboard/virtualkeyboardsettings_p.h
deleted file mode 100644
index 7acb8268..00000000
--- a/src/virtualkeyboard/virtualkeyboardsettings_p.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIRTUALKEYBOARDSETTINGS_H
-#define VIRTUALKEYBOARDSETTINGS_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qqml.h>
-#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
-
-QT_BEGIN_NAMESPACE
-namespace QtVirtualKeyboard {
-
-class WordCandidateListSettings;
-class VirtualKeyboardSettingsPrivate;
-
-class QVIRTUALKEYBOARD_EXPORT VirtualKeyboardSettings : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(VirtualKeyboardSettings)
- Q_PROPERTY(QUrl style READ style NOTIFY styleChanged)
- Q_PROPERTY(QUrl layoutPath READ layoutPath WRITE setLayoutPath NOTIFY layoutPathChanged)
- Q_PROPERTY(QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged)
- Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged)
- Q_PROPERTY(QStringList availableLocales READ availableLocales NOTIFY availableLocalesChanged)
- Q_PROPERTY(QStringList activeLocales READ activeLocales WRITE setActiveLocales NOTIFY activeLocalesChanged)
- Q_PROPERTY(WordCandidateListSettings *wordCandidateList READ wordCandidateList CONSTANT)
- Q_PROPERTY(bool fullScreenMode READ fullScreenMode WRITE setFullScreenMode NOTIFY fullScreenModeChanged)
-
-public:
- static QObject *registerSettingsModule(QQmlEngine *engine, QJSEngine *jsEngine);
-
- explicit VirtualKeyboardSettings(QQmlEngine *engine);
-
- QString style() const;
-
- QUrl layoutPath() const;
- void setLayoutPath(const QUrl &layoutPath);
-
- QString styleName() const;
- void setStyleName(const QString &styleName);
-
- QString locale() const;
- void setLocale(const QString &locale);
-
- QStringList availableLocales() const;
-
- void setActiveLocales(const QStringList &activeLocales);
- QStringList activeLocales() const;
-
- WordCandidateListSettings *wordCandidateList() const;
-
- bool fullScreenMode() const;
- void setFullScreenMode(bool fullScreenMode);
-
-signals:
- void styleChanged();
- void styleNameChanged();
- void localeChanged();
- void availableLocalesChanged();
- void activeLocalesChanged();
- void layoutPathChanged();
- void fullScreenModeChanged();
-
-private:
- void resetStyle();
- void resetLayoutPath();
-};
-
-class QVIRTUALKEYBOARD_EXPORT WordCandidateListSettings : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int autoHideDelay READ autoHideDelay WRITE setAutoHideDelay NOTIFY autoHideDelayChanged)
- Q_PROPERTY(bool alwaysVisible READ alwaysVisible WRITE setAlwaysVisible NOTIFY alwaysVisibleChanged)
- Q_PROPERTY(bool autoCommitWord READ autoCommitWord WRITE setAutoCommitWord NOTIFY autoCommitWordChanged)
-
- explicit WordCandidateListSettings(QObject *parent = nullptr);
- friend class VirtualKeyboardSettingsPrivate;
-
-public:
- int autoHideDelay() const;
- void setAutoHideDelay(int autoHideDelay);
-
- bool alwaysVisible() const;
- void setAlwaysVisible(bool alwaysVisible);
-
- bool autoCommitWord() const;
- void setAutoCommitWord(bool autoCommitWord);
-
-signals:
- void autoHideDelayChanged();
- void alwaysVisibleChanged();
- void autoCommitWordChanged();
-};
-
-} // namespace QtVirtualKeyboard
-QT_END_NAMESPACE
-
-#endif // VIRTUALKEYBOARDSETTINGS_H
diff --git a/sync.profile b/sync.profile
deleted file mode 100644
index 476934c8..00000000
--- a/sync.profile
+++ /dev/null
@@ -1,6 +0,0 @@
-%modules = ( # path to module name map
- "QtVirtualKeyboard" => "$basedir/src/virtualkeyboard",
- "QtHunspellInputMethod" => "$basedir/src/plugins/hunspell/hunspellinputmethod",
-);
-%moduleheaders = ( # restrict the module headers to those found in relative path
-);
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 22141371..800bc265 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from tests.pro.
if(QT_BUILD_STANDALONE_TESTS)
diff --git a/tests/auto/.prev_CMakeLists.txt b/tests/auto/.prev_CMakeLists.txt
deleted file mode 100644
index 57ca438e..00000000
--- a/tests/auto/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated from auto.pro.
-
-add_subdirectory(inputpanel)
-add_subdirectory(styles)
-add_subdirectory(layoutfilesystem)
-add_subdirectory(layoutresources)
-add_subdirectory(cmake)
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index 3777778c..1c0b3c51 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -1,7 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from auto.pro.
+if(NOT ANDROID) # QTBUG-102756
add_subdirectory(inputpanel)
+endif()
+add_subdirectory(inputpanelcontrols)
add_subdirectory(styles)
add_subdirectory(layoutfilesystem)
add_subdirectory(layoutresources)
-# add_subdirectory(cmake) # special case
+add_subdirectory(dictionarymanager)
+add_subdirectory(shadowinput)
+add_subdirectory(virtualkeyboardattached)
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
deleted file mode 100644
index 15685d5f..00000000
--- a/tests/auto/auto.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- inputpanel \
- styles \
- layoutfilesystem \
- layoutresources \
- cmake \
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
deleted file mode 100644
index 3d77b9e5..00000000
--- a/tests/auto/cmake/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-project(qmake_cmake_files)
-
-enable_testing()
-
-find_package(Qt5Core REQUIRED)
-
-include("${_Qt5CTestMacros}")
-
-test_module_includes(
-)
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
deleted file mode 100644
index f8635657..00000000
--- a/tests/auto/cmake/cmake.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-# Cause make to do nothing.
-TEMPLATE = subdirs
-
-CMAKE_QT_MODULES_UNDER_TEST = virtualkeyboard
-
-CONFIG += ctest_testcase
diff --git a/tests/auto/dictionarymanager/CMakeLists.txt b/tests/auto/dictionarymanager/CMakeLists.txt
new file mode 100644
index 00000000..f0e7857e
--- /dev/null
+++ b/tests/auto/dictionarymanager/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from dictionarymanager.pro.
+
+#####################################################################
+## tst_dictionarymanager Test:
+#####################################################################
+
+qt_internal_add_test(tst_dictionarymanager
+ SOURCES
+ tst_dictionarymanager.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::VirtualKeyboard
+)
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(tst_dictionarymanager CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
+ Qt::Svg
+)
+
+#### Keys ignored in scope 3:.:.:dictionarymanager.pro:static:
+# QTPLUGIN = "qtvirtualkeyboardplugin"
diff --git a/tests/auto/dictionarymanager/tst_dictionarymanager.cpp b/tests/auto/dictionarymanager/tst_dictionarymanager.cpp
new file mode 100644
index 00000000..8c7c4c06
--- /dev/null
+++ b/tests/auto/dictionarymanager/tst_dictionarymanager.cpp
@@ -0,0 +1,69 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtVirtualKeyboard/QVirtualKeyboardDictionary>
+#include <QtVirtualKeyboard/QVirtualKeyboardDictionaryManager>
+
+static bool moduleEnv = qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+
+class tst_dictionarymanager : public QObject
+{
+ Q_OBJECT
+
+public:
+
+private slots:
+ void testCreateDictionary();
+ void testDictionarySets();
+};
+
+void tst_dictionarymanager::testCreateDictionary()
+{
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+ QVERIFY(dictionaryManager != nullptr);
+
+ QVirtualKeyboardDictionary *dictionary = dictionaryManager->createDictionary("custom");
+ QSignalSpy dictionarySpy(dictionary, SIGNAL(contentsChanged()));
+ QVERIFY(dictionarySpy.isValid());
+ QStringList wordList = QStringList() << "myword";
+ dictionary->setContents(wordList);
+ QCOMPARE(dictionarySpy.size(), 1);
+
+ QVERIFY(dictionaryManager->availableDictionaries().contains("custom"));
+}
+
+void tst_dictionarymanager::testDictionarySets()
+{
+ QVirtualKeyboardDictionaryManager *dictionaryManager = QVirtualKeyboardDictionaryManager::instance();
+ QVERIFY(dictionaryManager != nullptr);
+
+ dictionaryManager->setBaseDictionaries(QStringList() << "non-existent");
+ QVERIFY(dictionaryManager->baseDictionaries().isEmpty());
+
+ dictionaryManager->setExtraDictionaries(QStringList() << "non-existent");
+ QVERIFY(dictionaryManager->extraDictionaries().isEmpty());
+
+ dictionaryManager->createDictionary("custom1");
+ dictionaryManager->createDictionary("custom2");
+ dictionaryManager->setBaseDictionaries(QStringList() << "custom1");
+ dictionaryManager->setExtraDictionaries(QStringList() << "custom2");
+ QCOMPARE(dictionaryManager->baseDictionaries(), QStringList() << "custom1");
+ QCOMPARE(dictionaryManager->extraDictionaries(), QStringList() << "custom2");
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom2"));
+
+ dictionaryManager->setBaseDictionaries(QStringList() << "custom1" << "custom2");
+ dictionaryManager->setExtraDictionaries(QStringList() << "custom2" << "custom1");
+ QVERIFY(dictionaryManager->baseDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->baseDictionaries().contains("custom2"));
+ QVERIFY(dictionaryManager->extraDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->extraDictionaries().contains("custom2"));
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom1"));
+ QVERIFY(dictionaryManager->activeDictionaries().contains("custom2"));
+}
+
+QTEST_MAIN(tst_dictionarymanager)
+
+#include "tst_dictionarymanager.moc"
diff --git a/tests/auto/inputpanel/BLACKLIST b/tests/auto/inputpanel/BLACKLIST
new file mode 100644
index 00000000..ac88f44e
--- /dev/null
+++ b/tests/auto/inputpanel/BLACKLIST
@@ -0,0 +1 @@
+# See qtbase/src/testlib/qtestblacklist.cpp for format
diff --git a/tests/auto/inputpanel/CMakeLists.txt b/tests/auto/inputpanel/CMakeLists.txt
index 1e9184a7..2dd636ed 100644
--- a/tests/auto/inputpanel/CMakeLists.txt
+++ b/tests/auto/inputpanel/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from inputpanel.pro.
#####################################################################
@@ -10,11 +13,11 @@ file(GLOB_RECURSE test_data_glob
${CMAKE_CURRENT_SOURCE_DIR}/data/*)
list(APPEND test_data ${test_data_glob})
-qt_add_test(tst_inputpanel
+qt_internal_add_test(tst_inputpanel
QMLTEST
SOURCES
tst_inputpanel.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
TESTDATA ${test_data}
)
@@ -26,8 +29,8 @@ qt_add_test(tst_inputpanel
## Scopes:
#####################################################################
-qt_extend_target(tst_inputpanel CONDITION NOT QT_BUILD_SHARED_LIBS
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_inputpanel CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/inputpanel/data/inputpanel/handwriting.js b/tests/auto/inputpanel/data/inputpanel/handwriting.js
index e289fb60..20b615e1 100644
--- a/tests/auto/inputpanel/data/inputpanel/handwriting.js
+++ b/tests/auto/inputpanel/data/inputpanel/handwriting.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
.pragma library
diff --git a/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml b/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
index f3dc4ace..7b81a42f 100644
--- a/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/handwritinginputpanel.qml
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
import "handwriting.js" as Handwriting
import "utils.js" as Utils
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
index dd46a5b9..5204c5b7 100644
--- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.3
-import QtQuick.VirtualKeyboard.Settings 2.2
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
import "handwriting.js" as Handwriting
import "utils.js" as Utils
@@ -55,25 +29,20 @@ InputPanel {
readonly property var activeLocales: VirtualKeyboardSettings.activeLocales
readonly property int inputMode: InputContext.inputEngine.inputMode
readonly property var inputMethod: InputContext.inputEngine.inputMethod
- readonly property var keyboard: Utils.findChildByProperty(inputPanel, "objectName", "keyboard", null)
readonly property bool handwritingMode: keyboard.handwritingMode
- readonly property var keyboardLayoutLoader: Utils.findChildByProperty(keyboard, "objectName", "keyboardLayoutLoader", null)
- readonly property var keyboardInputArea: Utils.findChildByProperty(keyboard, "objectName", "keyboardInputArea", null)
- readonly property var characterPreviewBubble: Utils.findChildByProperty(keyboard, "objectName", "characterPreviewBubble", null)
- readonly property var alternativeKeys: Utils.findChildByProperty(keyboard, "objectName", "alternativeKeys", null)
- readonly property var naviationHighlight: Utils.findChildByProperty(keyboard, "objectName", "naviationHighlight", null)
- readonly property bool naviationHighlightAnimating: naviationHighlight.xAnimation.running ||
- naviationHighlight.yAnimation.running ||
- naviationHighlight.widthAnimation.running ||
- naviationHighlight.heightAnimation.running
- readonly property var wordCandidateView: Utils.findChildByProperty(keyboard, "objectName", "wordCandidateView", null)
- readonly property var wordCandidateContextMenu: Utils.findChildByProperty(keyboard, "objectName", "wordCandidateContextMenu", null)
- readonly property var shadowInputControl: Utils.findChildByProperty(keyboard, "objectName", "shadowInputControl", null)
- readonly property var shadowInput: Utils.findChildByProperty(keyboard, "objectName", "shadowInput", null)
- readonly property var selectionControl: Utils.findChildByProperty(inputPanel, "objectName", "selectionControl", null)
+ readonly property Loader keyboardLayoutLoader: keyboard.keyboardLayoutLoader
+ readonly property MultiPointTouchArea keyboardInputArea: keyboard.keyboardInputArea
+ readonly property CharacterPreviewBubble characterPreviewBubble: keyboard.characterPreview
+ readonly property AlternativeKeys alternativeKeys: keyboard.alternativeKeys
+ readonly property Loader naviationHighlight: keyboard.naviationHighlight
+ readonly property ListView wordCandidateView: keyboard.wordCandidateView
+ readonly property Item wordCandidateContextMenu: keyboard.wordCandidateContextMenu
+ readonly property ShadowInputControl shadowInputControl: keyboard.shadowInputControl
+ readonly property TextInput shadowInput: keyboard.shadowInputControl.textEdit
+ readonly property SelectionControl selectionControl: Utils.findChildByProperty(inputPanel, "objectName", "selectionControl", null)
readonly property var anchorHandle: selectionControl.children[0]
readonly property var cursorHandle: selectionControl.children[1]
- readonly property var fullScreenModeSelectionControl: Utils.findChildByProperty(inputPanel, "objectName", "fullScreenModeSelectionControl", null)
+ readonly property SelectionControl fullScreenModeSelectionControl: keyboard.fullScreenModeSelectionControl
readonly property var fullScreenModeAnchorHandle: fullScreenModeSelectionControl.children[0]
readonly property var fullScreenModeCursorHandle: fullScreenModeSelectionControl.children[1]
readonly property bool wordCandidateListVisibleHint: InputContext.inputEngine.wordCandidateListVisibleHint
@@ -89,8 +58,10 @@ InputPanel {
property alias soundEffectSpy: soundEffectSpy
property alias inputMethodResultSpy: inputMethodResultSpy
property alias wordCandidateListChangedSpy: wordCandidateListChangedSpy
+ property alias wordCandidateListItemSelectedSpy: wordCandidateListItemSelectedSpy
property alias inputMethodSelectionListChangedSpy: inputMethodSelectionListChangedSpy
property alias wordCandidateListVisibleSpy: wordCandidateListVisibleSpy
+ property alias wordCandidateListCurrentIndexSpy: wordCandidateListCurrentIndexSpy
property alias shiftStateSpy: shiftStateSpy
property alias shadowInputControlVisibleSpy: shadowInputControlVisibleSpy
property alias externalLanguageSwitchSpy: externalLanguageSwitchSpy
@@ -179,6 +150,12 @@ InputPanel {
}
SignalSpy {
+ id: wordCandidateListItemSelectedSpy
+ target: wordCandidateView.model
+ signalName: "itemSelected"
+ }
+
+ SignalSpy {
id: inputMethodSelectionListChangedSpy
target: InputContext.inputEngine.inputMethod
signalName: "selectionListChanged"
@@ -191,6 +168,12 @@ InputPanel {
}
SignalSpy {
+ id: wordCandidateListCurrentIndexSpy
+ target: wordCandidateView
+ signalName: "onCurrentIndexChanged"
+ }
+
+ SignalSpy {
id: wordCandidateContextMenuActiveSpy
target: wordCandidateContextMenu
signalName: "onActiveChanged"
@@ -214,26 +197,18 @@ InputPanel {
signalName: "onExternalLanguageSwitch"
}
- function findChildByProperty(parent, propertyName, propertyValue, compareCb) {
- var obj = null
- if (parent === null)
- return null
- var children = parent.children
- for (var i = 0; i < children.length; i++) {
- obj = children[i]
- if (obj.hasOwnProperty(propertyName)) {
- if (compareCb !== null) {
- if (compareCb(obj[propertyName], propertyValue))
- break
- } else if (obj[propertyName] === propertyValue) {
- break
- }
- }
- obj = findChildByProperty(obj, propertyName, propertyValue, compareCb)
- if (obj)
- break
- }
- return obj
+ // Disable all animations during tests
+ Binding {
+ target: keyboard
+ property: "noAnimations"
+ value: true
+ }
+
+ // Reduce press and hold delay to avoid unnecessary wait during tests
+ Binding {
+ target: keyboard
+ property: "pressAndHoldDelay"
+ value: 50
}
function isLocaleSupported(inputLocale) {
@@ -252,6 +227,42 @@ InputPanel {
VirtualKeyboardSettings.activeLocales = activeLocales
}
+ function mapKeyboardFunction(keyboardFunctionName) {
+ if (keyboardFunctionName === "HideInputPanel")
+ return QtVirtualKeyboard.KeyboardFunction.HideInputPanel
+ if (keyboardFunctionName === "ChangeLanguage")
+ return QtVirtualKeyboard.KeyboardFunction.ChangeLanguage
+ if (keyboardFunctionName === "ToggleHandwritingMode")
+ return QtVirtualKeyboard.KeyboardFunction.ToggleHandwritingMode
+ return -1
+ }
+
+ function doKeyboardFunction(keyboardFunctionName) {
+ const keyboardFunction = mapKeyboardFunction(keyboardFunctionName)
+ testcase.verify(keyboardFunction !== -1)
+ keyboard.doKeyboardFunction(keyboardFunction)
+ }
+
+ function mapKeyboardFunctionKey(functionKeyName) {
+ if (functionKeyName === "None")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.None
+ if (functionKeyName === "Hide")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.Hide
+ if (functionKeyName === "Language")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.Language
+ if (functionKeyName === "All")
+ return QtVirtualKeyboard.KeyboardFunctionKeys.All
+ testcase.fail("Invalid function key '%1'".arg(functionKeyName))
+ }
+
+ function setVisibleFunctionKeys(functionKeyNames) {
+ let functionKeys = QtVirtualKeyboard.KeyboardFunctionKeys.None
+ for (const functionKeyName of functionKeyNames) {
+ functionKeys |= mapKeyboardFunctionKey(functionKeyName)
+ }
+ VirtualKeyboardSettings.visibleFunctionKeys = functionKeys
+ }
+
function setWclAutoHideDelay(wclAutoHideDelay) {
VirtualKeyboardSettings.wordCandidateList.autoHideDelay = wclAutoHideDelay
}
@@ -305,6 +316,10 @@ InputPanel {
return InputEngine.InputMode.KoreanHandwriting
else if (inputModeName === "Thai")
return InputEngine.InputMode.Thai
+ else if (inputModeName === "Stroke")
+ return InputEngine.InputMode.Stroke
+ else if (inputModeName === "Romaji")
+ return InputEngine.InputMode.Romaji
else
return -1
}
@@ -343,6 +358,8 @@ InputPanel {
testcase.verify(InputEngine.InputMode.JapaneseHandwriting !== undefined)
testcase.verify(InputEngine.InputMode.KoreanHandwriting !== undefined)
testcase.verify(InputEngine.InputMode.Thai !== undefined)
+ testcase.verify(InputEngine.InputMode.Stroke !== undefined)
+ testcase.verify(InputEngine.InputMode.Romaji !== undefined)
testcase.verify(InputEngine.PatternRecognitionMode.None !== undefined)
testcase.verify(InputEngine.PatternRecognitionMode.PatternRecognitionDisabled !== undefined)
testcase.verify(InputEngine.PatternRecognitionMode.Handwriting !== undefined)
@@ -356,40 +373,6 @@ InputPanel {
testcase.verify(SelectionListModel.Role.Dictionary !== undefined)
testcase.verify(SelectionListModel.DictionaryType.Default !== undefined)
testcase.verify(SelectionListModel.DictionaryType.User !== undefined)
- // Unscoped
- testcase.verify(InputEngine.Lower !== undefined)
- testcase.verify(InputEngine.Upper !== undefined)
- testcase.verify(InputEngine.Latin !== undefined)
- testcase.verify(InputEngine.Numeric !== undefined)
- testcase.verify(InputEngine.Dialable !== undefined)
- testcase.verify(InputEngine.Pinyin !== undefined)
- testcase.verify(InputEngine.Cangjie !== undefined)
- testcase.verify(InputEngine.Zhuyin !== undefined)
- testcase.verify(InputEngine.Hangul !== undefined)
- testcase.verify(InputEngine.Hiragana !== undefined)
- testcase.verify(InputEngine.Katakana !== undefined)
- testcase.verify(InputEngine.FullwidthLatin !== undefined)
- testcase.verify(InputEngine.Greek !== undefined)
- testcase.verify(InputEngine.Cyrillic !== undefined)
- testcase.verify(InputEngine.Arabic !== undefined)
- testcase.verify(InputEngine.Hebrew !== undefined)
- testcase.verify(InputEngine.ChineseHandwriting !== undefined)
- testcase.verify(InputEngine.JapaneseHandwriting !== undefined)
- testcase.verify(InputEngine.KoreanHandwriting !== undefined)
- testcase.verify(InputEngine.Thai !== undefined)
- testcase.verify(InputEngine.None !== undefined)
- testcase.verify(InputEngine.PatternRecognitionDisabled !== undefined)
- testcase.verify(InputEngine.Handwriting !== undefined)
- testcase.verify(InputEngine.HandwritingRecoginition !== undefined)
- testcase.verify(InputEngine.WordBeforeCursor !== undefined)
- testcase.verify(InputEngine.WordAfterCursor !== undefined)
- testcase.verify(InputEngine.WordAtCursor !== undefined)
- testcase.verify(SelectionListModel.WordCandidateList !== undefined)
- testcase.verify(SelectionListModel.DisplayRole !== undefined)
- testcase.verify(SelectionListModel.WordCompletionLengthRole !== undefined)
- testcase.verify(SelectionListModel.DictionaryType !== undefined)
- testcase.verify(SelectionListModel.Default !== undefined)
- testcase.verify(SelectionListModel.User !== undefined)
}
function setExternalLanguageSwitchEnabled(enabled) {
@@ -425,6 +408,19 @@ InputPanel {
return Utils.findChildByProperty(keyboard, "objectName", objectName, null)
}
+ function mapKeyboardKeyType(keyTypeName) {
+ if (keyTypeName === "ChangeLanguageKey")
+ return QtVirtualKeyboard.KeyType.ChangeLanguageKey
+ if (keyTypeName === "HideKeyboardKey")
+ return QtVirtualKeyboard.KeyType.HideKeyboardKey
+ testcase.fail("Invalid key type '%1'".arg(keyTypeName))
+ }
+
+ function findKeyByKeyType(keyTypeName) {
+ const keyType = mapKeyboardKeyType(keyTypeName)
+ return Utils.findChildByProperty(keyboard, "keyType", keyType, null)
+ }
+
function virtualKeyPressOnCurrentLayout(key) {
var keyObj = typeof key == "object" && key.hasOwnProperty("key") ? key : findVirtualKey(key)
var alternativeKey = false
@@ -437,14 +433,14 @@ InputPanel {
if (keyObj) {
virtualKeyPressPoint = inputPanel.mapFromItem(keyObj, keyObj.width / 2, keyObj.height / 2)
testcase.mousePress(inputPanel, virtualKeyPressPoint.x, virtualKeyPressPoint.y)
- testcase.wait(20)
+ testcase.wait(1)
if (alternativeKey) {
alternativeKeysSpy.wait()
var keyIndex = keyObj.effectiveAlternativeKeys.indexOf(key.toLowerCase())
var itemX = keyIndex * keyboard.style.alternateKeysListItemWidth + keyboard.style.alternateKeysListItemWidth / 2
virtualKeyPressPoint.x = inputPanel.mapFromItem(alternativeKeys.listView, itemX, 0).x
testcase.mouseMove(inputPanel, virtualKeyPressPoint.x, virtualKeyPressPoint.y)
- testcase.waitForRendering(inputPanel)
+ testcase.wait(1)
}
return true
}
@@ -453,7 +449,7 @@ InputPanel {
function multiLayoutKeyActionHelper(key, keyActionOnCurrentLayoutCb) {
if (!keyboardLayoutLoader.item) {
- console.warn("Key not found \\u%1 (keyboard layout not loaded)".arg(key.charCodeAt(0).toString(16)))
+ console.warn("Key not found \\u%1 (keyboard layout not loaded)".arg(typeof key == "string" ? key.charCodeAt(0).toString(16) : key.toString(16)))
return false
}
var success = keyActionOnCurrentLayoutCb(key)
@@ -496,7 +492,7 @@ InputPanel {
success = keyActionOnCurrentLayoutCb(key)
}
if (!success)
- console.warn("Key not found \\u%1".arg(key.charCodeAt(0).toString(16)))
+ console.warn("Key not found \\u%1".arg(typeof key == "string" ? key.charCodeAt(0).toString(16) : key.toString(16)))
return success
}
@@ -531,7 +527,6 @@ InputPanel {
function virtualKeyClick(key) {
if (virtualKeyPress(key)) {
virtualKeyRelease()
- testcase.waitForRendering(inputPanel)
return true
}
return false
@@ -539,13 +534,7 @@ InputPanel {
function emulateNavigationKeyClick(navigationKey) {
testcase.keyClick(navigationKey)
- while (inputPanel.naviationHighlightAnimating)
- testcase.wait(inputPanel.naviationHighlight.moveDuration / 2)
- }
-
- function navigationHighlightContains(point) {
- var navigationPoint = inputPanel.mapToItem(inputPanel.naviationHighlight, point.x, point.y)
- return inputPanel.naviationHighlight.contains(Qt.point(navigationPoint.x, navigationPoint.y))
+ testcase.wait(50)
}
function navigateToKeyOnPoint(point) {
@@ -553,7 +542,7 @@ InputPanel {
if (inputPanel.naviationHighlight.visible) {
while (true) {
var navigationPoint = inputPanel.mapToItem(inputPanel.naviationHighlight, point.x, point.y)
- if (navigationHighlightContains(point))
+ if (inputPanel.naviationHighlight.contains(Qt.point(navigationPoint.x, navigationPoint.y)))
return true
if (inputPanel.naviationHighlight.y > point.y)
emulateNavigationKeyClick(Qt.Key_Up)
@@ -613,12 +602,9 @@ InputPanel {
function activateNavigationKeyMode() {
if (!inputPanel.naviationHighlight.visible) {
- inputPanel.naviationHighlight.moveDuration = 0
- inputPanel.naviationHighlight.resizeDuration = 0
emulateNavigationKeyClick(Qt.Key_Right)
if (inputPanel.naviationHighlight.visible) {
- while (inputPanel.naviationHighlightAnimating)
- testcase.wait(inputPanel.naviationHighlight.moveDuration / 2)
+ testcase.wait(1)
}
}
return inputPanel.naviationHighlight.visible
@@ -658,6 +644,9 @@ InputPanel {
origIndex = inputPanel.wordCandidateView.currentIndex
}
if (origIndex !== -1) {
+ while (inputPanel.wordCandidateView.currentIndex > 0) {
+ inputPanel.wordCandidateView.decrementCurrentIndex()
+ }
while (true) {
if (inputPanel.wordCandidateView.model.dataAt(inputPanel.wordCandidateView.currentIndex) === suggestion) {
suggestionFound = true
@@ -672,7 +661,6 @@ InputPanel {
inputPanel.wordCandidateView.decrementCurrentIndex()
}
}
- testcase.waitForRendering(inputPanel)
}
return suggestionFound
}
@@ -680,7 +668,6 @@ InputPanel {
function selectionListSelectCurrentItem() {
if (!inputPanel.wordCandidateView.currentItem)
return false
- testcase.wait(200)
testcase.verify(inputPanel.wordCandidateView.currentItem,
"Expected wordCandidateView to have a currentItem, but it's null."
+ " Its property values at the time of failure are:"
@@ -696,7 +683,6 @@ InputPanel {
inputPanel.wordCandidateView.currentItem.width / 2,
inputPanel.wordCandidateView.currentItem.height / 2)
testcase.mouseClick(inputPanel, itemPos.x, itemPos.y, Qt.LeftButton, 0, 20)
- testcase.waitForRendering(inputPanel)
return true
}
@@ -730,7 +716,6 @@ InputPanel {
var wordCandidateContextMenuList = Utils.findChildByProperty(keyboard, "objectName", "wordCandidateContextMenuList", null)
if (wordCandidateContextMenuList.currentIndex !== index) {
wordCandidateContextMenuList.currentIndex = index
- testcase.waitForRendering(inputPanel)
}
if (!wordCandidateContextMenuList.currentItem)
return false
@@ -738,10 +723,13 @@ InputPanel {
wordCandidateContextMenuList.currentItem.width / 2,
wordCandidateContextMenuList.currentItem.height / 2)
testcase.mouseClick(inputPanel, itemPos.x, itemPos.y, Qt.LeftButton, 0, 20)
- testcase.waitForRendering(inputPanel)
return true
}
+ function isHandwritingFeatureAvailable() {
+ return VirtualKeyboardFeatures.Handwriting
+ }
+
function setHandwritingMode(enabled) {
if (inputPanel.keyboard.handwritingMode !== enabled) {
if (!enabled || inputPanel.keyboard.isHandwritingAvailable())
@@ -773,4 +761,12 @@ InputPanel {
return false
return inputMethod != null && inputMethod.hasOwnProperty("superimposed") && inputMethod.superimposed
}
+
+ function closeOnReturn() {
+ return VirtualKeyboardSettings.closeOnReturn
+ }
+
+ function setCloseOnReturn(enabled) {
+ VirtualKeyboardSettings.closeOnReturn = enabled
+ }
}
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data.js b/tests/auto/inputpanel/data/inputpanel/unipen_data.js
index 83ad1a2c..8c56733b 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0020": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js
index da810919..17a62c1a 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_arabic.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0627": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js
index 3f336427..c05ce2cd 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_cyrillic.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0430": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js
index 54db858b..56c630f2 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_greek.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0395": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js
index 29c9d3eb..1d061e14 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_hebrew.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x05d0": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js
index bef4fc56..fce71d6e 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_japanese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x65e5": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
index db30adda..4eea1c5e 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_korean.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0xad6d": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js
index b5942e6b..0b9c3c59 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_simp_chinese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x4e2d": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js
index 525df258..4486fe58 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_thai.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0e14": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js
index 5e0c5c3f..77d9ba08 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_trad_chinese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x570b": {
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js b/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
index 09d2fae6..73ed8e9b 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data_vietnamese.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var unipenData = {
"0x0067": {
diff --git a/tests/auto/inputpanel/data/inputpanel/utils.js b/tests/auto/inputpanel/data/inputpanel/utils.js
index de5117b1..1f1a6299 100644
--- a/tests/auto/inputpanel/data/inputpanel/utils.js
+++ b/tests/auto/inputpanel/data/inputpanel/utils.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
.pragma library
@@ -34,8 +8,7 @@ function findChildByProperty(parent, propertyName, propertyValue, compareCb) {
if (parent === null)
return null
var children = parent.children
- for (var i = 0; i < children.length; i++) {
- obj = children[i]
+ for (obj of children) {
if (obj.hasOwnProperty(propertyName)) {
if (compareCb !== null) {
if (compareCb(obj[propertyName], propertyValue))
@@ -56,8 +29,7 @@ function findChild(parent, param, matchCb) {
if (parent === null)
return null
var children = parent.children
- for (var i = 0; i < children.length; i++) {
- obj = children[i]
+ for (obj of children) {
if (matchCb(obj, param))
break
obj = findChild(obj, param, matchCb)
@@ -66,3 +38,13 @@ function findChild(parent, param, matchCb) {
}
return obj
}
+
+function toUnicodeHex(str) {
+ var result = ''
+ for (var i = 0; i < str.length; i++) {
+ if (result.length > 0)
+ result += ", "
+ result += "U+" + ("000" + str.charCodeAt(i).toString(16)).slice(-4)
+ }
+ return result
+}
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml
index ec1dbd97..026ed751 100644
--- a/tests/auto/inputpanel/data/tst_inputpanel.qml
+++ b/tests/auto/inputpanel/data/tst_inputpanel.qml
@@ -1,40 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.Window 2.3
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+import "inputpanel/utils.js" as Utils
Rectangle {
id: container
- width: 400
- height: 400
+ width: 800
+ height: 640
color: "blue"
Component {
@@ -47,6 +23,14 @@ Rectangle {
}
}
+ Component {
+ id: textFieldComp
+ TextField {
+ property int enterKeyType: Qt.EnterKeyDefault
+ EnterKey.type: enterKeyType
+ }
+ }
+
TestCase {
id: testcase
name: "tst_plugin"
@@ -79,12 +63,21 @@ Rectangle {
}
function prepareTest(data, skipIfFail) {
+ // Skip hwr tests early if handwriting feature is not available
+ if (data !== undefined && data.hasOwnProperty("initHwrMode") && data.initHwrMode) {
+ if (!inputPanel.isHandwritingFeatureAvailable())
+ skip("Handwriting feature not available")
+ }
+
inputPanel.setWclAutoHideDelay(data !== undefined && data.hasOwnProperty("wclAutoHideDelay") ? data.wclAutoHideDelay : 5000)
inputPanel.setWclAlwaysVisible(data !== undefined && data.hasOwnProperty("wclAlwaysVisible") && data.wclAlwaysVisible)
inputPanel.setWclAutoCommitWord(data !== undefined && data.hasOwnProperty("wclAutoCommitWord") && data.wclAutoCommitWord)
inputPanel.setFullScreenMode(data !== undefined && data.hasOwnProperty("fullScreenMode") && data.fullScreenMode)
inputPanel.setExternalLanguageSwitchEnabled(data !== undefined && data.hasOwnProperty("externalLanguageSwitchEnabled") && data.externalLanguageSwitchEnabled)
inputPanel.setLayoutMirroring(data !== undefined && data.hasOwnProperty("layoutMirroring") && data.layoutMirroring)
+ inputPanel.setVisibleFunctionKeys(data !== undefined && data.hasOwnProperty("visibleFunctionKeys") ? data.visibleFunctionKeys : ["All"])
+ inputPanel.setCloseOnReturn(data !== undefined && data.hasOwnProperty("closeOnReturn") && data.closeOnReturn)
+
var window = container.Window.window
verify(window)
@@ -93,7 +86,6 @@ Rectangle {
tryCompare(window, "active", true)
container.forceActiveFocus()
- waitForRendering(container)
if (data !== undefined && data.hasOwnProperty("initText")) {
textInput.text = data.initText
textInput.cursorPosition = data.hasOwnProperty("initCursorPosition") ? data.initCursorPosition : textInput.text.length
@@ -108,7 +100,6 @@ Rectangle {
handwritingInputPanel.available = false
inputPanel.setHandwritingMode(false)
textInput.forceActiveFocus()
- waitForRendering(inputPanel)
var activeLocales = data !== undefined && data.hasOwnProperty("activeLocales") ? data.activeLocales : []
inputPanel.setActiveLocales(activeLocales)
var locale = data !== undefined && data.hasOwnProperty("initLocale") ? data.initLocale : "en_GB"
@@ -138,6 +129,7 @@ Rectangle {
}
verify(inputPanel.setInputMode(inputMode))
}
+ waitForRendering(inputPanel)
verify(inputPanel.visible === true)
verify(textInput.activeFocus === true)
}
@@ -212,6 +204,20 @@ Rectangle {
property var wclAlwaysVisible: VirtualKeyboardSettings.wordCandidateList.alwaysVisible; \
property var wclAutoCommitWord: VirtualKeyboardSettings.wordCandidateList.autoCommitWord; \
property var fullScreenMode: VirtualKeyboardSettings.fullScreenMode; }" },
+ // without versions
+ { qml: "import QtQuick; \
+ import QtQuick.VirtualKeyboard; \
+ import QtQuick.VirtualKeyboard.Styles; \
+ import QtQuick.VirtualKeyboard.Settings; \
+ import QtQuick.VirtualKeyboard.Plugins; \
+ Item {}" },
+ // virtual keyboard 5.15
+ { qml: "import QtQuick 2.7; \
+ import QtQuick.VirtualKeyboard 2.3; \
+ import QtQuick.VirtualKeyboard.Styles 2.1; \
+ import QtQuick.VirtualKeyboard.Settings 2.2; \
+ import QtQuick.VirtualKeyboard.Plugins 2.3; \
+ Item {}" },
]
}
@@ -251,8 +257,14 @@ Rectangle {
Qt.inputMethod.hide()
verify(inputPanel.visible === false)
+ // Should not become visible because the active focus is set to container
Qt.inputMethod.show()
waitForRendering(inputPanel)
+ verify(inputPanel.visible === false)
+
+ // Should become visible because of previously called show() and focus set to input control
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
verify(inputPanel.visible === true)
Qt.inputMethod.hide()
@@ -321,6 +333,31 @@ Rectangle {
compare(textInput.text, "A")
}
+ function test_hardKeyBackspaceClearsInput_data() {
+ return [
+ { initLocale: "en_GB", initText: "12345", initCursorPosition: 1, inputSequence: "hello", outputText: "12345", expectedCursorPosition: 1 },
+ { initLocale: "ja_JP", initText: "12345", initCursorPosition: 1, inputSequence: "watashi", outputText: "12345", expectedCursorPosition: 1 },
+ ]
+ }
+
+ function test_hardKeyBackspaceClearsInput(data) {
+ prepareTest(data)
+
+ if (!inputPanel.wordCandidateListVisibleHint)
+ skip("Prediction/spell correction not enabled")
+
+ compare(Qt.inputMethod.locale.name, Qt.locale(data.initLocale).name)
+ for (var inputIndex in data.inputSequence) {
+ verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
+ }
+
+ keyClick(Qt.Key_Backspace)
+ waitForRendering(textInput)
+
+ compare(textInput.text, data.outputText)
+ compare(textInput.cursorPosition, data.expectedCursorPosition)
+ }
+
function test_hardKeyInput() {
prepareTest()
@@ -366,7 +403,6 @@ Rectangle {
{ initLocale: "pt_BR", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "ol\u00E1", outputText: "Ol\u00E1" },
{ initLocale: "pt_PT", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "ol\u00E1", outputText: "Ol\u00E1" },
{ initLocale: "ru_RU", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "\u043F\u0440\u0438\u0432\u0435\u0442", outputText: "\u041F\u0440\u0438\u0432\u0435\u0442" },
- { initLocale: "ru_RU", initInputMethodHints: Qt.ImhNoPredictiveText, initInputMode: "Latin", inputSequence: "hello", outputText: "Hello" },
{ initLocale: "sr_SP", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "\u0437\u0434\u0440\u0430\u0432\u043E", outputText: "\u0417\u0434\u0440\u0430\u0432\u043E" },
{ initLocale: "sv_SE", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "hall\u00E5", outputText: "Hall\u00E5" },
{ initLocale: "sq_AL", initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "përshëndetje", outputText: "Përshëndetje" },
@@ -387,7 +423,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -416,7 +451,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -448,7 +482,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -494,7 +527,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -599,16 +631,13 @@ Rectangle {
inputPanel.setStyle("retro")
inputPanel.styleSpy.wait()
- waitForRendering(inputPanel)
inputPanel.setStyle("default")
inputPanel.styleSpy.wait()
- waitForRendering(inputPanel)
compare(inputPanel.styleSpy.count, 2)
inputPanel.setStyle(origStyle)
- waitForRendering(inputPanel)
}
function test_soundEffects() {
@@ -628,9 +657,9 @@ Rectangle {
function test_navigationKeyInputSequence_data() {
return [
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "\u00E1\u017C", outputText: "\u00E1\u017C" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "~123qwe", outputText: "~123qwe" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: [ Qt.Key_Shift, Qt.Key_V, Qt.Key_K, Qt.Key_B, Qt.Key_Return ], outputText: "VKB\n" },
+ { initialKey: Qt.Key_Space, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "\u00E1\u017C", outputText: "\u00E1\u017C" },
+ { initialKey: Qt.Key_Space, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: "~123qwe", outputText: "~123qwe" },
+ { initialKey: Qt.Key_Space, initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputSequence: [ Qt.Key_Shift, Qt.Key_Shift, Qt.Key_V, Qt.Key_K, Qt.Key_B, Qt.Key_Return ], outputText: "VKB\n" },
]
}
@@ -641,20 +670,20 @@ Rectangle {
skip("Arrow key navigation not enabled")
verify(inputPanel.naviationHighlight.visible)
+ verify(inputPanel.navigateToKey(data.initialKey))
for (var inputIndex in data.inputSequence) {
verify(inputPanel.navigationKeyClick(data.inputSequence[inputIndex]))
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
function test_navigationCursorWrap_data() {
return [
- { initialKey: Qt.Key_Q, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
- { initialKey: Qt.Key_Q, navigationKey: Qt.Key_Down, navigationKeyRepeat: 4 },
+ { initialKey: Qt.Key_W, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
+ { initialKey: Qt.Key_W, navigationKey: Qt.Key_Down, navigationKeyRepeat: 4 },
{ initialKey: Qt.Key_T, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
{ initialKey: Qt.Key_T, navigationKey: Qt.Key_Down, navigationKeyRepeat: 4 },
{ initialKey: Qt.Key_Backspace, navigationKey: Qt.Key_Up, navigationKeyRepeat: 4 },
@@ -687,7 +716,7 @@ Rectangle {
}
}
- verify(inputPanel.keyboardInputArea.initialKey === initialKeyObj)
+ compare(inputPanel.keyboardInputArea.initialKey, initialKeyObj)
}
function test_navigationCursorAndWordCandidateView() {
@@ -727,7 +756,10 @@ Rectangle {
// Move focus to the next item in the list
var previousHighlightIndex = inputPanel.wordCandidateView.currentIndex
+ inputPanel.wordCandidateListCurrentIndexSpy.clear()
inputPanel.emulateNavigationKeyClick(Qt.Key_Right)
+ inputPanel.wordCandidateListCurrentIndexSpy.wait()
+ compare(inputPanel.wordCandidateListCurrentIndexSpy.count, 1)
compare(inputPanel.wordCandidateView.currentIndex, previousHighlightIndex + 1)
// Move focus to previously focused key on keyboard and back
@@ -743,7 +775,10 @@ Rectangle {
for (previousHighlightIndex = inputPanel.wordCandidateView.currentIndex;
previousHighlightIndex < inputPanel.wordCandidateView.count - 1;
previousHighlightIndex++) {
+ inputPanel.wordCandidateListCurrentIndexSpy.clear()
inputPanel.emulateNavigationKeyClick(Qt.Key_Right)
+ inputPanel.wordCandidateListCurrentIndexSpy.wait()
+ compare(inputPanel.wordCandidateListCurrentIndexSpy.count, 1)
compare(inputPanel.wordCandidateView.currentIndex, previousHighlightIndex + 1)
}
@@ -803,7 +838,7 @@ Rectangle {
var keysTraversed = []
do {
- verify(keysTraversed.indexOf(inputPanel.keyboardInputArea.initialKey) === -1)
+ compare(keysTraversed.indexOf(inputPanel.keyboardInputArea.initialKey), -1)
var currentKey = inputPanel.keyboardInputArea.initialKey
keysTraversed.push(currentKey)
inputPanel.emulateNavigationKeyClick(Qt.Key_Right)
@@ -838,7 +873,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
if (inputPanel.wordCandidateListVisibleHint) {
if (data.hasOwnProperty("expectedSuggestion")) {
@@ -860,16 +894,13 @@ Rectangle {
function test_spellCorrectionAutomaticSpaceInsertion_data() {
return [
{ inputSequence: ['h','e','l','l','o',Qt.Key_Select,'w','o','r','l','d'], outputText: "Hello world" },
- { inputSequence: ['h','e','l','l','o','\'','s',Qt.Key_Select,'w','o','r','l','d'], outputText: "Hello's world" },
+ { inputSequence: ['k','e','l','l','y','\'','s',Qt.Key_Select,'w','o','r','l','d'], outputText: "Kelly's world" },
{ inputSequence: ['h','e','l','l','o','s','\'',Qt.Key_Select,'w','o','r','l','d'], outputText: "Hellos' world" },
{ inputSequence: ['h','e','l','l','o','-','w','o','r','l','d'], outputText: "Hello-world" },
{ inputSequence: ['h','e','l','l','o',Qt.Key_Select,'.','w','o','r','l','d'], outputText: "Hello. World" },
{ inputSequence: ['h','e','l','l','o',Qt.Key_Select,',','w','o','r','l','d'], outputText: "Hello, world" },
{ inputSequence: ['h','e','l','l','o','.',Qt.Key_Backspace,'w','o','r','l','d'], outputText: "Helloworld" },
{ inputSequence: ['h','e','l','l','o',' ',Qt.Key_Backspace,'w','o','r','l','d'], outputText: "Helloworld" },
- { inputSequence: ['h','e','l','l','o',Qt.Key_Select,'w','o','r','l','d',':-)'], outputText: "Hello world :-)" },
- { inputSequence: ['h','e','l','l','o',Qt.Key_Select,'w','o','r','l','d',':-)',':-)'], outputText: "Hello world :-) :-)" },
- { inputSequence: ['h','e','l','l','o',Qt.Key_Select,':-)'], outputText: "Hello :-)" },
{ initText: "Hekko world", selectionStart: 2, selectionEnd: 4, inputSequence: ['l','l'], outputText: "Hello world" },
]
}
@@ -887,7 +918,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
if (!inputPanel.wordCandidateListVisibleHint && textInput.text !== data.outputText)
expectFail("", "Prediction/spell correction not enabled")
compare(textInput.text, data.outputText)
@@ -915,9 +945,13 @@ Rectangle {
{ initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "bailou", expectedCandidates: [ "\u5457", "\u5A04" ], outputText: "\u5457\u5A04" },
// Select phrase from the user dictinary
{ initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "bailou", expectedCandidates: [ "\u5457\u5A04" ], outputText: "\u5457\u5A04" },
+ // Suggest phrases according to the last selected word
+ { initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "da", expectedCandidates: [ "\u5927", "\u5bb6", "\u5ead" ], outputText: "\u5927\u5bb6\u5ead" },
// Add an apostrophe before joined syllables in cases of ambiguity, disable the user dictionary (Qt.ImhSensitiveData) so it does not affect to the results
{ initInputMethodHints: Qt.ImhNone | Qt.ImhSensitiveData, initLocale: "zh_CN", inputSequence: "zhangang", expectedCandidates: [ "\u5360", "\u94A2" ], outputText: "\u5360\u94A2" },
{ initInputMethodHints: Qt.ImhNone | Qt.ImhSensitiveData, initLocale: "zh_CN", inputSequence: "zhang'ang", expectedCandidates: [ "\u7AE0", "\u6602" ], outputText: "\u7AE0\u6602" },
+ // Invalid pinyin sequence
+ { initInputMethodHints: Qt.ImhNone, initLocale: "zh_CN", inputSequence: "fi", expectedCandidates: [ "\u53D1", "i" ], outputText: "\u53D1i" },
]
}
@@ -927,14 +961,13 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
for (var candidateIndex in data.expectedCandidates) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates[candidateIndex]))
verify(inputPanel.selectionListSelectCurrentItem())
}
- compare(textInput.text, data.outputText)
+ compare(Utils.toUnicodeHex(textInput.text), Utils.toUnicodeHex(data.outputText))
}
function test_cangjieInputMethod_data() {
@@ -973,6 +1006,9 @@ Rectangle {
function test_cangjieInputMethod(data) {
prepareTest(data, true)
+ if (!inputPanel.inputMethod.hasOwnProperty("simplified"))
+ skip("Input method does not support simplified mode")
+
if (data.hasOwnProperty("initSimplified")) {
if (inputPanel.inputMethod.simplified !== data.initSimplified)
verify(inputPanel.virtualKeyClick(Qt.Key_Mode_switch))
@@ -986,7 +1022,6 @@ Rectangle {
else
verify(inputPanel.virtualKeyClick(key))
}
- waitForRendering(inputPanel)
if (data.expectedCandidates) {
for (var candidateIndex in data.expectedCandidates) {
@@ -1055,8 +1090,6 @@ Rectangle {
}
function test_zhuyinInputMethod(data) {
- skip("The test is broken, see QTBUG-80663. Skipping rather than blacklisting to avoid crashes.")
-
prepareTest(data, true)
for (var inputIndex in data.inputSequence) {
@@ -1066,8 +1099,6 @@ Rectangle {
verify(inputPanel.virtualKeyClick(inputSequence[charIndex]))
}
- waitForRendering(inputPanel)
-
if (data.expectedCandidates && inputIndex < data.expectedCandidates.length && data.expectedCandidates[inputIndex].length > 0) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates[inputIndex]))
verify(inputPanel.selectionListSelectCurrentItem())
@@ -1076,7 +1107,6 @@ Rectangle {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
}
- waitForRendering(inputPanel)
if (!Array.isArray(data.inputSequence) && data.expectedCandidates) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates))
@@ -1114,7 +1144,7 @@ Rectangle {
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3139\u314D", outputText: "\uAC0E" },
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3139\u314E", outputText: "\uAC0F" },
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3142\u3145", outputText: "\uAC12" },
- { initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3145\u3145", outputText: "\uAC14" },
+ //{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3145\u3145", outputText: "\uAC14" }, // Actually not standard
// Test using the final Jamo of the first syllable as an initial
// Jamo of the following syllable
{ initLocale: "ko_KR", inputSequence: "\u3131\u314F\u3131\u314F", outputText: "\uAC00\uAC00" },
@@ -1131,24 +1161,30 @@ Rectangle {
compare(Qt.inputMethod.locale.name, Qt.locale(data.initLocale).name)
+ function textInputContents() {
+ return textInput.text.substring(0, textInput.cursorPosition) +
+ textInput.preeditText +
+ textInput.text.substring(textInput.cursorPosition)
+ }
+
// Add Jamos one by one
var intermediateResult = []
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
- intermediateResult.push(textInput.text)
+ intermediateResult.push(textInputContents())
}
- compare(textInput.text, data.outputText)
+ compare(Utils.toUnicodeHex(textInputContents()), Utils.toUnicodeHex(data.outputText))
// Remove Jamos one by one.
// The number of removed characters must match to the number of Jamos entered.
for (inputIndex = data.inputSequence.length - 1; inputIndex >= 0; inputIndex--) {
- compare(textInput.text, intermediateResult.pop())
+ compare(Utils.toUnicodeHex(textInputContents()), Utils.toUnicodeHex(intermediateResult.pop()))
inputPanel.virtualKeyClick(Qt.Key_Backspace)
}
- waitForRendering(inputPanel)
- compare(textInput.text, data.initText !== undefined ? data.initText : "")
+ compare(Utils.toUnicodeHex(textInputContents()),
+ Utils.toUnicodeHex(data.initText !== undefined ? data.initText : ""))
}
function test_japaneseInputModes_data() {
@@ -1157,8 +1193,6 @@ Rectangle {
{ initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",Qt.Key_Return], outputText: "\u306B\u307B\u3093\u3054" },
// Hiragana to Kanjie conversion
{ initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",Qt.Key_Space,Qt.Key_Return], outputText: "\u65E5\u672C\u8A9E" },
- // Hiragana to Kanjie conversion plus a smiley
- { initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: ["n","i","h","o","n","g","o",0xE000,Qt.Key_Space,Qt.Key_Return,Qt.Key_Return], outputText: "\u65E5\u672C\u8A9E\uFF1A\u30FC\uFF09" },
// Correction to Hiragana sequence using exact match mode
{ initLocale: "ja_JP", initInputMode: "Hiragana", inputSequence: [
// Write part of the text leaving out "ni" from the beginning
@@ -1193,7 +1227,6 @@ Rectangle {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
if (data.hasOwnProperty("expectedCursorPosition"))
@@ -1223,7 +1256,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex]))
}
- waitForRendering(inputPanel)
for (var candidateIndex in data.expectedCandidates) {
verify(inputPanel.selectionListSearchSuggestion(data.expectedCandidates[candidateIndex]))
@@ -1233,10 +1265,25 @@ Rectangle {
compare(textInput.cursorPosition, data.expectedCursorPosition)
}
+ function test_japaneseSelectCurrentItemResetsIndex() {
+ prepareTest({ initLocale: "ja_JP" }, true)
+
+ verify(inputPanel.virtualKeyClick("a"))
+ verify(inputPanel.virtualKeyClick("a"))
+ verify(inputPanel.virtualKeyClick("a"))
+
+ compare(inputPanel.wordCandidateView.currentIndex, -1)
+ inputPanel.wordCandidateView.currentIndex = 0
+ inputPanel.selectionListSelectCurrentItem()
+ compare(inputPanel.wordCandidateView.currentIndex, -1, "QTBUG-94560")
+ }
+
function test_baseKeyNoModifier() {
// The Japanese keyboard uses the BaseKey.noModifier flag for the arrow keys.
// Without this flag the arrow key + shift would extend the text selection.
prepareTest({ initLocale: "ja_JP", initInputMethodHints: Qt.ImhLatinOnly })
+ if (!inputPanel.findVirtualKey(Qt.Key_Left) || inputPanel.virtualKeyClick(Qt.Key_Right))
+ skip("Custom layout detected")
verify(inputPanel.virtualKeyClick("a"))
verify(inputPanel.virtualKeyClick(Qt.Key_Left))
compare(textInput.cursorPosition, 0)
@@ -1263,7 +1310,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -1307,7 +1353,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -1353,7 +1398,6 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
}
@@ -1387,12 +1431,10 @@ Rectangle {
}
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
var inputMode = inputPanel.inputMode
verify(inputPanel.virtualKeyClick(Qt.Key_Mode_switch))
- waitForRendering(inputPanel)
compare(inputPanel.inputMode !== inputMode, data.modeSwitchAllowed)
}
@@ -1416,7 +1458,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
}
- waitForRendering(inputPanel)
if (inputPanel.wordCandidateListVisibleHint) {
if (data.hasOwnProperty("expectedSuggestion")) {
@@ -1595,7 +1636,6 @@ Rectangle {
for (var inputIndex in data.inputSequence) {
verify(handwritingInputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
}
- waitForRendering(handwritingInputPanel)
if (data.popupFlipped) {
verify(handwritingInputPanel.wordCandidatePopupList.y + handwritingInputPanel.wordCandidatePopupList.height <= Qt.inputMethod.cursorRectangle.y)
@@ -1628,7 +1668,6 @@ Rectangle {
else
expectedResult = (inputPanel.activeLocales.length === 0 || inputPanel.activeLocales.indexOf(locale) !== -1) && inputPanel.availableLocales.indexOf(locale) !== -1
inputPanel.setLocale(locale)
- waitForRendering(inputPanel)
compare(inputPanel.locale === locale, expectedResult, "Test locale %1".arg(locale))
}
}
@@ -1662,6 +1701,9 @@ Rectangle {
{ initText: "aa http://www.example.com bb", initInputMethodHints: Qt.ImhUrlCharactersOnly, clickPositions: [4], expectedPreeditText: "http://www.example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
{ initText: "aa username@example.com bb", clickPositions: [4], expectedPreeditText: "username", expectedCursorPosition: 3, expectedText: "aa @example.com bb" },
{ initText: "aa username@example.com bb", initInputMethodHints: Qt.ImhEmailCharactersOnly, clickPositions: [4], expectedPreeditText: "username@example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
+ // 23
+ // Verify that word reselect is not activated during initial focus
+ { initText: "hello", clickPositions: [], initCursorPosition: 2, expectedPreeditText: "", expectedCursorPosition: 2, expectedText: "hello" },
]
}
@@ -1676,7 +1718,6 @@ Rectangle {
var cursorRect = cursorRects[i]
mousePress(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
mouseRelease(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
- waitForRendering(textInput)
}
if (!inputPanel.wordCandidateListVisibleHint && inputPanel.preeditText !== data.expectedPreeditText)
@@ -1738,7 +1779,6 @@ Rectangle {
var cursorRect = cursorRects[i]
mousePress(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
mouseRelease(textInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
- waitForRendering(textInput)
}
if (!inputPanel.wordCandidateListVisibleHint && inputPanel.preeditText !== data.expectedPreeditText)
@@ -1764,7 +1804,6 @@ Rectangle {
}
function test_selection(data) {
- waitForRendering(textInput)
prepareTest(data)
compare(inputPanel.cursorHandle.visible, data.expectHandlesToBeVisible)
compare(inputPanel.anchorHandle.visible, data.expectHandlesToBeVisible)
@@ -1793,13 +1832,12 @@ Rectangle {
prepareTest(data)
if (inputPanel.availableLocales.length < 2)
skip("Input language can not be changed")
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
inputPanel.externalLanguageSwitchSpy.clear()
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, !data.externalLanguageSwitchEnabled)
compare(inputPanel.externalLanguageSwitchSpy.count, data.externalLanguageSwitchEnabled ? 1 : 0)
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, false)
}
@@ -1807,9 +1845,8 @@ Rectangle {
prepareTest()
if (inputPanel.availableLocales.length < 2)
skip("Input language can not be changed")
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, true)
container.forceActiveFocus()
textInput.forceActiveFocus()
@@ -1820,9 +1857,8 @@ Rectangle {
prepareTest()
if (inputPanel.availableLocales.length < 2)
skip("Input language can not be changed")
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, true)
Qt.inputMethod.hide()
Qt.inputMethod.show()
@@ -1846,9 +1882,8 @@ Rectangle {
}
}
- var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey")
var languagePopupList = inputPanel.findObjectByName("languagePopupList")
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
compare(languagePopupList.visible, data.languagePopupVisible)
if (!data.languagePopupVisible)
@@ -1870,12 +1905,35 @@ Rectangle {
}
compare(inputPanel.locale, data.selectLocale, "Language popup select %1".arg(data.selectLocale))
} else {
- inputPanel.virtualKeyClick(changeLanguageKey)
+ inputPanel.doKeyboardFunction("ChangeLanguage")
}
compare(languagePopupList.visible, false)
}
+ function test_languagePopupListSortOrder_data() {
+ return [
+ { activeLocales: ["fi_FI", "foo", "en_GB", "bar", "ar_AR", "baz"] },
+ ]
+ }
+
+ function test_languagePopupListSortOrder(data) {
+ prepareTest(data)
+
+ if (!inputPanel.keyboard.style.languagePopupListEnabled)
+ skip("The language popup is disabled (!style.languagePopupListEnabled)")
+
+ var languagePopupList = inputPanel.findObjectByName("languagePopupList")
+ inputPanel.doKeyboardFunction("ChangeLanguage")
+
+ var previousIndex = -1
+ for (var i = 0; i < languagePopupList.model.count; ++i) {
+ var currentIndex = data.activeLocales.indexOf(languagePopupList.model.get(i).localeName)
+ verify(currentIndex > previousIndex)
+ previousIndex = currentIndex
+ }
+ }
+
function test_wclAutoHide_data() {
return [
{ wclAutoHideDelay: 100, wclAlwaysVisible: false },
@@ -1888,13 +1946,11 @@ Rectangle {
prepareTest(data)
inputPanel.wordCandidateListChangedSpy.clear()
Qt.inputMethod.show()
- waitForRendering(inputPanel)
compare(inputPanel.wordCandidateView.visibleCondition, data.wclAlwaysVisible)
inputPanel.virtualKeyClick("a")
inputPanel.virtualKeyClick("u")
inputPanel.virtualKeyClick("t")
inputPanel.virtualKeyClick("o")
- waitForRendering(inputPanel)
if (!inputPanel.wordCandidateListVisibleHint)
skip("Prediction/spell correction not enabled")
inputPanel.wordCandidateListChangedSpy.wait(1000)
@@ -1905,7 +1961,6 @@ Rectangle {
wait(data.wclAutoHideDelay + 250)
else
inputPanel.wordCandidateListVisibleSpy.wait(data.wclAutoHideDelay + 500)
- waitForRendering(inputPanel)
compare(inputPanel.wordCandidateView.visibleCondition, data.wclAlwaysVisible)
}
@@ -1922,20 +1977,19 @@ Rectangle {
if (!inputPanel.wordCandidateListVisibleHint)
skip("Prediction/spell correction not enabled")
+ inputPanel.wordCandidateListItemSelectedSpy.clear()
for (var len = 1; len <= 5; ++len) {
inputPanel.virtualKeyClick("z")
- if (len >= 2) {
- inputPanel.inputMethodSelectionListChangedSpy.clear()
- inputPanel.inputMethodSelectionListChangedSpy.wait()
- if (inputPanel.wordCandidateView.model.count <= 1)
- break
+ wait(200)
+ if (inputPanel.wordCandidateListItemSelectedSpy.count > 0) {
+ break
}
}
if (data.wclAutoCommitWord)
- compare(inputPanel.wordCandidateView.model.count, 0)
+ compare(inputPanel.wordCandidateListItemSelectedSpy.count, 1)
else
- verify(inputPanel.wordCandidateView.model.count >= 1)
+ compare(inputPanel.wordCandidateListItemSelectedSpy.count, 0)
}
function test_fullScreenModeActivation() {
@@ -1945,14 +1999,12 @@ Rectangle {
inputPanel.shadowInputControlVisibleSpy.clear()
inputPanel.setFullScreenMode(true)
- waitForRendering(inputPanel)
inputPanel.shadowInputControlVisibleSpy.wait()
compare(inputPanel.shadowInput.text, textInput.text)
inputPanel.shadowInputControlVisibleSpy.clear()
inputPanel.setFullScreenMode(false)
- waitForRendering(inputPanel)
inputPanel.shadowInputControlVisibleSpy.wait()
}
@@ -1974,7 +2026,6 @@ Rectangle {
compare(inputPanel.shadowInput.preeditText, textInput.preeditText)
Qt.inputMethod.commit()
- waitForRendering(inputPanel)
compare(textInput.text, data.outputText)
compare(inputPanel.shadowInput.text, textInput.text)
compare(inputPanel.shadowInput.cursorPosition, textInput.cursorPosition)
@@ -1993,7 +2044,6 @@ Rectangle {
prepareTest(data)
data.select()
- waitForRendering(textInput)
compare(inputPanel.shadowInput.text, textInput.text)
compare(inputPanel.shadowInput.cursorPosition, textInput.cursorPosition)
compare(inputPanel.shadowInput.selectedText, textInput.selectedText)
@@ -2030,6 +2080,7 @@ Rectangle {
{ initText: "aa http://www.example.com bb", initInputMethodHints: Qt.ImhUrlCharactersOnly, clickPositions: [4], expectedPreeditText: "http://www.example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
{ initText: "aa username@example.com bb", clickPositions: [4], expectedPreeditText: "username", expectedCursorPosition: 3, expectedText: "aa @example.com bb" },
{ initText: "aa username@example.com bb", initInputMethodHints: Qt.ImhEmailCharactersOnly, clickPositions: [4], expectedPreeditText: "username@example.com", expectedCursorPosition: 3, expectedText: "aa bb" },
+ { initText: "hello world", clickPositions: [1], expectedPreeditText: "hello", expectedCursorPosition: 0, expectedText: " world" },
]
}
@@ -2049,7 +2100,6 @@ Rectangle {
var cursorRect = cursorRects[i]
mousePress(inputPanel.shadowInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
mouseRelease(inputPanel.shadowInput, cursorRect.x, cursorRect.y + cursorRect.height / 2, Qt.LeftButton, Qt.NoModifier, 20)
- waitForRendering(inputPanel.shadowInput)
}
if (!inputPanel.wordCandidateListVisibleHint && inputPanel.preeditText !== data.expectedPreeditText)
@@ -2134,21 +2184,21 @@ Rectangle {
{ inputSequence: ['a','s','d'], initShift: false, expectedSuggestion: "asdf", suggestionIsFromUserDictionary: true },
{ inputSequence: ['a','s','d'], initShift: true, expectedSuggestion: "Asdf", suggestionIsFromUserDictionary: true },
//
- { inputSequence: ['s','d','f','a'], initShift: true },
- { inputSequence: ['s','d','f'], initShift: true, expectedSuggestion: "Sdfa", suggestionIsFromUserDictionary: true },
+ { inputSequence: ['S','d','f','a'], initShift: true },
+ { inputSequence: ['S','d','f'], initShift: true, expectedSuggestion: "Sdfa", suggestionIsFromUserDictionary: true },
{ inputSequence: ['s','d','f'], initShift: false, expectedSuggestion: "sdfa", suggestionIsFromUserDictionary: true, removeSuggestion: true },
//
- { inputSequence: ['d','f','a','s'], initCapsLock: true },
- { inputSequence: ['d','f','a'], initCapsLock: true, expectedSuggestion: "DFAS", suggestionIsFromUserDictionary: true },
+ { inputSequence: ['D','F','A','S'], initCapsLock: true },
+ { inputSequence: ['D','F','A'], initCapsLock: true, expectedSuggestion: "DFAS", suggestionIsFromUserDictionary: true },
{ inputSequence: ['d','f','a'], initShift: false, unexpectedSuggestion: "dfas", suggestionIsFromUserDictionary: true },
//
{ inputSequence: ['f','a','s','d'], initShift: false, initInputMethodHints: Qt.ImhSensitiveData },
{ inputSequence: ['f','a','s'], initShift: false, unexpectedSuggestion: "fasd" },
- { inputSequence: ['f','a','s'], initShift: true, unexpectedSuggestion: "Fasd"},
+ { inputSequence: ['F','a','s'], initShift: true, unexpectedSuggestion: "Fasd"},
//
- { initLocale: "en_GB", inputSequence: "windo", expectedSuggestion: "Window", suggestionIsFromUserDictionary: false, removeSuggestion: true },
- { initLocale: "en_GB", inputSequence: "window", },
- { initLocale: "en_GB", inputSequence: "windo", expectedSuggestion: "Window", suggestionIsFromUserDictionary: false },
+ { initLocale: "en_GB", inputSequence: "windo", initShift: false, expectedSuggestion: "window", suggestionIsFromUserDictionary: false, removeSuggestion: true },
+ { initLocale: "en_GB", inputSequence: "window",initShift: false, },
+ { initLocale: "en_GB", inputSequence: "windo", initShift: false, expectedSuggestion: "window", suggestionIsFromUserDictionary: false },
]
}
@@ -2163,11 +2213,14 @@ Rectangle {
if (data.hasOwnProperty("initCapsLock"))
inputPanel.setCapsLockActive(data.initCapsLock)
- for (var inputIndex in data.inputSequence)
+ var exactWord = ""
+ for (var inputIndex in data.inputSequence) {
inputPanel.virtualKeyClick(data.inputSequence[inputIndex])
+ exactWord += data.inputSequence[inputIndex]
+ }
if (data.hasOwnProperty("expectedSuggestion")) {
- tryVerify(function() {return inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 1000, "The expected spell correction suggestion \"%1\" was not found".arg(data.expectedSuggestion))
+ tryVerify(function() {return inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 10000, "The expected spell correction suggestion \"%1\" was not found".arg(data.expectedSuggestion))
verify(inputPanel.selectionListCurrentIndex() > 0)
if (data.hasOwnProperty("suggestionIsFromUserDictionary"))
compare(inputPanel.selectionListSuggestionIsFromUserDictionary(), data.suggestionIsFromUserDictionary)
@@ -2176,19 +2229,114 @@ Rectangle {
inputPanel.wordCandidateListChangedSpy.clear()
verify(inputPanel.selectItemFromWordCandidateContextMenu(0))
inputPanel.wordCandidateListChangedSpy.wait()
- tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 1000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
+ tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.expectedSuggestion)}, 10000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
} else {
inputPanel.selectionListSelectCurrentItem()
}
} else if (data.hasOwnProperty("unexpectedSuggestion")) {
var oldIndex = inputPanel.selectionListCurrentIndex()
- tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.unexpectedSuggestion)}, 1000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
+ tryVerify(function() {return !inputPanel.selectionListSearchSuggestion(data.unexpectedSuggestion)}, 10000, "An unexpected spell correction suggestion \"%1\" was found".arg(data.unexpectedSuggestion))
compare(inputPanel.selectionListCurrentIndex(), oldIndex)
} else {
+ tryVerify(function() {return inputPanel.selectionListSearchSuggestion(exactWord)}, 1000, "The exact word \"%1\" was not found".arg(exactWord))
inputPanel.selectionListSelectCurrentItem()
}
Qt.inputMethod.reset()
}
+
+ function test_visibleFunctionKey_data() {
+ return [
+ { initLocale: "en_GB", functionKeysAlwaysVisible: false },
+ // Number and digits layouts must always have the function keys, because otherwise the layout design looks bad
+ { initLocale: "en_GB", functionKeysAlwaysVisible: true, initInputMethodHints: Qt.ImhFormattedNumbersOnly },
+ { initLocale: "en_GB", functionKeysAlwaysVisible: true, initInputMethodHints: Qt.ImhDigitsOnly },
+ // Symbol layout follow the main layout
+ { initLocale: "en_GB", functionKeysAlwaysVisible: false, initInputMethodHints: Qt.ImhPreferNumbers },
+ ]
+ }
+
+ function test_visibleFunctionKey(data) {
+ prepareTest(data, true)
+
+ const changeLanguageKey = inputPanel.findKeyByKeyType("ChangeLanguageKey")
+ verify(!!changeLanguageKey)
+ const hideKeyboardKey = inputPanel.findKeyByKeyType("HideKeyboardKey")
+ verify(!!hideKeyboardKey)
+
+ for (const functionKeyName of [
+ "None",
+ "Hide",
+ "Language",
+ "All"
+ ]) {
+ inputPanel.setVisibleFunctionKeys([functionKeyName])
+ if (data.functionKeysAlwaysVisible) {
+ compare(changeLanguageKey.visible, true)
+ compare(hideKeyboardKey.visible, true)
+ } else if (functionKeyName === "None") {
+ compare(changeLanguageKey.visible, false)
+ compare(hideKeyboardKey.visible, false)
+ } else if (functionKeyName === "Hide") {
+ compare(changeLanguageKey.visible, false)
+ compare(hideKeyboardKey.visible, true)
+ } else if (functionKeyName === "Language") {
+ compare(changeLanguageKey.visible, true)
+ compare(hideKeyboardKey.visible, false)
+ } else if (functionKeyName === "All") {
+ compare(changeLanguageKey.visible, true)
+ compare(hideKeyboardKey.visible, true)
+ }
+ }
+ }
+
+ function test_closeOnReturnSingleLine_data() {
+ return [
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: false },
+ { closeOnReturn: false, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyReturn, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDone, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyGo, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySend, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySearch, expectedVisibleAfterReturn: false },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyNext, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyPrevious, expectedVisibleAfterReturn: true },
+ ]
+ }
+
+ function test_closeOnReturnSingleLine(data) {
+ prepareTest(data)
+ let testObj = textFieldComp.createObject(container, {enterKeyType: data.enterKeyType})
+ testObj.forceActiveFocus()
+ compare(inputPanel.closeOnReturn(), data.closeOnReturn)
+ verify(inputPanel.visible === true)
+ keyClick(Qt.Key_Return)
+ waitForRendering(inputPanel)
+ verify(inputPanel.visible === data.expectedVisibleAfterReturn)
+ testObj.destroy()
+ }
+
+ function test_closeOnReturnMultiline_data() {
+ return [
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: true },
+ { closeOnReturn: false, enterKeyType: Qt.EnterKeyDefault, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyReturn, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyDone, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyGo, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySend, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeySearch, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyNext, expectedVisibleAfterReturn: true },
+ { closeOnReturn: true, enterKeyType: Qt.EnterKeyPrevious, expectedVisibleAfterReturn: true },
+ ]
+ }
+
+ function test_closeOnReturnMultiline(data) {
+ prepareTest(data)
+ compare(inputPanel.closeOnReturn(), data.closeOnReturn)
+ verify(inputPanel.visible === true)
+ keyClick(Qt.Key_Return)
+ waitForRendering(inputPanel)
+ verify(inputPanel.visible === data.expectedVisibleAfterReturn)
+ }
}
}
diff --git a/tests/auto/inputpanel/hwr_test_data/README.txt b/tests/auto/inputpanel/hwr_test_data/README.txt
index ec2903c8..9dd2adca 100644
--- a/tests/auto/inputpanel/hwr_test_data/README.txt
+++ b/tests/auto/inputpanel/hwr_test_data/README.txt
@@ -12,9 +12,9 @@ characters.
The Unipen data can be collected using the virtual keyboard.
To enable the data collection mode, the virtual keyboard must
-be compiled with a special qmake parameters:
+be compiled with a special parameters:
-CONFIG+=lipi-toolkit CONFIG+=record-trace-input
+INPUT_vkb_handwriting FEATURE_vkb_record_trace_input
The first option enables the handwriting recognition engine and
the second option enables the data collection mode.
diff --git a/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py b/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py
index eb4231c3..a7758eb8 100755
--- a/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py
+++ b/tests/auto/inputpanel/hwr_test_data/build_unipen_data.py
@@ -1,33 +1,7 @@
#!/usr/bin/env python
-#############################################################################
-##
-## Copyright (C) 2017 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 or (at your option) any later version
-## approved by the KDE Free Qt Foundation. The licenses are as published by
-## the Free Software Foundation and appearing in the file LICENSE.GPL3
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
+# Copyright (C) 2017 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import os
import sys
@@ -39,34 +13,10 @@ import re
unipen_file_pattern = re.compile(r'(^[0-9]{2,9}).*\.txt')
def print_header():
- print """/****************************************************************************
-**
-** Copyright (C) %s The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/""" % datetime.datetime.now().year
+ print """
+// Copyright (C) %s The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+""" % datetime.datetime.now().year
def scan_unipen_files(path):
file_list = []
diff --git a/tests/auto/inputpanel/inputpanel.pro b/tests/auto/inputpanel/inputpanel.pro
deleted file mode 100644
index 053ad1cf..00000000
--- a/tests/auto/inputpanel/inputpanel.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-TARGET = tst_inputpanel
-
-QT += testlib
-CONFIG += qmltestcase console
-
-contains(CONFIG, static) {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-SOURCES += $$PWD/tst_inputpanel.cpp
-
-TESTDATA = $$PWD/data/*
-
-OTHER_FILES += \
- $$PWD/data/inputpanel/inputpanel.qml \
- $$PWD/data/inputpanel/handwritinginputpanel.qml \
- $$PWD/data/tst_inputpanel.qml \
diff --git a/tests/auto/inputpanel/tst_inputpanel.cpp b/tests/auto/inputpanel/tst_inputpanel.cpp
index 409383c7..41a3f967 100644
--- a/tests/auto/inputpanel/tst_inputpanel.cpp
+++ b/tests/auto/inputpanel/tst_inputpanel.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQuickTest/quicktest.h>
#include <QByteArray>
@@ -33,18 +7,25 @@
#include <QFileInfo>
#include <QDir>
-static bool s_configEnv = qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
-static bool initStandardPaths() {
- QStandardPaths::setTestModeEnabled(true);
- auto configLocations = QStringList()
- << QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/qtvirtualkeyboard"
- << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/qtvirtualkeyboard";
- for (const QString &configLocation : configLocations) {
- if (configLocation != "/qtvirtualkeyboard")
- QDir(configLocation).removeRecursively();
+namespace
+{
+
+struct VirtualKeyboardSetup : QObject
+{
+ VirtualKeyboardSetup()
+ {
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+ QStandardPaths::setTestModeEnabled(true);
+ auto configLocations = QStringList()
+ << QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/qtvirtualkeyboard"
+ << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/qtvirtualkeyboard";
+ for (const QString &configLocation : configLocations) {
+ if (configLocation != "/qtvirtualkeyboard")
+ QDir(configLocation).removeRecursively();
+ }
}
- return true;
+};
+
}
-static bool s_initStandardPaths = initStandardPaths();
-QUICK_TEST_MAIN(inputpanel)
+QUICK_TEST_MAIN_WITH_SETUP(inputpanel, VirtualKeyboardSetup)
diff --git a/tests/auto/inputpanelcontrols/CMakeLists.txt b/tests/auto/inputpanelcontrols/CMakeLists.txt
new file mode 100644
index 00000000..665f97d9
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_inputpanelcontrols
+ QMLTEST
+ SOURCES
+ tst_inputpanelcontrols.cpp
+ LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml b/tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml
new file mode 100644
index 00000000..582e7ea4
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/data/inputpanel/inputpanel.qml
@@ -0,0 +1,15 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+
+InputPanel {
+ id: inputPanel
+ z: 99
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ visible: active
+}
diff --git a/tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml b/tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml
new file mode 100644
index 00000000..a244e752
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/data/tst_inputpanelcontrols.qml
@@ -0,0 +1,98 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+import QtQuick.Controls
+
+Rectangle {
+ id: container
+ width: 800
+ height: 640
+ color: "blue"
+
+ Component {
+ id: textInputComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ }
+ }
+
+ TestCase {
+ id: testcase
+ name: "tst_inputpanelcontrols"
+ when: windowShown
+
+ property var inputPanel: null
+ property var textInput: null
+
+ function initTestCase() {
+ var inputPanelComp = Qt.createComponent("inputpanel/inputpanel.qml")
+ compare(inputPanelComp.status, Component.Ready, "Failed to create component: "+inputPanelComp.errorString())
+ inputPanel = inputPanelComp.createObject(container)
+
+ textInput = textInputComp.createObject(container)
+ }
+
+ function cleanupTestCase() {
+ if (inputPanel)
+ inputPanel.destroy()
+ }
+
+ function prepareTest() {
+ var window = container.Window.window
+ verify(window)
+ window.raise()
+ window.requestActivate()
+ tryCompare(window, "active", true)
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ textInput.text = ""
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+
+ Component {
+ id: modalDialogComp
+ Dialog {
+ id: dialog
+ modal: true
+ anchors.centerIn: parent
+ width: 200
+ height: 150
+ property alias textEdit: textEdit
+ TextEdit {
+ id: textEdit
+ visible: true
+ focus: true
+ color: "red"
+ }
+ }
+ }
+
+ function test_worksWithModal() {
+ prepareTest()
+ var modalDialog = modalDialogComp.createObject(container)
+ modalDialog.open()
+ modalDialog.forceActiveFocus()
+
+ verify(modalDialog.textEdit.activeFocus === true)
+ compare(modalDialog.textEdit.text, "")
+ verify(inputPanel.visible === true)
+ waitForRendering(inputPanel)
+
+ mousePress(inputPanel, 10, 10, Qt.LeftButton, Qt.NoModifier, 20)
+ verify(modalDialog.visible === true)
+ mouseRelease(inputPanel, 10, 10, Qt.LeftButton, Qt.NoModifier, 20)
+ compare(modalDialog.textEdit.text, "Q")
+ }
+ }
+}
diff --git a/tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp b/tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp
new file mode 100644
index 00000000..d06b2410
--- /dev/null
+++ b/tests/auto/inputpanelcontrols/tst_inputpanelcontrols.cpp
@@ -0,0 +1,31 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQuickTest/quicktest.h>
+#include <QByteArray>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+
+namespace
+{
+
+struct VirtualKeyboardSetup : QObject
+{
+ VirtualKeyboardSetup()
+ {
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+ QStandardPaths::setTestModeEnabled(true);
+ auto configLocations = QStringList()
+ << QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/qtvirtualkeyboard"
+ << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/qtvirtualkeyboard";
+ for (const QString &configLocation : configLocations) {
+ if (configLocation != "/qtvirtualkeyboard")
+ QDir(configLocation).removeRecursively();
+ }
+ }
+};
+
+}
+
+QUICK_TEST_MAIN_WITH_SETUP(inputpanelcontrols, VirtualKeyboardSetup)
diff --git a/tests/auto/layoutfilesystem/BLACKLIST b/tests/auto/layoutfilesystem/BLACKLIST
new file mode 100644
index 00000000..0ab84b92
--- /dev/null
+++ b/tests/auto/layoutfilesystem/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-102756
+[layouts]
+android
diff --git a/tests/auto/layoutfilesystem/CMakeLists.txt b/tests/auto/layoutfilesystem/CMakeLists.txt
index b0f9d70e..0232b449 100644
--- a/tests/auto/layoutfilesystem/CMakeLists.txt
+++ b/tests/auto/layoutfilesystem/CMakeLists.txt
@@ -1,18 +1,21 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from layoutfilesystem.pro.
#####################################################################
## tst_layoutfilesystem Test:
#####################################################################
-qt_add_test(tst_layoutfilesystem
+qt_internal_add_test(tst_layoutfilesystem
SOURCES
../shared/layouttesthelper.cpp ../shared/layouttesthelper.h
tst_layoutfilesystem.cpp
DEFINES
- SRC_DIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"
+ SRC_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
INCLUDE_DIRECTORIES
../shared
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Qml
Qt::Quick
@@ -24,8 +27,8 @@ qt_add_test(tst_layoutfilesystem
## Scopes:
#####################################################################
-qt_extend_target(tst_layoutfilesystem CONDITION static
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_layoutfilesystem CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml b/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
index e58b8d66..787afd3d 100644
--- a/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
+++ b/tests/auto/layoutfilesystem/data/layouts/en_GB/main.qml
@@ -1,34 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
KeyboardLayout {
objectName: "en_GB"
diff --git a/tests/auto/layoutfilesystem/layoutfilesystem.pro b/tests/auto/layoutfilesystem/layoutfilesystem.pro
deleted file mode 100644
index 6be71fd5..00000000
--- a/tests/auto/layoutfilesystem/layoutfilesystem.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-CONFIG += testcase
-TARGET = tst_layoutfilesystem
-
-macos:CONFIG -= app_bundle
-
-QT += testlib qml quick
-
-static {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-include(../shared/layouttest.pri)
-
-SOURCES += $$PWD/tst_layoutfilesystem.cpp
-
-OTHER_FILES += \
- data/layouts/en_GB/main.qml \
-
-DEFINES += SRC_DIR=\\\"$$PWD\\\"
diff --git a/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp b/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp
index 1d906712..a18fbea6 100644
--- a/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp
+++ b/tests/auto/layoutfilesystem/tst_layoutfilesystem.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "layouttesthelper.h"
diff --git a/tests/auto/layoutresources/CMakeLists.txt b/tests/auto/layoutresources/CMakeLists.txt
index b7c14247..42c26bf5 100644
--- a/tests/auto/layoutresources/CMakeLists.txt
+++ b/tests/auto/layoutresources/CMakeLists.txt
@@ -1,18 +1,21 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from layoutresources.pro.
#####################################################################
## tst_layoutresources Test:
#####################################################################
-qt_add_test(tst_layoutresources
+qt_internal_add_test(tst_layoutresources
SOURCES
../shared/layouttesthelper.cpp ../shared/layouttesthelper.h
tst_layoutresources.cpp
DEFINES
- SRC_DIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"
+ SRC_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
INCLUDE_DIRECTORIES
../shared
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Qml
Qt::Quick
@@ -20,10 +23,10 @@ qt_add_test(tst_layoutresources
# Resources:
set(resourceslayout_resource_files
- "layouts/en_GB/main.qml"
+ "data/layouts/en_GB/main.qml"
)
-qt_add_resource(tst_layoutresources "resourceslayout"
+qt_internal_add_resource(tst_layoutresources "resourceslayout"
PREFIX
"/resource"
BASE
@@ -36,8 +39,8 @@ qt_add_resource(tst_layoutresources "resourceslayout"
## Scopes:
#####################################################################
-qt_extend_target(tst_layoutresources CONDITION static
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_layoutresources CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/layoutresources/data/layouts/en_GB/main.qml b/tests/auto/layoutresources/data/layouts/en_GB/main.qml
index e58b8d66..787afd3d 100644
--- a/tests/auto/layoutresources/data/layouts/en_GB/main.qml
+++ b/tests/auto/layoutresources/data/layouts/en_GB/main.qml
@@ -1,34 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Components
KeyboardLayout {
objectName: "en_GB"
diff --git a/tests/auto/layoutresources/data/resourceslayout.qrc b/tests/auto/layoutresources/data/resourceslayout.qrc
deleted file mode 100644
index b95db56a..00000000
--- a/tests/auto/layoutresources/data/resourceslayout.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="resource">
- <file>layouts/en_GB/main.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/auto/layoutresources/layoutresources.pro b/tests/auto/layoutresources/layoutresources.pro
deleted file mode 100644
index edf608df..00000000
--- a/tests/auto/layoutresources/layoutresources.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-CONFIG += testcase
-TARGET = tst_layoutresources
-
-macos:CONFIG -= app_bundle
-
-QT += testlib qml quick
-
-static {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-include(../shared/layouttest.pri)
-
-SOURCES += $$PWD/tst_layoutresources.cpp
-
-RESOURCES += \
- $$PWD/data/resourceslayout.qrc
-
-DEFINES += SRC_DIR=\\\"$$PWD\\\"
diff --git a/tests/auto/layoutresources/tst_layoutresources.cpp b/tests/auto/layoutresources/tst_layoutresources.cpp
index e9509ed2..a3fa48e6 100644
--- a/tests/auto/layoutresources/tst_layoutresources.cpp
+++ b/tests/auto/layoutresources/tst_layoutresources.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "layouttesthelper.h"
diff --git a/tests/auto/shadowinput/CMakeLists.txt b/tests/auto/shadowinput/CMakeLists.txt
new file mode 100644
index 00000000..e7668ba8
--- /dev/null
+++ b/tests/auto/shadowinput/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_shadowinput
+ QMLTEST
+ SOURCES
+ tst_shadowinput.cpp
+ LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/shadowinput/data/inputpanel/inputpanel.qml b/tests/auto/shadowinput/data/inputpanel/inputpanel.qml
new file mode 100644
index 00000000..9879c40f
--- /dev/null
+++ b/tests/auto/shadowinput/data/inputpanel/inputpanel.qml
@@ -0,0 +1,24 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+InputPanel {
+ id: inputPanel
+ z: 99
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ visible: active
+ property bool fullScreenMode: true
+ property bool shadowInputVisible: keyboard.shadowInputControl.visible
+ property string shadowInputText: keyboard.shadowInputControl.textEdit.text
+ Binding {
+ target: VirtualKeyboardSettings
+ property: "fullScreenMode"
+ value: inputPanel.fullScreenMode
+ }
+}
diff --git a/tests/auto/shadowinput/data/tst_shadowinput.qml b/tests/auto/shadowinput/data/tst_shadowinput.qml
new file mode 100644
index 00000000..fbe79c82
--- /dev/null
+++ b/tests/auto/shadowinput/data/tst_shadowinput.qml
@@ -0,0 +1,92 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+
+Rectangle {
+ id: container
+ width: 800
+ height: 640
+ color: "blue"
+
+ Component {
+ id: textInputComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ }
+ }
+
+ TestCase {
+ id: testcase
+ name: "tst_inputpanelcontrols"
+ when: windowShown
+
+ property var inputPanel: null
+ property var textInput: null
+
+ function initTestCase() {
+ var inputPanelComp = Qt.createComponent("inputpanel/inputpanel.qml")
+ compare(inputPanelComp.status, Component.Ready, "Failed to create component: "+inputPanelComp.errorString())
+ inputPanel = inputPanelComp.createObject(container)
+
+ textInput = textEditComp.createObject(container)
+ }
+
+ function cleanupTestCase() {
+ if (inputPanel)
+ inputPanel.destroy()
+ }
+
+ function prepareTest() {
+ var window = container.Window.window
+ verify(window)
+ window.raise()
+ window.requestActivate()
+ tryCompare(window, "active", true)
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ textInput.text = ""
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+
+ Component {
+ id: textEditComp
+ TextEdit {
+ id: textEdit
+ visible: true
+ focus: true
+ color: "white"
+ }
+ }
+
+ function test_fullScreenModeBindingWorks() {
+ prepareTest()
+
+ verify(inputPanel.visible === true)
+ waitForRendering(inputPanel)
+
+ // VirtualKeyboardSettings.fullScreeenMode is initially true
+ // Verity that shadow input is visible and the content match with the edit field
+ verify(inputPanel.shadowInputVisible)
+ textInput.text = "hello"
+ compare(inputPanel.shadowInputText, textInput.text)
+
+ // Disable fullScreenMode and verify
+ inputPanel.fullScreenMode = false
+ waitForRendering(inputPanel)
+ verify(!inputPanel.shadowInputVisible)
+ textInput.text = "world"
+ compare(inputPanel.shadowInputText, "")
+ }
+ }
+}
diff --git a/tests/auto/shadowinput/tst_shadowinput.cpp b/tests/auto/shadowinput/tst_shadowinput.cpp
new file mode 100644
index 00000000..afa0bb28
--- /dev/null
+++ b/tests/auto/shadowinput/tst_shadowinput.cpp
@@ -0,0 +1,23 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQuickTest/quicktest.h>
+#include <QByteArray>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+
+namespace
+{
+
+struct VirtualKeyboardSetup : QObject
+{
+ VirtualKeyboardSetup()
+ {
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+ }
+};
+
+}
+
+QUICK_TEST_MAIN_WITH_SETUP(shadowinput, VirtualKeyboardSetup)
diff --git a/tests/auto/shared/layouttest.pri b/tests/auto/shared/layouttest.pri
deleted file mode 100644
index 3cb9a575..00000000
--- a/tests/auto/shared/layouttest.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-INCLUDEPATH += $$PWD
-DEPENDPATH += $$PWD
-
-SOURCES += $$PWD/layouttesthelper.cpp
-HEADERS += $$PWD/layouttesthelper.h
diff --git a/tests/auto/shared/layouttesthelper.cpp b/tests/auto/shared/layouttesthelper.cpp
index 54acf9c5..266906fe 100644
--- a/tests/auto/shared/layouttesthelper.cpp
+++ b/tests/auto/shared/layouttesthelper.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "layouttesthelper.h"
@@ -42,7 +16,8 @@ LayoutTestHelper::LayoutTestHelper()
Window { \
property var settings: VirtualKeyboardSettings; \
InputPanel { \
- id: inputPanel \
+ id: inputPanel; \
+ width: parent.width; \
} \
}", QUrl());
window.reset(qobject_cast<QQuickWindow*>(component->create()));
diff --git a/tests/auto/shared/layouttesthelper.h b/tests/auto/shared/layouttesthelper.h
index 93ddb6e2..c61fa75c 100644
--- a/tests/auto/shared/layouttesthelper.h
+++ b/tests/auto/shared/layouttesthelper.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Pelagicore AB
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Pelagicore AB
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/qscopedpointer.h>
#include <QtCore/QString>
diff --git a/tests/auto/styles/BLACKLIST b/tests/auto/styles/BLACKLIST
new file mode 100644
index 00000000..9e519abd
--- /dev/null
+++ b/tests/auto/styles/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-102756
+[tst_styles::test_style]
+android
diff --git a/tests/auto/styles/CMakeLists.txt b/tests/auto/styles/CMakeLists.txt
index 48240152..92f77c18 100644
--- a/tests/auto/styles/CMakeLists.txt
+++ b/tests/auto/styles/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from styles.pro.
#####################################################################
@@ -10,17 +13,35 @@ file(GLOB_RECURSE test_data_glob
${CMAKE_CURRENT_SOURCE_DIR}/data/*)
list(APPEND test_data ${test_data_glob})
-qt_add_test(tst_styles
+qt_internal_add_test(tst_styles
QMLTEST
SOURCES
tst_styles.cpp
DEFINES
- TESTDATA_DIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
- PUBLIC_LIBRARIES
+ TESTDATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
+ LIBRARIES
Qt::Gui
TESTDATA ${test_data}
)
+qt_internal_add_resource(tst_styles "test_res"
+ PREFIX
+ "/qt/qml/QtQuick/VirtualKeyboard/Styles/test_res"
+ BASE
+ "data/QtQuick/VirtualKeyboard/Styles/test"
+ FILES
+ "data/QtQuick/VirtualKeyboard/Styles/test/style.qml"
+)
+
+qt_internal_add_resource(tst_styles "test_res_compat"
+ PREFIX
+ "/QtQuick/VirtualKeyboard/content/styles/test_res_compat"
+ BASE
+ "data/QtQuick/VirtualKeyboard/Styles/test"
+ FILES
+ "data/QtQuick/VirtualKeyboard/Styles/test/style.qml"
+)
+
#### Keys ignored in scope 1:.:.:styles.pro:<TRUE>:
# DISTFILES = "data/tst_styles.qml" "data/QtQuick/VirtualKeyboard/Styles/test/style.qml"
# OTHER_FILES = "$$PWD/data/tst_styles.qml"
@@ -29,8 +50,8 @@ qt_add_test(tst_styles
## Scopes:
#####################################################################
-qt_extend_target(tst_styles CONDITION static
- PUBLIC_LIBRARIES
+qt_internal_extend_target(tst_styles CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
diff --git a/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml b/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml
index efb8e3bd..80ac843d 100644
--- a/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml
+++ b/tests/auto/styles/data/QtQuick/VirtualKeyboard/Styles/test/style.qml
@@ -1,35 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jeremy Katz
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jeremy Katz
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard 2.1
-import QtQuick.VirtualKeyboard.Styles 2.1
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Styles
KeyboardStyle {
diff --git a/tests/auto/styles/data/tst_styles.qml b/tests/auto/styles/data/tst_styles.qml
index 0b4d3b37..f5661b07 100644
--- a/tests/auto/styles/data/tst_styles.qml
+++ b/tests/auto/styles/data/tst_styles.qml
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jeremy Katz
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jeremy Katz
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtTest 1.0
-import QtQuick 2.0
-import QtQuick.VirtualKeyboard.Settings 2.0
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard.Settings
+import QtQuick.VirtualKeyboard.Styles
Item {
@@ -41,7 +16,9 @@ Item {
return [
{ tag: "default", result: "default"},
{ tag: "retro", result: "retro"}, // in-source alternate style
- { tag: "test", result: "test"} // out-of-source alternate style
+ { tag: "test", result: "test"}, // out-of-source alternate style
+ { tag: "test_res", result: "test_res"}, // default resource path
+ { tag: "test_res_compat", result: "test_res_compat"}, // compatibility resource path
];
}
diff --git a/tests/auto/styles/styles.pro b/tests/auto/styles/styles.pro
deleted file mode 100644
index eda24717..00000000
--- a/tests/auto/styles/styles.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TEMPLATE = app
-TARGET = tst_styles
-
-QT += testlib
-CONFIG += qmltestcase console
-
-static {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-SOURCES += $$PWD/tst_styles.cpp
-
-TESTDATA = $$PWD/data/*
-DEFINES += TESTDATA_DIR=\\\"$$_PRO_FILE_PWD_/data\\\"
-
-OTHER_FILES += \
- $$PWD/data/tst_styles.qml \
-
-DISTFILES += \
- data/tst_styles.qml \
- data/QtQuick/VirtualKeyboard/Styles/test/style.qml \
-
diff --git a/tests/auto/styles/tst_styles.cpp b/tests/auto/styles/tst_styles.cpp
index 3d2a329f..4f728955 100644
--- a/tests/auto/styles/tst_styles.cpp
+++ b/tests/auto/styles/tst_styles.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jeremy Katz
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Jeremy Katz
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQuickTest/quicktest.h>
#include <QByteArray>
diff --git a/tests/auto/virtualkeyboardattached/CMakeLists.txt b/tests/auto/virtualkeyboardattached/CMakeLists.txt
new file mode 100644
index 00000000..b3221bd2
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_virtualkeyboardattached
+ QMLTEST
+ SOURCES
+ tst_virtualkeyboardattached.cpp
+ LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml b/tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml
new file mode 100644
index 00000000..80fe6265
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/data/inputpanel/inputpanel.qml
@@ -0,0 +1,16 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.VirtualKeyboard
+import QtQuick.VirtualKeyboard.Settings
+
+InputPanel {
+ id: inputPanel
+ z: 99
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ visible: active
+}
diff --git a/tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml b/tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml
new file mode 100644
index 00000000..b158f603
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/data/tst_virtualkeyboardattached.qml
@@ -0,0 +1,99 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtTest
+import QtQuick
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+
+Rectangle {
+ id: container
+ width: 800
+ height: 640
+ color: "blue"
+
+ TestCase {
+ id: testcase
+ name: "tst_virtualkeyboardattached"
+ when: windowShown
+
+ property var inputPanel: null
+
+ function initTestCase() {
+ var inputPanelComp = Qt.createComponent("inputpanel/inputpanel.qml")
+ compare(inputPanelComp.status, Component.Ready, "Failed to create component: "+inputPanelComp.errorString())
+ inputPanel = inputPanelComp.createObject(container)
+ }
+
+ function cleanupTestCase() {
+ if (inputPanel)
+ inputPanel.destroy()
+ }
+
+ function prepareTest() {
+ var window = container.Window.window
+ verify(window)
+ window.raise()
+ window.requestActivate()
+ tryCompare(window, "active", true)
+ }
+
+ Component {
+ id: textInputWithVirtualKeyboardAttachedComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ VirtualKeyboard.extraDictionaries: ["example"]
+ }
+ }
+
+ function test_virtualKeyboardAttached() {
+ prepareTest()
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+
+ let textInput = textInputWithVirtualKeyboardAttachedComp.createObject(container)
+
+ verify(textInput !== null)
+
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+
+ Component {
+ id: textInputWithEnterKeyActionAttachedComp
+ TextEdit {
+ anchors.fill: parent
+ visible: true
+ focus: true
+ color: "white"
+ EnterKeyAction.actionId: EnterKeyAction.Done
+ EnterKeyAction.label: "hello"
+ EnterKeyAction.enabled: true
+ }
+ }
+
+ function test_enterKeyActionAttached() {
+ prepareTest()
+
+ container.forceActiveFocus()
+ waitForRendering(container)
+
+ let textInput = textInputWithEnterKeyActionAttachedComp.createObject(container)
+
+ verify(textInput !== null)
+
+ textInput.forceActiveFocus()
+ waitForRendering(inputPanel)
+
+ verify(inputPanel.visible === true)
+ verify(textInput.activeFocus === true)
+ }
+ }
+}
diff --git a/tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp b/tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp
new file mode 100644
index 00000000..5bf71dfb
--- /dev/null
+++ b/tests/auto/virtualkeyboardattached/tst_virtualkeyboardattached.cpp
@@ -0,0 +1,12 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtQuickTest/quicktest.h>
+#include <QByteArray>
+#include <QStandardPaths>
+#include <QFileInfo>
+#include <QDir>
+
+static bool s_configEnv = qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+
+QUICK_TEST_MAIN(virtualkeyboardattached)
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt
index a1d2a41d..861cd2ec 100644
--- a/tests/manual/CMakeLists.txt
+++ b/tests/manual/CMakeLists.txt
@@ -1,5 +1,14 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from manual.pro.
-add_subdirectory(x11vkbwrapper)
-add_subdirectory(x11vkbtest)
+find_package(X11)
+if(X11_FOUND)
+ add_subdirectory(x11vkbwrapper)
+ add_subdirectory(x11vkbtest)
+else()
+ message("Manual tests x11vkbwrapper and x11vkbtest are not built due to missing X11 lib.")
+endif()
add_subdirectory(quickcontrols2)
+add_subdirectory(startupperformance)
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
deleted file mode 100644
index 3f9a58c3..00000000
--- a/tests/manual/manual.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += \
- x11vkbwrapper \
- x11vkbtest \
- quickcontrols2
diff --git a/tests/manual/quickcontrols2/CMakeLists.txt b/tests/manual/quickcontrols2/CMakeLists.txt
index 0c1fade1..04204c69 100644
--- a/tests/manual/quickcontrols2/CMakeLists.txt
+++ b/tests/manual/quickcontrols2/CMakeLists.txt
@@ -1,14 +1,17 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from quickcontrols2.pro.
#####################################################################
## quickcontrols2 Binary:
#####################################################################
-qt_add_manual_test(quickcontrols2
+qt_internal_add_manual_test(quickcontrols2
GUI
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Qml
Qt::Quick
@@ -19,7 +22,7 @@ set(main_resource_files
"main.qml"
)
-qt_add_resource(quickcontrols2 "main"
+qt_internal_add_resource(quickcontrols2 "main"
PREFIX
"/"
FILES
diff --git a/tests/manual/quickcontrols2/main.cpp b/tests/manual/quickcontrols2/main.cpp
index 2da79e6e..a9448c8f 100644
--- a/tests/manual/quickcontrols2/main.cpp
+++ b/tests/manual/quickcontrols2/main.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QGuiApplication>
#include <QQmlApplicationEngine>
diff --git a/tests/manual/quickcontrols2/main.qml b/tests/manual/quickcontrols2/main.qml
index cfd4c0f5..67338624 100644
--- a/tests/manual/quickcontrols2/main.qml
+++ b/tests/manual/quickcontrols2/main.qml
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.15
-import QtQuick.Controls 2.15
-import QtQuick.Layouts 1.15
-import QtQuick.VirtualKeyboard 2.15
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.VirtualKeyboard
ApplicationWindow {
visible: true
diff --git a/tests/manual/quickcontrols2/main.qrc b/tests/manual/quickcontrols2/main.qrc
deleted file mode 100644
index 5f6483ac..00000000
--- a/tests/manual/quickcontrols2/main.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/manual/quickcontrols2/quickcontrols2.pro b/tests/manual/quickcontrols2/quickcontrols2.pro
deleted file mode 100644
index 95d9f765..00000000
--- a/tests/manual/quickcontrols2/quickcontrols2.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-QT += qml quick
-SOURCES += main.cpp
-RESOURCES += main.qrc
-
-# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH =
diff --git a/tests/manual/startupperformance/CMakeLists.txt b/tests/manual/startupperformance/CMakeLists.txt
new file mode 100644
index 00000000..d1132cf1
--- /dev/null
+++ b/tests/manual/startupperformance/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_manual_test(startupperformance
+ GUI
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+)
+
+# Resources:
+set(main_resource_files
+ "main.qml"
+)
+
+qt_internal_add_resource(startupperformance "main"
+ PREFIX
+ "/"
+ FILES
+ ${main_resource_files}
+)
diff --git a/tests/manual/startupperformance/main.cpp b/tests/manual/startupperformance/main.cpp
new file mode 100644
index 00000000..68799283
--- /dev/null
+++ b/tests/manual/startupperformance/main.cpp
@@ -0,0 +1,23 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QElapsedTimer>
+
+int main(int argc, char *argv[])
+{
+ QElapsedTimer timer;
+ timer.restart();
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
+
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QLatin1String("qrc:/main.qml")));
+
+ int result = app.exec();
+
+ qDebug() << "Start to finish" << timer.elapsed() << "ms";
+ return result;
+}
diff --git a/tests/manual/startupperformance/main.qml b/tests/manual/startupperformance/main.qml
new file mode 100644
index 00000000..a7749065
--- /dev/null
+++ b/tests/manual/startupperformance/main.qml
@@ -0,0 +1,28 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+
+Window {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("Virtual Keyboard")
+ id: root
+
+ TextInput {
+ anchors.fill: parent
+ Component.onCompleted: {
+ forceActiveFocus()
+ Qt.quit()
+ }
+ }
+
+ InputPanel {
+ id: inputPanel
+ anchors.bottom: parent.bottom
+ width: root.width
+ }
+}
diff --git a/tests/manual/x11vkbtest/CMakeLists.txt b/tests/manual/x11vkbtest/CMakeLists.txt
index abd452a6..b23be5a0 100644
--- a/tests/manual/x11vkbtest/CMakeLists.txt
+++ b/tests/manual/x11vkbtest/CMakeLists.txt
@@ -1,10 +1,19 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from x11vkbtest.pro.
#####################################################################
## x11vkbtest Binary:
#####################################################################
-qt_add_manual_test(x11vkbtest
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Charts)
+if(NOT TARGET Qt::Charts)
+ message("Manual test x11vkbtest won't be built, because Qt::Charts was not found.")
+ return()
+endif()
+
+qt_internal_add_manual_test(x11vkbtest
GUI
SOURCES
colors.h
@@ -22,10 +31,10 @@ qt_add_manual_test(x11vkbtest
windowhelper.cpp windowhelper.h
DEFINES
QT_DEPRECATED_WARNINGS
- PUBLIC_LIBRARIES
+ LIBRARIES
+ Qt::Charts
Qt::Gui
- X11
+ X11::X11
Xtst
- charts
xdo
)
diff --git a/tests/manual/x11vkbtest/colors.h b/tests/manual/x11vkbtest/colors.h
index ad1d5a0e..1ef2d095 100644
--- a/tests/manual/x11vkbtest/colors.h
+++ b/tests/manual/x11vkbtest/colors.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef COLORS_H
#define COLORS_H
diff --git a/tests/manual/x11vkbtest/filehelper.cpp b/tests/manual/x11vkbtest/filehelper.cpp
index f3a379af..f649edcb 100644
--- a/tests/manual/x11vkbtest/filehelper.cpp
+++ b/tests/manual/x11vkbtest/filehelper.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QFile>
#include <QTextStream>
@@ -33,6 +7,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <fstream>
+#include <utility>
#include "filehelper.h"
@@ -86,7 +61,7 @@ bool FileHelper::getJsonFromFile(const QString &fileName, std::map<QString, QVar
result = false;
} else {
auto jsonIter = jsonObj.constBegin();
- jsonMap.insert({jsonIter.key(), jsonIter.value()});
+ jsonMap.insert(std::make_pair(jsonIter.key(), jsonIter.value()));
}
}
}
diff --git a/tests/manual/x11vkbtest/filehelper.h b/tests/manual/x11vkbtest/filehelper.h
index cc65351c..a29ac167 100644
--- a/tests/manual/x11vkbtest/filehelper.h
+++ b/tests/manual/x11vkbtest/filehelper.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef FILEHELPER_H
#define FILEHELPER_H
diff --git a/tests/manual/x11vkbtest/main.cpp b/tests/manual/x11vkbtest/main.cpp
index f248bd53..c772b30d 100644
--- a/tests/manual/x11vkbtest/main.cpp
+++ b/tests/manual/x11vkbtest/main.cpp
@@ -1,36 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QApplication>
#include <QDebug>
#include <QCommandLineParser>
-#include <QStateMachine>
#include <QtGui/QGuiApplication>
#include <QtCharts/QChartView>
#include <QtWidgets/QMainWindow>
diff --git a/tests/manual/x11vkbtest/memorymonitor.cpp b/tests/manual/x11vkbtest/memorymonitor.cpp
index db1b53b9..c2523422 100644
--- a/tests/manual/x11vkbtest/memorymonitor.cpp
+++ b/tests/manual/x11vkbtest/memorymonitor.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "memorymonitor.h"
diff --git a/tests/manual/x11vkbtest/memorymonitor.h b/tests/manual/x11vkbtest/memorymonitor.h
index 01239383..47c8566d 100644
--- a/tests/manual/x11vkbtest/memorymonitor.h
+++ b/tests/manual/x11vkbtest/memorymonitor.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MEMORYMONITOR_H
#define MEMORYMONITOR_H
@@ -33,12 +7,10 @@
#include <QtCharts/QChart>
#include <QtCore/QTimer>
-QT_CHARTS_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE
class QSplineSeries;
class QValueAxis;
-QT_CHARTS_END_NAMESPACE
-
-QT_CHARTS_USE_NAMESPACE
+QT_END_NAMESPACE
class QMainWindow;
@@ -46,7 +18,7 @@ class MemoryMonitor : public QChart
{
Q_OBJECT
public:
- explicit MemoryMonitor(QMainWindow &window, QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = nullptr);
+ explicit MemoryMonitor(QMainWindow &window, QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = Qt::WindowFlags());
~MemoryMonitor();
public:
diff --git a/tests/manual/x11vkbtest/mousesimulator.cpp b/tests/manual/x11vkbtest/mousesimulator.cpp
index f49a91ef..d9337a10 100644
--- a/tests/manual/x11vkbtest/mousesimulator.cpp
+++ b/tests/manual/x11vkbtest/mousesimulator.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTextStream>
diff --git a/tests/manual/x11vkbtest/mousesimulator.h b/tests/manual/x11vkbtest/mousesimulator.h
index 7fdff58c..6b14ea43 100644
--- a/tests/manual/x11vkbtest/mousesimulator.h
+++ b/tests/manual/x11vkbtest/mousesimulator.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef MOUSESIMULATOR_H
#define MOUSESIMULATOR_H
diff --git a/tests/manual/x11vkbtest/processhandler.cpp b/tests/manual/x11vkbtest/processhandler.cpp
index ca9c82c6..9657c104 100644
--- a/tests/manual/x11vkbtest/processhandler.cpp
+++ b/tests/manual/x11vkbtest/processhandler.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QProcess>
#include <QTextStream>
diff --git a/tests/manual/x11vkbtest/processhandler.h b/tests/manual/x11vkbtest/processhandler.h
index c1d14983..63944ddb 100644
--- a/tests/manual/x11vkbtest/processhandler.h
+++ b/tests/manual/x11vkbtest/processhandler.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef PROCESSHANDLER_H
#define PROCESSHANDLER_H
diff --git a/tests/manual/x11vkbtest/startclose.cpp b/tests/manual/x11vkbtest/startclose.cpp
index ba9c9924..8931d5ed 100644
--- a/tests/manual/x11vkbtest/startclose.cpp
+++ b/tests/manual/x11vkbtest/startclose.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QProcess>
#include <QFile>
diff --git a/tests/manual/x11vkbtest/startclose.h b/tests/manual/x11vkbtest/startclose.h
index 434a95ad..960811ea 100644
--- a/tests/manual/x11vkbtest/startclose.h
+++ b/tests/manual/x11vkbtest/startclose.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef STARTCLOSE_H
#define STARTCLOSE_H
diff --git a/tests/manual/x11vkbtest/testbase.cpp b/tests/manual/x11vkbtest/testbase.cpp
index ef08c8c6..ef555aae 100644
--- a/tests/manual/x11vkbtest/testbase.cpp
+++ b/tests/manual/x11vkbtest/testbase.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTextStream>
#include "testbase.h"
diff --git a/tests/manual/x11vkbtest/testbase.h b/tests/manual/x11vkbtest/testbase.h
index 0b5c107b..6542eeb4 100644
--- a/tests/manual/x11vkbtest/testbase.h
+++ b/tests/manual/x11vkbtest/testbase.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTBASE_H
#define TESTBASE_H
diff --git a/tests/manual/x11vkbtest/testenglishletters.cpp b/tests/manual/x11vkbtest/testenglishletters.cpp
index 7bbe2414..89fb659a 100644
--- a/tests/manual/x11vkbtest/testenglishletters.cpp
+++ b/tests/manual/x11vkbtest/testenglishletters.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "filehelper.h"
#include "mousesimulator.h"
diff --git a/tests/manual/x11vkbtest/testenglishletters.h b/tests/manual/x11vkbtest/testenglishletters.h
index f39086de..7202e87d 100644
--- a/tests/manual/x11vkbtest/testenglishletters.h
+++ b/tests/manual/x11vkbtest/testenglishletters.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTENGLISHLETTERS_H
#define TESTENGLISHLETTERS_H
diff --git a/tests/manual/x11vkbtest/testlanguagechange.cpp b/tests/manual/x11vkbtest/testlanguagechange.cpp
index 4214c210..daba8948 100644
--- a/tests/manual/x11vkbtest/testlanguagechange.cpp
+++ b/tests/manual/x11vkbtest/testlanguagechange.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QJsonDocument>
#include <QJsonObject>
diff --git a/tests/manual/x11vkbtest/testlanguagechange.h b/tests/manual/x11vkbtest/testlanguagechange.h
index f49c9379..30a2ba75 100644
--- a/tests/manual/x11vkbtest/testlanguagechange.h
+++ b/tests/manual/x11vkbtest/testlanguagechange.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTLANGUAGECHANGE_H
#define TESTLANGUAGECHANGE_H
diff --git a/tests/manual/x11vkbtest/testreporter.cpp b/tests/manual/x11vkbtest/testreporter.cpp
index 49c28005..fc3ece5e 100644
--- a/tests/manual/x11vkbtest/testreporter.cpp
+++ b/tests/manual/x11vkbtest/testreporter.cpp
@@ -1,41 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QFile>
#include <QTextStream>
-#include <QListIterator>
#include <QTextStream>
#include "testreporter.h"
#include "testbase.h"
#include "colors.h"
#include "startclose.h"
+using Qt::endl;
+
namespace {
const QString KReport_CSV_File = "result.csv";
const QString KCSV_Column_Separator = ";";
diff --git a/tests/manual/x11vkbtest/testreporter.h b/tests/manual/x11vkbtest/testreporter.h
index d53f754f..c844430e 100644
--- a/tests/manual/x11vkbtest/testreporter.h
+++ b/tests/manual/x11vkbtest/testreporter.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef CSVPRINTER_H
#define CSVPRINTER_H
diff --git a/tests/manual/x11vkbtest/testthread.cpp b/tests/manual/x11vkbtest/testthread.cpp
index c68ce2a8..d11cd8eb 100644
--- a/tests/manual/x11vkbtest/testthread.cpp
+++ b/tests/manual/x11vkbtest/testthread.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QEventLoop>
#include <QFile>
diff --git a/tests/manual/x11vkbtest/testthread.h b/tests/manual/x11vkbtest/testthread.h
index f10e1497..4f4267b7 100644
--- a/tests/manual/x11vkbtest/testthread.h
+++ b/tests/manual/x11vkbtest/testthread.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TESTTHREAD_H
#define TESTTHREAD_H
diff --git a/tests/manual/x11vkbtest/windowhelper.cpp b/tests/manual/x11vkbtest/windowhelper.cpp
index 9223774b..a9b0303a 100644
--- a/tests/manual/x11vkbtest/windowhelper.cpp
+++ b/tests/manual/x11vkbtest/windowhelper.cpp
@@ -1,34 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTextStream>
-#include <cstdlib>
+
+#include "windowhelper.h"
extern "C" {
#include <xdo.h>
@@ -38,7 +13,6 @@ extern "C" {
#include <cstdio>
#include <cstdlib>
-#include "windowhelper.h"
WindowHelper::WindowHelper(QObject *parent) :
QObject(parent),
diff --git a/tests/manual/x11vkbtest/windowhelper.h b/tests/manual/x11vkbtest/windowhelper.h
index e9871737..1ca67c04 100644
--- a/tests/manual/x11vkbtest/windowhelper.h
+++ b/tests/manual/x11vkbtest/windowhelper.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WINDOWHELPER_H
#define WINDOWHELPER_H
diff --git a/tests/manual/x11vkbtest/x11vkbtest.pro b/tests/manual/x11vkbtest/x11vkbtest.pro
deleted file mode 100644
index 74623f89..00000000
--- a/tests/manual/x11vkbtest/x11vkbtest.pro
+++ /dev/null
@@ -1,41 +0,0 @@
-TARGET = x11vkbtest
-
-QT += charts
-
-CONFIG += c++11
-
-# The following define makes your compiler emit warnings if you use
-# any Qt feature that has been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-SOURCES += \
- filehelper.cpp \
- main.cpp \
- memorymonitor.cpp \
- mousesimulator.cpp \
- processhandler.cpp \
- startclose.cpp \
- testbase.cpp \
- testenglishletters.cpp \
- testlanguagechange.cpp \
- testreporter.cpp \
- testthread.cpp \
- windowhelper.cpp
-
-HEADERS += \
- colors.h \
- filehelper.h \
- memorymonitor.h \
- mousesimulator.h \
- processhandler.h \
- startclose.h \
- testbase.h \
- testenglishletters.h \
- testlanguagechange.h \
- testreporter.h \
- testthread.h \
- windowhelper.h
-
-LIBS += -lXtst -lX11 -lxdo
diff --git a/tests/manual/x11vkbwrapper/CMakeLists.txt b/tests/manual/x11vkbwrapper/CMakeLists.txt
index 3d74e769..94a0bcf1 100644
--- a/tests/manual/x11vkbwrapper/CMakeLists.txt
+++ b/tests/manual/x11vkbwrapper/CMakeLists.txt
@@ -1,10 +1,25 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from x11vkbwrapper.pro.
#####################################################################
## x11vkbwrapper Binary:
#####################################################################
-qt_add_manual_test(x11vkbwrapper
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Widgets)
+if(NOT TARGET Qt::Widgets)
+ message("Manual test x11vkbwrapper won't be built, because Qt::Widgets was not found.")
+ return()
+endif()
+
+find_package(ATSPI2)
+if(NOT TARGET PkgConfig::ATSPI2)
+ message("Manual test x11vkbwrapper won't be built, because ATSPI2 was not found.")
+ return()
+endif()
+
+qt_internal_add_manual_test(x11vkbwrapper
GUI
SOURCES
common_defs.h
@@ -18,14 +33,7 @@ qt_add_manual_test(x11vkbwrapper
xcbkeyboard.h
DEFINES
QT_DEPRECATED_WARNINGS
- INCLUDE_DIRECTORIES
- /usr/include/X11
- /usr/include/at-spi-2.0
- /usr/include/dbus-1.0
- /usr/include/glib-2.0
- /usr/lib/x86_64-linux-gnu/dbus-1.0/include
- /usr/lib/x86_64-linux-gnu/glib-2.0/include
- PUBLIC_LIBRARIES
+ LIBRARIES
PkgConfig::ATSPI2
Qt::DBus
Qt::Gui
@@ -34,7 +42,7 @@ qt_add_manual_test(x11vkbwrapper
Qt::Svg
Qt::VirtualKeyboard
Qt::Widgets
- X11
+ X11::X11
Xtst
xdo
)
@@ -46,7 +54,7 @@ set(qml_resource_files
"main.qml"
)
-qt_add_resource(x11vkbwrapper "qml"
+qt_internal_add_resource(x11vkbwrapper "qml"
PREFIX
"/"
FILES
@@ -60,15 +68,15 @@ qt_add_resource(x11vkbwrapper "qml"
## Scopes:
#####################################################################
-qt_extend_target(x11vkbwrapper CONDITION static
- PUBLIC_LIBRARIES
+qt_internal_extend_target(x11vkbwrapper CONDITION NOT QT_BUILD_SHARED_LIBS
+ LIBRARIES
Qt::Svg
)
#### Keys ignored in scope 2:.:.:x11vkbwrapper.pro:static:
# QTPLUGIN = "qtvirtualkeyboardplugin"
-qt_extend_target(x11vkbwrapper CONDITION CMAKE_BUILD_TYPE STREQUAL Release
+qt_internal_extend_target(x11vkbwrapper CONDITION CMAKE_BUILD_TYPE STREQUAL Release
DEFINES
QT_NO_DEBUG_OUTPUT
)
diff --git a/tests/manual/x11vkbwrapper/Keyboard.qml b/tests/manual/x11vkbwrapper/Keyboard.qml
index 152bdb98..0b7bb9e3 100644
--- a/tests/manual/x11vkbwrapper/Keyboard.qml
+++ b/tests/manual/x11vkbwrapper/Keyboard.qml
@@ -1,36 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.12
-import QtQuick.Window 2.2
-import QtQuick.VirtualKeyboard 2.2
-import Qt.labs.platform 1.1
+import QtQuick
+import QtQuick.Window
+import QtQuick.VirtualKeyboard
+import Qt.labs.platform
Window {
id: keyboardWindow
diff --git a/tests/manual/x11vkbwrapper/chromeextension/background.js b/tests/manual/x11vkbwrapper/chromeextension/background.js
index 67460404..38e535b7 100644
--- a/tests/manual/x11vkbwrapper/chromeextension/background.js
+++ b/tests/manual/x11vkbwrapper/chromeextension/background.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
const hostName = "x11vkb.host";
var port = null;
diff --git a/tests/manual/x11vkbwrapper/chromeextension/content.js b/tests/manual/x11vkbwrapper/chromeextension/content.js
index dcc8c840..5bb553ae 100644
--- a/tests/manual/x11vkbwrapper/chromeextension/content.js
+++ b/tests/manual/x11vkbwrapper/chromeextension/content.js
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
var lastActiveElement = null;
var inputs = ['input', 'textarea'];
diff --git a/tests/manual/x11vkbwrapper/common_defs.h b/tests/manual/x11vkbwrapper/common_defs.h
index 41eb288f..f73a7e85 100644
--- a/tests/manual/x11vkbwrapper/common_defs.h
+++ b/tests/manual/x11vkbwrapper/common_defs.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef COMMONDEFS_H
#define COMMONDEFS_H
diff --git a/tests/manual/x11vkbwrapper/handleatspievents.cpp b/tests/manual/x11vkbwrapper/handleatspievents.cpp
index ed330e0c..7b2c0743 100644
--- a/tests/manual/x11vkbwrapper/handleatspievents.cpp
+++ b/tests/manual/x11vkbwrapper/handleatspievents.cpp
@@ -1,36 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QLoggingCategory>
#include <QTime>
#include <QGuiApplication>
-#include <QMutableVectorIterator>
#include "handleatspievents.h"
#include "vkbhidetimer.h"
@@ -140,7 +113,7 @@ void HandleATSPIEvents::setKeyboardVisible(const bool visible)
void HandleATSPIEvents::storeFocusElement(const qint8 role)
{
m_focuses.append(role);
- qCDebug(lcHandleAtspiEvents) << "*****INSERTED FOCUS ELEMENT*****" << role << "TOTAL:" << m_focuses.length();
+ qCDebug(lcHandleAtspiEvents) << "*****INSERTED FOCUS ELEMENT*****" << role << "TOTAL:" << m_focuses.size();
}
/**
diff --git a/tests/manual/x11vkbwrapper/handleatspievents.h b/tests/manual/x11vkbwrapper/handleatspievents.h
index 15837824..b88e0567 100644
--- a/tests/manual/x11vkbwrapper/handleatspievents.h
+++ b/tests/manual/x11vkbwrapper/handleatspievents.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef HANDLEATSPIEVENTS_H
#define HANDLEATSPIEVENTS_H
diff --git a/tests/manual/x11vkbwrapper/handledbusforchrome.cpp b/tests/manual/x11vkbwrapper/handledbusforchrome.cpp
index a53ed80c..bff28653 100644
--- a/tests/manual/x11vkbwrapper/handledbusforchrome.cpp
+++ b/tests/manual/x11vkbwrapper/handledbusforchrome.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "handledbusforchrome.h"
#include "vkbhidetimer.h"
diff --git a/tests/manual/x11vkbwrapper/handledbusforchrome.h b/tests/manual/x11vkbwrapper/handledbusforchrome.h
index 0962b1f0..50e6b543 100644
--- a/tests/manual/x11vkbwrapper/handledbusforchrome.h
+++ b/tests/manual/x11vkbwrapper/handledbusforchrome.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef HANDLEDBUSFORCHROME_H
#define HANDLEDBUSFORCHROME_H
diff --git a/tests/manual/x11vkbwrapper/handlekeyevents.cpp b/tests/manual/x11vkbwrapper/handlekeyevents.cpp
index 9ddc3abf..a71a8e54 100644
--- a/tests/manual/x11vkbwrapper/handlekeyevents.cpp
+++ b/tests/manual/x11vkbwrapper/handlekeyevents.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtVirtualKeyboard>
#include <QApplication>
diff --git a/tests/manual/x11vkbwrapper/handlekeyevents.h b/tests/manual/x11vkbwrapper/handlekeyevents.h
index 72fc44f2..e1f81b70 100644
--- a/tests/manual/x11vkbwrapper/handlekeyevents.h
+++ b/tests/manual/x11vkbwrapper/handlekeyevents.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef HANDLEKEYEVENTS_H
#define HANDLEKEYEVENTS_H
diff --git a/tests/manual/x11vkbwrapper/handlelanguagechange.cpp b/tests/manual/x11vkbwrapper/handlelanguagechange.cpp
index 49c413c3..10b1e118 100644
--- a/tests/manual/x11vkbwrapper/handlelanguagechange.cpp
+++ b/tests/manual/x11vkbwrapper/handlelanguagechange.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QLoggingCategory>
#include <QJsonDocument>
diff --git a/tests/manual/x11vkbwrapper/handlelanguagechange.h b/tests/manual/x11vkbwrapper/handlelanguagechange.h
index 9600f006..b3424b7a 100644
--- a/tests/manual/x11vkbwrapper/handlelanguagechange.h
+++ b/tests/manual/x11vkbwrapper/handlelanguagechange.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef HANDLELANGUAGECHANGE_H
#define HANDLELANGUAGECHANGE_H
diff --git a/tests/manual/x11vkbwrapper/keysymmapsforfakeinput.h b/tests/manual/x11vkbwrapper/keysymmapsforfakeinput.h
index b36a4221..2037bceb 100644
--- a/tests/manual/x11vkbwrapper/keysymmapsforfakeinput.h
+++ b/tests/manual/x11vkbwrapper/keysymmapsforfakeinput.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QString>
#include <QList>
diff --git a/tests/manual/x11vkbwrapper/main.cpp b/tests/manual/x11vkbwrapper/main.cpp
index 1bc5408c..82da9a20 100644
--- a/tests/manual/x11vkbwrapper/main.cpp
+++ b/tests/manual/x11vkbwrapper/main.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QApplication>
#include <QQmlApplicationEngine>
@@ -52,7 +26,6 @@ int main(int argc, char *argv[])
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
bool error = false;
- QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
diff --git a/tests/manual/x11vkbwrapper/main.qml b/tests/manual/x11vkbwrapper/main.qml
index b5a0221f..6a5c7c64 100644
--- a/tests/manual/x11vkbwrapper/main.qml
+++ b/tests/manual/x11vkbwrapper/main.qml
@@ -1,34 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-import QtQuick 2.12
-import QtQuick.Window 2.2
+import QtQuick
+import QtQuick.Window
Window {
id: window
diff --git a/tests/manual/x11vkbwrapper/qml.qrc b/tests/manual/x11vkbwrapper/qml.qrc
deleted file mode 100644
index b8ccf60e..00000000
--- a/tests/manual/x11vkbwrapper/qml.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>graphics/Qt_logo.png</file>
- <file>Keyboard.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/manual/x11vkbwrapper/vkbhidetimer.cpp b/tests/manual/x11vkbwrapper/vkbhidetimer.cpp
index 25e52e5e..f656c48b 100644
--- a/tests/manual/x11vkbwrapper/vkbhidetimer.cpp
+++ b/tests/manual/x11vkbwrapper/vkbhidetimer.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "vkbhidetimer.h"
#include <QGuiApplication>
diff --git a/tests/manual/x11vkbwrapper/vkbhidetimer.h b/tests/manual/x11vkbwrapper/vkbhidetimer.h
index a4f3e223..8d138214 100644
--- a/tests/manual/x11vkbwrapper/vkbhidetimer.h
+++ b/tests/manual/x11vkbwrapper/vkbhidetimer.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef VKBHIDETIMER_H
#define VKBHIDETIMER_H
diff --git a/tests/manual/x11vkbwrapper/vkbnativehost/CMakeLists.txt b/tests/manual/x11vkbwrapper/vkbnativehost/CMakeLists.txt
index 244e4732..6874df79 100644
--- a/tests/manual/x11vkbwrapper/vkbnativehost/CMakeLists.txt
+++ b/tests/manual/x11vkbwrapper/vkbnativehost/CMakeLists.txt
@@ -1,17 +1,20 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Generated from vkbnativehost.pro.
#####################################################################
## x11vkbnativehost Binary:
#####################################################################
-qt_add_manual_test(x11vkbnativehost
+qt_internal_add_manual_test(x11vkbnativehost
SOURCES
common_defs.h
main.cpp
sendertodbus.cpp sendertodbus.h
DEFINES
QT_DEPRECATED_WARNINGS
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::DBus
)
diff --git a/tests/manual/x11vkbwrapper/vkbnativehost/common_defs.h b/tests/manual/x11vkbwrapper/vkbnativehost/common_defs.h
index b4d92ce7..619d4891 100644
--- a/tests/manual/x11vkbwrapper/vkbnativehost/common_defs.h
+++ b/tests/manual/x11vkbwrapper/vkbnativehost/common_defs.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef COMMONDEFS_H
#define COMMONDEFS_H
diff --git a/tests/manual/x11vkbwrapper/vkbnativehost/install_host.sh b/tests/manual/x11vkbwrapper/vkbnativehost/install_host.sh
index 8eae33d1..a2d45fd2 100755
--- a/tests/manual/x11vkbwrapper/vkbnativehost/install_host.sh
+++ b/tests/manual/x11vkbwrapper/vkbnativehost/install_host.sh
@@ -1,32 +1,6 @@
#!/bin/bash
-#******************************************************************************
-#**
-#** Copyright (C) 2019 The Qt Company Ltd.
-#** Contact: https://www.qt.io/licensing/
-#**
-#** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-#**
-#** $QT_BEGIN_LICENSE:GPL$
-#** Commercial License Usage
-#** Licensees holding valid commercial Qt licenses may use this file in
-#** accordance with the commercial license agreement provided with the
-#** Software or, alternatively, in accordance with the terms contained in
-#** a written agreement between you and The Qt Company. For licensing terms
-#** and conditions see https://www.qt.io/terms-conditions. For further
-#** information use the contact form at https://www.qt.io/contact-us.
-#**
-#** GNU General Public License Usage
-#** Alternatively, this file may be used under the terms of the GNU
-#** General Public License version 3 or (at your option) any later version
-#** approved by the KDE Free Qt Foundation. The licenses are as published by
-#** the Free Software Foundation and appearing in the file LICENSE.GPL3
-#** included in the packaging of this file. Please review the following
-#** information to ensure the GNU General Public License requirements will
-#** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-#**
-#** $QT_END_LICENSE$
-#**
-#****************************************************************************/
+# Copyright (C) 2019 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
set -e
BROWSER=$1
diff --git a/tests/manual/x11vkbwrapper/vkbnativehost/main.cpp b/tests/manual/x11vkbwrapper/vkbnativehost/main.cpp
index 8b28b6e6..407e5022 100644
--- a/tests/manual/x11vkbwrapper/vkbnativehost/main.cpp
+++ b/tests/manual/x11vkbwrapper/vkbnativehost/main.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QCoreApplication>
#include <QtDBus/QtDBus>
diff --git a/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.cpp b/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.cpp
index a4e59453..07f16f24 100644
--- a/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.cpp
+++ b/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.cpp
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QFile>
#include <QtDBus/QtDBus>
diff --git a/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.h b/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.h
index 39429569..cfd5f03a 100644
--- a/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.h
+++ b/tests/manual/x11vkbwrapper/vkbnativehost/sendertodbus.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef SENDERTODBUS_H
#define SENDERTODBUS_H
diff --git a/tests/manual/x11vkbwrapper/vkbnativehost/vkbnativehost.pro b/tests/manual/x11vkbwrapper/vkbnativehost/vkbnativehost.pro
deleted file mode 100644
index 492d8273..00000000
--- a/tests/manual/x11vkbwrapper/vkbnativehost/vkbnativehost.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET = x11vkbnativehost
-
-QT -= gui
-QT += dbus
-
-CONFIG += c++11 console
-CONFIG -= app_bundle
-
-# The following define makes your compiler emit warnings if you use
-# any Qt feature that has been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-HEADERS += \
- common_defs.h \
- sendertodbus.h
-
-SOURCES += \
- main.cpp \
- sendertodbus.cpp
-
-DISTFILES += \
- install_host.sh \
- x11vkb.host.json
-
diff --git a/tests/manual/x11vkbwrapper/x11vkbwrapper.pro b/tests/manual/x11vkbwrapper/x11vkbwrapper.pro
deleted file mode 100644
index 04978156..00000000
--- a/tests/manual/x11vkbwrapper/x11vkbwrapper.pro
+++ /dev/null
@@ -1,52 +0,0 @@
-TEMPLATE = app
-TARGET = x11vkbwrapper
-
-QT += qml quick dbus virtualkeyboard svg widgets
-CONFIG += c++11
-
-static {
- QT += svg
- QTPLUGIN += qtvirtualkeyboardplugin
-}
-
-# The following define makes your compiler emit warnings if you use
-# any Qt feature that has been marked deprecated (the exact warnings
-# depend on your compiler). Refer to the documentation for the
-# deprecated API to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-# Uncomment below line and re-build before running tests.
-# Enables writing of the current selected language to a json file for the test application to pick up.
-#DEFINES += QT_TESTING_RUN
-
-##### Skip Debug prints if Release build
-CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
-
-SOURCES += \
- handlelanguagechange.cpp \
- main.cpp \
- handlekeyevents.cpp \
- handleatspievents.cpp \
- handledbusforchrome.cpp \
- vkbhidetimer.cpp
-
-HEADERS += \
- handlekeyevents.h \
- handleatspievents.h \
- handledbusforchrome.h \
- common_defs.h \
- handlelanguagechange.h \
- keysymmapsforfakeinput.h \
- vkbhidetimer.h \
- xcbkeyboard.h
-
-RESOURCES += qml.qrc
-
-INCLUDEPATH += /usr/include/X11
-INCLUDEPATH += /usr/include/at-spi-2.0
-INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include
-INCLUDEPATH += /usr/include/glib-2.0
-INCLUDEPATH += /usr/include/dbus-1.0
-INCLUDEPATH += /usr/lib/x86_64-linux-gnu/dbus-1.0/include
-
-LIBS += -lXtst -lX11 -latspi -lxdo
diff --git a/tests/manual/x11vkbwrapper/xcbkeyboard.h b/tests/manual/x11vkbwrapper/xcbkeyboard.h
index 56e45b97..2a6274da 100644
--- a/tests/manual/x11vkbwrapper/xcbkeyboard.h
+++ b/tests/manual/x11vkbwrapper/xcbkeyboard.h
@@ -1,31 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef XCBKEYBOARD_H
#define XCBKEYBOARD_H
diff --git a/tests/tests.pro b/tests/tests.pro
deleted file mode 100644
index 15dd97bd..00000000
--- a/tests/tests.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-CONFIG += no_docs_target
-SUBDIRS = auto